diff --git a/resources/services/app-sre-stage-01/rhobs/observatorium-metrics-compact-template.yaml b/resources/services/app-sre-stage-01/rhobs/observatorium-metrics-compact-template.yaml index e96d1c3465..13dd15c574 100755 --- a/resources/services/app-sre-stage-01/rhobs/observatorium-metrics-compact-template.yaml +++ b/resources/services/app-sre-stage-01/rhobs/observatorium-metrics-compact-template.yaml @@ -216,6 +216,7 @@ objects: - -tls-cert=/etc/tls/private/tls.crt - -tls-key=/etc/tls/private/tls.key - -client-secret-file=/var/run/secrets/kubernetes.io/serviceaccount/token + - -cookie-secret=${OAUTH_PROXY_COOKIE_SECRET} - -cookie-secret-file=/etc/proxy/secrets/session_secret - -openshift-ca=/etc/pki/tls/cert.pem - -openshift-ca=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt @@ -273,3 +274,7 @@ objects: storage: 500Gi storageClassName: gp2 status: {} +parameters: +- from: '[a-zA-Z0-9]{40}' + generate: expression + name: OAUTH_PROXY_COOKIE_SECRET diff --git a/resources/services/telemeter-prod-01/rhobs/observatorium-metrics-compact-template.yaml b/resources/services/telemeter-prod-01/rhobs/observatorium-metrics-compact-template.yaml index edc513bc58..29393dc14c 100755 --- a/resources/services/telemeter-prod-01/rhobs/observatorium-metrics-compact-template.yaml +++ b/resources/services/telemeter-prod-01/rhobs/observatorium-metrics-compact-template.yaml @@ -216,6 +216,7 @@ objects: - -tls-cert=/etc/tls/private/tls.crt - -tls-key=/etc/tls/private/tls.key - -client-secret-file=/var/run/secrets/kubernetes.io/serviceaccount/token + - -cookie-secret=${OAUTH_PROXY_COOKIE_SECRET} - -cookie-secret-file=/etc/proxy/secrets/session_secret - -openshift-ca=/etc/pki/tls/cert.pem - -openshift-ca=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt @@ -273,3 +274,7 @@ objects: storage: 500Gi storageClassName: gp2 status: {} +parameters: +- from: '[a-zA-Z0-9]{40}' + generate: expression + name: OAUTH_PROXY_COOKIE_SECRET diff --git a/services_go/observatorium/observatorium.go b/services_go/observatorium/observatorium.go index 25c0394eff..9d66dd5d90 100644 --- a/services_go/observatorium/observatorium.go +++ b/services_go/observatorium/observatorium.go @@ -61,20 +61,28 @@ func (o *Observatorium) Manifests(generator *mimic.Generator) { components := []struct { name string objects k8sutil.ObjectMap + params []templatev1.Parameter }{ - {"observatorium-metrics-compact", makeCompactor(o.cfg.Namespace, o.cfg.PreManifestsHooks.Compactor)}, - {"observatorium-metrics-store", makeStore(o.cfg.Namespace, o.cfg.PreManifestsHooks.ThanosStore)}, + {"observatorium-metrics-compact", makeCompactor(o.cfg.Namespace, o.cfg.PreManifestsHooks.Compactor), []templatev1.Parameter{ + { + Name: "OAUTH_PROXY_COOKIE_SECRET", + Generate: "expression", + From: "[a-zA-Z0-9]{40}", + }, + }}, + {"observatorium-metrics-store", makeStore(o.cfg.Namespace, o.cfg.PreManifestsHooks.ThanosStore), []templatev1.Parameter{}}, } for _, component := range components { template := openshift.WrapInTemplate("", component.objects, metav1.ObjectMeta{ Name: component.name, - }, []templatev1.Parameter{}) + }, component.params) generator.With(o.cfg.Cluster, o.cfg.Instance).Add(component.name+"-template.yaml", &customYAML{encoder: encoding.GhodssYAML(template[""])}) } } // customYAML is a YAML encoder wrapper that allows cleaning of the output. +// Wihtout this, the manifests would contain a status section that is not needed. type customYAML struct { encoder encoding.Encoder reader io.Reader diff --git a/services_go/observatorium/sidecars.go b/services_go/observatorium/sidecars.go index 051d738764..3aab881241 100644 --- a/services_go/observatorium/sidecars.go +++ b/services_go/observatorium/sidecars.go @@ -27,6 +27,7 @@ func makeOauthProxy(upstreamPort int32, namespace, serviceAccount, tlsSecret str "-tls-cert=/etc/tls/private/tls.crt", "-tls-key=/etc/tls/private/tls.key", "-client-secret-file=/var/run/secrets/kubernetes.io/serviceaccount/token", + "-cookie-secret=${OAUTH_PROXY_COOKIE_SECRET}", // replaced by openshift template parameter "-cookie-secret-file=/etc/proxy/secrets/session_secret", "-openshift-ca=/etc/pki/tls/cert.pem", "-openshift-ca=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt",