-
Notifications
You must be signed in to change notification settings - Fork 44
✨ Usage of Extensions #386
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
Conversation
- new: implement KubeflexConfig Signed-off-by: rxinui <rainui.ly@gmail.com>
Signed-off-by: rxinui <rainui.ly@gmail.com>
- new: kubeconfig extensions funcs are implemented - test: extensions tests OK Signed-off-by: rxinui <rainui.ly@gmail.com>
Signed-off-by: rxinui <rainui.ly@gmail.com>
Signed-off-by: rxinui <rainui.ly@gmail.com>
Signed-off-by: rxinui <rainui.ly@gmail.com>
Signed-off-by: rxinui <rainui.ly@gmail.com>
- ref: update SetHostingClusterContext using KubeflexConfig Signed-off-by: rxinui <rainui.ly@gmail.com>
Signed-off-by: rxinui <rainui.ly@gmail.com>
Signed-off-by: rxinui <rainui.ly@gmail.com>
Hi @rxinui. Thanks for your PR. I'm waiting for a kubestellar member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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-sigs/prow repository. |
Signed-off-by: rxinui <rainui.ly@gmail.com>
af3f091
to
2c35c59
Compare
- test: update ctx_test.go Signed-off-by: rxinui <rainui.ly@gmail.com>
The constant |
/ok-to-test |
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 looks good, I have couple of general comments I think would be best to address before merging:
-
Since this is a breaking change, it would be helpful adding a script or command to migrate old kubeconfig extensions to the new format, or at least provide documentation about this breaking change and how the user can migrate (even by manually editing the file if no automation is provided)
-
Should add some text to README or release notes to explain the new extension mechanism, breaking changes, and manual steps required by users.
return err | ||
} | ||
return nil | ||
} |
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.
I think the code assumes all kubeconfig for Kubeflex have well-formed KubeflexExtensions objects under the extensions key. If a user manually edits kubeconfig, or if there are partial/invalid extension values, code may panic or behave unexpectedly.
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.
True. What should we do then? Isn't a panic
a good situation to act as such?
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.
yes, as long as the user understands what caused it
} | ||
|
||
// TODO: the signature is confusing. It switches context but expect controlPlane name as parameter | ||
// NOTE: Perhaps SwitchContext should only switch context to a context name | ||
// NOTE: Create a new function SwitchToControlPlaneContext to find a context using control plane name |
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.
Agreed - that would be more clear
The migration would be part of the issue #389 - therefore, i would like to favour documentation for a manual change. |
- new: kflex prints warning message about breaking changes Signed-off-by: rxinui <rainui.ly@gmail.com>
@@ -1,5 +1,54 @@ | |||
# User's Guide | |||
|
|||
## Breaking changes |
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.
@pdettori I have added this section to describe the breaking changes what needs to be done by the end-user.
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.
looks good, thx
func main() { | ||
// TODO - find a way to inject it using Makefile | ||
common.WarningMessage = "WARNING: current kflex version introduces BREAKING CHANGES related to kflex and your kubeconfig file which may interrupt kflex to function properly.\nSee https://github.com/kubestellar/kubeflex/blob/main/docs/users.md" |
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.
@pdettori Everytime kflex
is ran, a YELLOW WARNING message will be displayed to indicate the user about breaking changes, with a URL pointing to the end-user documentation.
Ideally, I wanted to inject the message within the Makefile
but it is rather complicated to do it. So I fallback in Go for now.
Perhaps it is a sign to move to https://taskfile.dev/usage/
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.
great, thx
/lgtm |
LGTM label has been added. Git tree hash: 5363a70b42e260c5f6e0f8d9de9ddd4136fc9217
|
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: pdettori 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:
Approvers can indicate their approval by writing |
Summary
The implementation of
Preferences
used to be on-the-fly by usingcorev1.ConfigMap
as "k8s.io/client-go/tools/clientcmd/api" requiresruntime.Object
type forExtension
.In our new implementation, a new file
extensions.go
is created where structs are defined. This allow us Static typing and check at compilation time, reducing likelihood of errors.BREAKING CHANGES
Within the code, breaking changes are indicated through comment
// BREAKING CHANGE
Those values have changed. Also, perhaps some of these values are now useless. In fact, all kubeflex metadata are stored under
kubeflex
key (ie.extensions.kubeflex
) thereforeExtensionConfigName
seems irrelevant.Functions defined in
pkg/kubeconfig/kubeconfig.go
are no longer looking up topreferences.extensions
within a Kubeconfig. Thereby, any clients/end-users using kflex version prior this PR has their Kubeconfig populated byPreferences
. Once this PR merge tokubestellar/kubeflex
, metadata stored underPreferences
are ignored (hence become irrelevant) and new metadata will be inserted underextensions
andcontexts[].extensions
. Breaking changes are to be expected for the end user.Old way:
New way:
To alleviate those breaking changes, a follow up PR is to be considerated. The creation of a command
kflex config
seems ideal where subcommands interact with Kubeconfig. For instance, to help the transition to this breaking changes, we can imagine:kflex config tidy
to migrate/clean-up a kubeconfig to adapt with kubeflex latest changes.Related issue(s)
Fixes #385