From 28d212260ba48156ba80b9d6a1d833d04ed6cdbe Mon Sep 17 00:00:00 2001 From: Yash Mehrotra Date: Mon, 18 Nov 2024 11:17:02 +0530 Subject: [PATCH] fix: gcp empty secret handling (#51) --- pkg/secrets/gcp.go | 2 +- pkg/tenant/resources.go | 2 ++ pkg/utils/utils.go | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/secrets/gcp.go b/pkg/secrets/gcp.go index 6a39f83..e89cfd4 100644 --- a/pkg/secrets/gcp.go +++ b/pkg/secrets/gcp.go @@ -4,5 +4,5 @@ type GCPSealedSecret struct{} func (s GCPSealedSecret) GenerateSealedSecret(params SealedSecretParams) ([]byte, error) { // We setup SQLUser and database via CRDs - return nil, nil + return []byte(""), nil } diff --git a/pkg/tenant/resources.go b/pkg/tenant/resources.go index 159b79c..6ea5f10 100644 --- a/pkg/tenant/resources.go +++ b/pkg/tenant/resources.go @@ -32,6 +32,7 @@ spec: values: domain: {{.host}} tenantSlug: {{.slug}} + cloud: {{.cloud}} vcluster: syncer: extraArgs: @@ -68,6 +69,7 @@ func GetTenantResources(tenant v1.Tenant, sealedSecret string) (obj []*unstructu "jwksURL": v1.GlobalConfig.Clerk.JWKSURL, "id": tenant.ID, "orgID": tenant.OrgID, + "cloud": tenant.Cloud, } helmReleaseRaw, err := utils.Template(HELM_RELEASE_TEMPLATE, vars) if err != nil { diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index a1dd907..8026a8e 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -37,6 +37,9 @@ func RandomString(length uint) string { func GetUnstructuredObjects(data ...string) ([]*unstructured.Unstructured, error) { var items []*unstructured.Unstructured for _, d := range data { + if d == "" { + continue + } decoder := yamlutil.NewYAMLOrJSONDecoder(bytes.NewReader([]byte(d)), 1024) var resource *unstructured.Unstructured