-
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
cmd/operator-sdk/alpha: 'up/down olm' commands to run an operator #1912
Conversation
on a cluster that has OLM installed internal/olm/operator: logic to load an operator bundle into a registry Deployment from a ConfigMap and serve that bundle from an operator-registry server to OLM
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.
Just a quick review with some questions and nits. Definitely want to give this a test run.
cmd/operator-sdk/alpha/cmd.go
Outdated
cmd.AddCommand( | ||
olm.NewCmd(), | ||
up.NewCmd(), | ||
down.NewCmd(), |
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.
Do we need a down
subcommand or can we make up olm
/olm up
work like up local
, where we could create the resources, wait for the operator to run, tail the logs, and wait for the user to terminate the process. Then we could catch the signal, and tear everything down cleanly.
One problem with that approach (and there are probably others, e.g. scorecard use cases?) would be the user using SIGKILL, which cannot be caught and handled.
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.
I imagine using operator-sdk alpha olm up
to deploy an operator for both production and test purposes, so IMO having a process that doesn't return gives a test-only feel. down
is for convenience, and likely won't/shouldn't be used in production.
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 this needs more discussion regardless, since there are a few use cases to consider.
if m.force { | ||
log.Printf("Forcefully recreating registry") | ||
} else { | ||
log.Printf("Registry data stale. Recreating registry") |
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.
Right now, it seems like the only difference between --force=true
and --force=false
is that in the former case, we'll delete and re-create the registry even when the registry data is correct.
Is there a use case for that? Maybe to get a newer registry image version?
Also, without --force
, we still delete and re-create when the data is stale. Is there a use case that dictates that we should bail out with stale data and require the --force
flag?
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.
In this particular case --force=true
isn't really useful, because as you say its not doing anything that a cache miss wouldn't.
I can't think of any case where we wouldn't want to rebuild the registry if its data is stale.
One slightly related thing I just thought of is that we don't necessarily have to re-create a Subscription
and CatalogSource
when rebuilding the registry, since they'll be pointing to the same registry server address. WDYT?
// not the other is an error. | ||
hasSub, hasCatSrc := m.hasSubscription(), m.hasCatalogSource() | ||
if hasSub || hasCatSrc && !(hasSub && hasCatSrc) { | ||
return nil, errors.New("both a CatalogSource and Subscription must be supplied if one is supplied") |
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.
We can likely relax this requirement in the future, as we can accept an external CatalogSource
and write a Subscription
internally referencing that CatalogSource
.
@camilamacedo86 |
// with UnsupportedOperatorGroup. | ||
// | ||
// https://github.com/operator-framework/operator-lifecycle-manager/blob/master/doc/design/operatorgroups.md | ||
func (m *operatorManager) operatorGroupUp(ctx context.Context) error { |
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.
@njhale @kevinrizza does this OperatorGroup logic make sense? I'm doing a thorough writeup of this logic and push that soon, which will further clarify my thinking.
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.
Proposed logic: #2324
@estroz: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Closing in favor of #2402 |
Description of the change:
Motivation for the change: OLM integration POC.
Test using:
or integration tests:
Notes:
TODO
's/FEAT
's kicking around the source. Let me know if you have opinions about any of them.operator-registry
dependency is using a branch from my fork until pkg/registry: use v1beta1.CustomResourceDefinition, as the apiextensions type is internal operator-registry#86 is merged/addressed./cc @dmesser @ecordell