-
Notifications
You must be signed in to change notification settings - Fork 1.8k
plugin: write Makefile recipes for generate bundle subcommand
#2860
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,78 @@ import ( | |
| "github.com/operator-framework/operator-sdk/internal/generate/collector" | ||
| ) | ||
|
|
||
| const ( | ||
| //nolint:lll | ||
| examples = ` | ||
| # Using the example 'memcached-operator' and assuming a directory structure | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is required to add the tree? What value does it bring?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It isn't strictly necessary, although other commands show trees. |
||
| # similar to the following exists: | ||
| $ tree api/ config/ | ||
| api/ | ||
| └── v1alpha1 | ||
| ├── groupversion_info.go | ||
| ├── memcached_types.go | ||
| └── zz_generated.deepcopy.go | ||
| config/ | ||
| ├── bundle | ||
| │ └── kustomization.yaml | ||
| ├── crd | ||
| │ ├── bases | ||
| │ │ └── cache.my.domain_memcacheds.yaml | ||
| │ ├── kustomization.yaml | ||
| │ ├── kustomizeconfig.yaml | ||
| │ ... | ||
| ├── default | ||
| │ ├── kustomization.yaml | ||
| │ ... | ||
| ├── manager | ||
| │ ├── kustomization.yaml | ||
| │ └── manager.yaml | ||
| ... | ||
|
|
||
| # Generate bundle files and build your bundle image with these 'make' recipes: | ||
| $ make bundle | ||
| $ export USERNAME=<your registry username> | ||
| $ export BUNDLE_IMG=quay.io/$USERNAME/memcached-operator-bundle:v0.0.1 | ||
| $ make bundle-build BUNDLE_IMG=$BUNDLE_IMG | ||
|
|
||
| # The above recipe runs the following commands manually. First it creates bundle | ||
| # manifests, metadata, and a bundle.Dockerfile: | ||
| $ make manifests | ||
|
estroz marked this conversation as resolved.
|
||
| /home/user/go/bin/controller-gen "crd:trivialVersions=true" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases | ||
| $ operator-sdk generate bundle -q --kustomize | ||
|
|
||
| Display name for the operator (required): | ||
| > memcached-operator | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is required to add its output?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope, just helps the user know what expected output should be. I can see this drifting from actual output though. |
||
| ... | ||
|
|
||
| $ kustomize build config/bundle | operator-sdk generate bundle --manifests --metadata --overwrite --version 0.0.1 | ||
| Generating bundle manifest version 0.0.1 | ||
| ... | ||
|
|
||
| # After running the above commands, you should see: | ||
| $ tree config/bundle | ||
| config/bundle | ||
| ├── bases | ||
| │ └── memcached-operator.clusterserviceversion.yaml | ||
| ├── kustomization.yaml | ||
| ├── manifests | ||
| │ ├── cache.my.domain_memcacheds.yaml | ||
| │ └── memcached-operator.clusterserviceversion.yaml | ||
| └── metadata | ||
| └── annotations.yaml | ||
|
|
||
| # Then it validates your bundle files and builds your bundle image: | ||
| $ operator-sdk bundle validate config/bundle | ||
| $ docker build -f bundle.Dockerfile -t $BUNDLE_IMG . | ||
| Sending build context to Docker daemon 42.33MB | ||
| Step 1/9 : FROM scratch | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is required to add the output? |
||
| ... | ||
|
|
||
| # You can then push your bundle image: | ||
| $ make docker-push IMG=$BUNDLE_IMG | ||
| ` | ||
|
estroz marked this conversation as resolved.
|
||
| ) | ||
|
|
||
|
estroz marked this conversation as resolved.
|
||
| // setCommonDefaults sets defaults useful to all modes of this subcommand. | ||
| func (c *bundleCmd) setCommonDefaults(cfg *config.Config) { | ||
| if c.operatorName == "" { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.