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

Merged
merged 1 commit into from
Jan 16, 2025

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:

@holyspectral
Copy link
Contributor Author

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

@holyspectral
Copy link
Contributor Author

Hi @rashmigottipati @oceanc80 , please advise how to proceed in order for this PR to be merged. I will appreciate it.

@acornett21
Copy link
Contributor

@holyspectral Can you rebase your PR since there are failing tests?

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

@acornett21 thanks! I've rebased my PR, but the sanity/sanity still fails due to OPERATOR_SDK_VERSION unmatched. Would you advise how to fix them?

@acornett21 acornett21 merged commit 7595583 into operator-framework:master Jan 16, 2025
22 of 23 checks passed
@holyspectral holyspectral deleted the owner-reference branch January 16, 2025 18:55
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.

2 participants