1+ ---
12apiVersion : argoproj.io/v1alpha1
23kind : ApplicationSet
34metadata :
4- name : operators
5+ name : understack-operators
6+ finalizers :
7+ # ensure applicationset is not deleted until its unreferenced
8+ - resources-finalizer.argocd.argoproj.io
59spec :
610 syncPolicy :
711 applicationsSync : create-update
12+ # for infrastructure resources we don't want to delete things automatically
13+ preserveResourcesOnDeletion : true
814 goTemplate : true
915 goTemplateOptions : ["missingkey=error"]
1016 generators :
1117 - matrix :
1218 generators :
1319 - clusters :
1420 selector :
15- matchLabels :
16- argocd.argoproj.io/secret-type : cluster
21+ matchExpressions :
22+ - key : understack.rackspace.com/role
23+ operator : In
24+ values :
25+ - " global"
26+ - " regional"
27+ - " aio"
28+ values :
29+ uc_skip_components : ' {{ default "[]" (index .metadata.annotations "uc_skip_components") }}'
30+ uc_repo_git_url : ' {{index .metadata.annotations "uc_repo_git_url"}}'
31+ uc_repo_ref : ' {{index .metadata.annotations "uc_repo_ref"}}'
32+ uc_deploy_git_url : ' {{index .metadata.annotations "uc_deploy_git_url"}}'
33+ uc_deploy_ref : ' {{index .metadata.annotations "uc_deploy_ref"}}'
34+ uc_role : ' {{index .metadata.labels "understack.rackspace.com/role"}}'
35+ uc_dns_zone : ' {{index .metadata.annotations "dns_zone" }}'
36+ uc_cluster_issuer : ' {{index .metadata.annotations "uc_cluster_issuer" }}'
37+ uc_global_dns_zone : ' {{index .metadata.annotations "uc_global_dns_zone" }}'
1738 - list :
1839 elements :
1940 - component : rook
2041 componentNamespace : rook-ceph
21- skipComponent : ' {{has "rook" ((default "[]" (index .metadata.annotations " uc_skip_components") | fromJson))}}'
42+ skipComponent : ' {{or ( has "rook" (.values. uc_skip_components | fromJson)) (eq "global" .values.uc_role )}}'
2243 sources :
2344 - repoURL : https://charts.rook.io/release
2445 chart : rook-ceph
@@ -38,39 +59,39 @@ spec:
3859 - $understack/operators/rook/values-cluster.yaml
3960 - $deploy/{{.name}}/helm-configs/rook-cluster.yaml
4061 ignoreMissingValueFiles : true
41- - repoURL : ' {{index .metadata.annotations " uc_repo_git_url" }}'
42- targetRevision : ' {{index .metadata.annotations " uc_repo_ref" }}'
62+ - repoURL : ' {{ .values. uc_repo_git_url }}'
63+ targetRevision : ' {{ .values. uc_repo_ref }}'
4364 path : ' operators/rook'
4465 ref : understack
45- - repoURL : ' {{index .metadata.annotations " uc_deploy_git_url" }}'
46- targetRevision : ' {{index .metadata.annotations " uc_deploy_ref" }}'
66+ - repoURL : ' {{ .values. uc_deploy_git_url }}'
67+ targetRevision : ' {{ .values. uc_deploy_ref }}'
4768 ref : deploy
4869 - component : cnpg-system
49- skipComponent : ' {{has "cnpg-system" ((default "[]" (index .metadata.annotations " uc_skip_components") | fromJson))}}'
70+ skipComponent : ' {{or ( has "cnpg-system" (.values. uc_skip_components | fromJson)) (eq "regional" .values.uc_role )}}'
5071 sources :
51- - repoURL : ' {{index .metadata.annotations " uc_repo_git_url" }}'
52- targetRevision : ' {{index .metadata.annotations " uc_repo_ref" }}'
72+ - repoURL : ' {{ .values. uc_repo_git_url }}'
73+ targetRevision : ' {{ .values. uc_repo_ref }}'
5374 path : ' operators/cnpg-system'
5475 - component : external-secrets
55- skipComponent : ' {{has "external-secrets" ((default "[]" (index .metadata.annotations " uc_skip_components") | fromJson) )}}'
76+ skipComponent : ' {{has "external-secrets" (.values. uc_skip_components | fromJson)}}'
5677 sources :
57- - repoURL : ' {{index .metadata.annotations " uc_repo_git_url" }}'
58- targetRevision : ' {{index .metadata.annotations " uc_repo_ref" }}'
78+ - repoURL : ' {{ .values. uc_repo_git_url }}'
79+ targetRevision : ' {{ .values. uc_repo_ref }}'
5980 path : ' operators/external-secrets'
6081 - component : mariadb-operator
61- skipComponent : ' {{has "mariadb-operator" ((default "[]" (index .metadata.annotations " uc_skip_components") | fromJson) )}}'
82+ skipComponent : ' {{has "mariadb-operator" (.values. uc_skip_components | fromJson)}}'
6283 sources :
63- - repoURL : ' {{index .metadata.annotations " uc_repo_git_url" }}'
64- targetRevision : ' {{index .metadata.annotations " uc_repo_ref" }}'
84+ - repoURL : ' {{ .values. uc_repo_git_url }}'
85+ targetRevision : ' {{ .values. uc_repo_ref }}'
6586 path : ' operators/mariadb-operator'
6687 - component : rabbitmq-system
67- skipComponent : ' {{has "rabbitmq-system" ((default "[]" (index .metadata.annotations " uc_skip_components") | fromJson) )}}'
88+ skipComponent : ' {{has "rabbitmq-system" (.values. uc_skip_components | fromJson)}}'
6889 sources :
69- - repoURL : ' {{index .metadata.annotations " uc_repo_git_url" }}'
70- targetRevision : ' {{index .metadata.annotations " uc_repo_ref" }}'
90+ - repoURL : ' {{ .values. uc_repo_git_url }}'
91+ targetRevision : ' {{ .values. uc_repo_ref }}'
7192 path : ' operators/rabbitmq-system'
7293 - component : monitoring
73- skipComponent : ' {{has "monitoring" ((default "[]" (index .metadata.annotations " uc_skip_components") | fromJson) )}}'
94+ skipComponent : ' {{has "monitoring" (.values. uc_skip_components | fromJson)}}'
7495 sources :
7596 - repoURL : https://prometheus-community.github.io/helm-charts
7697 chart : kube-prometheus-stack
@@ -81,15 +102,15 @@ spec:
81102 - $understack/operators/monitoring/values.yaml
82103 - $deploy/{{.name}}/helm-configs/monitoring.yaml
83104 ignoreMissingValueFiles : true
84- - repoURL : ' {{index .metadata.annotations " uc_repo_git_url" }}'
85- targetRevision : ' {{index .metadata.annotations " uc_repo_ref" }}'
105+ - repoURL : ' {{ .values. uc_repo_git_url }}'
106+ targetRevision : ' {{ .values. uc_repo_ref }}'
86107 path : ' operators/monitoring'
87108 ref : understack
88- - repoURL : ' {{index .metadata.annotations " uc_deploy_git_url" }}'
89- targetRevision : ' {{index .metadata.annotations " uc_deploy_ref" }}'
109+ - repoURL : ' {{ .values. uc_deploy_git_url }}'
110+ targetRevision : ' {{ .values. uc_deploy_ref }}'
90111 ref : deploy
91112 - component : opentelemetry-operator
92- skipComponent : ' {{has "opentelemetry-operator" ((default "[]" (index .metadata.annotations " uc_skip_components") | fromJson) )}}'
113+ skipComponent : ' {{has "opentelemetry-operator" (.values. uc_skip_components | fromJson)}}'
93114 sources :
94115 - repoURL : https://open-telemetry.github.io/opentelemetry-helm-charts
95116 chart : opentelemetry-operator
@@ -100,12 +121,12 @@ spec:
100121 - $understack/operators/opentelemetry-operator/values.yaml
101122 - $deploy/{{.name}}/helm-configs/opentelemetry-operator.yaml
102123 ignoreMissingValueFiles : true
103- - repoURL : ' {{index .metadata.annotations " uc_repo_git_url" }}'
104- targetRevision : ' {{index .metadata.annotations " uc_repo_ref" }}'
124+ - repoURL : ' {{ .values. uc_repo_git_url }}'
125+ targetRevision : ' {{ .values. uc_repo_ref }}'
105126 ref : understack
106127 path : ' operators/opentelemetry-operator'
107- - repoURL : ' {{index .metadata.annotations " uc_deploy_git_url" }}'
108- targetRevision : ' {{index .metadata.annotations " uc_deploy_ref" }}'
128+ - repoURL : ' {{ .values. uc_deploy_git_url }}'
129+ targetRevision : ' {{ .values. uc_deploy_ref }}'
109130 ref : deploy
110131 selector :
111132 # by setting the key in the elements 'skipComponent' to 'true' it will skip installing it
@@ -123,7 +144,7 @@ spec:
123144 annotations :
124145 argocd.argoproj.io/compare-options : ServerSideDiff=true,IncludeMutationWebhook=true
125146 spec :
126- project : operators
147+ project : understack- operators
127148 destination :
128149 server : ' {{.server}}'
129150 namespace : ' {{coalesce (get . "componentNamespace") .component}}'
@@ -134,20 +155,18 @@ spec:
134155 - CreateNamespace=true
135156 - ServerSideApply=true
136157 - RespectIgnoreDifferences=true
158+ managedNamespaceMetadata :
159+ annotations :
160+ # ArgoCD can create our namespace but let's not delete it
161+ argocd.argoproj.io/sync-options : Delete=false
137162 templatePatch : |
138163 spec:
139- {{- if hasKey . "source" }}
140- # indentation matters here. need to collapse to a single line to preserve it
141- source: {{ .source | toJson }}
142- {{- end }}
143- {{- if hasKey . "sources" }}
144164 sources:
145- {{- range $source := .sources }}
165+ {{- range $source := .sources }}
146166 # indentation matters so collapse to single line with toJson to keep it
147167 - {{ $source | toJson }}
148- {{- end }}
149168 {{- end }}
150- {{- if hasKey . "ignoreDifferences" }}
169+ {{- if hasKey . "ignoreDifferences" }}
151170 # indentation matters so collapse to single line with toJson to keep it
152171 ignoreDifferences: {{ .ignoreDifferences | toJson }}
153- {{- end }}
172+ {{- end }}
0 commit comments