-
Notifications
You must be signed in to change notification settings - Fork 690
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
internal/provisioner: support using ContourDeployment.Config #4459
internal/provisioner: support using ContourDeployment.Config #4459
Conversation
Codecov Report
@@ Coverage Diff @@
## main #4459 +/- ##
==========================================
- Coverage 76.47% 76.47% -0.01%
==========================================
Files 138 138
Lines 12427 12433 +6
==========================================
+ Hits 9504 9508 +4
- Misses 2674 2676 +2
Partials 249 249
|
1e7441c
to
5f756e4
Compare
When a GatewayClass has a parametersRef to a ContourDeployment resource that has Config specified, use that Config when provisioning Gateways and their associated ContourConfigurations. Signed-off-by: Steve Kriss <krisss@vmware.com>
01e38b1
to
3c3be71
Compare
@@ -323,3 +332,22 @@ func (r *gatewayReconciler) ensureContourDeleted(ctx context.Context, contour *m | |||
|
|||
return errs | |||
} | |||
|
|||
func (r *gatewayReconciler) getGatewayClassParams(ctx context.Context, gatewayClass *gatewayapi_v1alpha2.GatewayClass) (*contour_api_v1alpha1.ContourDeployment, error) { | |||
if !isContourDeploymentRef(gatewayClass.Spec.ParametersRef) { |
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.
is this case possible? since GatewayClasses won't be accepted if they have an invalid parametersref and we won't reconcile a Gateway for a GatewayClass that has not been accepted?
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.
Yeah probably not, I think this function call is effectively just handling nil-checking on the parametersref right now (since parameters are optional). Can simplify to just do that directly.
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.
Thinking about it some more, there probably is a (admittedly pretty hard-to-trigger) race condition here, if a GatewayClass has been updated from a valid ContourDeployment ref to a ref to some other resource type but hasn't yet reconciled / marked "Accepted: false", and ~simultaneously a Gateway reconcile is triggered that uses that GatewayClass. Based on that I'm thinking it's safer to keep the check here (it's just checking fields, no cache/API calls so not expensive to execute), but I'll add some comments.
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.
ah yep that is a good point about the race, yeah worth adding some comments (and maybe a test if possible) as to what is expected in this edge case
Signed-off-by: Steve Kriss <krisss@vmware.com>
When a GatewayClass has a parametersRef
to a ContourDeployment resource that has
Config specified, use that Config when
provisioning Gateways and their associated
ContourConfigurations.
Signed-off-by: Steve Kriss krisss@vmware.com