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: replacing of namespace annotation when openshift-cnv namespace is set #683

Merged
merged 1 commit into from
Sep 11, 2023

Conversation

ksimon1
Copy link
Member

@ksimon1 ksimon1 commented Sep 7, 2023

What this PR does / why we need it:
fix: replacing of namespace annotation when kubevirt namespace is set

When ssp CR contains kubevirt namespace as a target namespace
for pipelines, ssp operator recognized this namespace as user defined
and deployed configmaps and roleBindings to a single namespace, instead
of two namespaces. That broke our default pipeline flow. This
change adds a check if the pipeline namespace in the CR is kubevirt,
then it is not used as a user defined namespace and
kubevirt.io/deploy-namespace annotation is used instead.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2237916

Special notes for your reviewer:

Release note:

NONE

@kubevirt-bot kubevirt-bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Sep 7, 2023
@ksimon1
Copy link
Member Author

ksimon1 commented Sep 7, 2023

/cherrypick release-v0.18

@kubevirt-bot
Copy link
Contributor

@ksimon1: once the present PR merges, I will cherry-pick it on top of release-v0.18 in a new PR and assign it to you.

In response to this:

/cherrypick release-v0.18

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.


key := client.ObjectKeyFromObject(&configMap)
cm := &v1.ConfigMap{}
ExpectWithOffset(1, request.Client.Get(request.Context, key, cm)).ToNot(HaveOccurred())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using ExpectWithOffset() here does not make sense, because this is the top level of the test case.


key := client.ObjectKeyFromObject(&roleBinding)
rb := &rbac.RoleBinding{}
ExpectWithOffset(1, request.Client.Get(request.Context, key, rb)).ToNot(HaveOccurred())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same here.

@ksimon1 ksimon1 force-pushed the fix-custom-pipeline-namespace branch from 3c673b7 to 9e737a4 Compare September 7, 2023 10:39
@akrejcir
Copy link
Collaborator

akrejcir commented Sep 7, 2023

In the future, we should probably fix this in a better way. But it is ok for now.
Can you open a new issue so that we don't forget?

/lgtm
/approve

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Sep 7, 2023
@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: akrejcir

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

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 7, 2023
@0xFelix
Copy link
Member

0xFelix commented Sep 7, 2023

/hold This looks like a crude workaround to me, can't it be fixed properly immediately?

@kubevirt-bot kubevirt-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 7, 2023
@ksimon1
Copy link
Member Author

ksimon1 commented Sep 7, 2023

What other solution do you suggest?

@dominikholler
Copy link
Contributor

When ssp CR contains openshift-cnv namespace as a target namespace for pipelines, ssp operator recognized this namespace as user defined and deployed configmaps and roleBindings to a single namespace, instead of two namespaces.

Why?

@ksimon1
Copy link
Member Author

ksimon1 commented Sep 11, 2023

When ssp CR contains openshift-cnv namespace as a target namespace for pipelines, ssp operator recognized this namespace as user defined and deployed configmaps and roleBindings to a single namespace, instead of two namespaces.

Why?

Because we don't know in which different namespace the results will go. According to discussions we want to target to a single user defined namespace to allow regular user to use our pipelines. Thats why ssp operator deploys everything into single namespace when there is a namespace defined in ssp cr.

@ksimon1 ksimon1 force-pushed the fix-custom-pipeline-namespace branch from 9e737a4 to e80fd45 Compare September 11, 2023 08:49
@kubevirt-bot kubevirt-bot removed the lgtm Indicates that a PR is ready to be merged. label Sep 11, 2023
Copy link
Member

@lyarwood lyarwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments, I'm also not seeing any additional test coverage for your changes in Cleanup?

internal/operands/tekton-pipelines/reconcile.go Outdated Show resolved Hide resolved
internal/operands/tekton-pipelines/reconcile_test.go Outdated Show resolved Hide resolved
internal/operands/tekton-pipelines/reconcile_test.go Outdated Show resolved Hide resolved
@openshift-ci
Copy link

openshift-ci bot commented Sep 11, 2023

@ksimon1: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/win10-pipeline-example-test e80fd45 link true /test win10-pipeline-example-test
ci/prow/win11-pipeline-example-test e80fd45 link true /test win11-pipeline-example-test
ci/prow/win2k22-pipeline-example-test e80fd45 link true /test win2k22-pipeline-example-test

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

in ssp CR

When ssp CR contains kubevirt namespace as a target namespace
for pipelines, ssp operator recognized this namespace as user defined
and deployed configmaps and roleBindings to a single namespace, instead
of two namespaces. That broke our default pipeline flow. This
change adds a check if the pipeline namespace in the CR is kubevirt,
then it is not used as a user defined namespace and
kubevirt.io/tekton-piplines-deploy-namespace annotation is used instead.

rename kubevirt.io/deploy-namespace annotation to kubevirt.io/tekton-piplines-deploy-namespace
Signed-off-by: Karel Simon <[email protected]>
@ksimon1 ksimon1 force-pushed the fix-custom-pipeline-namespace branch from e80fd45 to 25dd686 Compare September 11, 2023 11:31
@sonarcloud
Copy link

sonarcloud bot commented Sep 11, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@ksimon1
Copy link
Member Author

ksimon1 commented Sep 11, 2023

A few comments, I'm also not seeing any additional test coverage for your changes in Cleanup?

This is already covered by test which already exists - https://github.com/kubevirt/ssp-operator/blob/main/internal/operands/tekton-pipelines/reconcile_test.go#L114
Without the code I added to cleanup fn that test would fail

@lyarwood
Copy link
Member

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Sep 11, 2023
@lyarwood
Copy link
Member

/unhold

@kubevirt-bot kubevirt-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 11, 2023
@ksimon1
Copy link
Member Author

ksimon1 commented Sep 11, 2023

Skipping pipelines tests, because they are not working due to https://bugzilla.redhat.com/show_bug.cgi?id=2236223

@ksimon1 ksimon1 merged commit 07876e6 into kubevirt:main Sep 11, 2023
4 checks passed
@kubevirt-bot
Copy link
Contributor

@ksimon1: new pull request created: #687

In response to this:

/cherrypick release-v0.18

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.

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. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants