Skip to content
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

Closed

Conversation

joelanford
Copy link
Member

Description:
Updates kubectl operator install to honor CSVs that provide an operatorframework.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

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 3, 2021
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 3, 2021
…efault

Signed-off-by: Joe Lanford <joe.lanford@gmail.com>
@openshift-ci
Copy link

openshift-ci bot commented Dec 17, 2021

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@@ -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"]
Copy link
Member

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.

Copy link
Member Author

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 struct
  • pc.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.

Copy link
Member

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.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 22, 2022
@openshift-merge-robot
Copy link

@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.

@perdasilva
Copy link
Contributor

closing due to inactivity - please re-open if needed ^^

@perdasilva perdasilva closed this May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature req: Honor operatorframework.io/suggested-namespace
4 participants