Skip to content

Commit 614f049

Browse files
committed
[VMOwnedVolumes] Introduce FSS, CRD, RBACs and controller skeleton
Signed-off-by: Deepak Kinni <deepak.kinni@broadcom.com>
1 parent 0e0bae3 commit 614f049

18 files changed

Lines changed: 1478 additions & 3 deletions

File tree

manifests/supervisorcluster/1.33/cns-csi.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ rules:
132132
- apiGroups: ["cns.vmware.com"]
133133
resources: ["cnsvolumeinfoes/status"]
134134
verbs: ["patch"]
135+
- apiGroups: ["cns.vmware.com"]
136+
resources: ["csivolumeinfos"]
137+
verbs: ["create", "get", "list", "watch", "delete", "patch", "update"]
138+
- apiGroups: ["cns.vmware.com"]
139+
resources: ["csivolumeinfos/status"]
140+
verbs: ["update", "patch"]
135141
- apiGroups: ["crd.nsx.vmware.com"]
136142
resources: ["networkinfos"]
137143
verbs: ["get", "watch", "list"]
@@ -791,6 +797,9 @@ rules:
791797
- apiGroups: ["vmoperator.vmware.com"]
792798
resources: ["virtualmachines"]
793799
verbs: ["get", "list"]
800+
- apiGroups: ["cns.vmware.com"]
801+
resources: ["csivolumeinfos"]
802+
verbs: ["get", "list"]
794803
---
795804
kind: ClusterRoleBinding
796805
apiVersion: rbac.authorization.k8s.io/v1

manifests/supervisorcluster/1.34/cns-csi.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ rules:
132132
- apiGroups: ["cns.vmware.com"]
133133
resources: ["cnsvolumeinfoes/status"]
134134
verbs: ["patch"]
135+
- apiGroups: ["cns.vmware.com"]
136+
resources: ["csivolumeinfos"]
137+
verbs: ["create", "get", "list", "watch", "delete", "patch", "update"]
138+
- apiGroups: ["cns.vmware.com"]
139+
resources: ["csivolumeinfos/status"]
140+
verbs: ["update", "patch"]
135141
- apiGroups: ["crd.nsx.vmware.com"]
136142
resources: ["networkinfos"]
137143
verbs: ["get", "watch", "list"]
@@ -791,6 +797,9 @@ rules:
791797
- apiGroups: ["vmoperator.vmware.com"]
792798
resources: ["virtualmachines"]
793799
verbs: ["get", "list"]
800+
- apiGroups: ["cns.vmware.com"]
801+
resources: ["csivolumeinfos"]
802+
verbs: ["get", "list"]
794803
---
795804
kind: ClusterRoleBinding
796805
apiVersion: rbac.authorization.k8s.io/v1

manifests/supervisorcluster/1.35/cns-csi.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ rules:
132132
- apiGroups: ["cns.vmware.com"]
133133
resources: ["cnsvolumeinfoes/status"]
134134
verbs: ["patch"]
135+
- apiGroups: ["cns.vmware.com"]
136+
resources: ["csivolumeinfos"]
137+
verbs: ["create", "get", "list", "watch", "delete", "patch", "update"]
138+
- apiGroups: ["cns.vmware.com"]
139+
resources: ["csivolumeinfos/status"]
140+
verbs: ["update", "patch"]
135141
- apiGroups: ["crd.nsx.vmware.com"]
136142
resources: ["networkinfos"]
137143
verbs: ["get", "watch", "list"]
@@ -791,6 +797,9 @@ rules:
791797
- apiGroups: ["vmoperator.vmware.com"]
792798
resources: ["virtualmachines"]
793799
verbs: ["get", "list"]
800+
- apiGroups: ["cns.vmware.com"]
801+
resources: ["csivolumeinfos"]
802+
verbs: ["get", "list"]
794803
---
795804
kind: ClusterRoleBinding
796805
apiVersion: rbac.authorization.k8s.io/v1
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
---
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.14.0
7+
creationTimestamp: null
8+
name: csivolumeinfos.cns.vmware.com
9+
spec:
10+
group: cns.vmware.com
11+
names:
12+
kind: CsiVolumeInfo
13+
listKind: CsiVolumeInfoList
14+
plural: csivolumeinfos
15+
shortNames:
16+
- cvi
17+
singular: csivolumeinfo
18+
scope: Namespaced
19+
versions:
20+
- additionalPrinterColumns:
21+
- jsonPath: .status.ownershipState
22+
name: OwnershipState
23+
type: string
24+
- jsonPath: .status.vmName
25+
name: VMName
26+
type: string
27+
- jsonPath: .status.diskUUID
28+
name: diskUUID
29+
type: string
30+
- jsonPath: .status.diskPath
31+
name: diskPath
32+
type: string
33+
- jsonPath: .metadata.creationTimestamp
34+
name: Age
35+
type: date
36+
name: v1alpha1
37+
schema:
38+
openAPIV3Schema:
39+
description: CsiVolumeInfo tracks the per-volume ownership lifecycle for
40+
the VM-owned volume attach/detach model. One CR exists per PVC (in the
41+
PVC's namespace) from the moment it is provisioned (while VMOwnedVolumes
42+
FSS is enabled) until its owning PV is deleted.
43+
properties:
44+
apiVersion:
45+
description: 'APIVersion defines the versioned schema of this representation
46+
of an object. Servers should convert recognized schemas to the latest
47+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
48+
type: string
49+
kind:
50+
description: 'Kind is a string value representing the REST resource this
51+
object represents. Servers may infer this from the endpoint the client
52+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
53+
type: string
54+
metadata:
55+
type: object
56+
spec:
57+
description: CsiVolumeInfoSpec defines the desired (immutable) state
58+
of CsiVolumeInfo. All fields are set at creation time and must not change
59+
except pvcName on Retain-reclaim rebind.
60+
properties:
61+
pvName:
62+
description: PVName is the bound PV name. The CVI carries a PV ownerReference
63+
so PV deletion cascades CVI deletion via K8s GC.
64+
type: string
65+
pvcName:
66+
description: PVCName is the bound PVC name at CVI creation (or last
67+
bind update on Retain-reclaim rebind). Together with metadata.namespace,
68+
uniquely identifies the PVC.
69+
type: string
70+
volumeID:
71+
description: VolumeID is the CNS volume ID. Immutable after creation.
72+
Matches PV.spec.csi.volumeHandle.
73+
minLength: 1
74+
type: string
75+
required:
76+
- pvName
77+
- pvcName
78+
- volumeID
79+
type: object
80+
status:
81+
description: CsiVolumeInfoStatus defines the observed state of CsiVolumeInfo.
82+
All writes go through the /status subresource endpoint.
83+
properties:
84+
conditions:
85+
description: Conditions is a standard K8s condition array for extensible
86+
status.
87+
items:
88+
description: "Condition contains details for one aspect of the current
89+
state of this API Resource."
90+
properties:
91+
lastTransitionTime:
92+
description: lastTransitionTime is the last time the condition
93+
transitioned from one status to another.
94+
format: date-time
95+
type: string
96+
message:
97+
description: message is a human readable message indicating
98+
details about the transition.
99+
maxLength: 32768
100+
type: string
101+
observedGeneration:
102+
description: observedGeneration represents the .metadata.generation
103+
that the condition was set based upon.
104+
format: int64
105+
minimum: 0
106+
type: integer
107+
reason:
108+
description: reason contains a programmatic identifier indicating
109+
the reason for the condition's last transition.
110+
maxLength: 1024
111+
minLength: 1
112+
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
113+
type: string
114+
status:
115+
description: status of the condition, one of True, False, Unknown.
116+
enum:
117+
- "True"
118+
- "False"
119+
- Unknown
120+
type: string
121+
type:
122+
description: type of condition in CamelCase.
123+
maxLength: 316
124+
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
125+
type: string
126+
required:
127+
- lastTransitionTime
128+
- message
129+
- reason
130+
- status
131+
- type
132+
type: object
133+
maxItems: 8
134+
type: array
135+
x-kubernetes-list-map-keys:
136+
- type
137+
x-kubernetes-list-type: map
138+
diskPath:
139+
description: DiskPath is the datastore path to the VMDK file. An
140+
informational JIT cache — may be stale at rest. Refreshed at each
141+
consumption point (attach, detach, snapshot-delete, revert).
142+
type: string
143+
diskUUID:
144+
description: DiskUUID is the stable identifier for the virtual disk
145+
(VirtualDisk.Backing.Uuid). Populated at CVI creation from the FCD's
146+
backing VMDK. Immutable after creation.
147+
type: string
148+
ownershipState:
149+
description: OwnershipState is the current ownership lifecycle state
150+
of the volume. One of CSI_MANAGED, TRANSFERRING_TO_VM, VM_MANAGED,
151+
TRANSFERRING_TO_CSI.
152+
enum:
153+
- CSI_MANAGED
154+
- TRANSFERRING_TO_VM
155+
- VM_MANAGED
156+
- TRANSFERRING_TO_CSI
157+
type: string
158+
vmInstanceUUID:
159+
description: VMInstanceUUID is the instance UUID of the VM identified
160+
by VMName. Empty when CSI-owned or snapshot-retained.
161+
type: string
162+
vmName:
163+
description: VMName is the name of the VirtualMachine CR this volume
164+
is attached to. Empty when CSI-owned or snapshot-retained.
165+
type: string
166+
required:
167+
- diskUUID
168+
- ownershipState
169+
type: object
170+
required:
171+
- spec
172+
type: object
173+
served: true
174+
storage: true
175+
subresources:
176+
status: {}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
Copyright 2026 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package config
18+
19+
import "embed"
20+
21+
//go:embed cns.vmware.com_csivolumeinfos.yaml
22+
var EmbedCsiVolumeInfoFile embed.FS
23+
24+
const EmbedCsiVolumeInfoFileName = "cns.vmware.com_csivolumeinfos.yaml"

0 commit comments

Comments
 (0)