-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
test framework: handle double-registered --kubeconfig
flag
#2731
test framework: handle double-registered --kubeconfig
flag
#2731
Conversation
@estroz: GitHub didn't allow me to request PR reviews from the following users: akoserwal, DirectXMan12. Note that only operator-framework members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
ae4665c
to
e718209
Compare
e718209
to
ef61373
Compare
flag.FlagSet
instead of global--kubeconfig
flag
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.
overall lgtm, I would add a test though. And confirm or deny my understanding of the flag parsing. If I misunderstood it, then we should add a changelog entry. If not, no changelog entry required.
786d4f9
to
3046e84
Compare
@@ -19,6 +19,10 @@ import ( | |||
"testing" | |||
|
|||
f "github.com/operator-framework/operator-sdk/pkg/test" | |||
|
|||
// This import tests double-registration of the --kubebuilder flag: |
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.
@jmrodri @camilamacedo86 confirmed that this import causes a panic w/o these changes.
pkg/client/config is imported (set up in an init() function). The SDK's test framework also adds this flag, which will panic if both are imported and the test framework is initialized. This commit only registers --kubeconfig if it is not already registered, and gets its value if so. pkg/test: only register --kubeconfig if not registered, get value if already registered test/e2e: add import of controller-runtime/pkg/client/config to test --kubebuilder registration CHANGELOG.md: add --kubeconfig double registration fix
6fb7e20
to
f20560c
Compare
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
/approved
Could you apply this fix to https://github.com/operator-framework/operator-sdk/tree/v0.15.x? |
Hi @akieling, SDK is in the version 0.18.2 already. So, 0.15.x is quite old and we would like to recommend you uprade your project. |
OK @camilamacedo86 . Thanks for the quick reply. |
Description of the change:
--kubeconfig
if not registered, get value if already registeredMotivation for the change: controller-runtime currently adds the
--kubeconfig
flag ifpkg/client/config
is imported (set up in aninit()
function). The SDK's test framework also adds this flag, which will panic if both packages are imported and the test framework is initialized.Closes: kubernetes-sigs/controller-runtime#878
/cc @joelanford @camilamacedo86 @DirectXMan12 @akoserwal
/kind bug