feat: define custom styles via values

Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>
This commit is contained in:
Oliver Bähler 2021-04-21 19:27:45 +02:00
parent 49ccf4ae8a
commit 484ed6916d
No known key found for this signature in database
GPG key ID: 7AE0B2618ECDC1B6
6 changed files with 47 additions and 2 deletions

View file

@ -80,6 +80,7 @@ Helm v3 has removed the `install-crds` hook so CRDs are now populated by files i
| global.hostAliases | Mapping between IP and hostnames that will be injected as entries in the pod's hosts files | `[]` | | global.hostAliases | Mapping between IP and hostnames that will be injected as entries in the pod's hosts files | `[]` |
| nameOverride | Provide a name in place of `argocd` | `"argocd"` | | nameOverride | Provide a name in place of `argocd` | `"argocd"` |
| installCRDs | Install CRDs if you are using Helm2. | `true` | | installCRDs | Install CRDs if you are using Helm2. | `true` |
| configs.styles | Define custom CSS styles for your argo instance ([Read More](https://argo-cd.readthedocs.io/en/stable/operator-manual/custom-styles/)). This Settings will automatically mount the provided css and reference it in the argo configuration. | `""` (See [values.yaml](values.yaml)) |
| configs.clusterCredentials | Provide one or multiple [external cluster credentials](https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#clusters) | `[]` (See [values.yaml](values.yaml)) | | configs.clusterCredentials | Provide one or multiple [external cluster credentials](https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#clusters) | `[]` (See [values.yaml](values.yaml)) |
| configs.knownHostsAnnotations | Known Hosts configmap annotations | `{}` | | configs.knownHostsAnnotations | Known Hosts configmap annotations | `{}` |
| configs.knownHosts.data.ssh_known_hosts | Known Hosts | See [values.yaml](values.yaml) | | configs.knownHosts.data.ssh_known_hosts | Known Hosts | See [values.yaml](values.yaml) |

View file

@ -152,3 +152,21 @@ Return the appropriate apiVersion for ingress
{{- print "networking.k8s.io/v1" -}} {{- print "networking.k8s.io/v1" -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{/*
Argo Configuration Preset Values (Incluenced by Values configuration)
*/}}
{{- define "argo-cd.config.presets" -}}
{{- if .Values.configs.styles }}
ui.cssurl: "./custom/custom.styles.css"
{{- end }}
{{- end -}}
{{/*
Merge Argo Configuration with Preset Configuration
*/}}
{{- define "argo-cd.config" -}}
{{- if .Values.server.configEnabled -}}
{{- toYaml (mergeOverwrite .Values.server.config (default dict (fromYaml (include "argo-cd.config.presets" $)))) }}
{{- end -}}
{{- end -}}

View file

@ -11,6 +11,5 @@ metadata:
{{ $key }}: {{ $value | quote }} {{ $key }}: {{ $value | quote }}
{{- end }} {{- end }}
{{- end }} {{- end }}
data: data: {{- include "argo-cd.config" $ | nindent 4 }}
{{- toYaml .Values.server.config | nindent 4 }}
{{- end }} {{- end }}

View file

@ -0,0 +1,11 @@
{{- if .Values.configs.styles }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "argo-cd.repoServer.fullname" . }}-styles-cm
labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.repoServer.name "name" .Values.repoServer.name) | nindent 4 }}
data:
custom.styles.css: |
{{- .Values.configs.styles | nindent 4 }}
{{- end }}

View file

@ -73,6 +73,11 @@ spec:
{{- end }} {{- end }}
- mountPath: /app/config/gpg/keys - mountPath: /app/config/gpg/keys
name: gpg-keyring name: gpg-keyring
{{- if .Values.configs.styles }}
- mountPath: /shared/app/custom
subPath: "custom.styles.css"
name: custom-styles
{{- end }}
{{- if .Values.configs.knownHosts }} {{- if .Values.configs.knownHosts }}
- mountPath: /app/config/ssh - mountPath: /app/config/ssh
name: ssh-known-hosts name: ssh-known-hosts
@ -131,6 +136,11 @@ spec:
{{- if .Values.repoServer.volumes }} {{- if .Values.repoServer.volumes }}
{{- toYaml .Values.repoServer.volumes | nindent 6}} {{- toYaml .Values.repoServer.volumes | nindent 6}}
{{- end }} {{- end }}
{{- if .Values.configs.styles }}
- configMap:
name: {{ template "argo-cd.repoServer.fullname" . }}-styles-cm
name: custom-styles
{{- end }}
- emptyDir: {} - emptyDir: {}
name: gpg-keyring name: gpg-keyring
{{- if .Values.configs.knownHosts }} {{- if .Values.configs.knownHosts }}

View file

@ -874,6 +874,12 @@ repoServer:
## Argo Configs ## Argo Configs
configs: configs:
## Custom CSS Styles
## Reference: https://argo-cd.readthedocs.io/en/stable/operator-manual/custom-styles/
#styles: |
# .nav-bar {
# background: linear-gradient(to bottom, #999, #777, #333, #222, #111);
# }
## External Cluster Credentials ## External Cluster Credentials
## reference: ## reference:
## - https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#clusters ## - https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#clusters