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

kubemacpool: Remove namespace labels #1566

Merged

Conversation

qinqon
Copy link
Collaborator

@qinqon qinqon commented Jun 14, 2023

What this PR does / why we need it:
The kubemacpool project was adding restricted label to test security context. This change remove labels altogether and configure them at CI to test it.

Special notes for your reviewer:
Since the CNAO namespace is shared between components is done there instead of kubemacpool that has it's own namespace.

Release note:

Remove kubemacpool namespace labels.

@kubevirt-bot kubevirt-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Jun 14, 2023
@qinqon qinqon force-pushed the remove-kubemacpool-namespace-labels branch from 28641b6 to 7a47ce7 Compare June 14, 2023 08:01
Copy link
Collaborator

@oshoval oshoval left a comment

Choose a reason for hiding this comment

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

Thanks

@@ -1,9 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
control-plane: mac-controller-manager
Copy link
Collaborator

Choose a reason for hiding this comment

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

why control-plane: mac-controller-manager is removed as well ?
it was not part of the latest breaking change

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1, it should stay. I think we already delete it for non-namespaced objects (here).

Copy link
Collaborator

@oshoval oshoval Jun 14, 2023

Choose a reason for hiding this comment

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

Btw some of the logic there was in order to maintain backward compatability
maybe the versions we support /deployed on customer site are new enough so we can remove this patch?
(more info here #1145)

also worth to see https://github.com/kubevirt/cluster-network-addons-operator/pull/1145/files#r796372158
not sure if was handled

of course not part of this PR scope

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would not depend on the controller and keep the manifest as we want them to be, so we don't need time for them to be fixed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The controller is removing them only for backward compatibility, for versions where CNAO label stuff that it didn't need to have and then those versions were upgraded to one that fixed the labeling.

You can see here a discussion that tells that we better remove it from the source itself - KMP, IIRC
https://github.com/kubevirt/cluster-network-addons-operator/pull/1145/files#r796372158

@oshoval
Copy link
Collaborator

oshoval commented Jun 14, 2023

/test pull-cluster-network-addons-operator-unit-test

@oshoval
Copy link
Collaborator

oshoval commented Jun 14, 2023

Worth to enclose the failure of HCO please on PR desc

@qinqon qinqon requested a review from oshoval June 14, 2023 08:27
metadata:
name: cluster-network-addons
labels:
control-plane: mac-controller-manager
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think adding/removing the control-plane label should not be part of this PR,

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will remove it from here, but the adding at bump-kubemacpool is ok

- op: replace
path: /data/RANGE_START
value: "{{ .RangeStart }}"
- op: replace
path: /data/RANGE_END
value: "{{ .RangeEnd }}"
EOF
cat <<EOF > config/cnao/cnao_remove-labels_patch.yaml
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you specifically remove the pod-security.kubernetes.io/enforce label?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am going to remove all the labels since controller is removing the other one too.

@qinqon qinqon force-pushed the remove-kubemacpool-namespace-labels branch from 7a47ce7 to f62b973 Compare June 14, 2023 09:00
@qinqon qinqon requested a review from RamLavi June 14, 2023 09:00
@oshoval
Copy link
Collaborator

oshoval commented Jun 14, 2023

https://prow.ci.kubevirt.io/view/gs/kubevirt-prow/pr-logs/pull/kubevirt_cluster-network-addons-operator/1566/pull-e2e-cnao-multus-dynamic-networks-functests/1668906222926958592
we have this here btw (don't think it is related to this PR IIRC, but maybe worth to double check if interesting)

W0614 09:24:17.766599   36399 warnings.go:70] would violate PodSecurity "restricted:latest": allowPrivilegeEscalation != false (container "samplepod" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (container "samplepod" must set securityContext.capabilities.drop=["ALL"]), runAsNonRoot != true (pod or container "samplepod" must set securityContext.runAsNonRoot=true), seccompProfile (pod or container "samplepod" must set securityContext.seccompProfile.type to "RuntimeDefault" or "Localhost")

@oshoval
Copy link
Collaborator

oshoval commented Jun 14, 2023

/test pull-e2e-cluster-network-addons-operator-kubemacpool-functests

@oshoval
Copy link
Collaborator

oshoval commented Jun 14, 2023

The connection to the server localhost:8080 was refused - did you specify the right host or port?
seems due to this PR ?
https://prow.ci.kubevirt.io/view/gs/kubevirt-prow/pr-logs/pull/kubevirt_cluster-network-addons-operator/1566/pull-e2e-cluster-network-addons-operator-kubemacpool-functests/1668918522979291136

or just a flake ? (didnt look deep)
happened twice, first time i see it

Copy link
Collaborator

@RamLavi RamLavi left a comment

Choose a reason for hiding this comment

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

/lgtm

I think that removing all the labels in the yaml patch may bite us in the future, but we can remove the control-plane label from the NS on the KMP repo in parallel, then consider refining the yaml patch to remove exactly the labels we want.

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Jun 15, 2023
@oshoval
Copy link
Collaborator

oshoval commented Jun 15, 2023

/test pull-e2e-cluster-network-addons-operator-kubemacpool-functests

@oshoval
Copy link
Collaborator

oshoval commented Jun 15, 2023

it still fails

@qinqon
Copy link
Collaborator Author

qinqon commented Jun 15, 2023

/override pull-e2e-cnao-multus-dynamic-networks-functests
/test pull-e2e-cluster-network-addons-operator-kubemacpool-functests

@kubevirt-bot
Copy link
Collaborator

@qinqon: Overrode contexts on behalf of qinqon: pull-e2e-cnao-multus-dynamic-networks-functests

In response to this:

/override pull-e2e-cnao-multus-dynamic-networks-functests
/test pull-e2e-cluster-network-addons-operator-kubemacpool-functests

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.

@qinqon
Copy link
Collaborator Author

qinqon commented Jun 15, 2023

hiccup

pull-e2e-cluster-network-addons-operator-kubemacpool-functest

/lgtm

I think that removing all the labels in the yaml patch may bite us in the future, but we can remove the control-plane label from the NS on the KMP repo in parallel, then consider refining the yaml patch to remove exactly the labels we want.

Is very dangerous to label the shared namespace, it affects all the network components, we should remove the label, if we see kubemacpool depends on something, we will fix it.

The kubemacpool project was adding restricted label to test security
context. This change remove labels altogether and configure them at CI
to test it.

Signed-off-by: Enrique Llorente <ellorent@redhat.com>
@qinqon qinqon force-pushed the remove-kubemacpool-namespace-labels branch from f62b973 to a32efaa Compare June 15, 2023 08:47
@kubevirt-bot kubevirt-bot removed the lgtm Indicates that a PR is ready to be merged. label Jun 15, 2023
@sonarcloud
Copy link

sonarcloud bot commented Jun 15, 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
No Duplication information No Duplication information

@oshoval
Copy link
Collaborator

oshoval commented Jun 15, 2023

Sumup here for future possible AI, thanks

#1567

@qinqon
Copy link
Collaborator Author

qinqon commented Jun 15, 2023

/override pull-e2e-cnao-multus-dynamic-networks-functests
/approve

@kubevirt-bot
Copy link
Collaborator

@qinqon: Overrode contexts on behalf of qinqon: pull-e2e-cnao-multus-dynamic-networks-functests

In response to this:

/override pull-e2e-cnao-multus-dynamic-networks-functests
/approve

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.

@kubevirt-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qinqon

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 Jun 15, 2023
Copy link
Collaborator

@RamLavi RamLavi left a comment

Choose a reason for hiding this comment

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

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Jun 15, 2023
@kubevirt-bot kubevirt-bot merged commit 26b0318 into kubevirt:main Jun 15, 2023
13 checks passed
apiVersion: v1
kind: Namespace
metadata:
name: cluster-network-addons
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: we don't need to parameterize the ns name ?
anyhow if needed can be done on follow PR

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 Denotes a PR that will be considered when it comes time to generate release notes. size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants