-
Notifications
You must be signed in to change notification settings - Fork 1.8k
*: add generate alm-catalog command #196
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
*: add generate alm-catalog command #196
Conversation
Current usage: $ operator-sdk new memcached-operator --api-version=cache.example.com/v1alpha1 --kind=Memcached
...
$ operator-sdk build quay.io/example/memcached-operator:v0.0.1
$ ls deploy/alm-catalog/
crd.yaml csv.yaml package.yaml
Testing out the current manifests by adding them as a new catalog entry for ALM. |
After some offline discussion I'm going to add a new command
|
@fanminshi PTAL.
|
pkg/generator/generator.go
Outdated
return err | ||
} | ||
path := filepath.Join(almDir, catalogPackageYaml) | ||
if err := ioutil.WriteFile(path, buf.Bytes(), defaultExecFileMode); err != nil { |
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.
s/defaultExecFileMode/defaultFileMode/
?
Those yaml files don't need exec permissions right?
pkg/generator/generator.go
Outdated
return err | ||
} | ||
path = filepath.Join(almDir, catalogCRDYaml) | ||
if err := ioutil.WriteFile(path, buf.Bytes(), defaultExecFileMode); err != nil { |
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.
s/defaultExecFileMode/defaultFileMode/
pkg/generator/generator.go
Outdated
return err | ||
} | ||
path = filepath.Join(almDir, catalogCSVYaml) | ||
return ioutil.WriteFile(path, buf.Bytes(), defaultExecFileMode) |
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.
s/defaultExecFileMode/defaultFileMode/
return ioutil.WriteFile(operatorYaml, buf.Bytes(), defaultFileMode) | ||
} | ||
|
||
// RenderAlmCatalog generates catalog manifests "deploy/alm-catalog/*" |
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.
you might want to add a comment saying that the caller must ensure that the current pwd is at the project's root path.
lgtm after nits |
Added the
operator-sdk generate alm-catalog
cmd to generate catalog resources for ALM:The build command will now generate the following catalog resources needed to create a new catalog entry in ALM.deploy/alm-catalog/csv.yaml
deploy/alm-catalog/package.yaml
deploy/alm-catalog/crd.yaml
The generated CSV has minimal metadata since this is for demo purposes.
The RBAC rules in the CSV are more restricted to avoid giving admin access in a namespace but still covers enough resources to work out of the box for most operators.
The image and version of the CSV are required to be set by the flags:
A few parameters such as the CSVversion
and packagechannel
are fixed to default values for now since theoperator-sdk build
command doesn't provide enough information to set those.Later on if the catalog generation is moved into its own command the catalog resources can be more configurable e.g:
operator-sdk generate catalog --image=<image> --version=<version> ...
/cc @fanminshi