|
| 1 | +Administrators may wish to attach additional tags to newly provisioned VMs. The cluster API provider for vSphere |
| 2 | +allows for this in the [`VirtualMachineCloneSpec`](https://github.com/kubernetes-sigs/cluster-api-provider-vsphere/blob/b9b2c22ea68c13cbf706f2116ced804b5afb124e/apis/v1beta1/types.go#L189-L193). |
| 3 | +A similar provision has been made in the [`VSphereMachineProviderSpec`](https://github.com/openshift/api/blob/6d48d55c0598ec78adacdd847dcf934035ec2e1b/machine/v1beta1/types_vsphereprovider.go#L54-L59). |
| 4 | + |
| 5 | +Up to 10 tags are attachable by their tag URN(for example: `urn:vmomi:InventoryServiceTag:f6dfddfd-b28a-44da-9503-635d3fc245ac:GLOBAL`), not by the name of the tag and tag category. As a result, a given tag must exist before the |
| 6 | +machine controller will attempt to associate the tag. The URN can be retrieved from the vCenter UI by accessing the `Tag & Custom Attributes` screen and selecting the desired tag. The tag URN will be in the URL: |
| 7 | +``` |
| 8 | +https://v8c-2-vcenter.ocp2.dev.cluster.com/ui/app/tags/tag/urn:vmomi:InventoryServiceTag:f6dfddfd-b28a-44da-9503-635d3fc245ac:GLOBAL/permissions |
| 9 | +``` |
| 10 | + |
| 11 | +The below example demonstrates a machine spec which defines `tagIDs`: |
| 12 | + |
| 13 | +```yaml |
| 14 | +apiVersion: machine.openshift.io/v1beta1 |
| 15 | +kind: Machine |
| 16 | +metadata: |
| 17 | + generateName: ci-ln-ll0lbgk-c1627-gslcw-worker-0- |
| 18 | + name: ci-ln-ll0lbgk-c1627-gslcw-worker-0-6nppd |
| 19 | +spec: |
| 20 | + lifecycleHooks: {} |
| 21 | + metadata: {} |
| 22 | + providerID: 'vsphere://421bb8b8-e7da-6bfa-3e1b-cc6ef9945343' |
| 23 | + providerSpec: |
| 24 | + value: |
| 25 | + numCoresPerSocket: 4 |
| 26 | + diskGiB: 120 |
| 27 | + snapshot: '' |
| 28 | + userDataSecret: |
| 29 | + name: worker-user-data |
| 30 | + memoryMiB: 16384 |
| 31 | + credentialsSecret: |
| 32 | + name: vsphere-cloud-credentials |
| 33 | + network: |
| 34 | + devices: |
| 35 | + - networkName: ci-vlan-1207 |
| 36 | + metadata: |
| 37 | + creationTimestamp: null |
| 38 | + numCPUs: 4 |
| 39 | + kind: VSphereMachineProviderSpec |
| 40 | + workspace: |
| 41 | + datacenter: IBMCloud |
| 42 | + datastore: /IBMCloud/datastore/vsanDatastore |
| 43 | + folder: /IBMCloud/vm/ci-ln-ll0lbgk-c1627-gslcw |
| 44 | + resourcePool: /IBMCloud/host/vcs-ci-workload/Resources/ipi-ci-clusters |
| 45 | + server: v8c-2-vcenter.ocp2.dev.cluster.com |
| 46 | + template: ci-ln-ll0lbgk-c1627-gslcw-rhcos-generated-region-generated-zone |
| 47 | + tagIDs: |
| 48 | + - 'urn:vmomi:InventoryServiceTag:8d893b87-28de-4ef0-90d2-af24f21b0f26:GLOBAL' |
| 49 | + apiVersion: machine.openshift.io/v1beta1 |
| 50 | +status: {} |
| 51 | +``` |
| 52 | +
|
| 53 | +
|
| 54 | +`machinesets` may also be defined to attach tags to `machines` created by the `machineset`. |
0 commit comments