Skip to content

Commit

Permalink
Merge pull request validatedpatterns#344 from mhjacks/add_extra_value…
Browse files Browse the repository at this point in the history
…_files

Add extra value files and nulling logic to allow "disabling" applications
  • Loading branch information
mhjacks authored Aug 16, 2023
2 parents c495d00 + b76d830 commit c75b39f
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 24 deletions.
3 changes: 3 additions & 0 deletions acm/templates/policies/application-policies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ spec:
ignoreMissingValueFiles: true
valueFiles:
{{- include "acm.app.policies.valuefiles" . | nindent 24 }}
{{- range $valueFile := $.Values.global.extraValueFiles }}
- {{ $valueFile | quote }}
{{- end }}
{{- range $valueFile := .extraValueFiles }}
- {{ $valueFile | quote }}
{{- end }}
Expand Down
1 change: 1 addition & 0 deletions acm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ main:
channel: "gitops-1.8"

global:
extraValueFiles: []
pattern: none
repoURL: none
targetRevision: main
Expand Down
5 changes: 5 additions & 0 deletions clustergroup/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,9 @@ Default always defined valueFiles to be included in Applications
{{- if $.Values.global.clusterVersion }}
- "/values-{{ $.Values.global.clusterVersion }}-{{ $.Values.clusterGroup.name }}.yaml"
{{- end }}
{{- if $.Values.global.extraValueFiles }}
{{- range $.Values.global.extraValueFiles }}
- {{ . | quote }}
{{- end }} {{/* range $.Values.global.extraValueFiles */}}
{{- end }} {{/* if $.Values.global.extraValueFiles */}}
{{- end }} {{/* clustergroup.app.globalvalues.valuefiles */}}
3 changes: 2 additions & 1 deletion clustergroup/templates/plumbing/applications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{{- $namespace = "openshift-gitops" }}
{{- end }}
{{- range .Values.clusterGroup.applications }}
{{- if or (.generators) (.generatorFile) (.useGeneratorValues) (.destinationServer) (.destinationNamespace) }}
{{- if .disabled }} {{- /* This allows us to null out an Application entry by specifying disabled: true in an override file */}}
{{- else if or (.generators) (.generatorFile) (.useGeneratorValues) (.destinationServer) (.destinationNamespace) }}
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
Expand Down
1 change: 1 addition & 0 deletions clustergroup/values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
global:
extraValueFiles: []
pattern: common
targetRevision: main
options:
Expand Down
3 changes: 2 additions & 1 deletion tests/clustergroup-industrial-edge-factory.expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ data:
enabled: all
global:
clusterDomain: region.example.com
extraValueFiles: []
git:
account: hybrid-cloud-patterns
dev_revision: main
Expand Down Expand Up @@ -407,7 +408,7 @@ spec:
ignoreMissingValueFiles: true
valueFiles:
- "/values-global.yaml"
- "/values-factory.yaml"
- "/values-factory.yaml"
parameters:
- name: global.repoURL
value: $ARGOCD_APP_SOURCE_REPO_URL
Expand Down
15 changes: 8 additions & 7 deletions tests/clustergroup-industrial-edge-hub.expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ data:
enabled: all
global:
clusterDomain: region.example.com
extraValueFiles: []
git:
account: hybrid-cloud-patterns
dev_revision: main
Expand Down Expand Up @@ -682,7 +683,7 @@ spec:
ignoreMissingValueFiles: true
valueFiles:
- "/values-global.yaml"
- "/values-datacenter.yaml"
- "/values-datacenter.yaml"
parameters:
- name: global.repoURL
value: $ARGOCD_APP_SOURCE_REPO_URL
Expand Down Expand Up @@ -737,7 +738,7 @@ spec:
ignoreMissingValueFiles: true
valueFiles:
- "/values-global.yaml"
- "/values-datacenter.yaml"
- "/values-datacenter.yaml"
parameters:
- name: global.repoURL
value: $ARGOCD_APP_SOURCE_REPO_URL
Expand Down Expand Up @@ -783,7 +784,7 @@ spec:
ignoreMissingValueFiles: true
valueFiles:
- "/values-global.yaml"
- "/values-datacenter.yaml"
- "/values-datacenter.yaml"
parameters:
- name: global.repoURL
value: $ARGOCD_APP_SOURCE_REPO_URL
Expand Down Expand Up @@ -829,7 +830,7 @@ spec:
ignoreMissingValueFiles: true
valueFiles:
- "/values-global.yaml"
- "/values-datacenter.yaml"
- "/values-datacenter.yaml"
parameters:
- name: global.repoURL
value: $ARGOCD_APP_SOURCE_REPO_URL
Expand Down Expand Up @@ -905,7 +906,7 @@ spec:
ignoreMissingValueFiles: true
valueFiles:
- "/values-global.yaml"
- "/values-datacenter.yaml"
- "/values-datacenter.yaml"
parameters:
- name: global.repoURL
value: $ARGOCD_APP_SOURCE_REPO_URL
Expand Down Expand Up @@ -951,7 +952,7 @@ spec:
ignoreMissingValueFiles: true
valueFiles:
- "/values-global.yaml"
- "/values-datacenter.yaml"
- "/values-datacenter.yaml"
parameters:
- name: global.repoURL
value: $ARGOCD_APP_SOURCE_REPO_URL
Expand Down Expand Up @@ -1022,7 +1023,7 @@ spec:
ignoreMissingValueFiles: true
valueFiles:
- "/values-global.yaml"
- "/values-datacenter.yaml"
- "/values-datacenter.yaml"
parameters:
- name: global.repoURL
value: $ARGOCD_APP_SOURCE_REPO_URL
Expand Down
27 changes: 14 additions & 13 deletions tests/clustergroup-medical-diagnosis-hub.expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ data:
enabled: all
global:
clusterDomain: region.example.com
extraValueFiles: []
git:
account: hybrid-cloud-patterns
dev_revision: main
Expand Down Expand Up @@ -627,7 +628,7 @@ spec:
ignoreMissingValueFiles: true
valueFiles:
- "/values-global.yaml"
- "/values-hub.yaml"
- "/values-hub.yaml"
parameters:
- name: global.repoURL
value: $ARGOCD_APP_SOURCE_REPO_URL
Expand Down Expand Up @@ -673,7 +674,7 @@ spec:
ignoreMissingValueFiles: true
valueFiles:
- "/values-global.yaml"
- "/values-hub.yaml"
- "/values-hub.yaml"
parameters:
- name: global.repoURL
value: $ARGOCD_APP_SOURCE_REPO_URL
Expand Down Expand Up @@ -719,7 +720,7 @@ spec:
ignoreMissingValueFiles: true
valueFiles:
- "/values-global.yaml"
- "/values-hub.yaml"
- "/values-hub.yaml"
parameters:
- name: global.repoURL
value: $ARGOCD_APP_SOURCE_REPO_URL
Expand Down Expand Up @@ -765,7 +766,7 @@ spec:
ignoreMissingValueFiles: true
valueFiles:
- "/values-global.yaml"
- "/values-hub.yaml"
- "/values-hub.yaml"
parameters:
- name: global.repoURL
value: $ARGOCD_APP_SOURCE_REPO_URL
Expand Down Expand Up @@ -811,7 +812,7 @@ spec:
ignoreMissingValueFiles: true
valueFiles:
- "/values-global.yaml"
- "/values-hub.yaml"
- "/values-hub.yaml"
parameters:
- name: global.repoURL
value: $ARGOCD_APP_SOURCE_REPO_URL
Expand Down Expand Up @@ -857,7 +858,7 @@ spec:
ignoreMissingValueFiles: true
valueFiles:
- "/values-global.yaml"
- "/values-hub.yaml"
- "/values-hub.yaml"
parameters:
- name: global.repoURL
value: $ARGOCD_APP_SOURCE_REPO_URL
Expand Down Expand Up @@ -903,7 +904,7 @@ spec:
ignoreMissingValueFiles: true
valueFiles:
- "/values-global.yaml"
- "/values-hub.yaml"
- "/values-hub.yaml"
parameters:
- name: global.repoURL
value: $ARGOCD_APP_SOURCE_REPO_URL
Expand Down Expand Up @@ -949,7 +950,7 @@ spec:
ignoreMissingValueFiles: true
valueFiles:
- "/values-global.yaml"
- "/values-hub.yaml"
- "/values-hub.yaml"
parameters:
- name: global.repoURL
value: $ARGOCD_APP_SOURCE_REPO_URL
Expand Down Expand Up @@ -1013,7 +1014,7 @@ spec:
ignoreMissingValueFiles: true
valueFiles:
- "/values-global.yaml"
- "/values-hub.yaml"
- "/values-hub.yaml"
parameters:
- name: global.repoURL
value: $ARGOCD_APP_SOURCE_REPO_URL
Expand Down Expand Up @@ -1059,7 +1060,7 @@ spec:
ignoreMissingValueFiles: true
valueFiles:
- "/values-global.yaml"
- "/values-hub.yaml"
- "/values-hub.yaml"
parameters:
- name: global.repoURL
value: $ARGOCD_APP_SOURCE_REPO_URL
Expand Down Expand Up @@ -1105,7 +1106,7 @@ spec:
ignoreMissingValueFiles: true
valueFiles:
- "/values-global.yaml"
- "/values-hub.yaml"
- "/values-hub.yaml"
parameters:
- name: global.repoURL
value: $ARGOCD_APP_SOURCE_REPO_URL
Expand Down Expand Up @@ -1160,7 +1161,7 @@ spec:
ignoreMissingValueFiles: true
valueFiles:
- "/values-global.yaml"
- "/values-hub.yaml"
- "/values-hub.yaml"
parameters:
- name: global.repoURL
value: $ARGOCD_APP_SOURCE_REPO_URL
Expand Down Expand Up @@ -1215,7 +1216,7 @@ spec:
ignoreMissingValueFiles: true
valueFiles:
- "/values-global.yaml"
- "/values-hub.yaml"
- "/values-hub.yaml"
parameters:
- name: global.repoURL
value: $ARGOCD_APP_SOURCE_REPO_URL
Expand Down
1 change: 1 addition & 0 deletions tests/clustergroup-naked.expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ data:
targetCluster: in-cluster
enabled: all
global:
extraValueFiles: []
options:
applicationRetryLimit: 20
installPlanApproval: Automatic
Expand Down
5 changes: 3 additions & 2 deletions tests/clustergroup-normal.expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ data:
enabled: all
global:
clusterDomain: region.example.com
extraValueFiles: []
git:
account: hybrid-cloud-patterns
dev_revision: main
Expand Down Expand Up @@ -537,7 +538,7 @@ spec:
ignoreMissingValueFiles: true
valueFiles:
- "/values-global.yaml"
- "/values-example.yaml"
- "/values-example.yaml"
parameters:
- name: global.repoURL
value: $ARGOCD_APP_SOURCE_REPO_URL
Expand Down Expand Up @@ -592,7 +593,7 @@ spec:
ignoreMissingValueFiles: true
valueFiles:
- "/values-global.yaml"
- "/values-example.yaml"
- "/values-example.yaml"
parameters:
- name: global.repoURL
value: $ARGOCD_APP_SOURCE_REPO_URL
Expand Down

0 comments on commit c75b39f

Please sign in to comment.