-
Notifications
You must be signed in to change notification settings - Fork 392
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
OCPBUGS-32739: MachineConfigurations is only effective with name <cluster> #4332
OCPBUGS-32739: MachineConfigurations is only effective with name <cluster> #4332
Conversation
@djoshy: This pull request references Jira Issue OCPBUGS-32739, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. In response to this: 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 openshift-eng/jira-lifecycle-plugin repository. |
Skipping CI for Draft Pull Request. |
dff2b59
to
ff14562
Compare
/retest-required |
/jira refresh |
@djoshy: This pull request references Jira Issue OCPBUGS-32739, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
Requesting review from QA contact: In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
everything looks good to me! great work david :)
/hold |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: djoshy, dkhater-redhat 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 |
/test e2e-hypershift |
@djoshy: The following tests failed, say
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. |
check validatingadmissionpolicy $ oc get validatingadmissionpolicy machine-configuration-guards -o yaml
apiVersion: admissionregistration.k8s.io/v1beta1
kind: ValidatingAdmissionPolicy
metadata:
creationTimestamp: "2024-04-28T01:41:01Z"
generation: 1
name: machine-configuration-guards
resourceVersion: "11562"
uid: 1e30604b-b2a9-424f-9052-f6b9defd7565
spec:
failurePolicy: Fail
matchConstraints:
matchPolicy: Equivalent
namespaceSelector: {}
objectSelector: {}
resourceRules:
- apiGroups:
- operator.openshift.io
apiVersions:
- v1
operations:
- CREATE
- UPDATE
resources:
- machineconfigurations
scope: '*'
validations:
- expression: object.metadata.name=='cluster'
message: Only a single object of MachineConfiguration is allowed and it must be
named cluster.
status:
observedGeneration: 1
typeChecking: {} create a new $ cat create_mcfgs_with_non_default_name.yaml
apiVersion: operator.openshift.io/v1
kind: MachineConfiguration
metadata:
name: myconfigs
namespace: openshift-machine-config-operator
spec:
nodeDisruptionPolicy:
files:
- path: /etc/test
actions:
- type: None
$ oc create -f create_mcfgs_with_non_default_name.yaml
The machineconfigurations "myconfigs" is invalid: : ValidatingAdmissionPolicy 'machine-configuration-guards' with binding 'machine-configuration-guards-binding' denied request: Only a single object of MachineConfiguration is allowed and it must be named cluster.
$ oc apply -f create_mcfgs_with_non_default_name.yaml
The machineconfigurations "myconfigs" is invalid: : ValidatingAdmissionPolicy 'machine-configuration-guards' with binding 'machine-configuration-guards-binding' denied request: Only a single object of MachineConfiguration is allowed and it must be named cluster. update $ cat file_action_none.yaml
apiVersion: operator.openshift.io/v1
kind: MachineConfiguration
metadata:
name: cluster
namespace: openshift-machine-config-operator
spec:
nodeDisruptionPolicy:
files:
- path: /etc/test
actions:
- type: None
$ oc apply -f file_action_none.yaml
Warning: resource machineconfigurations/cluster is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by oc apply. oc apply should only be used on resources created declaratively by either oc create --save-config or oc apply. The missing annotation will be patched automatically.
machineconfiguration.operator.openshift.io/cluster configured check the $ oc get featuregate cluster -o yaml | yq -y '.spec'
{}
$ oc get validatingadmissionpolicy machine-configuration-guards -o yaml
error: the server doesn't have a resource type "validatingadmissionpolicy" |
/unhold |
41cfb04
into
openshift:master
@djoshy: Jira Issue OCPBUGS-32739: All pull requests linked via external trackers have merged: Jira Issue OCPBUGS-32739 has been moved to the MODIFIED state. In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
[ART PR BUILD NOTIFIER] This PR has been included in build ose-machine-config-operator-container-v4.16.0-202404291018.p0.g41cfb04.assembly.stream.el9 for distgit ose-machine-config-operator. |
Fix included in accepted release 4.16.0-0.nightly-2024-04-29-154406 |
This adds a new ValidatingAdmissionPolicy which rejects all MachineConfiguration objects not named "cluster".
How to test:
If starting from default and transitioning to TechPreview, wait for the
kube-apiserver
operator to settle as this indicates that all the feature gates have been setup correctly. This can take up to 20 minutes, so I recommend the above method.This should fail, with a message like this:
This should be true for any object not named "cluster", regardless of the content.
It should succeed: