Skip to content
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

fail soft when crds are not installed #153

Merged
merged 1 commit into from
Apr 15, 2024

Conversation

LiorLieberman
Copy link
Member

What type of PR is this?
/kind bug

What this PR does / why we need it:
Execution should work regardless of whether CRDs are installed or not
Which issue(s) this PR fixes:

Fixes #138

Does this PR introduce a user-facing change?:

Fix errors when CRDs are not installed in the cluster

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 10, 2024
@LiorLieberman LiorLieberman requested review from dpasiukevich and mlavacca and removed request for dpasiukevich, Xunzhuo and levikobi April 10, 2024 07:15
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 10, 2024
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 10, 2024
Copy link
Member

@mlavacca mlavacca left a comment

Choose a reason for hiding this comment

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

Can we move this check to the caller logic and return a typed error from the provider, instead of having the same logic in each provider? Something like what I suggested here

@dpasiukevich
Copy link
Member

/ltgm
/hold to get every review

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 10, 2024
@LiorLieberman
Copy link
Member Author

Can we move this check to the caller logic and return a typed error from the provider, instead of having the same logic in each provider? Something like what I suggested here

I dont think we should wrap an already NotFound error in another custom NotFound type.

Also, I less like the idea of a list of providers that participated in the translation. I think providers can still participate in the translation with ingress annotations and without CRDs installed.

It is not ideal to have the same logic - hence a helper might be the way but I think we can not take it out to the caller, because we need to continue the execution of the provider even if the CRDs are not installed.

cc: @levikobi

Copy link
Member

@levikobi levikobi left a comment

Choose a reason for hiding this comment

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

This looks good to me also TBH

I would have preferred having the NotFound check once at the caller level, but the caller doesn't directly call readTCP... or readUDP... - it calls a method that aggregates the reading of specific CRDs. Since this mid level function that reads everything needs to keep going even if TCP for example isn't installed, we would have to make the check there...

The main issue is that we might have one error of resources not found, and another error since there was an actual problem reading from the cluster, and one error might override the other

In other words, even though I would have preferred it more, I don't see how we can move the check to the caller and preserve the required functionality

@LiorLieberman
Copy link
Member Author

/cc @mlavacca can you relate to the feedback and lgtm if this looks good to you ?

@mlavacca
Copy link
Member

Oh yes, I get your point. It is not possible to move the logic entirely out of the provider, as the ReadResourcesFromCluster is provider-specific as well, and it calls the Resource-specific methods. I'm good with this implementation then 👍

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 15, 2024
Copy link
Member

@mlavacca mlavacca left a comment

Choose a reason for hiding this comment

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

/approve
/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 15, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: LiorLieberman, mlavacca

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [LiorLieberman,mlavacca]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 15b873a into kubernetes-sigs:main Apr 15, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Execution fails when CRDs are not installed in the cluster
5 participants