Skip to content

Commit 3394bad

Browse files
authored
fix: added missing validations (#385)
1 parent 923199b commit 3394bad

File tree

1 file changed

+178
-6
lines changed

1 file changed

+178
-6
lines changed

modules/v2/metadata.display.yaml

Lines changed: 178 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,31 @@ spec:
5050
title: Container Image
5151
regexValidation: ^((([a-zA-Z0-9]+(-[a-zA-Z0-9]+)*\.)+[a-zA-Z]{2,}(:[0-9]+)?/)?([a-z0-9]+([._-][a-z0-9]+)*/)*[a-z0-9]+([._-][a-z0-9]+)*(:(\w[\w.-]{0,127})|@sha256:[a-fA-F0-9]{64})?)$
5252
validation: Must be a valid Docker image (lowercase repo, optional registry, tag, or SHA256 digest)
53+
container_name:
54+
name: container_name
55+
title: Container Name
56+
regexValidation: ^[a-z0-9][a-z0-9_.-]{0,62}$
57+
validation: Container name must start and end with a lowercase alphanumeric character, contain only lowercase alphanumeric characters, hyphens or periods and must be less than 64 characters.
58+
working_dir:
59+
name: working_dir
60+
title: Working Dir
61+
regexValidation: ^(/[^/ ]+)*\/?$
62+
validation: Must be an absolute path (e.g., /app/src).
5363
volume_mounts:
5464
name: volume_mounts
5565
title: Volume Mounts
5666
subtext: Mount In-memory, Network File System, Secret and Cloud Storage bucket volumes to your container
67+
properties:
68+
name:
69+
name: name
70+
title: Name
71+
regexValidation: ^[a-z0-9][a-z0-9_.-]{0,253}[a-z0-9]$
72+
validation: Volume mount name must only contain alphanumeric characters, hyphens and underscores.
73+
mount_path:
74+
name: mount_path
75+
title: Mount Path
76+
regexValidation: ^(/[^/ ]+)*\/?$
77+
validation: Mount path must be an absolute path (e.g., /mnt/data).
5778
resources:
5879
name: resources
5980
title: Resources
@@ -66,14 +87,26 @@ spec:
6687
name: cpu
6788
title: CPU
6889
subtext: Number of vCPUs allocated to each instance of this container
90+
enumValueLabels:
91+
- label: "1"
92+
value: "1"
93+
- label: "2"
94+
value: "2"
95+
- label: "3"
96+
value: "3"
97+
- label: "4"
98+
value: "4"
6999
memory:
70100
name: memory
71101
title: Memory
72-
subtext: Memory to allocate to each instance of this container (e.g., 256Mi, 4Gi).
102+
subtext: Memory to allocate to each instance of this container
103+
regexValidation: ^([5-9][0-9][0-9]Mi|[1-2]?[0-9]Gi|3[0-2]Gi|[1-9][0-9]Mi|[1-9]Gi|[1-9]M|[1-2]G)$
104+
validation: Must be a valid memory size with unit, such as Mi, Gi, M, or G
73105
nvidia_gpu:
74106
name: nvidia_gpu
75107
title: Nvidia GPU
76-
subtext: Number of GPUs to allocate to each instance of this container. Requires a minimum of 4 vCPUs and 16Gi of memory Maximum instance count for this template is 3. A node selector must be provided for GPU allocation.
108+
regexValidation: ^[0-9]+$
109+
validation: Must be a whole number representing the number of GPUs.
77110
startup_probe:
78111
name: startup_probe
79112
title: Startup Probe
@@ -110,10 +143,12 @@ spec:
110143
name: http_get
111144
title: Http Get
112145
properties:
113-
get:
114-
name: get
115-
title: Get
146+
path:
147+
name: path
148+
title: Path
116149
subtext: "Path to access on the HTTP server. Ex: e.g./reddy"
150+
regexValidation: ^(/[^/ ]+)*/?$
151+
validation: Path must be a valid URL path (e.g., /health).
117152
port:
118153
name: port
119154
title: Port
@@ -122,6 +157,17 @@ spec:
122157
name: http_headers
123158
title: Http Headers
124159
subtext: Custom headers to set in the request. HTTP allows repeated headers
160+
properties:
161+
name:
162+
name: name
163+
title: Name
164+
regexValidation: ^[A-Za-z][A-Za-z0-9-]{0,62}$
165+
validation: "Must be a valid HTTP header name: start with a letter, contain only letters [A–Z, a–z], digits [0–9], or hyphens [-], and be at most 63 characters long"
166+
value:
167+
name: value
168+
title: Value
169+
regexValidation: ^.*$
170+
validation: Must be a valid string
125171
tcp_socket:
126172
name: tcp_socket
127173
title: TCP Socket
@@ -133,7 +179,7 @@ spec:
133179
port:
134180
name: port
135181
title: Port
136-
subtext: Port to make a connection for the Cloud Run instance. It will default to the container port, whose default value is 8080.
182+
subtext: Port to make a connection for the Cloud Run instance. It will default to the container port, whose default value is 8080
137183
liveness_probe:
138184
name: liveness_probe
139185
title: Liveness Probe
@@ -162,6 +208,8 @@ spec:
162208
name: path
163209
title: Path
164210
subtext: Path to access on HTTP server
211+
regexValidation: ^(/[^/ ]+)*/?$
212+
validation: Path must be a valid URL path (e.g., /health).
165213
port:
166214
name: port
167215
title: Port
@@ -170,6 +218,17 @@ spec:
170218
name: http_headers
171219
title: Http Headers
172220
subtext: Custom Headers to set in the request. HTTP allows repeated headers.
221+
properties:
222+
name:
223+
name: name
224+
title: Name
225+
regexValidation: ^[A-Za-z][A-Za-z0-9-]{0,62}$
226+
validation: "Must be a valid HTTP header name: start with a letter, contain only letters [A–Z, a–z], digits [0–9], or hyphens [-], and be at most 63 characters long"
227+
value:
228+
name: value
229+
title: Value
230+
regexValidation: ^.*$
231+
validation: Header value can be any string
173232
ports:
174233
name: ports
175234
title: Ports
@@ -200,6 +259,8 @@ spec:
200259
custom_audiences:
201260
name: custom_audiences
202261
title: Custom Audiences
262+
regexValidation: ^https?://(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[A-Za-z]{2,}(?:/[^\s]*)?$
263+
validation: Custom audience must be a valid URL starting with 'http://' or 'https://'
203264
description:
204265
name: description
205266
title: Description
@@ -217,6 +278,8 @@ spec:
217278
name: encryption_key
218279
title: Encryption Key
219280
level: 1
281+
regexValidation: ^projects/[A-Za-z0-9\-\_]+/locations/[A-Za-z0-9\-\_]+/keyRings/[A-Za-z0-9\-\_]+/cryptoKeys/[A-Za-z0-9\-\_]+$
282+
validation: Encryption key must be in the format projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{key}.
220283
execution_environment:
221284
name: execution_environment
222285
title: Execution Environment
@@ -246,13 +309,30 @@ spec:
246309
launch_stage:
247310
name: launch_stage
248311
title: Launch Stage
312+
enumValueLabels:
313+
- label: UNIMPLEMENTED
314+
value: UNIMPLEMENTED
315+
- label: PRELAUNCH
316+
value: PRELAUNCH
317+
- label: EARLY_ACCESS
318+
value: EARLY_ACCESS
319+
- label: ALPHA
320+
value: ALPHA
321+
- label: BETA
322+
value: BETA
323+
- label: GA
324+
value: GA
325+
- label: DEPRECATED
326+
value: DEPRECATED
249327
location:
250328
name: location
251329
title: Location
252330
max_instance_request_concurrency:
253331
name: max_instance_request_concurrency
254332
title: Max Instance Request Concurrency
255333
level: 1
334+
regexValidation: ^([1-9][0-9]{0,2}|1000)$
335+
validation: Max instance request concurrency must be an integer between 1 and 1000.
256336
members:
257337
name: members
258338
title: Members
@@ -266,13 +346,19 @@ spec:
266346
name: revision
267347
title: Revision
268348
level: 1
349+
regexValidation: ^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$
350+
validation: Revision name must use only lowercase letters, numbers and '-'. Must begin with a letter and cannot end with a '-'
269351
service_account:
270352
name: service_account
271353
title: Service Account
354+
regexValidation: ^[a-z][a-z0-9-]{4,29}@[a-z][a-z0-9-]{4,29}\.iam\.gserviceaccount\.com$
355+
validation: Service account email must be in the format {account-id}@{project-id}.iam.gserviceaccount.com.
272356
service_account_project_roles:
273357
name: service_account_project_roles
274358
title: Service Account Project Roles
275359
level: 1
360+
regexValidation: ^(?:[a-z][a-z0-9-]{4,29}/)?roles/[a-zA-Z0-9_.]+$
361+
validation: Role must be in the format roles/{role_name}.
276362
service_annotations:
277363
name: service_annotations
278364
title: Service Annotations
@@ -323,9 +409,30 @@ spec:
323409
timeout:
324410
name: timeout
325411
title: Timeout
412+
regexValidation: ^[0-9]+(?:\.[0-9]{1,9})?s$
413+
validation: Timeout must be a duration in seconds, ending with 's' (e.g., 300s or 1.5s).
326414
traffic:
327415
name: traffic
328416
title: Traffic
417+
properties:
418+
type:
419+
name: type
420+
title: Type
421+
enumValueLabels:
422+
- label: TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST
423+
value: TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST
424+
- label: TRAFFIC_TARGET_ALLOCATION_TYPE_REVISION
425+
value: TRAFFIC_TARGET_ALLOCATION_TYPE_REVISION
426+
revision:
427+
name: revision
428+
title: Revision
429+
regexValidation: ^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$
430+
validation: Revision name must use only lowercase letters, numbers and '-'. Must begin with a letter and cannot end with a '-'
431+
tag:
432+
name: tag
433+
title: Tag
434+
regexValidation: ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$
435+
validation: Tag must start and end with a lowercase alphanumeric character, and contain only lowercase alphanumeric characters or hyphens.
329436
volumes:
330437
name: volumes
331438
title: Volumes
@@ -340,6 +447,16 @@ spec:
340447
name: secret
341448
title: Secret
342449
properties:
450+
secret:
451+
name: secret
452+
title: Secret
453+
regexValidation: ^([a-zA-Z0-9-_]{1,255}|projects\/([a-z][a-z0-9-]{4,28}[a-z0-9]|[0-9]{6,})\/secrets\/[a-zA-Z0-9-_]{1,255})$
454+
validation: Secret name must be either the secret name or the full Secret Manager resource path.
455+
default_mode:
456+
name: default_mode
457+
title: Default Mode
458+
regexValidation: ^(0[0-7]{3})$
459+
validation: Must be a value between 0000 and 0777 (octal).
343460
items:
344461
name: items
345462
title: Items
@@ -348,6 +465,45 @@ spec:
348465
name: path
349466
title: Path
350467
subtext: "Example format (parent secret): \"projects/project-number/secrets/secret-name\""
468+
regexValidation: ^(?:[A-Za-z0-9_-]|\.[A-Za-z0-9_-])+(?:/(?:[A-Za-z0-9_-]|\.[A-Za-z0-9_-])+)*$
469+
validation: Path must be a valid relative file path.
470+
version:
471+
name: version
472+
title: Version
473+
regexValidation: ^(latest|[1-9][0-9]*)$
474+
validation: Version must be 'latest' or a version number.
475+
mode:
476+
name: mode
477+
title: Mode
478+
regexValidation: ^(0|0[1-7]{1,3})?$
479+
validation: Must be a value between 01 and 0777 (octal)
480+
empty_dir:
481+
name: empty_dir
482+
title: Empty Dir
483+
properties:
484+
medium:
485+
name: medium
486+
title: Medium
487+
enumValueLabels:
488+
- label: MEMORY
489+
value: MEMORY
490+
gcs:
491+
name: gcs
492+
title: GCS
493+
properties:
494+
bucket:
495+
name: bucket
496+
title: Bucket
497+
regexValidation: ^[a-z0-9](?:[a-z0-9.-]{1,61}[a-z0-9])$
498+
validation: Bucket name must be lowercase, start and end with an alphanumeric character, and contain only alphanumeric characters, dashes, and dots.
499+
read_only:
500+
name: read_only
501+
title: Read Only
502+
enumValueLabels:
503+
- label: "true"
504+
value: "true"
505+
- label: "false"
506+
value: "false"
351507
nfs:
352508
name: nfs
353509
title: NFS
@@ -356,10 +512,22 @@ spec:
356512
name: server
357513
title: Server
358514
subtext: The IP address or domain of your NFS server
515+
regexValidation: ^(([a-zA-Z0-9]([-a-zA-Z0-9]*[a-zA-Z0-9])?\.)*[a-zA-Z]{2,}|((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9]))$
516+
validation: Must be a valid IP address or domain name.
359517
path:
360518
name: path
361519
title: Path
362520
subtext: The path to the NFS server directory you want to mount
521+
regexValidation: ^(/[^/ ]+)*/?$
522+
validation: Path must be an absolute path (e.g., /exports/data).
523+
read_only:
524+
name: read_only
525+
title: Read Only
526+
enumValueLabels:
527+
- label: "true"
528+
value: "true"
529+
- label: "false"
530+
value: "false"
363531
vpc_access:
364532
name: vpc_access
365533
title: Vpc Access
@@ -391,10 +559,14 @@ spec:
391559
name: network
392560
title: Network
393561
subtext: The VPC network that the Cloud Run resource will be able to send traffic to.
562+
regexValidation: ^(projects\/[a-z0-9\-]+\/global\/networks\/[a-zA-Z0-9\-_]+|[a-zA-Z0-9\-_]+)$
563+
validation: Network must be a valid network name or a full resource path.
394564
subnetwork:
395565
name: subnetwork
396566
title: Subnetwork
397567
subtext: The VPC subnetwork that the Cloud Run resource will get IPs from. At least one of network or subnetwork must be specified. If both network and subnetwork are specified, the given VPC subnetwork must belong to the given VPC network. If subnetwork is not specified, the subnetwork with the same name with the network will be used.
568+
regexValidation: ^(projects\/[a-z0-9\-]+\/regions\/[a-z0-9\-]+\/subnetworks\/[a-zA-Z0-9\-_]+|[a-zA-Z0-9\-_]+)$
569+
validation: Subnetwork must be a valid subnetwork name or a full resource path.
398570
altDefaults:
399571
- type: ALTERNATE_TYPE_DC
400572
value:

0 commit comments

Comments
 (0)