Sfoglia il codice sorgente

add infra id if porter provisioned infra

Alexander Belanger 5 anni fa
parent
commit
9266b5fecd

+ 2 - 0
internal/kubernetes/provisioner/global_stream.go

@@ -133,6 +133,7 @@ func GlobalStreamListener(
 					reg := &models.Registry{
 						ProjectID:        projID,
 						AWSIntegrationID: infra.AWSIntegrationID,
+						InfraID:          infra.ID,
 					}
 
 					// parse raw data into ECR type
@@ -174,6 +175,7 @@ func GlobalStreamListener(
 						AuthMechanism:    models.AWS,
 						ProjectID:        projID,
 						AWSIntegrationID: infra.AWSIntegrationID,
+						InfraID:          infra.ID,
 					}
 
 					// parse raw data into ECR type

+ 6 - 0
internal/models/cluster.go

@@ -47,6 +47,8 @@ type Cluster struct {
 	UserImpersonate         string `json:"act-as,omitempty"`
 	UserImpersonateGroups   string `json:"act-as-groups,omitempty"`
 
+	InfraID uint `json:"infra_id"`
+
 	// ------------------------------------------------------------------
 	// All fields below this line are encrypted before storage
 	// ------------------------------------------------------------------
@@ -79,6 +81,9 @@ type ClusterExternal struct {
 
 	// The integration service for this cluster
 	Service integrations.IntegrationService `json:"service"`
+
+	// The infra id, if cluster was provisioned with Porter
+	InfraID uint `json:"infra_id"`
 }
 
 // Externalize generates an external Cluster to be shared over REST
@@ -97,6 +102,7 @@ func (c *Cluster) Externalize() *ClusterExternal {
 		Name:      c.Name,
 		Server:    c.Server,
 		Service:   serv,
+		InfraID:   c.InfraID,
 	}
 }
 

+ 7 - 0
internal/models/registry.go

@@ -19,6 +19,9 @@ type Registry struct {
 	// The project that this integration belongs to
 	ProjectID uint `json:"project_id"`
 
+	// The infra id, if registry was provisioned with Porter
+	InfraID uint `json:"infra_id"`
+
 	// ------------------------------------------------------------------
 	// All fields below this line are encrypted before storage
 	// ------------------------------------------------------------------
@@ -45,6 +48,9 @@ type RegistryExternal struct {
 
 	// The integration service for this registry
 	Service integrations.IntegrationService `json:"service"`
+
+	// The infra id, if registry was provisioned with Porter
+	InfraID uint `json:"infra_id"`
 }
 
 // Externalize generates an external Registry to be shared over REST
@@ -63,5 +69,6 @@ func (r *Registry) Externalize() *RegistryExternal {
 		Name:      r.Name,
 		URL:       r.URL,
 		Service:   serv,
+		InfraID:   r.InfraID,
 	}
 }