Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(base-cluster/oidc): this fixes the wrongly rolled out outh config #1000

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
{{- $_ := set . "Values" .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" -}}
{{- $_ := set . "Values" .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