Skip to content

Commit 6bcba1c

Browse files
committed
Configuration options for webhooks running in hub cluster
Signed-off-by: Ben Perry <[email protected]>
1 parent ade1c7c commit 6bcba1c

File tree

4 files changed

+201
-13
lines changed

4 files changed

+201
-13
lines changed

operator/v1/0000_01_operator.open-cluster-management.io_clustermanagers.crd.yaml

Lines changed: 121 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,85 @@ spec:
9191
DeployOption contains the options of deploying a cluster-manager
9292
Default mode is used if DeployOption is not set.
9393
properties:
94+
default:
95+
description: Default includes configurations for clustermanager
96+
in the Default mode
97+
properties:
98+
registrationWebhookConfiguration:
99+
description: RegistrationWebhookConfiguration represents the
100+
customized webhook-server configuration of registration.
101+
properties:
102+
address:
103+
description: |-
104+
Address represents the address of a webhook-server.
105+
It could be in IP format or fqdn format.
106+
The Address must be reachable by apiserver of the hub cluster.
107+
pattern: ^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$
108+
type: string
109+
healthProbeBindAddress:
110+
default: :8000
111+
description: |-
112+
HealthProbeBindAddress represents the healthcheck address of a webhook-server. The default value is ":8000".
113+
Healthchecks may be disabled by setting a value of "0" or "".
114+
type: string
115+
hostNetwork:
116+
description: |-
117+
HostNetwork enables running webhook pods with hostNetwork: true
118+
This may be required in some installations, such as EKS with Calico CNI,
119+
to allow the API Server to communicate with the webhook pods.
120+
type: boolean
121+
metricsBindAddress:
122+
default: :8080
123+
description: |-
124+
MetricsBindAddress represents the metrics address of a webhook-server. The default value is ":8080"
125+
Metrics may be disabled by setting a value of "0" or "".
126+
type: string
127+
port:
128+
default: 443
129+
description: Port represents the port of a webhook-server.
130+
The default value of Port is 443.
131+
format: int32
132+
maximum: 65535
133+
type: integer
134+
type: object
135+
workWebhookConfiguration:
136+
description: WorkWebhookConfiguration represents the customized
137+
webhook-server configuration of work.
138+
properties:
139+
address:
140+
description: |-
141+
Address represents the address of a webhook-server.
142+
It could be in IP format or fqdn format.
143+
The Address must be reachable by apiserver of the hub cluster.
144+
pattern: ^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$
145+
type: string
146+
healthProbeBindAddress:
147+
default: :8000
148+
description: |-
149+
HealthProbeBindAddress represents the healthcheck address of a webhook-server. The default value is ":8000".
150+
Healthchecks may be disabled by setting a value of "0" or "".
151+
type: string
152+
hostNetwork:
153+
description: |-
154+
HostNetwork enables running webhook pods with hostNetwork: true
155+
This may be required in some installations, such as EKS with Calico CNI,
156+
to allow the API Server to communicate with the webhook pods.
157+
type: boolean
158+
metricsBindAddress:
159+
default: :8080
160+
description: |-
161+
MetricsBindAddress represents the metrics address of a webhook-server. The default value is ":8080"
162+
Metrics may be disabled by setting a value of "0" or "".
163+
type: string
164+
port:
165+
default: 443
166+
description: Port represents the port of a webhook-server.
167+
The default value of Port is 443.
168+
format: int32
169+
maximum: 65535
170+
type: integer
171+
type: object
172+
type: object
94173
hosted:
95174
description: Hosted includes configurations we need for clustermanager
96175
in the Hosted mode.
@@ -106,16 +185,35 @@ spec:
106185
The Address must be reachable by apiserver of the hub cluster.
107186
pattern: ^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$
108187
type: string
188+
healthProbeBindAddress:
189+
default: :8000
190+
description: |-
191+
HealthProbeBindAddress represents the healthcheck address of a webhook-server. The default value is ":8000".
192+
Healthchecks may be disabled by setting a value of "0" or "".
193+
type: string
194+
hostNetwork:
195+
description: |-
196+
HostNetwork enables running webhook pods with hostNetwork: true
197+
This may be required in some installations, such as EKS with Calico CNI,
198+
to allow the API Server to communicate with the webhook pods.
199+
type: boolean
200+
metricsBindAddress:
201+
default: :8080
202+
description: |-
203+
MetricsBindAddress represents the metrics address of a webhook-server. The default value is ":8080"
204+
Metrics may be disabled by setting a value of "0" or "".
205+
type: string
109206
port:
110207
default: 443
111208
description: Port represents the port of a webhook-server.
112209
The default value of Port is 443.
113210
format: int32
114211
maximum: 65535
115212
type: integer
116-
required:
117-
- address
118213
type: object
214+
x-kubernetes-validations:
215+
- message: Address is required for hosted webhook configuration
216+
rule: self.Address != ''
119217
workWebhookConfiguration:
120218
description: WorkWebhookConfiguration represents the customized
121219
webhook-server configuration of work.
@@ -127,16 +225,35 @@ spec:
127225
The Address must be reachable by apiserver of the hub cluster.
128226
pattern: ^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$
129227
type: string
228+
healthProbeBindAddress:
229+
default: :8000
230+
description: |-
231+
HealthProbeBindAddress represents the healthcheck address of a webhook-server. The default value is ":8000".
232+
Healthchecks may be disabled by setting a value of "0" or "".
233+
type: string
234+
hostNetwork:
235+
description: |-
236+
HostNetwork enables running webhook pods with hostNetwork: true
237+
This may be required in some installations, such as EKS with Calico CNI,
238+
to allow the API Server to communicate with the webhook pods.
239+
type: boolean
240+
metricsBindAddress:
241+
default: :8080
242+
description: |-
243+
MetricsBindAddress represents the metrics address of a webhook-server. The default value is ":8080"
244+
Metrics may be disabled by setting a value of "0" or "".
245+
type: string
130246
port:
131247
default: 443
132248
description: Port represents the port of a webhook-server.
133249
The default value of Port is 443.
134250
format: int32
135251
maximum: 65535
136252
type: integer
137-
required:
138-
- address
139253
type: object
254+
x-kubernetes-validations:
255+
- message: Address is required for hosted webhook configuration
256+
rule: self.Address != ''
140257
type: object
141258
mode:
142259
default: Default

operator/v1/types_clustermanager.go

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,24 +232,36 @@ const (
232232
FeatureGateModeTypeDisable FeatureGateModeType = "Disable"
233233
)
234234

235+
// DefaultClusterManagerConfiguration represents customized configurations for clustermanager in the Default mode
236+
type DefaultClusterManagerConfiguration struct {
237+
// RegistrationWebhookConfiguration represents the customized webhook-server configuration of registration.
238+
// +optional
239+
RegistrationWebhookConfiguration WebhookConfiguration `json:"registrationWebhookConfiguration,omitempty"`
240+
241+
// WorkWebhookConfiguration represents the customized webhook-server configuration of work.
242+
// +optional
243+
WorkWebhookConfiguration WebhookConfiguration `json:"workWebhookConfiguration,omitempty"`
244+
}
245+
235246
// HostedClusterManagerConfiguration represents customized configurations we need to set for clustermanager in the Hosted mode.
236247
type HostedClusterManagerConfiguration struct {
237248
// RegistrationWebhookConfiguration represents the customized webhook-server configuration of registration.
238249
// +optional
250+
// +kubebuilder:validation:XValidation:rule="self.Address != ''",message="Address is required for hosted webhook configuration"
239251
RegistrationWebhookConfiguration WebhookConfiguration `json:"registrationWebhookConfiguration,omitempty"`
240252

241253
// WorkWebhookConfiguration represents the customized webhook-server configuration of work.
242254
// +optional
255+
// +kubebuilder:validation:XValidation:rule="self.Address != ''",message="Address is required for hosted webhook configuration"
243256
WorkWebhookConfiguration WebhookConfiguration `json:"workWebhookConfiguration,omitempty"`
244257
}
245258

246-
// WebhookConfiguration has two properties: Address and Port.
259+
// WebhookConfiguration represents customization of webhook servers
247260
type WebhookConfiguration struct {
248261
// Address represents the address of a webhook-server.
249262
// It could be in IP format or fqdn format.
250263
// The Address must be reachable by apiserver of the hub cluster.
251-
// +required
252-
// +kubebuilder:validation:Required
264+
// +optional
253265
// +kubebuilder:validation:Pattern=^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$
254266
Address string `json:"address"`
255267

@@ -258,6 +270,24 @@ type WebhookConfiguration struct {
258270
// +kubebuilder:default=443
259271
// +kubebuilder:validation:Maximum=65535
260272
Port int32 `json:"port,omitempty"`
273+
274+
// HealthProbeBindAddress represents the healthcheck address of a webhook-server. The default value is ":8000".
275+
// Healthchecks may be disabled by setting a value of "0" or "".
276+
// +optional
277+
// +kubebuilder:default=":8000"
278+
HealthProbeBindAddress string `json:"healthProbeBindAddress"`
279+
280+
// MetricsBindAddress represents the metrics address of a webhook-server. The default value is ":8080"
281+
// Metrics may be disabled by setting a value of "0" or "".
282+
// +optional
283+
// +kubebuilder:default=":8080"
284+
MetricsBindAddress string `json:"metricsBindAddress"`
285+
286+
// HostNetwork enables running webhook pods with hostNetwork: true
287+
// This may be required in some installations, such as EKS with Calico CNI,
288+
// to allow the API Server to communicate with the webhook pods.
289+
// +optional
290+
HostNetwork bool `json:"hostNetwork,omitempty"`
261291
}
262292

263293
// ClusterManagerDeployOption describes the deployment options for cluster-manager
@@ -274,6 +304,10 @@ type ClusterManagerDeployOption struct {
274304
// +kubebuilder:validation:Enum=Default;Hosted
275305
Mode InstallMode `json:"mode,omitempty"`
276306

307+
// Default includes configurations for clustermanager in the Default mode
308+
// +optional
309+
Default *DefaultClusterManagerConfiguration `json:"default,omitempty"`
310+
277311
// Hosted includes configurations we need for clustermanager in the Hosted mode.
278312
// +optional
279313
Hosted *HostedClusterManagerConfiguration `json:"hosted,omitempty"`

operator/v1/zz_generated.deepcopy.go

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

operator/v1/zz_generated.swagger_doc_generated.go

Lines changed: 20 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)