Skip to content

Commit b859cf1

Browse files
committed
Networking configuration options for webhooks
Signed-off-by: Ben Perry <[email protected]>
1 parent ade1c7c commit b859cf1

File tree

5 files changed

+270
-25
lines changed

5 files changed

+270
-25
lines changed

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

Lines changed: 99 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,69 @@ 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+
healthProbeBindAddress:
103+
default: :8000
104+
description: |-
105+
HealthProbeBindAddress represents the healthcheck address of a webhook-server. The default value is ":8000".
106+
Healthchecks may be disabled by setting a value of "0" or "".
107+
type: string
108+
hostNetwork:
109+
description: |-
110+
HostNetwork enables running webhook pods with hostNetwork: true
111+
This may be required in some installations, such as EKS with Calico CNI,
112+
to allow the API Server to communicate with the webhook pods.
113+
type: boolean
114+
metricsBindAddress:
115+
default: :8080
116+
description: |-
117+
MetricsBindAddress represents the metrics address of a webhook-server. The default value is ":8080"
118+
Metrics may be disabled by setting a value of "0" or "".
119+
type: string
120+
port:
121+
description: Port represents the port of a webhook-server.
122+
The default value of Port is 9443.
123+
format: int32
124+
maximum: 65535
125+
type: integer
126+
type: object
127+
workWebhookConfiguration:
128+
description: WorkWebhookConfiguration represents the customized
129+
webhook-server configuration of work.
130+
properties:
131+
healthProbeBindAddress:
132+
default: :8000
133+
description: |-
134+
HealthProbeBindAddress represents the healthcheck address of a webhook-server. The default value is ":8000".
135+
Healthchecks may be disabled by setting a value of "0" or "".
136+
type: string
137+
hostNetwork:
138+
description: |-
139+
HostNetwork enables running webhook pods with hostNetwork: true
140+
This may be required in some installations, such as EKS with Calico CNI,
141+
to allow the API Server to communicate with the webhook pods.
142+
type: boolean
143+
metricsBindAddress:
144+
default: :8080
145+
description: |-
146+
MetricsBindAddress represents the metrics address of a webhook-server. The default value is ":8080"
147+
Metrics may be disabled by setting a value of "0" or "".
148+
type: string
149+
port:
150+
description: Port represents the port of a webhook-server.
151+
The default value of Port is 9443.
152+
format: int32
153+
maximum: 65535
154+
type: integer
155+
type: object
156+
type: object
94157
hosted:
95158
description: Hosted includes configurations we need for clustermanager
96159
in the Hosted mode.
@@ -106,8 +169,25 @@ spec:
106169
The Address must be reachable by apiserver of the hub cluster.
107170
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])$
108171
type: string
172+
healthProbeBindAddress:
173+
default: :8000
174+
description: |-
175+
HealthProbeBindAddress represents the healthcheck address of a webhook-server. The default value is ":8000".
176+
Healthchecks may be disabled by setting a value of "0" or "".
177+
type: string
178+
hostNetwork:
179+
description: |-
180+
HostNetwork enables running webhook pods with hostNetwork: true
181+
This may be required in some installations, such as EKS with Calico CNI,
182+
to allow the API Server to communicate with the webhook pods.
183+
type: boolean
184+
metricsBindAddress:
185+
default: :8080
186+
description: |-
187+
MetricsBindAddress represents the metrics address of a webhook-server. The default value is ":8080"
188+
Metrics may be disabled by setting a value of "0" or "".
189+
type: string
109190
port:
110-
default: 443
111191
description: Port represents the port of a webhook-server.
112192
The default value of Port is 443.
113193
format: int32
@@ -127,8 +207,25 @@ spec:
127207
The Address must be reachable by apiserver of the hub cluster.
128208
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])$
129209
type: string
210+
healthProbeBindAddress:
211+
default: :8000
212+
description: |-
213+
HealthProbeBindAddress represents the healthcheck address of a webhook-server. The default value is ":8000".
214+
Healthchecks may be disabled by setting a value of "0" or "".
215+
type: string
216+
hostNetwork:
217+
description: |-
218+
HostNetwork enables running webhook pods with hostNetwork: true
219+
This may be required in some installations, such as EKS with Calico CNI,
220+
to allow the API Server to communicate with the webhook pods.
221+
type: boolean
222+
metricsBindAddress:
223+
default: :8080
224+
description: |-
225+
MetricsBindAddress represents the metrics address of a webhook-server. The default value is ":8080"
226+
Metrics may be disabled by setting a value of "0" or "".
227+
type: string
130228
port:
131-
default: 443
132229
description: Port represents the port of a webhook-server.
133230
The default value of Port is 443.
134231
format: int32

operator/v1/types_clustermanager.go

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,19 +232,62 @@ 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 DefaultWebhookConfiguration `json:"registrationWebhookConfiguration,omitempty"`
240+
241+
// WorkWebhookConfiguration represents the customized webhook-server configuration of work.
242+
// +optional
243+
WorkWebhookConfiguration DefaultWebhookConfiguration `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
239-
RegistrationWebhookConfiguration WebhookConfiguration `json:"registrationWebhookConfiguration,omitempty"`
250+
RegistrationWebhookConfiguration HostedWebhookConfiguration `json:"registrationWebhookConfiguration,omitempty"`
240251

241252
// WorkWebhookConfiguration represents the customized webhook-server configuration of work.
242253
// +optional
243-
WorkWebhookConfiguration WebhookConfiguration `json:"workWebhookConfiguration,omitempty"`
254+
WorkWebhookConfiguration HostedWebhookConfiguration `json:"workWebhookConfiguration,omitempty"`
244255
}
245256

246-
// WebhookConfiguration has two properties: Address and Port.
257+
// WebhookConfiguration represents customization of webhook servers
247258
type WebhookConfiguration struct {
259+
// HealthProbeBindAddress represents the healthcheck address of a webhook-server. The default value is ":8000".
260+
// Healthchecks may be disabled by setting a value of "0" or "".
261+
// +optional
262+
// +kubebuilder:default=":8000"
263+
HealthProbeBindAddress string `json:"healthProbeBindAddress"`
264+
265+
// MetricsBindAddress represents the metrics address of a webhook-server. The default value is ":8080"
266+
// Metrics may be disabled by setting a value of "0" or "".
267+
// +optional
268+
// +kubebuilder:default=":8080"
269+
MetricsBindAddress string `json:"metricsBindAddress"`
270+
271+
// HostNetwork enables running webhook pods with hostNetwork: true
272+
// This may be required in some installations, such as EKS with Calico CNI,
273+
// to allow the API Server to communicate with the webhook pods.
274+
// +optional
275+
HostNetwork bool `json:"hostNetwork,omitempty"`
276+
}
277+
278+
// DefaultWebhookConfiguration represents customization of webhook servers running in default installation mode
279+
type DefaultWebhookConfiguration struct {
280+
// Port represents the port of a webhook-server. The default value of Port is 9443.
281+
// +optional
282+
// +kubebuilder:validation:Default=9443
283+
// +kubebuilder:validation:Maximum=65535
284+
Port int32 `json:"port,omitempty"`
285+
286+
WebhookConfiguration `json:",inline"`
287+
}
288+
289+
// HostedWebhookConfiguration represents customization of webhook servers running in hosted installation mode
290+
type HostedWebhookConfiguration struct {
248291
// Address represents the address of a webhook-server.
249292
// It could be in IP format or fqdn format.
250293
// The Address must be reachable by apiserver of the hub cluster.
@@ -255,9 +298,11 @@ type WebhookConfiguration struct {
255298

256299
// Port represents the port of a webhook-server. The default value of Port is 443.
257300
// +optional
258-
// +kubebuilder:default=443
301+
// +kubebuilder:validation:Default=443
259302
// +kubebuilder:validation:Maximum=65535
260303
Port int32 `json:"port,omitempty"`
304+
305+
WebhookConfiguration `json:",inline"`
261306
}
262307

263308
// ClusterManagerDeployOption describes the deployment options for cluster-manager
@@ -274,6 +319,10 @@ type ClusterManagerDeployOption struct {
274319
// +kubebuilder:validation:Enum=Default;Hosted
275320
Mode InstallMode `json:"mode,omitempty"`
276321

322+
// Default includes configurations for clustermanager in the Default mode
323+
// +optional
324+
Default *DefaultClusterManagerConfiguration `json:"default,omitempty"`
325+
277326
// Hosted includes configurations we need for clustermanager in the Hosted mode.
278327
// +optional
279328
Hosted *HostedClusterManagerConfiguration `json:"hosted,omitempty"`

operator/v1/zz_generated.deepcopy.go

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

0 commit comments

Comments
 (0)