Skip to content

Commit

Permalink
fix(base-cluster/oidc): this fixes the wrongly rolled out outh config (
Browse files Browse the repository at this point in the history
  • Loading branch information
cwrau authored Jul 1, 2024
1 parent 4b49283 commit 798a7c7
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion charts/base-cluster/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ You can access your grafana instance via

http://localhost:3000
{{- end }}
{{ if .Values.global.authentication.config.clientId }}
{{ if .Values.global.authentication.config }}
Login via your OIDC provider, or via;

{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ dashboards:
{{- $grafanaIni := .Values.monitoring.grafana.config | default (dict) }}
{{- if and .Values.ingress.enabled .Values.monitoring.grafana.ingress.enabled .Values.certManager.email (or .Values.global.baseDomain .Values.monitoring.grafana.ingress.customDomain) }}
{{- $grafanaIni = mustMerge $grafanaIni (include "base-cluster.prometheus-stack.grafana.ini.ingress" (dict "context" $) | fromYaml) }}
{{- if .Values.global.authentication.config }}
{{- if .Values.global.authentication }}
{{- $grafanaIni = mustMerge $grafanaIni (include "base-cluster.prometheus-stack.grafana.ini.oauth" (dict "context" $) | fromYaml) }}
envValueFrom:
OIDC_CLIENT_SECRET:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ privileged: false
{{- $_ := mustMerge . (pick .context "Values") -}}
{{- $ingress := include "base-cluster.monitoring.ingress.config" (dict "name" .name "context" .context) | fromYaml -}}
{{- if include "base-cluster.monitoring.ingress.enabled" (dict "name" .name "context" .context) -}}
{{- and (empty .Values.global.authentication.config.clientId) (dig "enabled" false $ingress) | ternary true "" -}}
{{- and (empty .Values.global.authentication.config) (dig "enabled" false $ingress) | ternary true "" -}}
{{- end -}}
{{- end -}}

{{- define "base-cluster.monitoring.authenticated-ingress.enabled" -}}
{{- $_ := mustMerge . (pick .context "Values") -}}
{{- $ingress := include "base-cluster.monitoring.ingress.config" (dict "name" .name "context" .context) | fromYaml -}}
{{- if include "base-cluster.monitoring.ingress.enabled" (dict "name" .name "context" .context) -}}
{{- and (not (empty .Values.global.authentication.config.clientId)) (dig "enabled" true $ingress) | ternary true "" -}}
{{- and (not (empty .Values.global.authentication.config)) (dig "enabled" true $ingress) | ternary true "" -}}
{{- end -}}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and .Values.global.authentication.config.clientId .Values.monitoring.prometheus.enabled (or (include "base-cluster.monitoring.authenticated-ingress.enabled" (dict "name" "prometheus" "context" .)) (include "base-cluster.monitoring.authenticated-ingress.enabled" (dict "name" "alertmanager" "context" .)) (include "base-cluster.monitoring.authenticated-ingress.enabled" (dict "name" "grafana" "context" .))) }}
{{- if and .Values.global.authentication.config .Values.monitoring.prometheus.enabled (or (include "base-cluster.monitoring.authenticated-ingress.enabled" (dict "name" "prometheus" "context" .)) (include "base-cluster.monitoring.authenticated-ingress.enabled" (dict "name" "alertmanager" "context" .)) (include "base-cluster.monitoring.authenticated-ingress.enabled" (dict "name" "grafana" "context" .))) }}
{{- $name := include "common.secrets.name" (dict "defaultNameSuffix" "oauth-proxy" "context" $) -}}
apiVersion: v1
kind: Secret
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and .Values.global.authentication.config.clientId .Values.monitoring.prometheus.enabled }}
{{- if and .Values.global.authentication.config .Values.monitoring.prometheus.enabled }}
{{- $backends := list -}}
{{- if include "base-cluster.monitoring.authenticated-ingress.enabled" (dict "name" "prometheus" "context" .) -}}
{{- $backends = append $backends (dict "host" "prometheus" "port" 9090) -}}
Expand Down
5 changes: 5 additions & 0 deletions charts/base-cluster/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,11 @@
"type": "string"
}
},
"required": [
"clientId",
"clientSecret",
"issuerHost"
],
"additionalProperties": false
},
"grafana": {
Expand Down
5 changes: 0 additions & 5 deletions charts/base-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,6 @@ global:
opentelemetry-collector: 0.x.x
condition: "{{ and .Values.monitoring.tracing.enabled .Values.monitoring.prometheus.enabled }}"
authentication:
config:
clientId: ""
clientSecret: ""
issuerHost: ""
issuerPath: ""
grafana:
authenticationPath: /protocol/openid-connect/auth
apiPath: /protocol/openid-connect/userinfo
Expand Down

0 comments on commit 798a7c7

Please sign in to comment.