Skip to content

Commit 6f399f4

Browse files
committed
reconciler kinds selection
1 parent 97c0bf5 commit 6f399f4

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

pkg/generate/ack/release.go

+14
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,17 @@ func Release(
104104
)
105105
metaVars := m.MetaVars()
106106

107+
crds, err := m.GetCRDs()
108+
if err != nil {
109+
return nil, err
110+
}
111+
112+
reconcileResources := make([]string, 0)
113+
114+
for _, crd := range crds {
115+
reconcileResources = append(reconcileResources, strings.ToLower(crd.Names.Camel))
116+
}
117+
107118
releaseVars := &templateReleaseVars{
108119
metaVars,
109120
ImageReleaseVars{
@@ -112,6 +123,7 @@ func Release(
112123
},
113124
metadata,
114125
serviceAccountName,
126+
reconcileResources,
115127
}
116128
for _, path := range releaseTemplatePaths {
117129
outPath := strings.TrimSuffix(path, ".tpl")
@@ -140,4 +152,6 @@ type templateReleaseVars struct {
140152
Metadata *ackmetadata.ServiceMetadata
141153
// ServiceAccountName is the name of the ServiceAccount used in the Helm chart
142154
ServiceAccountName string
155+
// ReconcileResources contains all CRD names in their original format
156+
ReconcileResources []string
143157
}

templates/helm/templates/deployment.yaml.tpl

+4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ spec:
5959
- "$(ACK_WATCH_NAMESPACE)"
6060
- --watch-selectors
6161
- "$(ACK_WATCH_SELECTORS)"
62+
- --reconcile-resources
63+
- "$(RECONCILE_RESOURCES)"
6264
- --deletion-policy
6365
- "$(DELETION_POLICY)"
6466
{{ "{{- if .Values.leaderElection.enabled }}" }}
@@ -107,6 +109,8 @@ spec:
107109
value: {{ IncludeTemplate "watch-namespace" }}
108110
- name: ACK_WATCH_SELECTORS
109111
value: {{ "{{ .Values.watchSelectors }}" }}
112+
- name: RECONCILE_RESOURCES
113+
value: {{ "{{ join \",\" .Values.reconcile.resources | quote }}" }}
110114
- name: DELETION_POLICY
111115
value: {{ "{{ .Values.deletionPolicy }}" }}
112116
- name: LEADER_ELECTION_NAMESPACE

templates/helm/values.schema.json

+7
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,13 @@
239239
},
240240
"resourceMaxConcurrentSyncs": {
241241
"type": "object"
242+
},
243+
"resources": {
244+
"type": "array",
245+
"items": {
246+
"type": "string"
247+
},
248+
"description": "List of resource kinds to reconcile. If empty, all resources will be reconciled."
242249
}
243250
},
244251
"type": "object"

templates/helm/values.yaml.tpl

+9
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,15 @@ reconcile:
137137
# An object representing the reconcile max concurrent syncs configuration for each specific
138138
# resource.
139139
resourceMaxConcurrentSyncs: {}
140+
141+
# Set the value of resources to specify which resource kinds to reconcile.
142+
# If empty, all resources will be reconciled.
143+
# If specified, only the listed resource kinds will be reconciled.
144+
resources: []
145+
# Available resource kinds for this controller:
146+
{{- range $resource := .ReconcileResources }}
147+
# - {{ $resource }}
148+
{{- end }}
140149

141150
serviceAccount:
142151
# Specifies whether a service account should be created

0 commit comments

Comments
 (0)