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

feat(base-cluster/grafana): add persistence and configuration options… #999

Merged
merged 9 commits into from
Jun 28, 2024
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
{{- define "base-cluster.grafana.config" -}}
tasches marked this conversation as resolved.
Show resolved Hide resolved
auth:
signout_redirect_url: {{ printf "https://%s" (include "base-cluster.grafana.host" .) }}
{{- with .Values.global.authentication }}
{{- if .config.clientId }}
{{- $issuerUrl := printf "https://%s%s" .config.issuerHost .config.issuerPath}}
oauth_auto_login: true
disable_login_form: false
auth.generic_oauth:
enabled: true
allow_sign_up: true
api_url: {{ printf "%s%s" $issuerUrl .grafana.apiPath }}
auth_url: {{ printf "%s%s" $issuerUrl .grafana.authenticationPath }}
token_url: {{ printf "%s%s" $issuerUrl .grafana.tokenPath }}
client_id: {{ .config.clientId }}
client_secret: ${OIDC_CLIENT_SECRET}
name: OAuth
role_attribute_path: {{ .grafana.roleAttributePath | quote }}
scopes: openid profile email
{{- end }}
{{- end }}
server:
root_url: {{ printf "https://%s" (include "base-cluster.grafana.host" .) }}
{{- end -}}

{{- define "base-cluster.prometheus-stack.grafana.config" -}}
imageRenderer:
enabled: true
Expand All @@ -13,6 +38,13 @@ securityContext:
type: RuntimeDefault
containerSecurityContext: {{- include "base-cluster.prometheus-stack.containerSecurityContext" (dict) | nindent 2 }}
resources: {{- include "common.resources" .Values.monitoring.grafana | nindent 2 }}
{{- if .Values.monitoring.grafana.persistence.enabled }}
persistence:
tasches marked this conversation as resolved.
Show resolved Hide resolved
enabled: true
size: {{ .Values.monitoring.grafana.persistence.size | default "10Gi" }}
{{- $storageClass := include "common.storage.class" (dict "persistence" .Values.storage.readWriteMany.persistence "global" $.Values.global) | fromYaml -}}
storageClassName: {{ $storageClass.storageClassName | default "default" | quote }}
tasches marked this conversation as resolved.
Show resolved Hide resolved
{{- end }}
serviceMonitor:
interval: "30s"
labels: {{- toYaml .Values.monitoring.labels | nindent 4 }}
Expand Down Expand Up @@ -146,28 +178,7 @@ envValueFrom:
optional: false
{{- end }}
grafana.ini:
auth:
signout_redirect_url: {{ printf "https://%s" (include "base-cluster.grafana.host" .) }}
{{- with .Values.global.authentication }}
{{- if .config.clientId }}
{{- $issuerUrl := printf "https://%s%s" .config.issuerHost .config.issuerPath}}
oauth_auto_login: true
disable_login_form: false
auth.generic_oauth:
enabled: true
allow_sign_up: true
api_url: {{ printf "%s%s" $issuerUrl .grafana.apiPath }}
auth_url: {{ printf "%s%s" $issuerUrl .grafana.authenticationPath }}
token_url: {{ printf "%s%s" $issuerUrl .grafana.tokenPath }}
client_id: {{ .config.clientId }}
client_secret: ${OIDC_CLIENT_SECRET}
name: OAuth
role_attribute_path: {{ .grafana.roleAttributePath | quote }}
scopes: openid profile email
{{- end }}
{{- end }}
server:
root_url: {{ printf "https://%s" (include "base-cluster.grafana.host" .) }}
{{ merge ($.Values.monitoring.grafana.config | default (dict)) (include "base-cluster.grafana.config" $ | fromYaml) | toYaml | nindent 4 -}}
tasches marked this conversation as resolved.
Show resolved Hide resolved
{{- end }}
downloadDashboards:
securityContext: {{- include "base-cluster.prometheus-stack.containerSecurityContext" (dict) | nindent 4 }}
Expand Down
17 changes: 16 additions & 1 deletion charts/base-cluster/values.schema.json
tasches marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,22 @@
"resources": {
"$ref": "#/$defs/resourceRequirements"
},
"sidecar": {
"persistence": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
},
"size": {
"$ref": "#/$defs/quantity"
},
"storageClassName": {
"type": "string"
}
},
"additionalProperties": false
},
"sidecar": {
"type": "object",
"properties": {
"resourcesPreset": {
Expand Down
3 changes: 3 additions & 0 deletions charts/base-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ monitoring:
notifiers: []
resourcesPreset: nano
resources: {}
persistence:
enabled: false
config: {}
sidecar:
resourcesPreset: nano
resources: {}
Expand Down