Skip to content

Commit a9f9d9a

Browse files
author
Cyril TOVENA
committed
add OpenAPI spec validation to the CRD install file
1 parent f697a96 commit a9f9d9a

2 files changed

Lines changed: 186 additions & 0 deletions

File tree

build/install.yaml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,99 @@ spec:
3131
shortNames:
3232
- gs
3333
singular: gameserver
34+
validation:
35+
openAPIV3Schema:
36+
required:
37+
- spec
38+
properties:
39+
spec:
40+
required:
41+
- containerPort
42+
- template
43+
properties:
44+
template:
45+
type: object
46+
required:
47+
- spec
48+
properties:
49+
spec:
50+
type: object
51+
required:
52+
- containers
53+
properties:
54+
containers:
55+
type: array
56+
items:
57+
type: object
58+
required:
59+
- image
60+
properties:
61+
name:
62+
type: string
63+
minLength: 0
64+
maxLength: 63
65+
pattern: "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
66+
image:
67+
type: string
68+
minLength: 1
69+
minItems: 1
70+
container:
71+
title: The container name running the gameserver
72+
description: if there is more than one container, specify which one is the game server
73+
type: string
74+
minLength: 0
75+
maxLength: 63
76+
pattern: "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
77+
portPolicy:
78+
title: the port policy that will be applied to the game server
79+
description: |
80+
portPolicy has two options:
81+
- "dynamic" (default) the system allocates a free hostPort for the gameserver, for game clients to connect to
82+
- "static", user defines the hostPort that the game client will connect to. Then onus is on the user to ensure that the
83+
port is available. When static is the policy specified, `hostPort` is required to be populated
84+
type: string
85+
enum:
86+
- dynamic
87+
- static
88+
protocol:
89+
title: Protocol being used. Defaults to UDP. TCP is the only other option
90+
type: string
91+
enum:
92+
- UDP
93+
- TCP
94+
containerPort:
95+
title: The port that is being opened on the game server process
96+
type: integer
97+
minimum: 0
98+
maximum: 65535
99+
hostPort:
100+
title: The port exposed on the host
101+
description: Only required when `portPolicy` is "static". Overwritten when portPolicy is "dynamic".
102+
type: integer
103+
minimum: 0
104+
maximum: 65535
105+
health:
106+
type: object
107+
title: Health checking for the running game server
108+
properties:
109+
disabled:
110+
title: Disable health checking. defaults to false, but can be set to true
111+
type: boolean
112+
initialDelaySeconds:
113+
title: Number of seconds after the container has started before health check is initiated. Defaults to 5 seconds
114+
type: integer
115+
minimum: 0
116+
maximum: 2147483648
117+
periodSeconds:
118+
title: How long before the server is considered not healthy
119+
type: integer
120+
minimum: 0
121+
maximum: 2147483648
122+
failureThreshold:
123+
title: Minimum consecutive failures for the health probe to be considered failed after having succeeded.
124+
type: integer
125+
minimum: 1
126+
maximum: 2147483648
34127
---
35128
apiVersion: extensions/v1beta1
36129
kind: Deployment

install.yaml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,99 @@ spec:
3131
shortNames:
3232
- gs
3333
singular: gameserver
34+
validation:
35+
openAPIV3Schema:
36+
required:
37+
- spec
38+
properties:
39+
spec:
40+
required:
41+
- containerPort
42+
- template
43+
properties:
44+
template:
45+
type: object
46+
required:
47+
- spec
48+
properties:
49+
spec:
50+
type: object
51+
required:
52+
- containers
53+
properties:
54+
containers:
55+
type: array
56+
items:
57+
type: object
58+
required:
59+
- image
60+
properties:
61+
name:
62+
type: string
63+
minLength: 0
64+
maxLength: 63
65+
pattern: "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
66+
image:
67+
type: string
68+
minLength: 1
69+
minItems: 1
70+
container:
71+
title: The container name running the gameserver
72+
description: if there is more than one container, specify which one is the game server
73+
type: string
74+
minLength: 0
75+
maxLength: 63
76+
pattern: "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
77+
portPolicy:
78+
title: the port policy that will be applied to the game server
79+
description: |
80+
portPolicy has two options:
81+
- "dynamic" (default) the system allocates a free hostPort for the gameserver, for game clients to connect to
82+
- "static", user defines the hostPort that the game client will connect to. Then onus is on the user to ensure that the
83+
port is available. When static is the policy specified, `hostPort` is required to be populated
84+
type: string
85+
enum:
86+
- dynamic
87+
- static
88+
protocol:
89+
title: Protocol being used. Defaults to UDP. TCP is the only other option
90+
type: string
91+
enum:
92+
- UDP
93+
- TCP
94+
containerPort:
95+
title: The port that is being opened on the game server process
96+
type: integer
97+
minimum: 0
98+
maximum: 65535
99+
hostPort:
100+
title: The port exposed on the host
101+
description: Only required when `portPolicy` is "static". Overwritten when portPolicy is "dynamic".
102+
type: integer
103+
minimum: 0
104+
maximum: 65535
105+
health:
106+
type: object
107+
title: Health checking for the running game server
108+
properties:
109+
disabled:
110+
title: Disable health checking. defaults to false, but can be set to true
111+
type: boolean
112+
initialDelaySeconds:
113+
title: Number of seconds after the container has started before health check is initiated. Defaults to 5 seconds
114+
type: integer
115+
minimum: 0
116+
maximum: 2147483648
117+
periodSeconds:
118+
title: How long before the server is considered not healthy
119+
type: integer
120+
minimum: 0
121+
maximum: 2147483648
122+
failureThreshold:
123+
title: Minimum consecutive failures for the health probe to be considered failed after having succeeded.
124+
type: integer
125+
minimum: 1
126+
maximum: 2147483648
34127
---
35128
apiVersion: extensions/v1beta1
36129
kind: Deployment

0 commit comments

Comments
 (0)