-
Notifications
You must be signed in to change notification settings - Fork 36
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 install: honor operatorframework.io/suggested-namespace #52
Conversation
b345abb
to
b09a75f
Compare
b09a75f
to
57b3597
Compare
57b3597
to
bf48013
Compare
…efault Signed-off-by: Joe Lanford <joe.lanford@gmail.com>
bf48013
to
3e3f998
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: joelanford The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@@ -110,6 +128,18 @@ func (i *OperatorInstall) getPackageManifest(ctx context.Context) (*operator.Pac | |||
return &operator.PackageManifest{PackageManifest: *pm}, nil | |||
} | |||
|
|||
func (i *OperatorInstall) ensureNamespace(ctx context.Context, pc *operator.PackageChannel) error { | |||
suggestedNamespace := pc.CurrentCSVDesc.Annotations["operatorframework.io/suggested-namespace"] |
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.
This could panic I believe.
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.
It can panic if pc
is nil
, but that can't happen because pm.GetChannel()
(called one function up in the stack) doesn't return nil, nil
Other than that, it can't panic:
pc.CurrentCSVDesc
is a concrete structpc.CurrentCSVDesc.Annotations
is a map[string]string
If you do a lookup of a key in a nil map, the returned value is the default value of the value type.
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.
If you do a lookup of a key in a nil map, the returned value is the default value of the value type.
TIL! This is kinda crazy to me because a map is really a pointer to an hmap, so you're dereferencing and indexing a nil pointer.
@joelanford: 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 due to inactivity - please re-open if needed ^^ |
Description:
Updates
kubectl operator install
to honor CSVs that provide anoperatorframework.io/suggested-namespace
annotation.Motivation:
Closes #50
/hold
I can't find any upstream documentation for
operatorframework.io/suggested-namespace
, so I'm somewhat concerned that we're adding support for a downstream feature. There's nothing actually OpenShift-specific with this annotation other than that OpenShift Console is the only current client that supports it. I think this would be as simple as a doc change to upstream OLM docs that specifies this annotation and describes what clients should do when it's present.Downstream enhancement describes this annotation here: https://github.com/openshift/enhancements/blob/master/enhancements/olm/olm-managed-operator-metrics.md#fulfilling-namespace-and-rbac-requirements