-
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
adds migrate
and run ansible
commands
#887
Conversation
The `operator-sdk migrate` command adds go source and other files necessary to convert an ansible operator to a hybrid operator. The scaffolds used for `migrate` are also made available for use in creating the ansible-operator base image through `commands/ansible-operator-base/main.go`. The `operator-sdk run ansible` command uses the operator-sdk binary as the production-use ansible operator binary. fixes operator-framework#886
@mhrivnak why do we need both |
The The FWIW I don't know if this is the best location for this file. Since it is for release engineering only, maybe it would be more clear to move it into |
@mhrivnak thanks for clarifying. I agree, since |
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.
Some user experience questions
Watches: true, | ||
Roles: true, | ||
} | ||
_, err := os.Stat("playbook.yaml") |
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.
Wonder if this should be a flag or at least alert the user that we are assuming no playbook if this is not found. I could see cases, where playbooks are in a new directory and users, have changed things. Telling the users what we are doing, and what they can do to change it back if that is incorrect might be a good idea. Thoughts?
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.
Yeah a good example of this would be the etcd operator which puts all of it's ansible code under a folder ansible
.
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.
Sounds good. If they put it in a different location that what we expect, they'll have to manually add it to their new Dockerfile. Presumably they'd catch that in comparing their old Dockerfile to new, but it's worth calling out explicitly.
commands/operator-sdk/cmd/migrate.go
Outdated
} | ||
|
||
dockerfilePath := filepath.Join(scaffold.BuildDir, scaffold.DockerfileFile) | ||
err = os.Rename(dockerfilePath, dockerfilePath+".sdkold") |
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 we need to alert the user that we took this action after this finishes IMO.
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.
Also, at the end of the command, should we run dep ensure? or should we ask the user to run dep ensure?
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 to the alerting. I'll log something about it.
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 lean toward not running dep automatically, in part because it will cause the e2e tests to fail in cases like we see here where operator-sdk has changes that aren't in the upstream repo. It makes me think there are enough other cases where the user doesn't want to run dep ensure
right away, that we shouldn't do it automatically.
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.
Like the approach you took and I had success with the migrate
and run
commands. Good stuff!
fixes version check in `release.sh` Co-Authored-By: mhrivnak <mhrivnak@hrivnak.org>
@estroz thanks for the assist with |
@mhrivnak Can you please update the CHANGELOG for the |
We also need to update the CLI reference guide for the new commands. |
Yes, I'll add that and a bit of documentation separately. |
The
operator-sdk migrate
command adds go source and other files necessary toconvert an ansible operator to a hybrid operator.
The scaffolds used for
migrate
are also made available for use in creatingthe ansible-operator base image through
commands/ansible-operator-base/main.go
.The
operator-sdk run ansible
command uses the operator-sdk binary as theproduction-use ansible operator binary.
fixes #886