Skip to content

fix: wrong gatewayclass status without paramsRef#1999

Closed
cnvergence wants to merge 1 commit intoenvoyproxy:mainfrom
cnvergence:fix-gc-parameters
Closed

fix: wrong gatewayclass status without paramsRef#1999
cnvergence wants to merge 1 commit intoenvoyproxy:mainfrom
cnvergence:fix-gc-parameters

Conversation

@cnvergence
Copy link
Copy Markdown
Member

@cnvergence cnvergence commented Oct 18, 2023

What this PR does / why we need it:

Fixing the bug:
Providing GatewayClass without paramsRef

apiVersion: gateway.networking.k8s.io/v1beta1
kind: GatewayClass
metadata:
  name: example-class
spec:
  controllerName: gateway.envoyproxy.io/gatewayclass-controller

results in error in the provider, not accepting the GatewayClass.

ERROR provider kubernetes/controller.go:330 failed to process parametersRef for gatewayclass
{"runner": "provider", "name": "example-class", "error": "failed to find envoyproxy referenced by gatewayclass: example-class"}
  status:
    conditions:
    - message: 'Invalid parametersRef: failed to find envoyproxy referenced by gatewayclass:
        example-class'
      observedGeneration: 2
      reason: InvalidParameters
      status: "False"
      type: Accepted
 
NAME            CONTROLLER                                      ACCEPTED   AGE
example-class   gateway.envoyproxy.io/gatewayclass-controller   False      2m

@cnvergence cnvergence requested a review from a team as a code owner October 18, 2023 19:12
@codecov
Copy link
Copy Markdown

codecov bot commented Oct 18, 2023

Codecov Report

Merging #1999 (a112fcf) into main (604a0fb) will increase coverage by 0.04%.
Report is 1 commits behind head on main.
The diff coverage is 70.00%.

@@            Coverage Diff             @@
##             main    #1999      +/-   ##
==========================================
+ Coverage   65.51%   65.56%   +0.04%     
==========================================
  Files          92       92              
  Lines       13528    13528              
==========================================
+ Hits         8863     8869       +6     
+ Misses       4116     4110       -6     
  Partials      549      549              
Files Coverage Δ
internal/provider/kubernetes/controller.go 54.29% <70.00%> (+0.16%) ⬆️

... and 1 file with indirect coverage changes

@cnvergence
Copy link
Copy Markdown
Member Author

cnvergence commented Oct 18, 2023

PTAL @arkodg
seems like I have missed something during retesting this or something has lately changed
#1534 (comment)

if !refsEnvoyProxy(gc) {
return fmt.Errorf("unsupported parametersRef for gatewayclass %s", gc.Name)
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

here's the issue with this new code that was added

  • its a processParamsRef function for a specific gc but it fetches all EnvoyProxies and then tries to remove the finalizer for unrelated EnvoyProxies
    I see another bug on L1675 where we are removing a finalizer from the EnvoyProxy without actually checking if the EnvoyProxy is being referenced by any other GatewayClass or not.

We are very close to our v0.6 release and I prefer reverting #1534 and adding the feature later when all issues have been addressed

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This L1675 was actually added to support this case #1534 (comment)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes, but the way its written it, it can just rm another EnvoyProxy's finalizer which may actually be referenced by a GatewayClass

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I assumed it was supporting only one gateway class and therefore only one envoy proxy config or am I understanding it wrong?
Finalizer will be only there if it was referenced by a GatewayClass that was accepted.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

its a processParamsRef function for a specific gc but it fetches all EnvoyProxies and then tries to remove the finalizer for unrelated EnvoyProxies
I agree with that, it could definitely be refactored now and have a list taken out of this function

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the issue is - its a one level check for the EnvoyProxy without backtracking which GatewayClass it belongs to, it may belong to a accepted GatewayClass from another EG controller

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hmm, that could be the truth, so we would need to add the check for ControllerName as well

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ive raised #2000 for the revert
@cnvergence we really appreciate the hard work on this feature, the provider codebase is already so complex, and there are many edge cases that needed to be handled before we introduce the Envoyproxy finalizer which is not a must have yet, so prefer reverting for now

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I agree, there are a lot of corner cases, I would be happy to help again, after the 0.6.0.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thanks for understanding, I actually prefer pausing on this one, until we've cleaned up some of the GC and EP handling in the code before re adding it

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.

2 participants