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

fix: primary-resouce is created in wrong place. #6872

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

holyspectral
Copy link
Contributor

Description of the change:

This PR fixes the issue where the primary custom resource would randomly get assigned "operator-sdk/primary-resource" and "operator-sdk/primary-resource-type" annotations when helm-operator is used.

Motivation for the change:

We use helm operator to deploy our software in OpenShift environment. However, our primary custom resource would get random annotations assigned , e.g.,

apiVersion: apm.neuvector.com/v1alpha1
kind: Neuvector
metadata:
  annotations:
    operator-sdk/primary-resource: /neuvector-binding-nvvulnerabilityprofiles
    operator-sdk/primary-resource-type: ClusterRoleBinding.rbac.authorization.k8s.io

The resource name and resource type would change randomly after each deployment.

After some debugging, it looks like handler.SetOwnerAnnotations()'s arguments are in reverse.

The caller:

err := handler.SetOwnerAnnotations(u, c.owner)

The function:

func SetOwnerAnnotations(owner, object client.Object)

This PR fixes the issue by correcting the order of arguments.

Checklist

If the pull request includes user-facing changes, extra documentation is required:

When deployed with helm-operator, the primary custom resource would
randomly get assigned "operator-sdk/primary-resource" and
"operator-sdk/primary-resource-type" annotations.

This commit fixes the issue.

Signed-off-by: Sam Wang (holyspectral) <[email protected]>
@holyspectral
Copy link
Contributor Author

Hi @rashmigottipati @oceanc80 , I wonder if any of you have time to check my PR? Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant