-
Notifications
You must be signed in to change notification settings - Fork 54
SPLAT-2410: Introduce Cluster API for OpenShift Installations on vSphere #455
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
Open
AnnaZivkovic
wants to merge
7
commits into
openshift:main
Choose a base branch
from
AnnaZivkovic:vsphere-conversion
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7b60136
Enable vSphere in MAPI<->CAPI conversion framework
AnnaZivkovic ea9f2d0
Add v1beta2 condition support for infrastructure providers
AnnaZivkovic f6ed902
Add feature gate check for vSphere migration support
AnnaZivkovic 1b0fda1
Add ValidatingAdmissionPolicy for vSphere unsupported fields
AnnaZivkovic cfe099e
Convert vSphere ProviderStatus during CAPI to MAPI conversion
AnnaZivkovic 6b8c40d
squash! Enable vSphere in MAPI<->CAPI conversion framework
AnnaZivkovic a662b42
squash! Convert vSphere ProviderStatus during CAPI to MAPI conversion
AnnaZivkovic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| apiVersion: kustomize.config.k8s.io/v1beta1 | ||
| kind: Kustomization | ||
|
|
||
| resources: | ||
| - unsupported-vsphere-spec-fields.yaml |
213 changes: 213 additions & 0 deletions
213
admission-policies/vsphere/unsupported-vsphere-spec-fields.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,213 @@ | ||
| # ValidatingAdmissionPolicy for blocking unsupported vSphere fields | ||
| # | ||
| # API Version: v1beta1 | ||
| # This policy targets cluster-api-provider-vsphere v1beta1 API. | ||
| # When upgrading to v1beta2, add these additional fields to block: | ||
| # - nestedHV | ||
| # - ftEncryptionMode | ||
| # - migrateEncryption | ||
| # - cryptoKeyID | ||
| # - cryptoProfile | ||
| # | ||
| # Fields Currently Allowed (conversion supports them): | ||
| # - template, cloneMode, snapshot | ||
| # - numCPUs, numCoresPerSocket, memoryMiB, diskGiB | ||
| # - server, datacenter, folder, datastore, resourcePool | ||
| # - tagIDs, dataDisks | ||
| # - network.devices[*].networkName | ||
| # - network.devices[*].gateway4 (supports IPv6 addresses too) | ||
| # - network.devices[*].ipAddrs (supports IPv4 and IPv6) | ||
| # - network.devices[*].nameservers (supports IPv4 and IPv6) | ||
| # - network.devices[*].addressesFromPools (IPAM) | ||
| # | ||
| # Fields Warned for Future Enhancement (when MAPI support is added): | ||
| # - storagePolicyName (medium priority) | ||
| # - hardwareVersion (low priority) | ||
| # - pciDevices (low priority) | ||
| # - network.devices[*].macAddr (low priority - CAPV supports it but not in MAPI yet) | ||
| # | ||
| # See docs/vsphere-field-conversion-support.md for complete field documentation. | ||
| # | ||
| apiVersion: admissionregistration.k8s.io/v1 | ||
| kind: ValidatingAdmissionPolicyBinding | ||
| metadata: | ||
| name: "openshift-cluster-api-unsupported-vsphere-spec-fields" | ||
| spec: | ||
| policyName: "openshift-cluster-api-unsupported-vsphere-spec-fields" | ||
| validationActions: [Deny] | ||
| matchResources: | ||
| namespaceSelector: | ||
| matchExpressions: | ||
| - key: kubernetes.io/metadata.name | ||
| operator: In | ||
| values: | ||
| - openshift-cluster-api | ||
| --- | ||
| apiVersion: admissionregistration.k8s.io/v1 | ||
| kind: ValidatingAdmissionPolicyBinding | ||
| metadata: | ||
| name: "openshift-cluster-api-unsupported-vsphere-spec-fields-warning" | ||
| spec: | ||
| policyName: "openshift-cluster-api-unsupported-vsphere-spec-fields-warning" | ||
| validationActions: [Warn] | ||
| matchResources: | ||
| namespaceSelector: | ||
| matchExpressions: | ||
| - key: kubernetes.io/metadata.name | ||
| operator: In | ||
| values: | ||
| - openshift-cluster-api | ||
| --- | ||
| apiVersion: admissionregistration.k8s.io/v1 | ||
| kind: ValidatingAdmissionPolicy | ||
| metadata: | ||
| name: "openshift-cluster-api-unsupported-vsphere-spec-fields" | ||
| spec: | ||
| failurePolicy: Fail | ||
| matchConstraints: | ||
| resourceRules: | ||
| - apiGroups: ["infrastructure.cluster.x-k8s.io"] | ||
| apiVersions: ["v1beta1"] | ||
| operations: ["CREATE", "UPDATE"] | ||
| resources: ["vspheremachines", "vspheremachinetemplates"] | ||
| variables: | ||
| - name: machineSpec | ||
| expression: "object.kind == 'VSphereMachine' ? object.spec : object.spec.template.spec" | ||
| - name: specPath | ||
| expression: "object.kind == 'VSphereMachine' ? 'spec' : 'spec.template.spec'" | ||
| validations: | ||
| # Cluster-level configuration | ||
| - expression: "!has(variables.machineSpec.thumbprint) || variables.machineSpec.thumbprint == ''" | ||
| messageExpression: "variables.specPath + '.thumbprint is not supported - TLS validation is handled at cluster level'" | ||
|
|
||
| # CAPI-only runtime configuration | ||
| - expression: "!has(variables.machineSpec.customVMXKeys) || variables.machineSpec.customVMXKeys.size() == 0" | ||
| messageExpression: "variables.specPath + '.customVMXKeys is not supported in OpenShift'" | ||
|
|
||
| # Resource management (not implemented in CAPV) | ||
| - expression: "!has(variables.machineSpec.resources)" | ||
| messageExpression: "variables.specPath + '.resources is not supported'" | ||
|
|
||
| # Lifecycle management (not in MAPI) | ||
| - expression: "!has(variables.machineSpec.guestSoftPowerOffTimeout)" | ||
| messageExpression: "variables.specPath + '.guestSoftPowerOffTimeout is not supported'" | ||
|
|
||
| - expression: "!has(variables.machineSpec.namingStrategy)" | ||
| messageExpression: "variables.specPath + '.namingStrategy is not supported'" | ||
|
|
||
| # Power off mode - only allow hard or unset | ||
| - expression: "!has(variables.machineSpec.powerOffMode) || variables.machineSpec.powerOffMode == '' || variables.machineSpec.powerOffMode == 'hard'" | ||
| messageExpression: "variables.specPath + '.powerOffMode must be \"hard\" or unset - soft power-off is not supported'" | ||
|
|
||
| # Operating system type (not used by CAPV) | ||
| - expression: "!has(variables.machineSpec.os) || variables.machineSpec.os == ''" | ||
| messageExpression: "variables.specPath + '.os is not supported'" | ||
|
|
||
| # Network-level fields | ||
| - expression: "!has(variables.machineSpec.network.routes) || variables.machineSpec.network.routes.size() == 0" | ||
| messageExpression: "variables.specPath + '.network.routes is not supported'" | ||
|
|
||
| - expression: "!has(variables.machineSpec.network.preferredAPIServerCIDR) || variables.machineSpec.network.preferredAPIServerCIDR == ''" | ||
| messageExpression: "variables.specPath + '.network.preferredAPIServerCIDR is not supported'" | ||
|
|
||
| # Network device fields - iterate over all devices and check unsupported fields | ||
| - expression: >- | ||
| !has(variables.machineSpec.network.devices) || | ||
| variables.machineSpec.network.devices.all(device, | ||
| !has(device.deviceName) || device.deviceName == '' | ||
| ) | ||
| messageExpression: "variables.specPath + '.network.devices[*].deviceName is not supported'" | ||
|
|
||
| - expression: >- | ||
| !has(variables.machineSpec.network.devices) || | ||
| variables.machineSpec.network.devices.all(device, | ||
| !has(device.dhcp6) | ||
| ) | ||
| messageExpression: "variables.specPath + '.network.devices[*].dhcp6 is not supported'" | ||
|
|
||
| - expression: >- | ||
| !has(variables.machineSpec.network.devices) || | ||
| variables.machineSpec.network.devices.all(device, | ||
| !has(device.gateway6) || device.gateway6 == '' | ||
| ) | ||
| messageExpression: "variables.specPath + '.network.devices[*].gateway6 is not supported'" | ||
|
|
||
| - expression: >- | ||
| !has(variables.machineSpec.network.devices) || | ||
| variables.machineSpec.network.devices.all(device, | ||
| !has(device.mtu) | ||
| ) | ||
| messageExpression: "variables.specPath + '.network.devices[*].mtu is not supported'" | ||
|
|
||
| - expression: >- | ||
| !has(variables.machineSpec.network.devices) || | ||
| variables.machineSpec.network.devices.all(device, | ||
| !has(device.routes) || device.routes.size() == 0 | ||
| ) | ||
| messageExpression: "variables.specPath + '.network.devices[*].routes is not supported'" | ||
|
|
||
| - expression: >- | ||
| !has(variables.machineSpec.network.devices) || | ||
| variables.machineSpec.network.devices.all(device, | ||
| !has(device.searchDomains) || device.searchDomains.size() == 0 | ||
| ) | ||
| messageExpression: "variables.specPath + '.network.devices[*].searchDomains is not supported'" | ||
|
|
||
| - expression: >- | ||
| !has(variables.machineSpec.network.devices) || | ||
| variables.machineSpec.network.devices.all(device, | ||
| !has(device.dhcp4Overrides) | ||
| ) | ||
| messageExpression: "variables.specPath + '.network.devices[*].dhcp4Overrides is not supported'" | ||
|
|
||
| - expression: >- | ||
| !has(variables.machineSpec.network.devices) || | ||
| variables.machineSpec.network.devices.all(device, | ||
| !has(device.dhcp6Overrides) | ||
| ) | ||
| messageExpression: "variables.specPath + '.network.devices[*].dhcp6Overrides is not supported'" | ||
|
|
||
| - expression: >- | ||
| !has(variables.machineSpec.network.devices) || | ||
| variables.machineSpec.network.devices.all(device, | ||
| !has(device.skipIPAllocation) | ||
| ) | ||
| messageExpression: "variables.specPath + '.network.devices[*].skipIPAllocation is not supported'" | ||
| --- | ||
| apiVersion: admissionregistration.k8s.io/v1 | ||
| kind: ValidatingAdmissionPolicy | ||
| metadata: | ||
| name: "openshift-cluster-api-unsupported-vsphere-spec-fields-warning" | ||
| spec: | ||
| failurePolicy: Fail | ||
| matchConstraints: | ||
| resourceRules: | ||
| - apiGroups: ["infrastructure.cluster.x-k8s.io"] | ||
| apiVersions: ["v1beta1"] | ||
| operations: ["CREATE", "UPDATE"] | ||
| resources: ["vspheremachines", "vspheremachinetemplates"] | ||
| variables: | ||
| - name: machineSpec | ||
| expression: "object.kind == 'VSphereMachine' ? object.spec : object.spec.template.spec" | ||
| - name: specPath | ||
| expression: "object.kind == 'VSphereMachine' ? 'spec' : 'spec.template.spec'" | ||
| validations: | ||
| # Storage policy (not yet supported - future enhancement) | ||
| - expression: "!has(variables.machineSpec.storagePolicyName) || variables.machineSpec.storagePolicyName == ''" | ||
| messageExpression: "variables.specPath + '.storagePolicyName is not yet supported but planned for future release'" | ||
|
|
||
| # PCI devices (not yet supported - future enhancement) | ||
| - expression: "!has(variables.machineSpec.pciDevices) || variables.machineSpec.pciDevices.size() == 0" | ||
| messageExpression: "variables.specPath + '.pciDevices is not yet supported but planned for future release'" | ||
|
|
||
| # Hardware version (not yet supported - future enhancement) | ||
| - expression: "!has(variables.machineSpec.hardwareVersion) || variables.machineSpec.hardwareVersion == ''" | ||
| messageExpression: "variables.specPath + '.hardwareVersion is not yet supported but planned for future release'" | ||
|
|
||
| # MAC address (not yet supported - future enhancement) | ||
| - expression: >- | ||
| !has(variables.machineSpec.network.devices) || | ||
| variables.machineSpec.network.devices.all(device, | ||
| !has(device.macAddr) || device.macAddr == '' | ||
| ) | ||
| messageExpression: "variables.specPath + '.network.devices[*].macAddr is not yet supported but planned for future release'" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.