Skip to content

Commit 8f184d6

Browse files
committed
Adding UI validations for MiG and instance template
1 parent 8b44c66 commit 8f184d6

File tree

2 files changed

+343
-9
lines changed

2 files changed

+343
-9
lines changed

modules/instance_template/metadata.display.yaml

Lines changed: 207 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# you may not use this file except in compliance with the License.
55
# You may obtain a copy of the License at
66
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
7+
# http://www.apache.org/licenses/LICENSE-2.0
88
#
99
# Unless required by applicable law or agreed to in writing, software
1010
# distributed under the License is distributed on an "AS IS" BASIS,
@@ -31,6 +31,17 @@ spec:
3131
access_config:
3232
name: access_config
3333
title: Access Config
34+
properties:
35+
network_tier:
36+
name: network_tier
37+
title: Network Tier
38+
enumValueLabels:
39+
- label: PREMIUM
40+
value: PREMIUM
41+
- label: STANDARD
42+
value: STANDARD
43+
- label: FIXED_STANDARD
44+
value: FIXED_STANDARD
3445
altDefaults:
3546
- type: ALTERNATE_TYPE_DC
3647
value:
@@ -39,25 +50,141 @@ spec:
3950
additional_disks:
4051
name: additional_disks
4152
title: Additional Disks
53+
properties:
54+
disk_type:
55+
name: disk_type
56+
title: Disk Type
57+
enumValueLabels:
58+
- label: pd-standard
59+
value: pd-standard
60+
- label: pd-balanced
61+
value: pd-balanced
62+
- label: pd-ssd
63+
value: pd-ssd
64+
- label: local-ssd
65+
value: local-ssd
66+
- label: hyperdisk-balanced
67+
value: hyperdisk-balanced
68+
- label: hyperdisk-throughput
69+
value: hyperdisk-throughput
70+
- label: hyperdisk-extreme
71+
value: hyperdisk-extreme
72+
interface:
73+
name: interface
74+
title: Interface
75+
enumValueLabels:
76+
- label: SCSI
77+
value: SCSI
78+
- label: NVME
79+
value: NVME
80+
mode:
81+
name: mode
82+
title: Mode
83+
enumValueLabels:
84+
- label: READ_WRITE
85+
value: READ_WRITE
86+
- label: READ_ONLY
87+
value: READ_ONLY
4288
additional_networks:
4389
name: additional_networks
4490
title: Additional Networks
91+
properties:
92+
network:
93+
name: network
94+
title: Network
95+
regexValidation: ^(?:projects\/[a-z0-9-]+\/)?global\/networks\/[a-z0-9-]{1,63}$
96+
validation: Invalid network format. Must be a network name or a self link.
97+
subnetwork:
98+
name: subnetwork
99+
title: Subnetwork
100+
regexValidation: ^(?:projects\/[a-z0-9-]+\/)?(?:regions\/[a-z0-9-]+\/)?subnetworks\/[a-z0-9-]{1,63}$
101+
validation: Invalid subnetwork format. Must be a subnetwork name or a self link.
102+
network_ip:
103+
name: network_ip
104+
title: Network Ip
105+
regexValidation: ^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$
106+
validation: Invalid IP address format. Must be a valid IPv4 address.
107+
nic_type:
108+
name: nic_type
109+
title: Nic Type
110+
enumValueLabels:
111+
- label: VIRTIO_NET
112+
value: VIRTIO_NET
113+
- label: GVNIC
114+
value: GVNIC
115+
- label: MRDMA
116+
value: MRDMA
117+
- label: IRDMA
118+
value: IRDMA
119+
stack_type:
120+
name: stack_type
121+
title: Stack Type
122+
enumValueLabels:
123+
- label: IPV4_ONLY
124+
value: IPV4_ONLY
125+
- label: IPV6_ONLY
126+
value: IPV6_ONLY
127+
- label: IPV4_IPV6
128+
value: IPV4_IPV6
129+
access_config:
130+
name: access_config
131+
title: Access Config
132+
properties:
133+
network_tier:
134+
name: network_tier
135+
title: Network Tier
136+
enumValueLabels:
137+
- label: PREMIUM
138+
value: PREMIUM
139+
- label: STANDARD
140+
value: STANDARD
141+
- label: FIXED_STANDARD
142+
value: FIXED_STANDARD
143+
ipv6_access_config:
144+
name: ipv6_access_config
145+
title: Ipv6 Access Config
146+
properties:
147+
network_tier:
148+
name: network_tier
149+
title: Network Tier
150+
enumValueLabels:
151+
- label: PREMIUM
152+
value: PREMIUM
153+
- label: STANDARD
154+
value: STANDARD
45155
alias_ip_range:
46156
name: alias_ip_range
47157
title: Alias Ip Range
48158
auto_delete:
49159
name: auto_delete
50160
title: Auto Delete
161+
enumValueLabels:
162+
- label: "true"
163+
value: "true"
164+
- label: "false"
165+
value: "false"
51166
automatic_restart:
52167
name: automatic_restart
53168
title: Automatic Restart
54169
level: 1
55170
can_ip_forward:
56171
name: can_ip_forward
57172
title: Can Ip Forward
173+
enumValueLabels:
174+
- label: "false"
175+
value: "false"
176+
- label: "true"
177+
value: "true"
58178
confidential_instance_type:
59179
name: confidential_instance_type
60180
title: Confidential Instance Type
181+
enumValueLabels:
182+
- label: SEV
183+
value: SEV
184+
- label: SEV_SNP
185+
value: SEV_SNP
186+
- label: TDX
187+
value: TDX
61188
create_service_account:
62189
name: create_service_account
63190
title: Create Service Account
@@ -83,6 +210,21 @@ spec:
83210
name: disk_type
84211
title: Disk Type
85212
level: 1
213+
enumValueLabels:
214+
- label: pd-standard
215+
value: pd-standard
216+
- label: pd-balanced
217+
value: pd-balanced
218+
- label: pd-ssd
219+
value: pd-ssd
220+
- label: local-ssd
221+
value: local-ssd
222+
- label: hyperdisk-balanced
223+
value: hyperdisk-balanced
224+
- label: hyperdisk-throughput
225+
value: hyperdisk-throughput
226+
- label: hyperdisk-extreme
227+
value: hyperdisk-extreme
86228
enable_confidential_vm:
87229
name: enable_confidential_vm
88230
title: Enable Confidential Vm
@@ -102,6 +244,15 @@ spec:
102244
ipv6_access_config:
103245
name: ipv6_access_config
104246
title: Ipv6 Access Config
247+
properties:
248+
network_tier:
249+
name: network_tier
250+
title: Network Tier
251+
enumValueLabels:
252+
- label: PREMIUM
253+
value: PREMIUM
254+
- label: STANDARD
255+
value: STANDARD
105256
labels:
106257
name: labels
107258
title: Labels
@@ -112,42 +263,63 @@ spec:
112263
maintenance_interval:
113264
name: maintenance_interval
114265
title: Maintenance Interval
266+
enumValueLabels:
267+
- label: PERIODIC
268+
value: PERIODIC
115269
metadata:
116270
name: metadata
117271
title: Metadata
118272
min_cpu_platform:
119273
name: min_cpu_platform
120274
title: Min Cpu Platform
121-
enumValueLabels:
122-
- label: Intel Haswell
123-
value: Intel Haswell
124-
- label: Intel Skylake
125-
value: Intel Skylake
126275
name_prefix:
127276
name: name_prefix
128277
title: Name Prefix
129-
regexValidation: ^[a-z][a-z0-9-]{0,51}[a-z0-9]$
130-
validation: Use lowercase letters, numbers, and hyphens. Start with a letter and end with letter/number. Must be 53 characters or fewer.
278+
regexValidation: ^.{1,54}$
279+
validation: Name prefix must be 54 characters or less.
131280
level: 1
132281
network:
133282
name: network
134283
title: Network
135284
level: 1
285+
regexValidation: ^(?:projects\/[a-z0-9-]+\/)?global\/networks\/[a-z0-9-]{1,63}$
286+
validation: Invalid network format. Must be a network name or a self link.
136287
altDefaults:
137288
- type: ALTERNATE_TYPE_DC
138289
value: default
139290
network_ip:
140291
name: network_ip
141292
title: Network Ip
293+
regexValidation: ^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$
294+
validation: Invalid IP address format. Must be a valid IPv4 address.
142295
nic_type:
143296
name: nic_type
144297
title: Nic Type
298+
enumValueLabels:
299+
- label: VIRTIO_NET
300+
value: VIRTIO_NET
301+
- label: GVNIC
302+
value: GVNIC
303+
- label: MRDMA
304+
value: MRDMA
305+
- label: IRDMA
306+
value: IRDMA
145307
on_host_maintenance:
146308
name: on_host_maintenance
147309
title: On Host Maintenance
310+
enumValueLabels:
311+
- label: MIGRATE
312+
value: MIGRATE
313+
- label: TERMINATE
314+
value: TERMINATE
148315
preemptible:
149316
name: preemptible
150317
title: Preemptible
318+
enumValueLabels:
319+
- label: "true"
320+
value: "true"
321+
- label: "false"
322+
value: "false"
151323
project_id:
152324
name: project_id
153325
title: Project Id
@@ -159,6 +331,12 @@ spec:
159331
resource_manager_tags:
160332
name: resource_manager_tags
161333
title: Resource Manager Tags
334+
properties:
335+
value:
336+
name: value
337+
title: Value
338+
regexValidation: ^tagValues\/\d+$
339+
validation: Resource Manager tag values must be in the format 'tagValues/{tag_value_id}'.
162340
resource_policies:
163341
name: resource_policies
164342
title: Resource Policies
@@ -168,6 +346,8 @@ spec:
168346
service_account_project_roles:
169347
name: service_account_project_roles
170348
title: Service Account Project Roles
349+
regexValidation: ^(roles\/[a-zA-Z0-9_\\.]+|(projects\/[a-z][a-z0-9\\-]{4,28}[a-z0-9]|organizations\/[0-9]+)\/roles\/[a-zA-Z0-9_]+)$
350+
validation: Role must be a valid Google Cloud IAM role name, in the format of 'roles/{role_name}'.
171351
shielded_instance_config:
172352
name: shielded_instance_config
173353
title: Shielded Instance Config
@@ -189,16 +369,30 @@ spec:
189369
spot_instance_termination_action:
190370
name: spot_instance_termination_action
191371
title: Spot Instance Termination Action
372+
enumValueLabels:
373+
- label: STOP
374+
value: STOP
375+
- label: DELETE
376+
value: DELETE
192377
stack_type:
193378
name: stack_type
194379
title: Stack Type
380+
enumValueLabels:
381+
- label: IPV4_ONLY
382+
value: IPV4_ONLY
383+
- label: IPV4_IPV6
384+
value: IPV4_IPV6
385+
- label: IPV6_ONLY
386+
value: IPV6_ONLY
195387
startup_script:
196388
name: startup_script
197389
title: Startup Script
198390
subnetwork:
199391
name: subnetwork
200392
title: Subnetwork
201393
level: 1
394+
regexValidation: ^(?:projects\/[a-z0-9-]+\/)?(?:regions\/[a-z0-9-]+\/)?subnetworks\/[a-z0-9-]{1,63}$
395+
validation: Invalid subnetwork format. Must be a subnetwork name or a self link.
202396
subnetwork_project:
203397
name: subnetwork_project
204398
title: Subnetwork Project
@@ -212,3 +406,8 @@ spec:
212406
total_egress_bandwidth_tier:
213407
name: total_egress_bandwidth_tier
214408
title: Total Egress Bandwidth Tier
409+
enumValueLabels:
410+
- label: DEFAULT
411+
value: DEFAULT
412+
- label: TIER_1
413+
value: TIER_1

0 commit comments

Comments
 (0)