Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 2105382

Summary: Add a validation webhook for Nutanix machine provider spec in Machine API Operator
Product: OpenShift Container Platform Reporter: Michael McCune <mimccune>
Component: Cloud ComputeAssignee: Michael McCune <mimccune>
Cloud Compute sub component: Other Providers QA Contact: sunzhaohua <zhsun>
Status: CLOSED ERRATA Docs Contact:
Severity: urgent    
Priority: unspecified CC: aarapov, cluster-infrastructure-bug-bot, mimccune, miyadav, sishukla, zhsun
Version: 4.11   
Target Milestone: ---   
Target Release: 4.11.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 2104642 Environment:
Last Closed: 2022-08-10 11:20:51 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2104642    
Bug Blocks:    

Comment 1 Michael McCune 2022-07-13 19:13:26 UTC
i have created a single PR against 4.11 that includes both the PRs from the original issue.

Comment 2 Milind Yadav 2022-07-14 05:24:32 UTC
[miyadav@miyadav ~]$ oc get clusterversion
NAME      VERSION                                                   AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.11.0-0.ci.test-2022-07-14-024107-ci-ln-mfjpi6b-latest   True        False         31m     Cluster version is 4.11.0-0.ci.test-2022-07-14-024107-ci-ln-mfjpi6b-latest


[miyadav@miyadav nuatanix]$ oc create -f invalid411.yaml (removed userdata.name)
Error from server (providerSpec.userDataSecret.name: Required value: name must be provided): error when creating "invalid411.yaml": admission webhook "validation.machineset.machine.openshift.io" denied the request: providerSpec.userDataSecret.name: Required value: name must be provided
[miyadav@miyadav nuatanix]$ 
 
[miyadav@miyadav nuatanix]$ oc create -f invalid411.yaml  (removed both userdata and credential secret , mutating webhooks worked)
machineset.machine.openshift.io/miyadav-147-frkp5-worker-in created
[miyadav@miyadav nuatanix]$ oc get machines 
NAME                                PHASE          TYPE   REGION   ZONE   AGE
miyadav-147-frkp5-master-0          Running                               57m
miyadav-147-frkp5-master-1          Running                               57m
miyadav-147-frkp5-master-2          Running                               57m
miyadav-147-frkp5-worker-dl9dh      Running                               53m
miyadav-147-frkp5-worker-in-nwqmq   Provisioning                          87s
miyadav-147-frkp5-worker-in-t8xh8   Provisioning                          88s
miyadav-147-frkp5-worker-tknvp      Running                               53m
[miyadav@miyadav nuatanix]$ oc get machines 
NAME                                PHASE     TYPE   REGION   ZONE   AGE
miyadav-147-frkp5-master-0          Running                          61m
miyadav-147-frkp5-master-1          Running                          61m
miyadav-147-frkp5-master-2          Running                          61m
miyadav-147-frkp5-worker-dl9dh      Running                          57m
miyadav-147-frkp5-worker-in-nwqmq   Running                          5m7s
miyadav-147-frkp5-worker-in-t8xh8   Running                          5m8s
miyadav-147-frkp5-worker-tknvp      Running                          57m

[miyadav@miyadav nuatanix]$ vi invalid411.yaml (removed credentialsecret.name ) 
[miyadav@miyadav nuatanix]$ oc get machineset miyadav-147-frkp5-worker-in -o yaml > invalid411.yaml
[miyadav@miyadav nuatanix]$ vi invalid411.yaml 
[miyadav@miyadav nuatanix]$ oc create -f invalid411.yaml 
Error from server (providerSpec.credentialsSecret.name: Required value: name must be provided): error when creating "invalid411.yaml": admission webhook "validation.machineset.machine.openshift.io" denied the request: providerSpec.credentialsSecret.name: Required value: name must be provided


[miyadav@miyadav nuatanix]$ oc get mutatingwebhookconfiguration
NAME          WEBHOOKS   AGE
machine-api   2          59m

[miyadav@miyadav nuatanix]$ oc get ValidatingWebhookConfiguration
NAME                               WEBHOOKS   AGE
alertmanagerconfigs.openshift.io   1          49m
autoscaling.openshift.io           2          59m
machine-api                        2          60m
multus.openshift.io                1          61m
performance-addon-operator         1          63m
prometheusrules.openshift.io       1          49m
snapshot.storage.k8s.io            1          60m

Comment 6 errata-xmlrpc 2022-08-10 11:20:51 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: OpenShift Container Platform 4.11.0 bug fix and security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:5069