diff --git a/charts/cryostat/templates/alpha_config.yaml b/charts/cryostat/templates/alpha_config.yaml index e86013b8..94f1fa07 100644 --- a/charts/cryostat/templates/alpha_config.yaml +++ b/charts/cryostat/templates/alpha_config.yaml @@ -1,7 +1,13 @@ +{{/* + Alpha Configuration is not used with OpenShift OAuth Proxy +*/}} +{{- if not (.Values.authentication.openshift).enabled -}} apiVersion: v1 kind: ConfigMap metadata: name: {{ .Release.Name }}-alpha-config + labels: + {{- include "cryostat.labels" . | nindent 4 }} data: alpha_config.yaml: |- server: @@ -27,3 +33,4 @@ data: clientId: CLIENT_ID clientSecret: CLIENT_SECRET provider: google +{{- end }} diff --git a/charts/cryostat/templates/deployment.yaml b/charts/cryostat/templates/deployment.yaml index 1307ebcf..07f1fecc 100644 --- a/charts/cryostat/templates/deployment.yaml +++ b/charts/cryostat/templates/deployment.yaml @@ -265,9 +265,11 @@ spec: - name: {{ .Chart.Name }} emptyDir: {} {{- end }} + {{- if not (.Values.authentication.openshift).enabled }} - name: alpha-config configMap: name: {{ .Release.Name }}-alpha-config + {{- end }} {{- if .Values.authentication.basicAuth.enabled }} - name: {{ .Release.Name }}-htpasswd secret: diff --git a/charts/cryostat/tests/alpha_config_test.yaml b/charts/cryostat/tests/alpha_config_test.yaml new file mode 100644 index 00000000..22b0deb7 --- /dev/null +++ b/charts/cryostat/tests/alpha_config_test.yaml @@ -0,0 +1,31 @@ +suite: test alpha_config.yaml +templates: + - templates/alpha_config.yaml + +tests: + - it: should create configmap with correct alpha configurations + asserts: + - matchRegex: + path: data['alpha_config.yaml'] + pattern: "server:\\s*BindAddress: http://0.0.0.0:4180" + - matchRegex: + path: data['alpha_config.yaml'] + pattern: "upstreamConfig:\\s*proxyRawPath: true\\s*upstreams:\\s*- id: cryostat\\s*path: /\\s*uri: http://localhost:8181" + - matchRegex: + path: data['alpha_config.yaml'] + pattern: "- id: grafana\\s*path: /grafana/\\s*uri: http://localhost:3000" + - matchRegex: + path: data['alpha_config.yaml'] + pattern: "- id: storage\\s*path: \\^/storage/\\(\\.\\*\\)\\$\\s*rewriteTarget: /\\$1\\s*uri: http://localhost:8333\\s*passHostHeader: false\\s*proxyWebSockets: false" + - matchRegex: + path: data['alpha_config.yaml'] + pattern: "providers:\\s*- id: dummy\\s*name: Unused - Sign In Below\\s*clientId: CLIENT_ID\\s*clientSecret: CLIENT_SECRET\\s*provider: google" + + - it: should not create alpha_config when openshift authentication is enabled + set: + authentication: + openshift: + enabled: true + asserts: + - hasDocuments: + count: 0