Skip to content
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 .github/workflows/helm-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

steps:
- name: Checkout Code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/helm-unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

steps:
- name: Checkout Code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/jsonschema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

steps:
- name: Checkout Code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/superlinter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- name: Checkout Code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
# Full git history is needed to get a proper list of changed files within `super-linter`
Expand Down
26 changes: 19 additions & 7 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ Default always defined valueFiles to be included in Applications but with a pref
{{- end }} {{/* if $.Values.global.extraValueFiles */}}
{{- end }} {{/* clustergroup.app.globalvalues.prefixedvaluefiles */}}

{{/*
{{/*
Helper function to generate AppProject from a map object
Called from common/clustergroup/templates/plumbing/projects.yaml
Called from common/clustergroup/templates/plumbing/projects.yaml
*/}}
{{- define "clustergroup.template.plumbing.projects.map" -}}
{{- $projects := index . 0 }}
Expand Down Expand Up @@ -194,18 +194,19 @@ status: {}
{{- end }}
{{- end }}

{{/*
{{/*
Helper function to generate Namespaces from a map object.
Arguments passed as a list object are:
0 - The namespace hash keys
1 - Pattern name from .Values.global.pattern
2 - Cluster group name from .Values.clusterGroup.name
Called from common/clustergroup/templates/core/namespaces.yaml
Called from common/clustergroup/templates/core/namespaces.yaml
*/}}
{{- define "clustergroup.template.core.namespaces.map" -}}
{{- $ns := index . 0 }}
{{- $patternName := index . 1 }}
{{- $clusterGroupName := index . 2 }}
{{- $root := index . 3 }}

{{- range $k, $v := $ns }}{{- /* We loop here even though the map has always just one key */}}
{{- if or (eq $v nil) (not $v.disabled) }} {{- /* Process if $v is nil or disabled is false */}}
Expand All @@ -216,7 +217,7 @@ metadata:
name: {{ $k }}
{{- if ne $v nil }}
labels:
argocd.argoproj.io/managed-by: {{ $patternName }}-{{ $clusterGroupName }}
argocd.argoproj.io/managed-by: {{ include "clustergroup.template.argocdnamespace" $root }}
{{- if $v.labels }}
{{- range $key, $value := $v.labels }} {{- /* We loop here even though the map has always just one key */}}
{{ $key }}: {{ $value | default "" | quote }}
Expand All @@ -225,14 +226,14 @@ metadata:
{{- include "clustergroup.annotations" $v.annotations | nindent 2 }}
{{- else }}
labels:
argocd.argoproj.io/managed-by: {{ $patternName }}-{{ $clusterGroupName }}
argocd.argoproj.io/managed-by: {{ include "clustergroup.template.argocdnamespace" $root }}
{{- end }}
spec:
{{- end }}{{- /* if not disabled */}}
{{- end }}{{- /* range $k, $v := $ns */}}
{{- end }}

{{- /*
{{- /*
Helper function to generate OperatorGroup from a map object.
Arguments passed as a list object are:
0 - The namespace hash keys
Expand Down Expand Up @@ -320,3 +321,14 @@ false
false
{{- end -}}
{{- end }}

{{- /*
Helper function to generate argocd namespace name
*/ -}}
{{- define "clustergroup.template.argocdnamespace" -}}
{{- if .Values.global.singleArgoCD }}
{{- .Values.global.vpArgoNamespace -}}
{{- else }}
{{- .Values.global.pattern }}-{{ .Values.clusterGroup.name -}}
{{- end }}{{- /* if .singleArgoCD */}}
{{- end }} {{- /* End define "clustergroup.template.argocdnamespace" */}}
8 changes: 4 additions & 4 deletions templates/core/namespaces.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{{- /*
We first check if namespaces are defined as a map. If it is we call
our helper function in _helpers.tpl to process the namespaces
described in the values file. This is to support issue
described in the values file. This is to support issue
https://github.com/validatedpatterns/common/issues/459 created by our customer.
*/ -}}
{{- if kindIs "map" .Values.clusterGroup.namespaces }}
{{- template "clustergroup.template.core.namespaces.map" (list .Values.clusterGroup.namespaces $.Values.global.pattern $.Values.clusterGroup.name) }}
{{- template "clustergroup.template.core.namespaces.map" (list .Values.clusterGroup.namespaces $.Values.global.pattern $.Values.clusterGroup.name $) }}
{{- else }}
{{- range $ns := .Values.clusterGroup.namespaces }}
{{- if $ns }} {{- /* Skip null namespaces */}}
Expand All @@ -25,7 +25,7 @@ metadata:
{{- range $k, $v := $ns }}{{- /* We loop here even though the map has always just one key */}}
name: {{ $k }}
labels:
argocd.argoproj.io/managed-by: {{ $.Values.global.pattern }}-{{ $.Values.clusterGroup.name }}
argocd.argoproj.io/managed-by: {{ include "clustergroup.template.argocdnamespace" $ }}
{{- if $v.labels }}
{{- range $key, $value := $v.labels }} {{- /* We loop here even though the map has always just one key */}}
{{ $key }}: {{ $value | default "" | quote }}
Expand All @@ -36,7 +36,7 @@ metadata:

{{- else if kindIs "string" $ns }}
labels:
argocd.argoproj.io/managed-by: {{ $.Values.global.pattern }}-{{ $.Values.clusterGroup.name }}
argocd.argoproj.io/managed-by: {{ include "clustergroup.template.argocdnamespace" $ }}
name: {{ $ns }}
{{- end }} {{- /* if kindIs "string" $ns */}}
spec:
Expand Down
2 changes: 1 addition & 1 deletion templates/core/nodes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
{{- range $k, $v := $node }}
name: {{ $k }}
labels:
argocd.argoproj.io/managed-by: {{ $.Values.global.pattern }}-{{ $.Values.clusterGroup.name }}
argocd.argoproj.io/managed-by: {{ include "clustergroup.template.argocdnamespace" $ | quote }}
{{- if $v.labels }}
{{- range $key, $value := $v.labels }}
{{ $key }}: {{ $value | default "" | quote }}
Expand Down
2 changes: 1 addition & 1 deletion templates/imperative/namespace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ kind: Namespace
metadata:
labels:
name: {{ $.Values.clusterGroup.imperative.namespace }}
argocd.argoproj.io/managed-by: {{ $.Values.global.pattern }}-{{ $.Values.clusterGroup.name }}
argocd.argoproj.io/managed-by: {{ include "clustergroup.template.argocdnamespace" . }}
name: {{ $.Values.clusterGroup.imperative.namespace }}
{{- end }}
2 changes: 1 addition & 1 deletion templates/plumbing/applications.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if ($.Values.global.deletePattern | ne "DeleteChildApps") }} {{- /* When a pattern is deleting applications should be removed */}}
{{- $namespace := print $.Values.global.pattern "-" $.Values.clusterGroup.name }}
{{- $namespace := include "clustergroup.template.argocdnamespace" . | trim }}
{{- range .Values.clusterGroup.applications }}
{{- if . }} {{- /* Skip null applications */}}
{{- $projectName := coalesce .argoProject .project "default" -}} {{- /* Read argoProject if set, otherwise .project and otherwise set it to "default" */}}
Expand Down
2 changes: 1 addition & 1 deletion templates/plumbing/argoProjects.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- $namespace := print $.Values.global.pattern "-" $.Values.clusterGroup.name }}
{{ $namespace := include "clustergroup.template.argocdnamespace" . | trim }}
{{- /*
We first check if projects are defined as a map. If it is we call
our helper function in _helpers.tpl to process the projects
Expand Down
3 changes: 3 additions & 0 deletions templates/plumbing/argocd-super-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ subjects:
name: {{ $.Values.global.vpArgoNamespace }}-argocd-server
namespace: {{ $.Values.global.vpArgoNamespace }}
---
{{- if $.Values.global.singleArgoCD }}
{{- else }}
# WARNING: ONLY USE THIS FOR MANAGING CLUSTERS NOT FOR REGULAR USERS
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand All @@ -43,3 +45,4 @@ subjects:
- kind: ServiceAccount
name: {{ .Values.clusterGroup.name }}-gitops-argocd-dex-server
namespace: {{ $.Values.global.pattern }}-{{ .Values.clusterGroup.name }}
{{- end }}{{- /* if .singleArgoCD */}}
5 changes: 4 additions & 1 deletion templates/plumbing/argocd.yaml

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions templates/plumbing/gitops-namespace.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- if $.Values.global.singleArgoCD }}
{{- else }}
apiVersion: v1
kind: Namespace
metadata:
Expand All @@ -9,3 +11,4 @@ metadata:
# - any references to secrets and route URLs in documentation
name: {{ $.Values.global.pattern }}-{{ .Values.clusterGroup.name }}
spec: {}
{{- end }}{{- /* if .singleArgoCD */}}
3 changes: 2 additions & 1 deletion templates/plumbing/trusted-bundle-ca-configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{{- $namespace := include "clustergroup.template.argocdnamespace" . | trim }}
kind: ConfigMap
apiVersion: v1
metadata:
name: trusted-ca-bundle
namespace: {{ $.Values.global.pattern }}-{{ .Values.clusterGroup.name }}
namespace: {{ $namespace }}
labels:
config.openshift.io/inject-trusted-cabundle: 'true'
18 changes: 14 additions & 4 deletions values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@
"type": "string",
"description": "The namespace used for the GitOps subscription. Passed as a helm parameter to all ArgoCD applications.",
"default": ""
},
"singleArgoCD": {
"type": "boolean",
"description": "If set to true there will only be a single argocd instance"
}
},
"required": [
Expand Down Expand Up @@ -301,8 +305,8 @@
"description": "DEPRECATED: If set to true the values is used to identify whether this is the hub cluster or an edge/spoke cluster configuration. Use global.localClusterDomain and global.hubClusterDomain instead."
},
"sharedValueFiles": {
"type": "array",
"description": "Templated value file paths."
"type": "array",
"description": "Templated value file paths."
},
"scheduler": {
"type": "object",
Expand Down Expand Up @@ -893,7 +897,10 @@
"type": "string"
},
"clusterRoleYaml": {
"type": ["string", "array"]
"type": [
"string",
"array"
]
},
"roleName": {
"type": "string"
Expand Down Expand Up @@ -957,7 +964,10 @@
"type": "string"
},
"timeout": {
"type": ["integer", "string"]
"type": [
"integer",
"string"
]
},
"image": {
"type": "string",
Expand Down