Jelajahi Sumber

list endpoint returns cluster status'

Stefan McShane 3 tahun lalu
induk
melakukan
412304d74e
2 mengubah file dengan 25 tambahan dan 11 penghapusan
  1. 11 0
      api/types/cluster.go
  2. 14 11
      internal/models/cluster.go

+ 11 - 0
api/types/cluster.go

@@ -41,6 +41,17 @@ type Cluster struct {
 
 	// Cluster provisioning status if managed by Porter
 	Status ClusterStatus `json:"status"`
+
+	// ProvisionedBy is used for identifing the provisioner used for the cluster. Accepted values: [CAPI, ]
+	ProvisionedBy string `json:"provisioned_by"`
+
+	// CloudProvider is the cloud provider that hosts the Kubernetes Cluster. Accepted values: [AWS, GCP, AZURE]
+	CloudProvider string `json:"cloud_provider"`
+
+	// CloudProviderCredentialIdentifier is a reference to find the credentials required for access the cluster's API.
+	// This was likely the credential that was used to create the cluster.
+	// For AWS EKS clusters, this will be an ARN for the final target role in the assume role chain.
+	CloudProviderCredentialIdentifier string `json:"cloud_provider_credential_identifier"`
 }
 
 type ClusterCandidate struct {

+ 14 - 11
internal/models/cluster.go

@@ -117,17 +117,20 @@ func (c *Cluster) ToClusterType() *types.Cluster {
 	}
 
 	return &types.Cluster{
-		ID:                      c.ID,
-		ProjectID:               c.ProjectID,
-		Name:                    c.Name,
-		Server:                  c.Server,
-		Service:                 serv,
-		AgentIntegrationEnabled: c.AgentIntegrationEnabled,
-		InfraID:                 c.InfraID,
-		AWSIntegrationID:        c.AWSIntegrationID,
-		AWSClusterID:            c.AWSClusterID,
-		PreviewEnvsEnabled:      c.PreviewEnvsEnabled,
-		Status:                  c.Status,
+		ID:                                c.ID,
+		ProjectID:                         c.ProjectID,
+		Name:                              c.Name,
+		Server:                            c.Server,
+		Service:                           serv,
+		AgentIntegrationEnabled:           c.AgentIntegrationEnabled,
+		InfraID:                           c.InfraID,
+		AWSIntegrationID:                  c.AWSIntegrationID,
+		AWSClusterID:                      c.AWSClusterID,
+		PreviewEnvsEnabled:                c.PreviewEnvsEnabled,
+		Status:                            c.Status,
+		ProvisionedBy:                     c.ProvisionedBy,
+		CloudProvider:                     c.CloudProvider,
+		CloudProviderCredentialIdentifier: c.CloudProviderCredentialIdentifier,
 	}
 }