-
Notifications
You must be signed in to change notification settings - Fork 216
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
Flag not working: --Kubeconfig
Flag doesn't work with Retina Create
#258
Labels
Milestone
Comments
rbtr
added
type/bug
Something isn't working
lang/go
The Go Programming Language
area/captures
priority/1
P1
labels
Apr 11, 2024
github-merge-queue bot
pushed a commit
that referenced
this issue
Apr 15, 2024
# Description Changes the CLI command structure from Command method "constructors" to direct struct initialization of package variables and flag/registration init hooks. This seems like a trivial syntactic difference, but due to the way that Cobra initializes the CLI runtime (including things like binding flags), it is critical that all Commands are already instantiated, and all flags registered, by the time the CLI framework starts running. In the previous pattern, for example, the flag for `--kubeconfig` was bound in the constructor for the nested `capture create` Command and, although Cobra detected and parsed the flag value correctly at runtime, it was not _available_ inside that nested command execution and evaluated to the zero-value. Additionally, this is the Command/init pattern demonstrated in the [Cobra docs](https://github.com/spf13/cobra/blob/main/site/content/user_guide.md#create-rootcmd), and we should stay aligned with their documented best-practices. Finally I think it's much clearer the previous pattern, but I am used to reading and writing Cobra-style CLIs 🙂 ## Related Issue I started investigating #258 and ended up here. Incidentally fixes #258. ## Checklist - [x] I have read the [contributing documentation](https://retina.sh/docs/contributing). - [x] I signed and signed-off the commits (`git commit -S -s ...`). See [this documentation](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification) on signing commits. - [x] I have correctly attributed the author(s) of the code. - [x] I have tested the changes locally. - [x] I have followed the project's style guidelines. - [x] I have updated the documentation, if necessary. - [x] I have added tests, if applicable. ## Screenshots (if applicable) or Testing Completed Please add any relevant screenshots or GIFs to showcase the changes made. ## Additional Notes Add any additional notes or context about the pull request here. --- Please refer to the [CONTRIBUTING.md](../CONTRIBUTING.md) file for more information on how to contribute to this project. --------- Signed-off-by: Evan Baker <[email protected]>
github-project-automation
bot
moved this from In Progress
to Accepted
in Retina Triage Board
Apr 15, 2024
nddq
pushed a commit
that referenced
this issue
May 6, 2024
# Description Changes the CLI command structure from Command method "constructors" to direct struct initialization of package variables and flag/registration init hooks. This seems like a trivial syntactic difference, but due to the way that Cobra initializes the CLI runtime (including things like binding flags), it is critical that all Commands are already instantiated, and all flags registered, by the time the CLI framework starts running. In the previous pattern, for example, the flag for `--kubeconfig` was bound in the constructor for the nested `capture create` Command and, although Cobra detected and parsed the flag value correctly at runtime, it was not _available_ inside that nested command execution and evaluated to the zero-value. Additionally, this is the Command/init pattern demonstrated in the [Cobra docs](https://github.com/spf13/cobra/blob/main/site/content/user_guide.md#create-rootcmd), and we should stay aligned with their documented best-practices. Finally I think it's much clearer the previous pattern, but I am used to reading and writing Cobra-style CLIs 🙂 ## Related Issue I started investigating #258 and ended up here. Incidentally fixes #258. ## Checklist - [x] I have read the [contributing documentation](https://retina.sh/docs/contributing). - [x] I signed and signed-off the commits (`git commit -S -s ...`). See [this documentation](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification) on signing commits. - [x] I have correctly attributed the author(s) of the code. - [x] I have tested the changes locally. - [x] I have followed the project's style guidelines. - [x] I have updated the documentation, if necessary. - [x] I have added tests, if applicable. ## Screenshots (if applicable) or Testing Completed Please add any relevant screenshots or GIFs to showcase the changes made. ## Additional Notes Add any additional notes or context about the pull request here. --- Please refer to the [CONTRIBUTING.md](../CONTRIBUTING.md) file for more information on how to contribute to this project. --------- Signed-off-by: Evan Baker <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Describe the bug
Thanks in advance for taking a look at this, upon supplying the
--kubeconfig
flag forretina create
it still takes the current set cluster context rather then the supplied kubeconfig file context.To Reproduce
Steps to reproduce the behavior:
Sample command:
kubectl retina capture create --host-path /mnt/capture --node-selectors "kubernetes.io/os=linux" --kubeconfig /path/to/aksclusterfoo
Please see screenshot below as to how
get node
works with--kubeconfig
and the Crete retina output.Expected behavior
Screenshots
If applicable, add screenshots to help explain your problem.
Platform (please complete the following information):
Additional context
Add any other context about the problem here.
Reference: discovered as part of work when doing this: Azure/vscode-aks-tools#569
The text was updated successfully, but these errors were encountered: