-
Notifications
You must be signed in to change notification settings - Fork 786
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
Switch microk8s enable wrapper to Python script #1467
Conversation
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.
Seems reasonable to me, aside from handling the one edge case that I mentioned a bit more gracefully (unless I'm missing something about how click works).
614f408
to
b400c65
Compare
@knkski do we drop the checking for addons if they are already running? If yes, i think this is required, sometimes users manually edit the resource, and when the user enabled it again, it loses their previous changes. |
b400c65
to
2042819
Compare
@balchua: The use case for dropping that check is a result of #1397. If a user enables kubeflow and it either fails or the It would be nice to have |
2042819
to
61e8790
Compare
Thanks @knkski for the info. Instead of dropping that altogether, maybe we can consider adding |
The enable script used to reapply the manifests without checking if the addon was already enabled. This was causing some confusion [2] and we had to fix it [1]. @knkski kubeflow enables the dns addon but I also think it expects the forward dns to be correctly set. Will the kubeflow deploy in an environment where 8.8.8.8 is not reachable? |
So does it mean that |
Sorry I was not clear. We need to keep the current behavior of not re-applying the addon manifests. We have to respect any configuration users have on the running workloads. |
Aaa ok. Thanks for clarifying. |
4a8a384
to
02fb591
Compare
I've updated this PR so that it keeps the current behavior of not enabling already-enabled addons, for everything but Kubeflow, which has it's own logic for handling that. Namely, it will allow disabling Kubeflow even if Kubeflow is already disabled, which lets us fix #1397. I didn't create a |
Thanks @knkski. Im good with that. The unix style args is nice. |
8c43cf7
to
7a4cc8a
Compare
@knkski there are a few conflicts in this PR. Do you think you could address them so we get this PR ready for 1.20? Thank you. |
ffc330b
to
b0617e1
Compare
For now, they're just clones of the old bash scripts, with the ability to handle unix-style flag arguments. Using click however, will allow expanding the enable scripts to be full click subcommands, instead of just bash scripts.
ea7a79f
to
9de59d1
Compare
scripts/wrappers/common/utils.py
Outdated
|
||
if addon not in existing_addons: | ||
click.secho("Addon `%s` not found." % addon, fg='red', err=True) | ||
click.echo("The available addons are:\n - %s" % '\n - '.join(existing_addons), err=True) |
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 am not so sure about this. If we print the list of addons here I easily see a request to put descriptions next to the addon names.
scripts/wrappers/common/utils.py
Outdated
exit(0) | ||
if (snap_data() / 'var/lock/clustered.lock').exists(): | ||
click.echo('This MicroK8s deployment is acting as a node in a cluster.') | ||
click.echo('Please use `microk8s enable` on the master.') |
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.
Based on the error message, I assume method was used by microk8s.status
.
scripts/wrappers/common/utils.py
Outdated
if args and addons[1:]: | ||
click.secho( | ||
click.style( | ||
"Can't pass string arguments and flag arguments simultaneously!\n", fg='red' |
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 like what you are doing here, error messages in red. Could we do this across all microk8s in a separate PR? If we do this coloring only here it will look odd.
This reverts commit a0ac699.
Just reverted this PR, there are a few things (probably minor) that will need a bit more attention. On enable/disable we request the status of each addon [1]. We should first make sure the API server is running or else the get status fails with:
Similar case is when we enable/disable addons. We used to wait for up to 30 seconds for the API server to get ready [2]. This way if an addon enables/disables the apiserver we would not fail in [3]. The last thing that needs some mending is the
We should get back the old help message. [1] https://github.com/ubuntu/microk8s/pull/1467/files#diff-44f8a77098734624eb59a3c59e17024d622e15fb9927eb4d6f3583ac724ffe25R25 |
For now, it's just a clone of the old bash script, with the ability to handle unix-style flag arguments. Using click however, will allow expanding the enable scripts to be full click subcommands, instead of just bash scripts.
Fixes #1446