Skip to content
Merged
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: 8 additions & 1 deletion templates/cmd/controller/main.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
ackrtutil "github.com/aws-controllers-k8s/runtime/pkg/util"
ackrtwebhook "github.com/aws-controllers-k8s/runtime/pkg/webhook"
flag "github.com/spf13/pflag"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
ctrlrt "sigs.k8s.io/controller-runtime"
Expand Down Expand Up @@ -62,7 +63,13 @@ func main() {
flag.Parse()
ackCfg.SetupLogger()

if err := ackCfg.Validate(); err != nil {
managerFactories := svcresource.GetManagerFactories()
resourceGVKs := make([]schema.GroupVersionKind, 0, len(managerFactories))
for _, mf := range managerFactories {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should just pass the entire GroupKind, so that different downstream validation can use whichever naming and casing it needs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Changed to GroupKinds

resourceGVKs = append(resourceGVKs, mf.ResourceDescriptor().GroupVersionKind())
}

if err := ackCfg.Validate(ackcfg.WithGVKs(resourceGVKs)); err != nil {
setupLog.Error(
err, "Unable to create controller manager",
"aws.service", awsServiceAlias,
Expand Down