diff --git a/operator/zitadel/kinds/iam/zitadel/configuration/adapt.go b/operator/zitadel/kinds/iam/zitadel/configuration/adapt.go index 4e5c77e71d..57965d9d72 100644 --- a/operator/zitadel/kinds/iam/zitadel/configuration/adapt.go +++ b/operator/zitadel/kinds/iam/zitadel/configuration/adapt.go @@ -1,8 +1,6 @@ package configuration import ( - "time" - "github.com/caos/orbos/mntr" "github.com/caos/orbos/pkg/kubernetes" "github.com/caos/orbos/pkg/kubernetes/resources/configmap" @@ -11,6 +9,7 @@ import ( "github.com/caos/zitadel/operator" "github.com/caos/zitadel/operator/zitadel/kinds/iam/zitadel/configuration/users" "github.com/caos/zitadel/operator/zitadel/kinds/iam/zitadel/database" + "time" ) type ConsoleEnv struct { @@ -18,6 +17,7 @@ type ConsoleEnv struct { MgmtServiceURL string `json:"mgmtServiceUrl"` Issuer string `json:"issuer"` ClientID string `json:"clientid"` + SubServiceURL string `json:"subscriptionServiceUrl"` } const ( diff --git a/operator/zitadel/kinds/iam/zitadel/configuration/desired.go b/operator/zitadel/kinds/iam/zitadel/configuration/desired.go index 41f935f76e..1a91377894 100644 --- a/operator/zitadel/kinds/iam/zitadel/configuration/desired.go +++ b/operator/zitadel/kinds/iam/zitadel/configuration/desired.go @@ -22,10 +22,11 @@ type DNS struct { } type Subdomains struct { - Accounts string `yaml:"accounts"` - API string `yaml:"api"` - Console string `yaml:"console"` - Issuer string `yaml:"issuer"` + Accounts string `yaml:"accounts"` + API string `yaml:"api"` + Console string `yaml:"console"` + Issuer string `yaml:"issuer"` + Subscription string `yaml:"subscription"` } type Passwords struct { Migration *secret.Secret `yaml:"migration"` diff --git a/operator/zitadel/kinds/iam/zitadel/configuration/literals.go b/operator/zitadel/kinds/iam/zitadel/configuration/literals.go index fc34ce7366..e0a0ae7dec 100644 --- a/operator/zitadel/kinds/iam/zitadel/configuration/literals.go +++ b/operator/zitadel/kinds/iam/zitadel/configuration/literals.go @@ -199,6 +199,7 @@ func literalsConsoleCM( consoleEnv.Issuer = "https://" + dns.Subdomains.Issuer + "." + dns.Domain consoleEnv.AuthServiceURL = "https://" + dns.Subdomains.API + "." + dns.Domain consoleEnv.MgmtServiceURL = "https://" + dns.Subdomains.API + "." + dns.Domain + consoleEnv.SubServiceURL = "https://" + dns.Subdomains.Subscription + "." + dns.Domain data, err := json.Marshal(consoleEnv) if err != nil { diff --git a/operator/zitadel/kinds/iam/zitadel/configuration/literals_test.go b/operator/zitadel/kinds/iam/zitadel/configuration/literals_test.go index ad913cff1a..3811530772 100644 --- a/operator/zitadel/kinds/iam/zitadel/configuration/literals_test.go +++ b/operator/zitadel/kinds/iam/zitadel/configuration/literals_test.go @@ -62,10 +62,11 @@ var ( Domain: "", TlsSecret: "", Subdomains: &Subdomains{ - Accounts: "", - API: "", - Console: "", - Issuer: "", + Accounts: "", + API: "", + Console: "", + Issuer: "", + Subscription: "", }, }, ClusterDNS: "", @@ -119,10 +120,11 @@ var ( Domain: "domain", TlsSecret: "tls", Subdomains: &Subdomains{ - Accounts: "accounts", - API: "api", - Console: "console", - Issuer: "issuer", + Accounts: "accounts", + API: "api", + Console: "console", + Issuer: "issuer", + Subscription: "sub", }, }, ClusterDNS: "cluster", @@ -175,10 +177,11 @@ var ( Domain: "domain", TlsSecret: "tls", Subdomains: &Subdomains{ - Accounts: "accounts", - API: "api", - Console: "console", - Issuer: "issuer", + Accounts: "accounts", + API: "api", + Console: "console", + Issuer: "issuer", + Subscription: "sub", }, }, ClusterDNS: "cluster", @@ -496,10 +499,10 @@ func TestConfiguration_LiteralsConsoleCM(t *testing.T) { Namespace: namespace, Name: cmName, }, - Data: map[string]string{"environment.json": "{\"authServiceUrl\":\"https://.\",\"mgmtServiceUrl\":\"https://.\",\"issuer\":\"https://.\",\"clientid\":\"\"}"}, + Data: map[string]string{"environment.json": "{\"authServiceUrl\":\"https://.\",\"mgmtServiceUrl\":\"https://.\",\"issuer\":\"https://.\",\"clientid\":\"\",\"subscriptionServiceUrl\":\"https://.\"}"}, } - equals := map[string]string{"environment.json": "{\"authServiceUrl\":\"https://.\",\"mgmtServiceUrl\":\"https://.\",\"issuer\":\"https://.\",\"clientid\":\"\"}"} + equals := map[string]string{"environment.json": "{\"authServiceUrl\":\"https://.\",\"mgmtServiceUrl\":\"https://.\",\"issuer\":\"https://.\",\"clientid\":\"\",\"subscriptionServiceUrl\":\"https://.\"}"} k8sClient.EXPECT().GetConfigMap(namespace, cmName).Times(1).Return(cm, nil) literals := literalsConsoleCM(clientID, desiredEmpty.DNS, k8sClient, namespace, cmName) @@ -521,7 +524,7 @@ func TestConfiguration_LiteralsConsoleCMFull(t *testing.T) { } equals := map[string]string{ - "environment.json": "{\"authServiceUrl\":\"https://api.domain\",\"mgmtServiceUrl\":\"https://api.domain\",\"issuer\":\"https://issuer.domain\",\"clientid\":\"test\"}", + "environment.json": "{\"authServiceUrl\":\"https://api.domain\",\"mgmtServiceUrl\":\"https://api.domain\",\"issuer\":\"https://issuer.domain\",\"clientid\":\"test\",\"subscriptionServiceUrl\":\"https://sub.domain\"}", } k8sClient.EXPECT().GetConfigMap(namespace, cmName).Times(1).Return(cm, nil) @@ -541,12 +544,12 @@ func TestConfiguration_LiteralsConsoleCMWithCM(t *testing.T) { Name: cmName, }, Data: map[string]string{ - "environment.json": "{\"authServiceUrl\":\"https://api.domain\",\"mgmtServiceUrl\":\"https://api.domain\",\"issuer\":\"https://issuer.domain\",\"clientid\":\"\"}", + "environment.json": "{\"authServiceUrl\":\"https://api.domain\",\"mgmtServiceUrl\":\"https://api.domain\",\"issuer\":\"https://issuer.domain\",\"clientid\":\"\",\"subscriptionServiceUrl\":\"https://sub.domain\"}", }, } equals := map[string]string{ - "environment.json": "{\"authServiceUrl\":\"https://api.domain\",\"mgmtServiceUrl\":\"https://api.domain\",\"issuer\":\"https://issuer.domain\",\"clientid\":\"test\"}", + "environment.json": "{\"authServiceUrl\":\"https://api.domain\",\"mgmtServiceUrl\":\"https://api.domain\",\"issuer\":\"https://issuer.domain\",\"clientid\":\"test\",\"subscriptionServiceUrl\":\"https://sub.domain\"}", } k8sClient.EXPECT().GetConfigMap(namespace, cmName).Times(1).Return(cm, nil) @@ -566,12 +569,12 @@ func TestConfiguration_LiteralsConsoleCMWithCMFull(t *testing.T) { Name: cmName, }, Data: map[string]string{ - "environment.json": "{\"authServiceUrl\":\"https://api.domain\",\"mgmtServiceUrl\":\"https://api.domain\",\"issuer\":\"https://issuer.domain\",\"clientid\":\"test\"}", + "environment.json": "{\"authServiceUrl\":\"https://api.domain\",\"mgmtServiceUrl\":\"https://api.domain\",\"issuer\":\"https://issuer.domain\",\"clientid\":\"test\",\"subscriptionServiceUrl\":\"https://sub.domain\"}", }, } equals := map[string]string{ - "environment.json": "{\"authServiceUrl\":\"https://api.domain\",\"mgmtServiceUrl\":\"https://api.domain\",\"issuer\":\"https://issuer.domain\",\"clientid\":\"test\"}", + "environment.json": "{\"authServiceUrl\":\"https://api.domain\",\"mgmtServiceUrl\":\"https://api.domain\",\"issuer\":\"https://issuer.domain\",\"clientid\":\"test\",\"subscriptionServiceUrl\":\"https://sub.domain\"}", } k8sClient.EXPECT().GetConfigMap(namespace, cmName).Times(1).Return(cm, nil)