Skip to content

Commit 6657565

Browse files
authored
Pass registered resource names to config.Validate (#423)
[fixes aws-controllers-k8s/community#1647] Completes aws-controllers-k8s/runtime#117 This patch adds a tiny modification to the controllers `main.go` that passes the resource names to `ackCfg.Validate` method. Needs a new runtime release. /hold Signed-off-by: Amine Hilaly <[email protected]> By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent e69321e commit 6657565

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

templates/cmd/controller/main.go.tpl

+8-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
ackrtutil "github.com/aws-controllers-k8s/runtime/pkg/util"
1313
ackrtwebhook "github.com/aws-controllers-k8s/runtime/pkg/webhook"
1414
flag "github.com/spf13/pflag"
15+
"k8s.io/apimachinery/pkg/runtime/schema"
1516
"k8s.io/apimachinery/pkg/runtime"
1617
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
1718
ctrlrt "sigs.k8s.io/controller-runtime"
@@ -62,7 +63,13 @@ func main() {
6263
flag.Parse()
6364
ackCfg.SetupLogger()
6465
65-
if err := ackCfg.Validate(); err != nil {
66+
managerFactories := svcresource.GetManagerFactories()
67+
resourceGVKs := make([]schema.GroupVersionKind, 0, len(managerFactories))
68+
for _, mf := range managerFactories {
69+
resourceGVKs = append(resourceGVKs, mf.ResourceDescriptor().GroupVersionKind())
70+
}
71+
72+
if err := ackCfg.Validate(ackcfg.WithGVKs(resourceGVKs)); err != nil {
6673
setupLog.Error(
6774
err, "Unable to create controller manager",
6875
"aws.service", awsServiceAlias,

0 commit comments

Comments
 (0)