fix: added console environment attribute for subscription service (#1620)

* fix: add subscription service url to console environment json

* fix: corrected missed unit-tests

* fix: show edit button on new orgs (#1606)

* fix: reset login_policy views (to ensure defaults) (#1605)

* fix: reset login_policy views (to ensure defaults)

* fix: migration 1.37

Co-authored-by: Max Peintner <max@caos.ch>
Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
Stefan Benz 2021-04-20 07:33:52 +02:00 committed by GitHub
parent 2c20292b24
commit 1f72eaab82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 25 deletions

View File

@ -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 (

View File

@ -26,6 +26,7 @@ type Subdomains struct {
API string `yaml:"api"`
Console string `yaml:"console"`
Issuer string `yaml:"issuer"`
Subscription string `yaml:"subscription"`
}
type Passwords struct {
Migration *secret.Secret `yaml:"migration"`

View File

@ -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 {

View File

@ -66,6 +66,7 @@ var (
API: "",
Console: "",
Issuer: "",
Subscription: "",
},
},
ClusterDNS: "",
@ -123,6 +124,7 @@ var (
API: "api",
Console: "console",
Issuer: "issuer",
Subscription: "sub",
},
},
ClusterDNS: "cluster",
@ -179,6 +181,7 @@ var (
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)