Commit bf5a74e
authored
🌱 Simplify VirtualMachineSnapshot and related APIs (#1196)
This commit refactors the VirtualMachineSnapshot API to use a simple string
field for VM references instead of a complex LocalObjectRef structure, and
resolves field conflicts in the VirtualMachine API.
API Changes:
- Replace VirtualMachineSnapshotSpec.VMRef (LocalObjectRef) with VMName (string)
- Rename VirtualMachine.Spec.CurrentSnapshot to CurrentSnapshotName to resolve
JSON tag conflict with VirtualMachine.Status.CurrentSnapshot
- Simplify VirtualMachineSnapshotReference to use Name field directly
- VM status now includes the type (managed / unmanaged) and the name
of the snapshot CR)
Changes include:
- Update virtualmachinesnapshot controller to use VMName instead of VMRef
- Update storagepolicyusage and other references in code to handle the
above change.
- Simplify the validation webhook to handle this change
- Add validation to prevent empty/whitespace-only currentSnapshotName
- Maintain VKS/TKG node snapshot prevention logic
- Provider changes to handle this change
Note that I wanted to keep the `spec.currentSnapshot` for the desired
snapshot but that's not possible because two fields with different
type can't have the same JSON tag (spec being a string, and status
being an object).1 parent 152468c commit bf5a74e
File tree
39 files changed
+261
-799
lines changed- api
- v1alpha1
- v1alpha2
- v1alpha3
- v1alpha4
- v1alpha5
- config/crd/bases
- controllers
- virtualmachinesnapshot
- virtualmachine/storagepolicyusage
- pkg
- crd
- providers/vsphere
- virtualmachine
- vmlifecycle
- util
- kube
- vmopv1
- test/builder
- webhooks
- unifiedstoragequota/validation
- virtualmachinesnapshot
- mutation
- validation
- virtualmachine/validation
39 files changed
+261
-799
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
| |||
162 | 161 | | |
163 | 162 | | |
164 | 163 | | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
171 | 167 | | |
172 | 168 | | |
173 | 169 | | |
174 | 170 | | |
175 | 171 | | |
176 | 172 | | |
177 | | - | |
| 173 | + | |
178 | 174 | | |
179 | 175 | | |
180 | 176 | | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
185 | 182 | | |
186 | 183 | | |
187 | 184 | | |
188 | 185 | | |
| 186 | + | |
189 | 187 | | |
190 | 188 | | |
191 | 189 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
975 | 975 | | |
976 | 976 | | |
977 | 977 | | |
978 | | - | |
| 978 | + | |
979 | 979 | | |
980 | 980 | | |
981 | 981 | | |
982 | 982 | | |
983 | 983 | | |
984 | | - | |
985 | | - | |
986 | | - | |
| 984 | + | |
| 985 | + | |
987 | 986 | | |
988 | 987 | | |
989 | 988 | | |
| |||
998 | 997 | | |
999 | 998 | | |
1000 | 999 | | |
1001 | | - | |
| 1000 | + | |
1002 | 1001 | | |
1003 | 1002 | | |
1004 | 1003 | | |
| |||
1232 | 1231 | | |
1233 | 1232 | | |
1234 | 1233 | | |
| 1234 | + | |
1235 | 1235 | | |
1236 | 1236 | | |
1237 | 1237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | 10 | | |
13 | 11 | | |
14 | 12 | | |
| |||
59 | 57 | | |
60 | 58 | | |
61 | 59 | | |
62 | | - | |
| 60 | + | |
63 | 61 | | |
64 | | - | |
| 62 | + | |
65 | 63 | | |
66 | 64 | | |
67 | 65 | | |
| |||
201 | 199 | | |
202 | 200 | | |
203 | 201 | | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
209 | 205 | | |
210 | 206 | | |
211 | 207 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2151 | 2151 | | |
2152 | 2152 | | |
2153 | 2153 | | |
2154 | | - | |
| 2154 | + | |
2155 | 2155 | | |
2156 | | - | |
| 2156 | + | |
2157 | 2157 | | |
2158 | 2158 | | |
2159 | 2159 | | |
2160 | 2160 | | |
2161 | 2161 | | |
2162 | | - | |
2163 | | - | |
2164 | | - | |
| 2162 | + | |
| 2163 | + | |
2165 | 2164 | | |
2166 | 2165 | | |
2167 | 2166 | | |
| |||
2176 | 2175 | | |
2177 | 2176 | | |
2178 | 2177 | | |
2179 | | - | |
2180 | | - | |
2181 | | - | |
2182 | | - | |
2183 | | - | |
2184 | | - | |
2185 | | - | |
2186 | | - | |
2187 | | - | |
2188 | | - | |
2189 | | - | |
2190 | | - | |
2191 | | - | |
2192 | | - | |
2193 | | - | |
2194 | | - | |
2195 | | - | |
2196 | | - | |
2197 | | - | |
2198 | | - | |
2199 | | - | |
2200 | | - | |
2201 | | - | |
2202 | | - | |
2203 | | - | |
| 2178 | + | |
2204 | 2179 | | |
2205 | 2180 | | |
2206 | 2181 | | |
| |||
0 commit comments