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

Small improvements to the kudo init command and docs #880

Merged
merged 3 commits into from
Oct 2, 2019

Conversation

alenkacz
Copy link
Contributor

What this PR does / why we need it:
This was the main motivation for this PR https://github.com/kudobuilder/kudo/compare/av/init-small-improvements?expand=1#diff-c74faa6263971005d609e60d78ff0f8eL171 I think the message is no longer true and we should be skipping all already exists errors now, correct? The rest is just small wording improvements.

Copy link
Member

@kensipe kensipe left a comment

Choose a reason for hiding this comment

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

Needs code consistency with the rest of the code base otherwise looks good!

Thanks for the validation and grammar updates!!

@@ -32,6 +31,9 @@ version. You can specify an alternative image with '--kudo-image' which is the f
or '--version' which will replace the version designation on the standard image.

To dump a manifest containing the KUDO deployment YAML, combine the '--dry-run' and '--output=yaml' flags.

Running 'kudo init' on server-side is idempotent - it skips manifests alredy applied to the cluster in previous runs
and finishes with success if KUDO is already installed.
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if necessary or not... but an important part of this message to me is that if the k8s objects exists... the create is skipped... there is no update. If kudo init was applied with version 0.7.0 followed by a future 0.8.0 there is no update to the objects. It would have to be uninstalled reinstalled currently.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm, interesting, I actually did not know that so maybe that should be in the documentation as well 🤔

@@ -168,10 +175,6 @@ func (initCmd *initCmd) run() error {
}

if err := cmdInit.Install(initCmd.client, opts, initCmd.crdOnly); err != nil {
if apierrors.IsAlreadyExists(err) {
Copy link
Member

Choose a reason for hiding this comment

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

this removed message is still necessary IMO... unless we want to change line 108 of manager.go.
Most of the installs return nil if isAlreadyExistsError returns true... with the exception of the last install which is the kudo controller itself. If the kudo controller exists then it returns the error and this warning message was printed.

For clarity: this is what most install services do:

This is what install the service does:

if isAlreadyExistsError(err) {
clog.V(4).Printf("service %v already exists", s.Name)
// this service considered different. If it exists and there is an init we will return the error
}
return err

I'm marking as reject because we either:

  1. need to return nil from the install of the statefulset (along with the removal of this warning message) or
  2. need to return warning message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting, I wonder what to do here. I don't really have any immediate answer, have to think about it...

but that means you cannot run init twice because the second one will always fail because the manager is already running, right?

I am actually starting to think that the correct behavior of init here is to do an update when the thing already exists. Because manager is not the only thing that if it exists, it means it is in the same state as what we're trying to apply 🤔 Let me know what you think... I think that way, it would be truly idempotent which would be lovely...

@kensipe
Copy link
Member

kensipe commented Oct 2, 2019

for public record... in slack channel we discussed the value and challenge of "update"... which is to say if the object exists to update to the latest version. The issue is there could be running operators which don't work with the newer version and we may need to migrate from one ver to another. Our current thinking for this PR is to do nothing if exists and to install if it doesn't exists. frankly this could have issues as well as we could have init'ed originally with 0.7.0 and delete a crd record which we want to restore as we moved to 0.8.0. The current solution is definitely naive and needs to be revisited. We agreed to land this with the change that the current error message for existing controller should be removed and be consist with the other resources.

Created this issue for tracking the future: #891

@kensipe kensipe merged commit c341195 into master Oct 2, 2019
@kensipe kensipe deleted the av/init-small-improvements branch October 2, 2019 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants