Skip to content

Conversation

@u-kai
Copy link
Contributor

@u-kai u-kai commented Jan 1, 2025

What type of PR is this?
Feature

Which issue does this PR fix:
#660

What does this PR do / Why do we need it:
This PR adds a feature that pre-checks the required CRDs for the controller.
If the required CRDs are not installed, the controller will fail fast.

If an issue # is not available please add repro steps and logs from aws-gateway-controller showing the issue:

Testing done on this change:

Tested by deploying the changes in my EKS cluster.
If the required CRDs are not installed, the controller logs the following message:

{"level":"info","ts":"2025-01-01T04:23:53.272Z","caller":"workspace/main.go:161","msg":"log level set to debug"}
...
{"level":"info","ts":"2025-01-01T04:23:53.272Z","logger":"setup","caller":"runtime/proc.go:272","msg":"Webhook is enabled, 'webhook-cert' secret must contain a valid TLS key and cert"}
{"level":"fatal","ts":"2025-01-01T04:23:53.376Z","logger":"setup","caller":"runtime/proc.go:272","msg":"required CRDs check failed:missing required CRDs: gateway.networking.k8s.io/v1, Kind=Gateway, gateway.networking.k8s.io/v1, Kind=GatewayClass, gateway.networking.k8s.io/v1, Kind=HTTPRoute, gateway.networking.k8s.io/v1, Kind=GRPCRoute, gateway.networking.k8s.io/v1alpha2, Kind=TLSRoute"}

Automation added to e2e:

No
Will this PR introduce any new dependencies?:

No
Will this break upgrades or downgrades. Has updating a running cluster been tested?:

Does this PR introduce any user-facing change?:


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@u-kai u-kai marked this pull request as ready for review January 1, 2025 06:11
@ghost
Copy link

ghost commented Jan 30, 2025

Just tested myself as well!

2025-01-30T15:16:00.422-0800    INFO    setup   runtime/proc.go:272     init config     {"VpcId": "vpc-###", "Region": "us-east-1", "AccountId": "###", "DefaultServiceNetwork": "", "ClusterName": "crd-check", "LogLevel": "debug", "DisableTaggingServiceAPI": false}
2025-01-30T15:16:00.422-0800    INFO    setup   runtime/proc.go:272     Webhook is disabled, value: ''
2025-01-30T15:16:01.240-0800    FATAL   setup   runtime/proc.go:272     required CRDs check failed:missing required CRDs: gateway.networking.k8s.io/v1, Kind=Gateway, gateway.networking.k8s.io/v1, Kind=GatewayClass, gateway.networking.k8s.io/v1, Kind=HTTPRoute, gateway.networking.k8s.io/v1, Kind=GRPCRoute
runtime.main
        /opt/homebrew/Cellar/go/1.23.5/libexec/src/runtime/proc.go:272
exit status 1
make: *** [run] Error 1

After install:

customresourcedefinition.apiextensions.k8s.io/gatewayclasses.gateway.networking.k8s.io created
customresourcedefinition.apiextensions.k8s.io/gateways.gateway.networking.k8s.io created
customresourcedefinition.apiextensions.k8s.io/grpcroutes.gateway.networking.k8s.io created
customresourcedefinition.apiextensions.k8s.io/httproutes.gateway.networking.k8s.io created
customresourcedefinition.apiextensions.k8s.io/referencegrants.gateway.networking.k8s.io created
gatewayclass.gateway.networking.k8s.io/amazon-vpc-lattice created

...

make run

2025-01-30T15:17:14.191-0800    INFO    setup   runtime/proc.go:272     Webhook is disabled, value: ''
2025-01-30T15:17:15.080-0800    INFO    controller.route        controllers/route_controller.go:142     DNSEndpoint CRD is not installed, skipping watch
2025-01-30T15:17:15.248-0800    INFO    controller.route        controllers/route_controller.go:142     DNSEndpoint CRD is not installed, skipping watch
2025-01-30T15:17:15.420-0800    INFO    controller.route        controllers/route_controller.go:142     DNSEndpoint CRD is not installed, skipping watch
2025-01-30T15:17:15.507-0800    DEBUG   controller.iam-auth-policy      policyhelper/policy.go:252      add watchers for types: [{gateway.networking.k8s.io Gateway} {gateway.networking.k8s.io HTTPRoute} {gateway.networking.k8s.io GRPCRoute}]
2025-01-30T15:17:15.508-0800    DEBUG   controller.target-group-policy  policyhelper/policy.go:252      add watchers for types: [{ Service}]
2025-01-30T15:17:15.508-0800    DEBUG   controller.target-group-policy  policyhelper/policy.go:252      add watchers for types: [{application-networking.k8s.aws ServiceExport}]
...

@ghost ghost enabled auto-merge (squash) January 30, 2025 23:19
@ghost ghost self-requested a review January 30, 2025 23:24
@ghost ghost merged commit 55d1d40 into aws:main Jan 30, 2025
2 checks passed
@u-kai
Copy link
Contributor Author

u-kai commented Jan 31, 2025

@rlymbur
Thank you for reviewing and merging!

@u-kai u-kai deleted the fix-issue-660 branch January 31, 2025 12:41
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant