-
Notifications
You must be signed in to change notification settings - Fork 679
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
replace dynamic client with controller-runtime client #4153
Conversation
Replaces the dynamic Kubernetes client with the controller-runtime client, which is easier to use and can natively perform reads from the cache. Closes projectcontour#3983. Signed-off-by: Steve Kriss <krisss@vmware.com>
Signed-off-by: Steve Kriss <krisss@vmware.com>
Signed-off-by: Steve Kriss <krisss@vmware.com>
Codecov Report
@@ Coverage Diff @@
## main #4153 +/- ##
==========================================
+ Coverage 72.56% 73.17% +0.61%
==========================================
Files 115 113 -2
Lines 10032 9884 -148
==========================================
- Hits 7280 7233 -47
+ Misses 2597 2497 -100
+ Partials 155 154 -1
|
for name, r := range map[string]client.Object{ | ||
"httpproxies": &contour_api_v1.HTTPProxy{}, | ||
"tlscertificatedelegations": &contour_api_v1.TLSCertificateDelegation{}, | ||
"extensionservices": &contour_api_v1alpha1.ExtensionService{}, | ||
"contourconfigurations": &contour_api_v1alpha1.ContourConfiguration{}, | ||
"services": &corev1.Service{}, | ||
"ingresses": &networking_v1.Ingress{}, | ||
"ingressclasses": &networking_v1.IngressClass{}, | ||
} { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seemed easier to just inline these now that they're one-liners each, but if you all prefer this being kept in informers.go
/ in a DefaultResources()
function I can go back to that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree inline is cleaner.
// Only inform on GatewayAPI if found in the cluster. | ||
if s.clients.ResourcesExist(k8s.GatewayAPIResources()...) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dropped the explicit resources-exist check since it seemed redundant now: startup will fail anyway if you try to enable Gateway API but the resources don't exist. Had the benefit of being able to entirely get rid of the RESTMapper.
@@ -21,29 +21,8 @@ rules: | |||
- "" | |||
resources: | |||
- endpoints | |||
verbs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change was just rearranging things to group them by API group, shouldn't be any actual changes to the rules.
Ready for review but I'd like to do some additional manual testing on this one before merging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm pending the smoke tests! There are spots where we could probably just move to controller manager setups to standardize a bit on how we get data, but not for this PR.
for name, r := range map[string]client.Object{ | ||
"httpproxies": &contour_api_v1.HTTPProxy{}, | ||
"tlscertificatedelegations": &contour_api_v1.TLSCertificateDelegation{}, | ||
"extensionservices": &contour_api_v1alpha1.ExtensionService{}, | ||
"contourconfigurations": &contour_api_v1alpha1.ContourConfiguration{}, | ||
"services": &corev1.Service{}, | ||
"ingresses": &networking_v1.Ingress{}, | ||
"ingressclasses": &networking_v1.IngressClass{}, | ||
} { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree inline is cleaner.
I deployed it to a cloud cluster, ensured ingress address was updated properly, did some manual smoke-testing and things seemed fine so I think we're good here. |
Signed-off-by: Steve Kriss <krisss@vmware.com>
Replaces the dynamic Kubernetes client with
the controller-runtime client, which is easier
to use and can natively perform reads from
the cache.
Closes #3983.
Signed-off-by: Steve Kriss krisss@vmware.com