Skip to content

Commit

Permalink
Merge pull request #19 from neticdk/feat/improve-nso-config
Browse files Browse the repository at this point in the history
First attempt to make bootstrapConfig.git more dynamic
  • Loading branch information
alex5517 authored Feb 12, 2024
2 parents b5218f1 + 457559c commit aaa0a5c
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 33 deletions.
12 changes: 10 additions & 2 deletions charts/aoi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ A Helm chart for Netic application operations infrastructure
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| alerting.clusterId | string | `""` | Value of the label (cluster_id) |
| alerting.clusterWideNamespace.bootstrapConfig | object | `{"externalSecretsStore":{},"git":{"github":{"secretRef":"tcs-github-auth","template":{"adminTeam":"oaas-team","owner":"neticdk-k8s","repo":"tenant-alerting-template"}}},"vault":{}}` | Options to configure the bootstrapConfig used for cluster-wide alert namespace. |
| alerting.clusterWideNamespace.bootstrapConfig | object | `{"externalSecretsStore":{},"git":{"github":{},"gitlab":{}},"vault":{}}` | overwrite options configured in global.bootstrapConfig |
| alerting.clusterWideNamespace.bootstrapConfig.externalSecretsStore | object | `{}` | overwrite externalSecretStore options, make sure to include all options in overwrite, it is not merged with globally defined options. |
| alerting.clusterWideNamespace.bootstrapConfig.git.github | object | `{}` | overwrite git options, make sure to include all options in overwrite, it is not merged with globally defined options. |
| alerting.clusterWideNamespace.bootstrapConfig.vault | object | `{}` | overwrite vault options, make sure to include all options in overwrite, it is not merged with globally defined options. |
| alerting.clusterWideNamespace.enabled | bool | `false` | Create alerting namespace for cluster-wide alert definitions |
| alerting.clusterWideNamespace.name | string | `"application-operations-alerting"` | |
| alerting.clusterWideNamespace.projectBootstrap | object | `{"git":{}}` | Options to configure the projectBootstrap used for cluster-wide alert namespace. |
Expand Down Expand Up @@ -54,13 +57,18 @@ A Helm chart for Netic application operations infrastructure
| authProxy.terminationGracePeriodSeconds | int | `30` | |
| authProxy.tolerations | list | `[]` | |
| authProxy.topologySpauthProxyConstraints | list | `[]` | |
| dashboards.bootstrapConfig | object | `{"externalSecretsStore":{},"git":{"github":{"secretRef":"tcs-github-auth","template":{"adminTeam":"oaas-team","owner":"neticdk-k8s","repo":"tenant-grafana-template"}}},"vault":{}}` | Options to configure the bootstrapConfig used for tenant dashboard namespace |
| dashboards.bootstrapConfig | object | `{"externalSecretsStore":{},"git":{"github":{},"gitlab":{}},"vault":{}}` | overwrite options configured in global.bootstrapConfig |
| dashboards.bootstrapConfig.externalSecretsStore | object | `{}` | overwrite externalSecretStore options, make sure to include all options in overwrite, it is not merged with globally defined options. |
| dashboards.bootstrapConfig.git.github | object | `{}` | overwrite git options, make sure to include all options in overwrite, it is not merged with globally defined options. |
| dashboards.bootstrapConfig.vault | object | `{}` | overwrite vault options, make sure to include all options in overwrite, it is not merged with globally defined options. |
| dashboards.projectBootstrap | object | `{"git":{}}` | Options to configure the projectBootstrap used for tenant dashboard namespace |
| externalSecret.vaultDataFromKey | string | `nil` | |
| externalSecret.vaultMountPath | string | `nil` | |
| externalSecret.vaultPath | string | `nil` | |
| externalSecret.vaultServer | string | `nil` | |
| global.annotations | object | `{}` | |
| global.bootstrapConfig | object | `{"externalSecretsStore":{},"git":{"flavor":"github","github":{},"gitlab":{}},"vault":{}}` | Options to configure the bootstrapConfig used for all bootstrapConfig can be overwritten in specific bootstrapConfig |
| global.bootstrapConfig.git.flavor | string | `"github"` | Which git flavor to use, currently only supports github and gitlab |
| global.clusterDomain | string | `"cluster.local"` | |
| global.containerSecurityContext.allowPrivilegeEscalation | bool | `false` | |
| global.containerSecurityContext.capabilities.drop[0] | string | `"all"` | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,22 @@ priorityClassName: {{ $pcn }}
{{- end }}
{{- end }}


{{/*
Create the git config for bootstrapConfig.
*/}}
{{- define "aoi.alerting.bootstrapConfig" -}}
git:
{{- if eq .Values.global.bootstrapConfig.git.flavor "github" }}
github:
{{- default .Values.global.bootstrapConfig.git.github .Values.alerting.clusterWideNamespace.bootstrapConfig.git.github | toYaml | nindent 4}}
{{- else if eq .Values.global.bootstrapConfig.git.flavor "gitlab" }}
gitlab:
{{- default .Values.global.bootstrapConfig.git.gitlab .Values.alerting.clusterWideNamespace.bootstrapConfig.git.gitlab | toYaml | nindent 4}}
{{- else }}
{{ fail "Invalid git flavor. Supported git flavors (github,gitlab)" }}
{{- end }}
vault:
{{- default .Values.global.bootstrapConfig.vault .Values.alerting.clusterWideNamespace.bootstrapConfig.vault | toYaml | nindent 2}}
externalSecretsStore:
{{- default .Values.global.bootstrapConfig.externalSecretsStore .Values.alerting.clusterWideNamespace.bootstrapConfig.externalSecretsStore | toYaml | nindent 2}}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,5 @@ spec:

labels:
netic.dk/enforce-policies: "true"
git:
{{- toYaml .Values.alerting.clusterWideNamespace.bootstrapConfig.git | nindent 4 }}

vault:
{{- toYaml .Values.alerting.clusterWideNamespace.bootstrapConfig.vault | nindent 4 }}

externalSecretsStore:
{{- toYaml .Values.alerting.clusterWideNamespace.bootstrapConfig.externalSecretsStore | nindent 4 }}
{{- include "aoi.alerting.bootstrapConfig" . | nindent 2 }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{/*
Create the git config for bootstrapConfig.
*/}}
{{- define "aoi.dashboards.bootstrapConfig" -}}
git:
{{- if eq .Values.global.bootstrapConfig.git.flavor "github" }}
github:
{{- default .Values.global.bootstrapConfig.git.github .Values.dashboards.bootstrapConfig.git.github | toYaml | nindent 4}}
{{- else if eq .Values.global.bootstrapConfig.git.flavor "gitlab" }}
gitlab:
{{- default .Values.global.bootstrapConfig.git.gitlab .Values.dashboards.bootstrapConfig.git.gitlab | toYaml | nindent 4}}
{{- else }}
{{ fail "Invalid git flavor. Supported git flavors (github,gitlab)" }}
{{- end }}
vault:
{{- default .Values.global.bootstrapConfig.vault .Values.dashboards.bootstrapConfig.vault | toYaml | nindent 2}}
externalSecretsStore:
{{- default .Values.global.bootstrapConfig.externalSecretsStore .Values.dashboards.bootstrapConfig.externalSecretsStore | toYaml | nindent 2}}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,4 @@ spec:

labels:
netic.dk/enforce-policies: "true"
git:
{{- toYaml .Values.dashboards.bootstrapConfig.git | nindent 4 }}

vault:
{{- toYaml .Values.dashboards.bootstrapConfig.vault | nindent 4 }}

externalSecretsStore:
{{- toYaml .Values.dashboards.bootstrapConfig.externalSecretsStore | nindent 4 }}
{{- include "aoi.dashboards.bootstrapConfig" . | nindent 2 }}
38 changes: 24 additions & 14 deletions charts/aoi/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,30 @@ global:
capabilities:
drop:
- all
# -- Options to configure the bootstrapConfig globally can be overwritten for dashboards and clusterWideNamespace alerting namespace.
# .Values.dashboards.bootstrapConfig
# .Values.alerting.clusterWideNamespace.bootstrapConfig
bootstrapConfig:
git:
# -- Which git flavor to use, currently only supports github and gitlab
flavor: "github"
github: {}
gitlab: {}
vault: {}
externalSecretsStore: {}


# Namespace for tenant dashboards
dashboards:
# -- Options to configure the bootstrapConfig used for tenant dashboard namespace
# -- overwrite options configured in global.bootstrapConfig
bootstrapConfig:
git:
github:
secretRef: tcs-github-auth
template:
adminTeam: oaas-team
owner: neticdk-k8s
repo: tenant-grafana-template
# -- overwrite git options, make sure to include all options in overwrite, it is not merged with globally defined options.
github: {}
gitlab: {}
# -- overwrite vault options, make sure to include all options in overwrite, it is not merged with globally defined options.
vault: {}
# -- overwrite externalSecretStore options, make sure to include all options in overwrite, it is not merged with globally defined options.
externalSecretsStore: {}
# -- Options to configure the projectBootstrap used for tenant dashboard namespace
projectBootstrap:
Expand Down Expand Up @@ -326,16 +337,15 @@ alerting:
# -- Create alerting namespace for cluster-wide alert definitions
enabled: false
name: application-operations-alerting
# -- Options to configure the bootstrapConfig used for cluster-wide alert namespace.
# -- overwrite options configured in global.bootstrapConfig
bootstrapConfig:
git:
github:
secretRef: tcs-github-auth
template:
adminTeam: oaas-team
owner: neticdk-k8s
repo: tenant-alerting-template
# -- overwrite git options, make sure to include all options in overwrite, it is not merged with globally defined options.
github: {}
gitlab: {}
# -- overwrite vault options, make sure to include all options in overwrite, it is not merged with globally defined options.
vault: {}
# -- overwrite externalSecretStore options, make sure to include all options in overwrite, it is not merged with globally defined options.
externalSecretsStore: {}
# -- Options to configure the projectBootstrap used for cluster-wide alert namespace.
projectBootstrap:
Expand Down

0 comments on commit aaa0a5c

Please sign in to comment.