Skip to content
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
9 changes: 4 additions & 5 deletions templates/cmd/controller/main.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,14 @@ func main() {
flag.Parse()
ackCfg.SetupLogger()

ctx := ctrlrt.SetupSignalHandler()

managerFactories := svcresource.GetManagerFactories()
resourceGVKs := make([]schema.GroupVersionKind, 0, len(managerFactories))
for _, mf := range managerFactories {
resourceGVKs = append(resourceGVKs, mf.ResourceDescriptor().GroupVersionKind())
}

ctx := context.Background()
if err := ackCfg.Validate(ctx, ackcfg.WithGVKs(resourceGVKs)); err != nil {
setupLog.Error(
err, "Unable to create controller manager",
Expand Down Expand Up @@ -144,8 +145,6 @@ func main() {
os.Exit(1)
}

stopChan := ctrlrt.SetupSignalHandler()

setupLog.Info(
"initializing service controller",
"aws.service", awsServiceAlias,
Expand Down Expand Up @@ -177,7 +176,7 @@ func main() {
}
}

if err = sc.BindControllerManager(mgr, ackCfg); err != nil {
if err = sc.BindControllerManager(ctx, mgr, ackCfg); err != nil {
setupLog.Error(
err, "unable bind to controller manager to service controller",
"aws.service", awsServiceAlias,
Expand All @@ -204,7 +203,7 @@ func main() {
"starting manager",
"aws.service", awsServiceAlias,
)
if err := mgr.Start(stopChan); err != nil {
if err := mgr.Start(ctx); err != nil {
setupLog.Error(
err, "unable to start controller manager",
"aws.service", awsServiceAlias,
Expand Down
7 changes: 7 additions & 0 deletions templates/config/controller/deployment.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ spec:
- --feature-gates
- "$(FEATURE_GATES)"
- --enable-carm=$(ENABLE_CARM)
- --lazy-bind-reconcilers=$(LAZY_BIND_RECONCILERS)
- --lazy-bind-retry-interval
- "$(LAZY_BIND_RETRY_INTERVAL)"
image: controller:latest
name: controller
ports:
Expand Down Expand Up @@ -83,6 +86,10 @@ spec:
value: ""
- name: "ENABLE_CARM"
value: "true"
- name: "LAZY_BIND_RECONCILERS"
value: "false"
- name: "LAZY_BIND_RETRY_INTERVAL"
value: "10"
securityContext:
allowPrivilegeEscalation: false
privileged: false
Expand Down
5 changes: 5 additions & 0 deletions templates/helm/templates/deployment.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ spec:
- "$(FEATURE_GATES)"
{{ "{{- end }}" }}
- {{ "--enable-carm={{ .Values.enableCARM }}" }}
- {{ "--lazy-bind-reconcilers={{ .Values.lazyBindReconcilers }}" }}
{{ "{{- if .Values.lazyBindReconcilers }}" }}
- --lazy-bind-retry-interval
- {{ "{{ .Values.lazyBindRetryInterval | quote }}" }}
{{ "{{- end }}" }}
image: {{ "{{ .Values.image.repository }}:{{ .Values.image.tag }}" }}
imagePullPolicy: {{ "{{ .Values.image.pullPolicy }}" }}
name: controller
Expand Down
9 changes: 9 additions & 0 deletions templates/helm/values.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,15 @@ leaderElection:
# Enable Cross Account Resource Management (default = true). Set this to false to disable cross account resource management.
enableCARM: true

# Enable Lazy Bind Reconcilers (default = false). When enabled, defers reconciler
# binding for missing CRDs until they become available, allowing the controller to
# start serving installed CRDs immediately instead of crash-looping.
lazyBindReconcilers: false

# The interval in seconds between retry attempts when polling the discovery API
# for missing CRDs (only used when lazyBindReconcilers is true).
lazyBindRetryInterval: 10

# Configuration for feature gates. These are optional controller features that
# can be individually enabled ("true") or disabled ("false") by adding key/value
# pairs below.
Expand Down
6 changes: 6 additions & 0 deletions templates/pkg/resource/descriptor.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ func (d *resourceDescriptor) GroupVersionKind() schema.GroupVersionKind {
return svcapitypes.GroupVersion.WithKind(GroupKind.Kind)
}

// GroupVersionResource returns a Kubernetes schema.GroupVersionResource struct that
// describes the API Group, Version and Resource of CRs described by the descriptor
func (d *resourceDescriptor) GroupVersionResource() schema.GroupVersionResource {
return GroupVersionResource
}

// EmptyRuntimeObject returns an empty object prototype that may be used in
// apimachinery and k8s client operations
func (d *resourceDescriptor) EmptyRuntimeObject() rtclient.Object {
Expand Down