From 0849144b0aecde69eeef909b9f13a1793aabdacb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristhian=20Fern=C3=A1ndez?= Date: Tue, 26 Sep 2023 10:53:43 -0500 Subject: [PATCH] fix: environment struct and export cluster status (#167) --- internal/controller/kubefirst.go | 3 +++ pkg/types/cluster.go | 36 +++++++++++++++++++------------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/internal/controller/kubefirst.go b/internal/controller/kubefirst.go index 129eaa47..b3ebdebf 100644 --- a/internal/controller/kubefirst.go +++ b/internal/controller/kubefirst.go @@ -30,6 +30,9 @@ func (clctrl *ClusterController) ExportClusterRecord() error { return err } + cluster.Status = "provisioned" + cluster.InProgress = false + time.Sleep(time.Second * 10) consoleCloudUrl := fmt.Sprintf("https://kubefirst.%s", cluster.DomainName) diff --git a/pkg/types/cluster.go b/pkg/types/cluster.go index 2e6710cf..df47273b 100644 --- a/pkg/types/cluster.go +++ b/pkg/types/cluster.go @@ -146,20 +146,26 @@ type ProxyImportRequest struct { Url string `bson:"url" json:"url"` } +type Environment struct { + Name string `bson:"name" json:"name"` + Color string `bson:"color" json:"color"` + Description string `bson:"description,omitempty" json:"description,omitempty"` +} + type WorkloadCluster struct { - AdminEmail string `bson:"admin_email,omitempty" json:"admin_email,omitempty"` - CloudProvider string `bson:"cloud_provider,omitempty" json:"cloud_provider,omitempty"` - ClusterID string `bson:"cluster_id,omitempty" json:"cluster_id,omitempty"` - ClusterName string `bson:"cluster_name,omitempty" json:"cluster_name,omitempty"` - ClusterType string `bson:"cluster_type,omitempty" json:"cluster_type,omitempty"` - CloudRegion string `bson:"cloud_region,omitempty" json:"cloud_region,omitempty"` - CreationTimestamp string `bson:"creation_timestamp" json:"creation_timestamp"` - DomainName string `bson:"domain_name,omitempty" json:"domain_name,omitempty"` - DnsProvider string `bson:"dns_provider,omitempty" json:"dns_provider,omitempty"` - Environment string `bson:"environment,omitempty" json:"environment,omitempty"` - GitAuth GitAuth `bson:"git_auth,omitempty" json:"git_auth,omitempty"` - InstanceSize string `bson:"instance_size,omitempty" json:"instance_size,omitempty"` - MachineType string `bson:"machine_type,omitempty" json:"machine_type,omitempty"` - NodeCount int `bson:"node_count,omitempty" json:"node_count,omitempty"` - Status string `bson:"status,omitempty" json:"status,omitempty"` + AdminEmail string `bson:"admin_email,omitempty" json:"admin_email,omitempty"` + CloudProvider string `bson:"cloud_provider,omitempty" json:"cloud_provider,omitempty"` + ClusterID string `bson:"cluster_id,omitempty" json:"cluster_id,omitempty"` + ClusterName string `bson:"cluster_name,omitempty" json:"cluster_name,omitempty"` + ClusterType string `bson:"cluster_type,omitempty" json:"cluster_type,omitempty"` + CloudRegion string `bson:"cloud_region,omitempty" json:"cloud_region,omitempty"` + CreationTimestamp string `bson:"creation_timestamp" json:"creation_timestamp"` + DomainName string `bson:"domain_name,omitempty" json:"domain_name,omitempty"` + DnsProvider string `bson:"dns_provider,omitempty" json:"dns_provider,omitempty"` + Environment Environment `bson:"environment,omitempty" json:"environment,omitempty"` + GitAuth GitAuth `bson:"git_auth,omitempty" json:"git_auth,omitempty"` + InstanceSize string `bson:"instance_size,omitempty" json:"instance_size,omitempty"` + MachineType string `bson:"machine_type,omitempty" json:"machine_type,omitempty"` + NodeCount int `bson:"node_count,omitempty" json:"node_count,omitempty"` + Status string `bson:"status,omitempty" json:"status,omitempty"` }