diff --git a/pkg/generate/ack/release.go b/pkg/generate/ack/release.go index 922f9404..3901aab5 100644 --- a/pkg/generate/ack/release.go +++ b/pkg/generate/ack/release.go @@ -21,6 +21,7 @@ import ( "github.com/aws-controllers-k8s/code-generator/pkg/generate/templateset" ackmetadata "github.com/aws-controllers-k8s/code-generator/pkg/metadata" ackmodel "github.com/aws-controllers-k8s/code-generator/pkg/model" + "github.com/aws-controllers-k8s/pkg/names" ) var ( @@ -103,6 +104,10 @@ func Release( releaseFuncMap(m.MetaVars().ControllerName), ) metaVars := m.MetaVars() + reconcileResources := make([]string, len(metaVars.CRDNames)) + for i, name := range metaVars.CRDNames { + reconcileResources[i] = names.New(name).Camel + } releaseVars := &templateReleaseVars{ metaVars, @@ -112,6 +117,7 @@ func Release( }, metadata, serviceAccountName, + reconcileResources, } for _, path := range releaseTemplatePaths { outPath := strings.TrimSuffix(path, ".tpl") @@ -140,4 +146,6 @@ type templateReleaseVars struct { Metadata *ackmetadata.ServiceMetadata // ServiceAccountName is the name of the ServiceAccount used in the Helm chart ServiceAccountName string + // ReconcileResources contains all CRD names in their original format + ReconcileResources []string } diff --git a/templates/helm/templates/deployment.yaml.tpl b/templates/helm/templates/deployment.yaml.tpl index c78c3c08..86e73ccf 100644 --- a/templates/helm/templates/deployment.yaml.tpl +++ b/templates/helm/templates/deployment.yaml.tpl @@ -59,6 +59,8 @@ spec: - "$(ACK_WATCH_NAMESPACE)" - --watch-selectors - "$(ACK_WATCH_SELECTORS)" + - --reconcile-resources + - "$(RECONCILE_RESOURCES)" - --deletion-policy - "$(DELETION_POLICY)" {{ "{{- if .Values.leaderElection.enabled }}" }} @@ -107,6 +109,8 @@ spec: value: {{ IncludeTemplate "watch-namespace" }} - name: ACK_WATCH_SELECTORS value: {{ "{{ .Values.watchSelectors }}" }} + - name: RECONCILE_RESOURCES + value: {{ "{{ join \",\" .Values.reconcile.resources | quote }}" }} - name: DELETION_POLICY value: {{ "{{ .Values.deletionPolicy }}" }} - name: LEADER_ELECTION_NAMESPACE diff --git a/templates/helm/values.schema.json b/templates/helm/values.schema.json index 37f2ca01..e656c749 100644 --- a/templates/helm/values.schema.json +++ b/templates/helm/values.schema.json @@ -239,6 +239,14 @@ }, "resourceMaxConcurrentSyncs": { "type": "object" + }, + "resources": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of resource kinds to reconcile. If empty, all resources will be reconciled.", + "default": [] } }, "type": "object" diff --git a/templates/helm/values.yaml.tpl b/templates/helm/values.yaml.tpl index 31891c2d..7db5659a 100644 --- a/templates/helm/values.yaml.tpl +++ b/templates/helm/values.yaml.tpl @@ -137,6 +137,14 @@ reconcile: # An object representing the reconcile max concurrent syncs configuration for each specific # resource. resourceMaxConcurrentSyncs: {} + + # Set the value of resources to specify which resource kinds to reconcile. + # If empty, all resources will be reconciled. + # If specified, only the listed resource kinds will be reconciled. + resources: + {{- range $resource := .ReconcileResources }} + - {{ $resource }} + {{- end }} serviceAccount: # Specifies whether a service account should be created