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

operator-migrate: migrate an existing SDK project to a kubebuilder-style one #2851

Closed
wants to merge 1 commit into from

Conversation

estroz
Copy link
Member

@estroz estroz commented Apr 16, 2020

Description of the change: operator-migrate migrates an operator-sdk-style project to a kubebuilder-style project.

Motivation for the change: eases the migration process to a kubebuilder-style project:

$ go install ./cmd/operator-migrate/...
$ operator-migrate --from-dir your/sdk/operator --type go

This will run operator-sdk init then operator-sdk create api for each API type found in deploy/crds.

TODO's:

  • more configuration options
  • improve automated migration process
  • test data

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 16, 2020
@estroz estroz force-pushed the feature/kb-migrate branch 6 times, most recently from 74d9dc6 to 8f573b0 Compare April 16, 2020 17:45
@estroz estroz added the kubebuilder-integration Relates to rewriting the SDK in Kubebuilder plugin form label Apr 16, 2020
@estroz estroz changed the title migrate: migrate an existing SDK project to a kubebuilder-style one operator-migrate: migrate an existing SDK project to a kubebuilder-style one Apr 16, 2020
},
}

cmd.Flags().StringVar(&c.ptype, "type", "",
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the tool would just make sense for GO operators, so would be required to have a type here?

"directory of project to migrate")
cmd.Flags().StringVar(&c.toDir, "to-dir", "",
"directory to place migrated project")

Copy link
Contributor

Choose a reason for hiding this comment

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

WDYT about source and tagert instead of from-dir to "to-dir"?

if len(pathSplit) < 2 || filePath == "go.mod" || filePath == "go.sum" {
return filePath
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
dir := pathSplit[0]

}

switch {
case pathSplit[0] == "deploy":
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
case pathSplit[0] == "deploy":
case dir == "deploy":


func main() {
if err := rootCmd().Execute(); err != nil {
os.Exit(1)
Copy link
Contributor

Choose a reason for hiding this comment

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

should not log the error?

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 30, 2020
@estroz estroz mentioned this pull request Jul 1, 2020
92 tasks
@estroz estroz force-pushed the feature/kb-migrate branch from 8f573b0 to 7581fa2 Compare July 13, 2020 21:35
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 13, 2020
@estroz estroz marked this pull request as ready for review July 13, 2020 21:36
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 13, 2020
@estroz estroz force-pushed the feature/kb-migrate branch from 7581fa2 to c5d6cff Compare July 13, 2020 22:36
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 13, 2020
@estroz estroz force-pushed the feature/kb-migrate branch from c5d6cff to 0e64051 Compare July 13, 2020 22:38
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 13, 2020
@@ -0,0 +1,131 @@
// Copyright 2020 The Operator-SDK Authors
Copy link
Contributor

Choose a reason for hiding this comment

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

WDYT about it be an incubete/tools module whcih will allow users to get it such as go get github.com/operator-framework/operator-sdk/incubete/tools/migration. Then, we also can publish it without support and getting started to give an opportunity to receive an incubating project for the https://github.com/operator-framework/community/pull/22/files which would allow us to move forward with #3787. We might be able to have as well go get github.com/operator-framework/operator-sdk/incubete/plugins.

@joelanford @jmccormick2001 @jmrodri wdyt

@estroz estroz closed this Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kubebuilder-integration Relates to rewriting the SDK in Kubebuilder plugin form
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants