File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 helm template -n $(NAMESPACE ) $(NAME ) . --dry-run=server $(API_VERSIONS_FLAGS )
88
99apply :
10- @echo " Applying active HelmReleases..."
1110 helm template -n $(NAMESPACE ) $(NAME ) . --dry-run=server $(API_VERSIONS_FLAGS ) \
12- | yq ' select(.metadata.annotations."cozystack.io/marked-for-deletion" != "true")' - \
1311 | kubectl apply -f-
12+ kubectl delete helmreleases.helm.toolkit.fluxcd.io -l cozystack.io/marked-for-deletion=true -A
1413
15- delete :
16- @echo " Deleting marked-for-deletion HelmReleases..."
17- helm template -n $(NAMESPACE ) $(NAME ) . --dry-run=server $(API_VERSIONS_FLAGS ) \
18- | yq ' select(.metadata.annotations."cozystack.io/marked-for-deletion" == "true")' - \
19- | kubectl delete -f - --ignore-not-found=true
20-
21- reconcile : apply delete
14+ reconcile : apply
2215
2316namespaces-show :
2417 helm template -n $(NAMESPACE ) $(NAME ) . --dry-run=server $(API_VERSIONS_FLAGS ) -s templates/namespaces.yaml
Original file line number Diff line number Diff line change 1111{{- end }}
1212
1313{{- range $x := $bundle.releases }}
14- {{- if not (has $x.name $disabledComponents) }}
15- {{- if or (not $x.optional) (and ($x.optional) (has $x.name $enabledComponents)) }}
14+
15+ {{- $shouldInstall := true }}
16+ {{- $shouldDelete := false }}
17+ {{- if or (has $x.name $disabledComponents) (and ($x.optional) (not (has $x.name $enabledComponents))) }}
18+ {{- $shouldInstall = false }}
19+ {{- if lookup "helm.toolkit.fluxcd.io/v2" "HelmRelease" $x.namespace $x.name }}
20+ {{- $shouldDelete = true }}
21+ {{- end }}
22+ {{- end }}
23+
24+ {{- if or $shouldInstall $shouldDelete }}
1625---
1726apiVersion : helm.toolkit.fluxcd.io/v2
1827kind : HelmRelease
@@ -22,6 +31,9 @@ metadata:
2231 labels :
2332 cozystack.io/repository : system
2433 cozystack.io/system-app : " true"
34+ {{- if $shouldDelete }}
35+ cozystack.io/marked-for-deletion : " true"
36+ {{- end }}
2537spec :
2638 interval : 5m
2739 releaseName : {{ $x.releaseName | default $x.name }}
7991 {{- end }}
8092{{- end }}
8193{{- end }}
82- {{- end }}
83-
84- {{- range $name := $disabledComponents }}
85- {{- if ne $name "" }}
86- ---
87- apiVersion : helm.toolkit.fluxcd.io/v2
88- kind : HelmRelease
89- metadata :
90- name : {{ $name }}
91- namespace : {{ index $dependencyNamespaces $name | default "cozy-system" }}
92- annotations :
93- cozystack.io/marked-for-deletion : " true"
94- labels :
95- cozystack.io/repository : system
96- cozystack.io/system-app : " true"
97- spec :
98- suspend : true
99- {{- end }}
100- {{- end }}
You can’t perform that action at this time.
0 commit comments