From ba3f3bbdfe58e6c032707752eb2df35d9e850a97 Mon Sep 17 00:00:00 2001 From: Clayton Dittman Date: Fri, 22 Sep 2023 13:02:38 -0500 Subject: [PATCH 1/2] fix: revamp the import/expot functionality --- go.mod | 2 - go.sum | 2 + internal/controller/kubefirst.go | 29 +------ internal/db/clusters.go | 134 ------------------------------ internal/router/api/v1/cluster.go | 39 +++++---- internal/router/router.go | 2 +- internal/types/cluster.go | 6 +- 7 files changed, 28 insertions(+), 186 deletions(-) diff --git a/go.mod b/go.mod index b1cd8f1f..224ab9e2 100644 --- a/go.mod +++ b/go.mod @@ -323,5 +323,3 @@ replace ( k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.24.2 k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.24.2 ) - -replace github.com/kubefirst/runtime => /Users/claywd/projects/kubefirst/runtime diff --git a/go.sum b/go.sum index 4f654c8d..91065e3f 100644 --- a/go.sum +++ b/go.sum @@ -735,6 +735,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kubefirst/runtime v0.3.19 h1:M0GrJSDwMU6yZNBebMm4Y9hkDFE8GxmgtnNp0h3uCvo= +github.com/kubefirst/runtime v0.3.19/go.mod h1:q9GkYqn/QPR7daUqhEuk50/IeFybTAYftuJVcBW2StI= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= diff --git a/internal/controller/kubefirst.go b/internal/controller/kubefirst.go index 368ed994..e3a566b0 100644 --- a/internal/controller/kubefirst.go +++ b/internal/controller/kubefirst.go @@ -8,7 +8,6 @@ package controller import ( "bytes" - "crypto/tls" "encoding/json" "errors" "fmt" @@ -16,17 +15,14 @@ import ( "net/http" "time" - "github.com/kubefirst/kubefirst-api/internal/db" "github.com/kubefirst/runtime/pkg" - runtimetypes "github.com/kubefirst/runtime/pkg/types" log "github.com/sirupsen/logrus" ) // ExportClusterRecord will export cluster record to mgmt cluster +// To be intiated by cluster 0 func (clctrl *ClusterController) ExportClusterRecord() error { cluster, err := clctrl.MdbCl.GetCluster(clctrl.ClusterName) - - err = db.Client.Export(clctrl.ClusterName) if err != nil { log.Errorf("Error exporting cluster record: %s", err) return err @@ -41,31 +37,10 @@ func (clctrl *ClusterController) ExportClusterRecord() error { log.Error("unable to start kubefirst api") } - importObject := runtimetypes.ImportClusterRequest{ - ClusterName: cluster.ClusterName, - CloudRegion: cluster.CloudRegion, - CloudProvider: cluster.CloudProvider, - } - importObject.StateStoreCredentials.AccessKeyID = cluster.StateStoreCredentials.AccessKeyID - importObject.StateStoreCredentials.ID = cluster.StateStoreCredentials.ID - importObject.StateStoreCredentials.Name = cluster.StateStoreCredentials.Name - importObject.StateStoreCredentials.SecretAccessKey = cluster.StateStoreCredentials.SecretAccessKey - importObject.StateStoreCredentials.SessionToken = cluster.StateStoreCredentials.SessionToken - - importObject.StateStoreDetails.Hostname = cluster.StateStoreDetails.Hostname - importObject.StateStoreDetails.ID = cluster.StateStoreDetails.ID - importObject.StateStoreDetails.Name = cluster.StateStoreDetails.Name - - requestObject := runtimetypes.ProxyImportRequest{ - Body: importObject, - Url: "/cluster/import", - } - customTransport := http.DefaultTransport.(*http.Transport).Clone() - customTransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true} httpClient := http.Client{Transport: customTransport} - payload, err := json.Marshal(requestObject) + payload, err := json.Marshal(cluster) if err != nil { return err } diff --git a/internal/db/clusters.go b/internal/db/clusters.go index f1f2a5b4..8559818f 100644 --- a/internal/db/clusters.go +++ b/internal/db/clusters.go @@ -7,12 +7,8 @@ See the LICENSE file for more details. package db import ( - "encoding/json" "fmt" - "os" - "github.com/kubefirst/kubefirst-api/internal/constants" - "github.com/kubefirst/kubefirst-api/internal/objectStorage" "github.com/kubefirst/kubefirst-api/internal/types" log "github.com/sirupsen/logrus" "go.mongodb.org/mongo-driver/bson" @@ -126,133 +122,3 @@ func (mdbcl *MongoDBClient) UpdateCluster(clusterName string, field string, valu return nil } - -// Backups - -// Export parses the contents of a single cluster to a local file -func (mdbcl *MongoDBClient) Export(clusterName string) error { - var localFilePath = fmt.Sprintf("%s/%s.json", clusterExportsPath, clusterName) - var remoteFilePath = fmt.Sprintf("%s.json", clusterName) - - // Find - filter := bson.D{{Key: "cluster_name", Value: clusterName}} - var result types.Cluster - err := mdbcl.ClustersCollection.FindOne(mdbcl.Context, filter).Decode(&result) - result.Status = constants.ClusterStatusProvisioned - result.InProgress = false - if err != nil { - return err - } - - // Format file for cluster dump - // Verify export directory exists - if _, err := os.Stat(clusterExportsPath); os.IsNotExist(err) { - log.Info("cluster exports directory does not exist, creating") - err := os.MkdirAll(clusterExportsPath, 0777) - if err != nil { - return err - } - } - - file, _ := json.MarshalIndent(result, "", " ") - _ = os.WriteFile(localFilePath, file, 0644) - - // Put file containing cluster dump in object storage - err = objectStorage.PutClusterObject( - &result.StateStoreCredentials, - &result.StateStoreDetails, - &types.PushBucketObject{ - LocalFilePath: localFilePath, - RemoteFilePath: remoteFilePath, - ContentType: "application/json", - }, - ) - if err != nil { - return err - } - - log.Infof("successfully exported cluster %s to object storage bucket", clusterName) - - err = os.Remove(localFilePath) - if err != nil { - return err - } - - return nil -} - -// Restore retrieves a target cluster's database export from a state storage bucket and -// attempts to insert the parsed cluster object into the database -func (mdbcl *MongoDBClient) Restore(req *types.ImportClusterRequest) error { - var cluster *types.Cluster - var localFilePath = fmt.Sprintf("%s/%s.json", clusterImportsPath, req.ClusterName) - var remoteFilePath = fmt.Sprintf("%s.json", req.ClusterName) - - // Verify import directory exists - if _, err := os.Stat(clusterImportsPath); os.IsNotExist(err) { - log.Info("cluster imports directory does not exist, creating") - err := os.MkdirAll(clusterImportsPath, 0777) - if err != nil { - return err - } - } - - var bucketHostname string - switch req.CloudProvider { - case "aws": - bucketHostname = "s3.amazonaws.com" - case "civo": - bucketHostname = fmt.Sprintf("objectstore.%s.civo.com", req.CloudRegion) - // case "google" doesn't use the endpoint/hostname and isn't s3 compatible - case "digitalocean": - bucketHostname = fmt.Sprintf("%s.digitaloceanspaces.com", req.CloudRegion) - case "vultr": - bucketHostname = fmt.Sprintf("%s.vultrobjects.com", req.CloudRegion) - case "k3d": - bucketHostname = "minio.minio.svc.cluster.local:9000" - } - - // Retrieve the object from state storage bucket - err := objectStorage.GetClusterObject( - &types.StateStoreCredentials{ - AccessKeyID: req.StateStoreCredentials.AccessKeyID, - SecretAccessKey: req.StateStoreCredentials.SecretAccessKey, - SessionToken: req.StateStoreCredentials.SessionToken, - }, - &types.StateStoreDetails{ - Name: req.StateStoreDetails.Name, - Hostname: bucketHostname, - }, - localFilePath, - remoteFilePath, - req.CloudProvider != "k3d", - ) - if err != nil { - return err - } - - // Marshal file contents into cluster struct - fileContents, err := os.ReadFile(localFilePath) - if err != nil { - return err - } - err = json.Unmarshal(fileContents, &cluster) - if err != nil { - return fmt.Errorf("target file %s does not appear to be valid json: %s", localFilePath, err) - } - - // Insert the cluster into the target database - err = mdbcl.InsertCluster(*cluster) - if err != nil { - return err - } - - log.Infof("successfully restored cluster %s to database", req.ClusterName) - - err = os.Remove(localFilePath) - if err != nil { - return err - } - - return nil -} diff --git a/internal/router/api/v1/cluster.go b/internal/router/api/v1/cluster.go index c3ccdd68..cc85ce3e 100644 --- a/internal/router/api/v1/cluster.go +++ b/internal/router/api/v1/cluster.go @@ -461,7 +461,7 @@ func PostCreateCluster(c *gin.Context) { // @Router /cluster/:cluster_name/export [post] // @Param Authorization header string true "API key" default(Bearer ) // PostExportCluster handles a request to export a cluster -func PostExportCluster(c *gin.Context) { +func GetExportCluster(c *gin.Context) { clusterName, param := c.Params.Get("cluster_name") if !param { c.JSON(http.StatusBadRequest, types.JSONFailureResponse{ @@ -470,18 +470,19 @@ func PostExportCluster(c *gin.Context) { return } - // Export - err := db.Client.Export(clusterName) + // get cluster object + cluster, err := db.Client.GetCluster(clusterName) if err != nil { c.JSON(http.StatusBadRequest, types.JSONFailureResponse{ - Message: fmt.Sprintf("error exporting cluster %s: %s", clusterName, err), + Message: err.Error(), }) return } - c.JSON(http.StatusOK, types.JSONSuccessResponse{ - Message: "cluster exported", - }) + // return json of cluster + c.IndentedJSON(http.StatusOK, cluster) + return + } // PostImportCluster godoc @@ -498,8 +499,8 @@ func PostExportCluster(c *gin.Context) { // PostImportCluster handles a request to import a cluster func PostImportCluster(c *gin.Context) { // Bind to variable as application/json, handle error - var req types.ImportClusterRequest - err := c.Bind(&req) + var cluster types.Cluster + err := c.Bind(&cluster) if err != nil { c.JSON(http.StatusBadRequest, types.JSONFailureResponse{ Message: err.Error(), @@ -507,26 +508,30 @@ func PostImportCluster(c *gin.Context) { return } - log.Info("Restoring database") - // Restores database record - err = db.Client.Restore(&req) + // Insert the cluster into the target database + err = db.Client.InsertCluster(cluster) + if err != nil { + c.JSON(http.StatusBadRequest, types.JSONFailureResponse{ + Message: err.Error(), + }) + return + } // Create default service entries log.Info("Adding default services") - cl, _ := db.Client.GetCluster(req.ClusterName) - err = services.AddDefaultServices(&cl) + err = services.AddDefaultServices(&cluster) if err != nil { - log.Errorf("error adding default service entries for cluster %s: %s", cl.ClusterName, err) + log.Errorf("error adding default service entries for cluster %s: %s", cluster.ClusterName, err) } - err = gitShim.PrepareMgmtCluster(cl) + err = gitShim.PrepareMgmtCluster(cluster) if err != nil { log.Fatalf("error cloning repository: %s", err) } if err != nil { c.JSON(http.StatusBadRequest, types.JSONFailureResponse{ - Message: fmt.Sprintf("error importing cluster %s: %s", req.ClusterName, err), + Message: fmt.Sprintf("error importing cluster %s: %s", cluster.ClusterName, err), }) return } diff --git a/internal/router/router.go b/internal/router/router.go index adb4e8b3..703f8151 100644 --- a/internal/router/router.go +++ b/internal/router/router.go @@ -51,7 +51,7 @@ func SetupRouter() *gin.Engine { v1.GET("/cluster/:cluster_name", middleware.ValidateAPIKey(), router.GetCluster) v1.DELETE("/cluster/:cluster_name", middleware.ValidateAPIKey(), router.DeleteCluster) v1.POST("/cluster/:cluster_name", middleware.ValidateAPIKey(), router.PostCreateCluster) - v1.POST("/cluster/:cluster_name/export", middleware.ValidateAPIKey(), router.PostExportCluster) + v1.GET("/cluster/:cluster_name/export", middleware.ValidateAPIKey(), router.GetExportCluster) v1.POST("/cluster/:cluster_name/reset_progress", middleware.ValidateAPIKey(), router.PostResetClusterProgress) // Gitops Catalog diff --git a/internal/types/cluster.go b/internal/types/cluster.go index 4d81cf63..d04959f6 100644 --- a/internal/types/cluster.go +++ b/internal/types/cluster.go @@ -143,11 +143,7 @@ type PushBucketObject struct { // ImportClusterRequest type ImportClusterRequest struct { - ClusterName string `bson:"cluster_name" json:"cluster_name"` - CloudRegion string `bson:"cloud_region" json:"cloud_region"` - CloudProvider string `bson:"cloud_provider" json:"cloud_provider"` - StateStoreCredentials StateStoreCredentials `bson:"state_store_credentials" json:"state_store_credentials"` - StateStoreDetails StateStoreDetails `bson:"state_store_details" json:"state_store_details"` + ClusterName string `bson:"cluster_name" json:"cluster_name"` } type WorkloadCluster struct { From 533a0953171a27c998411be2c5864861db630c26 Mon Sep 17 00:00:00 2001 From: Clayton Dittman Date: Fri, 22 Sep 2023 13:07:47 -0500 Subject: [PATCH 2/2] fix: swagger update --- docs/docs.go | 128 ++++++++++++++++++++++++++++++++++++++++------ docs/swagger.json | 125 +++++++++++++++++++++++++++++++++++++++----- docs/swagger.yaml | 82 +++++++++++++++++++++++++---- 3 files changed, 296 insertions(+), 39 deletions(-) diff --git a/docs/docs.go b/docs/docs.go index 841d3103..6dddb52d 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1,5 +1,4 @@ -// Code generated by swaggo/swag. DO NOT EDIT. - +// Package docs Code generated by swaggo/swag. DO NOT EDIT package docs import "github.com/swaggo/swag" @@ -925,6 +924,12 @@ const docTemplate = `{ "types.CloudflareAuth": { "type": "object", "properties": { + "api_token": { + "type": "string" + }, + "origin_ca_issuer_key": { + "type": "string" + }, "token": { "type": "string" } @@ -985,9 +990,6 @@ const docTemplate = `{ "aws_kms_key_id": { "type": "string" }, - "cf_api_token": { - "$ref": "#/definitions/types.CloudflareAuth" - }, "civo_auth": { "$ref": "#/definitions/types.CivoAuth" }, @@ -1003,6 +1005,9 @@ const docTemplate = `{ "cloud_terraform_apply_failed_check": { "type": "boolean" }, + "cloudflare_auth": { + "$ref": "#/definitions/types.CloudflareAuth" + }, "cluster_id": { "type": "string" }, @@ -1067,6 +1072,9 @@ const docTemplate = `{ "gitops_template_url": { "type": "string" }, + "google_auth": { + "$ref": "#/definitions/types.GoogleAuth" + }, "in_progress": { "type": "boolean" }, @@ -1099,6 +1107,9 @@ const docTemplate = `{ "description": "Status", "type": "string" }, + "subdomain_name": { + "type": "string" + }, "useTelemetry": { "description": "Telemetry", "type": "boolean" @@ -1106,6 +1117,9 @@ const docTemplate = `{ "users_terraform_apply_check": { "type": "boolean" }, + "vault_auth": { + "$ref": "#/definitions/types.VaultAuth" + }, "vault_initialized_check": { "type": "boolean" }, @@ -1114,6 +1128,12 @@ const docTemplate = `{ }, "vultr_auth": { "$ref": "#/definitions/types.VultrAuth" + }, + "workload_clusters": { + "type": "array", + "items": { + "$ref": "#/definitions/types.WorkloadCluster" + } } } }, @@ -1151,7 +1171,8 @@ const docTemplate = `{ "aws", "civo", "digitalocean", - "vultr" + "vultr", + "google" ] }, "cloud_region": { @@ -1200,6 +1221,12 @@ const docTemplate = `{ "description": "Git", "type": "string" }, + "google_auth": { + "$ref": "#/definitions/types.GoogleAuth" + }, + "subdomain_name": { + "type": "string" + }, "type": { "type": "string", "enum": [ @@ -1258,6 +1285,9 @@ const docTemplate = `{ "do_auth": { "$ref": "#/definitions/types.DigitaloceanAuth" }, + "google_auth": { + "$ref": "#/definitions/types.GoogleAuth" + }, "vultr_auth": { "$ref": "#/definitions/types.VultrAuth" } @@ -1365,23 +1395,22 @@ const docTemplate = `{ } } }, - "types.ImportClusterRequest": { + "types.GoogleAuth": { "type": "object", "properties": { - "cloud_provider": { + "key_file": { "type": "string" }, - "cloud_region": { + "project_id": { "type": "string" - }, + } + } + }, + "types.ImportClusterRequest": { + "type": "object", + "properties": { "cluster_name": { "type": "string" - }, - "state_store_credentials": { - "$ref": "#/definitions/types.StateStoreCredentials" - }, - "state_store_details": { - "$ref": "#/definitions/types.StateStoreDetails" } } }, @@ -1427,6 +1456,9 @@ const docTemplate = `{ "do_auth": { "$ref": "#/definitions/types.DigitaloceanAuth" }, + "google_auth": { + "$ref": "#/definitions/types.GoogleAuth" + }, "vultr_auth": { "$ref": "#/definitions/types.VultrAuth" } @@ -1483,6 +1515,9 @@ const docTemplate = `{ }, "secret_access_key": { "type": "string" + }, + "session_token": { + "type": "string" } } }, @@ -1514,6 +1549,17 @@ const docTemplate = `{ } } }, + "types.VaultAuth": { + "type": "object", + "properties": { + "kbot_password": { + "type": "string" + }, + "root_token": { + "type": "string" + } + } + }, "types.VultrAuth": { "type": "object", "properties": { @@ -1521,6 +1567,56 @@ const docTemplate = `{ "type": "string" } } + }, + "types.WorkloadCluster": { + "type": "object", + "properties": { + "admin_email": { + "type": "string" + }, + "cloud_provider": { + "type": "string" + }, + "cloud_region": { + "type": "string" + }, + "cluster_id": { + "type": "string" + }, + "cluster_name": { + "type": "string" + }, + "cluster_type": { + "type": "string" + }, + "creation_timestamp": { + "type": "string" + }, + "dns_provider": { + "type": "string" + }, + "domain_name": { + "type": "string" + }, + "environment": { + "type": "string" + }, + "git_auth": { + "$ref": "#/definitions/types.GitAuth" + }, + "instance_size": { + "type": "string" + }, + "machine_type": { + "type": "string" + }, + "node_count": { + "type": "integer" + }, + "status": { + "type": "string" + } + } } } }` diff --git a/docs/swagger.json b/docs/swagger.json index 81b874c8..da807d60 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -918,6 +918,12 @@ "types.CloudflareAuth": { "type": "object", "properties": { + "api_token": { + "type": "string" + }, + "origin_ca_issuer_key": { + "type": "string" + }, "token": { "type": "string" } @@ -978,9 +984,6 @@ "aws_kms_key_id": { "type": "string" }, - "cf_api_token": { - "$ref": "#/definitions/types.CloudflareAuth" - }, "civo_auth": { "$ref": "#/definitions/types.CivoAuth" }, @@ -996,6 +999,9 @@ "cloud_terraform_apply_failed_check": { "type": "boolean" }, + "cloudflare_auth": { + "$ref": "#/definitions/types.CloudflareAuth" + }, "cluster_id": { "type": "string" }, @@ -1060,6 +1066,9 @@ "gitops_template_url": { "type": "string" }, + "google_auth": { + "$ref": "#/definitions/types.GoogleAuth" + }, "in_progress": { "type": "boolean" }, @@ -1092,6 +1101,9 @@ "description": "Status", "type": "string" }, + "subdomain_name": { + "type": "string" + }, "useTelemetry": { "description": "Telemetry", "type": "boolean" @@ -1099,6 +1111,9 @@ "users_terraform_apply_check": { "type": "boolean" }, + "vault_auth": { + "$ref": "#/definitions/types.VaultAuth" + }, "vault_initialized_check": { "type": "boolean" }, @@ -1107,6 +1122,12 @@ }, "vultr_auth": { "$ref": "#/definitions/types.VultrAuth" + }, + "workload_clusters": { + "type": "array", + "items": { + "$ref": "#/definitions/types.WorkloadCluster" + } } } }, @@ -1144,7 +1165,8 @@ "aws", "civo", "digitalocean", - "vultr" + "vultr", + "google" ] }, "cloud_region": { @@ -1193,6 +1215,12 @@ "description": "Git", "type": "string" }, + "google_auth": { + "$ref": "#/definitions/types.GoogleAuth" + }, + "subdomain_name": { + "type": "string" + }, "type": { "type": "string", "enum": [ @@ -1251,6 +1279,9 @@ "do_auth": { "$ref": "#/definitions/types.DigitaloceanAuth" }, + "google_auth": { + "$ref": "#/definitions/types.GoogleAuth" + }, "vultr_auth": { "$ref": "#/definitions/types.VultrAuth" } @@ -1358,23 +1389,22 @@ } } }, - "types.ImportClusterRequest": { + "types.GoogleAuth": { "type": "object", "properties": { - "cloud_provider": { + "key_file": { "type": "string" }, - "cloud_region": { + "project_id": { "type": "string" - }, + } + } + }, + "types.ImportClusterRequest": { + "type": "object", + "properties": { "cluster_name": { "type": "string" - }, - "state_store_credentials": { - "$ref": "#/definitions/types.StateStoreCredentials" - }, - "state_store_details": { - "$ref": "#/definitions/types.StateStoreDetails" } } }, @@ -1420,6 +1450,9 @@ "do_auth": { "$ref": "#/definitions/types.DigitaloceanAuth" }, + "google_auth": { + "$ref": "#/definitions/types.GoogleAuth" + }, "vultr_auth": { "$ref": "#/definitions/types.VultrAuth" } @@ -1476,6 +1509,9 @@ }, "secret_access_key": { "type": "string" + }, + "session_token": { + "type": "string" } } }, @@ -1507,6 +1543,17 @@ } } }, + "types.VaultAuth": { + "type": "object", + "properties": { + "kbot_password": { + "type": "string" + }, + "root_token": { + "type": "string" + } + } + }, "types.VultrAuth": { "type": "object", "properties": { @@ -1514,6 +1561,56 @@ "type": "string" } } + }, + "types.WorkloadCluster": { + "type": "object", + "properties": { + "admin_email": { + "type": "string" + }, + "cloud_provider": { + "type": "string" + }, + "cloud_region": { + "type": "string" + }, + "cluster_id": { + "type": "string" + }, + "cluster_name": { + "type": "string" + }, + "cluster_type": { + "type": "string" + }, + "creation_timestamp": { + "type": "string" + }, + "dns_provider": { + "type": "string" + }, + "domain_name": { + "type": "string" + }, + "environment": { + "type": "string" + }, + "git_auth": { + "$ref": "#/definitions/types.GitAuth" + }, + "instance_size": { + "type": "string" + }, + "machine_type": { + "type": "string" + }, + "node_count": { + "type": "integer" + }, + "status": { + "type": "string" + } + } } } } \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 7c0a933f..e74ba90f 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -31,6 +31,10 @@ definitions: type: object types.CloudflareAuth: properties: + api_token: + type: string + origin_ca_issuer_key: + type: string token: type: string type: object @@ -70,8 +74,6 @@ definitions: type: boolean aws_kms_key_id: type: string - cf_api_token: - $ref: '#/definitions/types.CloudflareAuth' civo_auth: $ref: '#/definitions/types.CivoAuth' cloud_provider: @@ -82,6 +84,8 @@ definitions: type: boolean cloud_terraform_apply_failed_check: type: boolean + cloudflare_auth: + $ref: '#/definitions/types.CloudflareAuth' cluster_id: type: string cluster_name: @@ -125,6 +129,8 @@ definitions: type: string gitops_template_url: type: string + google_auth: + $ref: '#/definitions/types.GoogleAuth' in_progress: type: boolean install_tools_check: @@ -147,17 +153,25 @@ definitions: status: description: Status type: string + subdomain_name: + type: string useTelemetry: description: Telemetry type: boolean users_terraform_apply_check: type: boolean + vault_auth: + $ref: '#/definitions/types.VaultAuth' vault_initialized_check: type: boolean vault_terraform_apply_check: type: boolean vultr_auth: $ref: '#/definitions/types.VultrAuth' + workload_clusters: + items: + $ref: '#/definitions/types.WorkloadCluster' + type: array type: object types.ClusterDefinition: properties: @@ -176,6 +190,7 @@ definitions: - civo - digitalocean - vultr + - google type: string cloud_region: type: string @@ -209,6 +224,10 @@ definitions: gitops_template_url: description: Git type: string + google_auth: + $ref: '#/definitions/types.GoogleAuth' + subdomain_name: + type: string type: enum: - mgmt @@ -256,6 +275,8 @@ definitions: $ref: '#/definitions/types.CloudflareAuth' do_auth: $ref: '#/definitions/types.DigitaloceanAuth' + google_auth: + $ref: '#/definitions/types.GoogleAuth' vultr_auth: $ref: '#/definitions/types.VultrAuth' type: object @@ -325,18 +346,17 @@ definitions: name: type: string type: object - types.ImportClusterRequest: + types.GoogleAuth: properties: - cloud_provider: + key_file: type: string - cloud_region: + project_id: type: string + type: object + types.ImportClusterRequest: + properties: cluster_name: type: string - state_store_credentials: - $ref: '#/definitions/types.StateStoreCredentials' - state_store_details: - $ref: '#/definitions/types.StateStoreDetails' type: object types.JSONFailureResponse: properties: @@ -366,6 +386,8 @@ definitions: type: string do_auth: $ref: '#/definitions/types.DigitaloceanAuth' + google_auth: + $ref: '#/definitions/types.GoogleAuth' vultr_auth: $ref: '#/definitions/types.VultrAuth' type: object @@ -403,6 +425,8 @@ definitions: type: string secret_access_key: type: string + session_token: + type: string type: object types.StateStoreDetails: properties: @@ -422,11 +446,51 @@ definitions: event: type: string type: object + types.VaultAuth: + properties: + kbot_password: + type: string + root_token: + type: string + type: object types.VultrAuth: properties: token: type: string type: object + types.WorkloadCluster: + properties: + admin_email: + type: string + cloud_provider: + type: string + cloud_region: + type: string + cluster_id: + type: string + cluster_name: + type: string + cluster_type: + type: string + creation_timestamp: + type: string + dns_provider: + type: string + domain_name: + type: string + environment: + type: string + git_auth: + $ref: '#/definitions/types.GitAuth' + instance_size: + type: string + machine_type: + type: string + node_count: + type: integer + status: + type: string + type: object host: localhost:port info: contact: