Skip to content

add support for reconcile-resources flag #580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pkg/generate/ack/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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,
Expand All @@ -112,6 +117,7 @@ func Release(
},
metadata,
serviceAccountName,
reconcileResources,
}
for _, path := range releaseTemplatePaths {
outPath := strings.TrimSuffix(path, ".tpl")
Expand Down Expand Up @@ -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
}
4 changes: 4 additions & 0 deletions templates/helm/templates/deployment.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}" }}
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions templates/helm/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 8 additions & 0 deletions templates/helm/values.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down