Switch over to new CLI and deprecate operator-sdk new --type=go#3190
Conversation
joelanford
left a comment
There was a problem hiding this comment.
Can we also remove all of the now-unused Go scaffolds?
@joelanford I intentionally left that out of this PR so reviewers could focus on verifying the more important docs, links and CLI changes. Or since it's just straight up removing code I can tack it on at the very end if the PR size isn't too large. |
|
Something's off with the doc links. Going to fix that. - /target/docs/contribution-guidelines/testing/travis-build/index.html
* internally linking to ../../../golang/quickstart#a-note-on-dependency-management, which does not exist (line 1113)
<a href="../../../golang/quickstart#a-note-on-dependency-management">note</a>
* linking to internal hash #a-note-on-dependency-management that does not exist (line 1113)
<a href="../../../golang/quickstart#a-note-on-dependency-management">note</a>
- /target/docs/faq/index.html
* internally linking to /docs/golang/legacy/legacy/monitoring/prometheus/#garbage-collection, which does not exist (line 993)
... |
Either way seems fine to me. Just wanted to make sure that is covered. |
|
Hi @hasbro17, It s not passing in the tests. Shows that it missing update the links reference. Maybe can be easy to split the PR one for the docs and other for the code source. Regards the code see: Regards the docs, also see that it shows not accurate. It has now 2 installations and is missing the Golang menu. See: |
jmccormick2001
left a comment
There was a problem hiding this comment.
Create a validating or mutating Admission Webhook
I get a 404 on that link in the docs.
|
Also see the advanced topics doc for more use cases and under the hood details. I get a 404 on that link in the docs when served locally. |
|
Filter watch events using predicates I get a 404 on that link in the docs when served locally. |
|
completely unrelated to this PR, but I found it interesting that no labels were added to the role/sa/binding resources whereby you could remove them in an explicit way using a label selector: jeffmc@breve: NAME ROLE AGE LABELS NAME SECRETS AGE LABELS so, the line in the docs under cleanup: $ kubectl delete role,rolebinding --all could be sort of dangerous if you have other stuff running in the default namespace. Would be great if a unique label were applied, maybe the operator name or similar. |
operator-sdk new --type=gooperator-sdk new --type=go
|
The broken links are due to a missing index file. Will push that fix along with other changes in a bit.
@camilamacedo86 I'd rather not split this up if possible because the CLI changes and the doc changes depend on each other. |
756034f to
eb17e7b
Compare
operator-sdk new --type=gooperator-sdk new --type=go
|
So I was going to disable the old e2e test for Go operators completely now that we're using the new CLI (which already has an e2e test). But I think we probably could keep it around even though the old CLI for Go projects is deprecated, it's not unsupported in existing projects. operator-sdk/hack/tests/scaffolding/scaffold-memcached.go Lines 62 to 70 in 6e000a4 |
operator-sdk new --type=gooperator-sdk new --type=go
|
The docs and CLI part of this PR should be ready for reviews (based on the layout in #3190 (comment)). I'll fix the old Go e2e test in the meanwhile. |
| TODO: Once versioned docs are supported on the website the CHANGELOG notes | ||
| that link to the legacy CLI should be updated before being removed on the master | ||
| branch. |
| weight: 2 | ||
| --- | ||
|
|
||
| **Note:** This guide is for the legacy CLI and project layout. See the [new docs][new_docs] for the [Kubebuilder aligned CLI][new_CLI] and project layout. |
There was a problem hiding this comment.
Given that this quickstart assumes operator-sdk new --type=go exists, should we remove it?
This is non-blocking and could be done in a follow-up.
There was a problem hiding this comment.
Oh yeah forgot about that.
There's some stuff in the FAQ talking about metrics as well.
I'll add a TODO to follow this up.
| new.NewCmd(), | ||
|
|
||
| alpha.NewCmd(), | ||
| build.NewCmd(), |
There was a problem hiding this comment.
The operator-sdk create api is not showing when we use the help. Not a blocker too. We can do it in a follow up too.
There was a problem hiding this comment.
That's a plugin issue right @estroz
You have to be inside an initialized project for that help to show up for the correct plugin version I believe.
$ operator-sdk create api -h
Scaffold a Kubernetes API.
For project-specific information, run this command in the root directory of a
project.
Note: unable to find configuration file, project must be initialized
Usage:
operator-sdk create api [flags]
Flags:
-h, --help help for apiAnd inside a project:
$ operator-sdk create api -h
Scaffold a Kubernetes API by creating a Resource definition and / or a Controller.
create resource will prompt the user for if it should scaffold the Resource and / or Controller. To only
scaffold a Controller for an existing Resource, select "n" for Resource. To only define
the schema for a Resource without writing a Controller, select "n" for Controller.
After the scaffold is written, api will run make on the project.
Usage:
operator-sdk create api [flags]
Examples:
# Create a frigates API with Group: ship, Version: v1beta1 and Kind: Frigate
operator-sdk create api --group ship --version v1beta1 --kind Frigate
...There was a problem hiding this comment.
You need to set --project-version to output help for the default plugin. However I do see create listed in the available subcommands when I run operator-sdk -h regardless of where the binary is.
There was a problem hiding this comment.
I saw: create Scaffold a Kubernetes API or webhook 👍
camilamacedo86
left a comment
There was a problem hiding this comment.
/lgtm
/approve
terrific work @hasbro17
I added 2 comments which IMO are not blocker and we can check in a follow-up.
|
Merging this. Will address the TODOs(in the description) for the CHANGELOG, docs layout reshuffle and Go scaffold removal in follow up PRs. |
|
Any inputs "how to use the new CLI" for the operator based on GO ? any samples or docs ? thanks |

Make the new Kubebuilder aligned CLI the default for Go operators.
There are 3 main changes/commits in this PR to make it easier to review:
website/content/en/docs/golang/*=>website/content/en/docs/golang/legacy/*website/content/en/docs/kubebuilder/*=>website/content/en/docs/golang/new/*hack/generate/cli-doc/gen-cli-doc.goto generate both the legacy and new CLI reference docswebsite/content/en/docs/new-cli/_index.md.operator-sdk new --type=goand make the new KB CLI the default entrypoint outside of legacy projects:main.godefaults to the new KB CLI except when running in legacy Go, or Ansible/Helm projects.operator-sdk new --type=gohas been removed so legacy Go projects cannot be scaffolded anymore.--type=Ansible/Helmstill exist.TODO:
operator-sdk new --type=GoFollow up PRs:
v0.19.0to summarize removal ofnew --type=Goand deprecation of old CLI.