Skip to content

Commit

Permalink
fix(configmaps): skip creating configmap for Alpha Configurations whe…
Browse files Browse the repository at this point in the history
…n used with OCP Proxy (#181)

Signed-off-by: Thuan Vo <[email protected]>
(cherry picked from commit 208b142)

# Conflicts:
#	charts/cryostat/tests/alpha_config_test.yaml
  • Loading branch information
tthvo authored and mergify[bot] committed Aug 8, 2024
1 parent 66adb75 commit cd5fcf0
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
7 changes: 7 additions & 0 deletions charts/cryostat/templates/alpha_config.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -27,3 +33,4 @@ data:
clientId: CLIENT_ID
clientSecret: CLIENT_SECRET
provider: google
{{- end }}
2 changes: 2 additions & 0 deletions charts/cryostat/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
31 changes: 31 additions & 0 deletions charts/cryostat/tests/alpha_config_test.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit cd5fcf0

Please sign in to comment.