fix(operator): proxy and asset storage secrets handling (#2403)

* fix(operator): proxy and asset storage secrets handling

* fix test
This commit is contained in:
Livio Amstutz 2021-09-24 10:25:50 +02:00 committed by GitHub
parent 30153cff39
commit 5c32fc9c12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 0 deletions

View File

@ -183,6 +183,8 @@ func literalsSecretVars(k8sClient kubernetes.ClientInt, desired *Configuration)
literalsSecretVars["ZITADEL_TWILIO_SID"] = value literalsSecretVars["ZITADEL_TWILIO_SID"] = value
} }
} }
literalsSecretVars["ZITADEL_ASSET_STORAGE_ACCESS_KEY_ID"] = ""
literalsSecretVars["ZITADEL_ASSET_STORAGE_SECRET_ACCESS_KEY"] = ""
if desired.AssetStorage != nil { if desired.AssetStorage != nil {
as := desired.AssetStorage as := desired.AssetStorage
if as.AccessKeyID != nil || as.ExistingAccessKeyID != nil { if as.AccessKeyID != nil || as.ExistingAccessKeyID != nil {
@ -200,6 +202,8 @@ func literalsSecretVars(k8sClient kubernetes.ClientInt, desired *Configuration)
literalsSecretVars["ZITADEL_ASSET_STORAGE_SECRET_ACCESS_KEY"] = value literalsSecretVars["ZITADEL_ASSET_STORAGE_SECRET_ACCESS_KEY"] = value
} }
} }
literalsSecretVars["HTTP_PROXY"] = ""
literalsSecretVars["HTTPS_PROXY"] = ""
if desired.Proxy != nil { if desired.Proxy != nil {
if desired.Proxy.HTTP != nil || desired.Proxy.ExistingHTTP != nil { if desired.Proxy.HTTP != nil || desired.Proxy.ExistingHTTP != nil {
value, err := read.GetSecretValue(k8sClient, desired.Proxy.HTTP, desired.Proxy.ExistingHTTP) value, err := read.GetSecretValue(k8sClient, desired.Proxy.HTTP, desired.Proxy.ExistingHTTP)

View File

@ -79,6 +79,20 @@ func GetContainer(
Key: "ZITADEL_ASSET_STORAGE_SECRET_ACCESS_KEY", Key: "ZITADEL_ASSET_STORAGE_SECRET_ACCESS_KEY",
}, },
}}, }},
{Name: "HTTP_PROXY",
ValueFrom: &corev1.EnvVarSource{
SecretKeyRef: &corev1.SecretKeySelector{
LocalObjectReference: corev1.LocalObjectReference{Name: secretVarsName},
Key: "HTTP_PROXY",
},
}},
{Name: "HTTPS_PROXY",
ValueFrom: &corev1.EnvVarSource{
SecretKeyRef: &corev1.SecretKeySelector{
LocalObjectReference: corev1.LocalObjectReference{Name: secretVarsName},
Key: "HTTPS_PROXY",
},
}},
{Name: "SENTRY_DSN", {Name: "SENTRY_DSN",
ValueFrom: &corev1.EnvVarSource{ ValueFrom: &corev1.EnvVarSource{
SecretKeyRef: &corev1.SecretKeySelector{ SecretKeyRef: &corev1.SecretKeySelector{

View File

@ -86,6 +86,20 @@ func TestDeployment_GetContainer(t *testing.T) {
Key: "ZITADEL_ASSET_STORAGE_SECRET_ACCESS_KEY", Key: "ZITADEL_ASSET_STORAGE_SECRET_ACCESS_KEY",
}, },
}}, }},
{Name: "HTTP_PROXY",
ValueFrom: &corev1.EnvVarSource{
SecretKeyRef: &corev1.SecretKeySelector{
LocalObjectReference: corev1.LocalObjectReference{Name: secretVarsName},
Key: "HTTP_PROXY",
},
}},
{Name: "HTTPS_PROXY",
ValueFrom: &corev1.EnvVarSource{
SecretKeyRef: &corev1.SecretKeySelector{
LocalObjectReference: corev1.LocalObjectReference{Name: secretVarsName},
Key: "HTTPS_PROXY",
},
}},
{Name: "SENTRY_DSN", {Name: "SENTRY_DSN",
ValueFrom: &corev1.EnvVarSource{ ValueFrom: &corev1.EnvVarSource{
SecretKeyRef: &corev1.SecretKeySelector{ SecretKeyRef: &corev1.SecretKeySelector{