@@ -171,8 +171,10 @@ const (
171
171
type WebhookDescription struct {
172
172
GenerateName string `json:"generateName"`
173
173
// +kubebuilder:validation:Enum=ValidatingAdmissionWebhook;MutatingAdmissionWebhook;ConversionWebhook
174
- Type WebhookAdmissionType `json:"type"`
175
- DeploymentName string `json:"deploymentName,omitempty"`
174
+ Type WebhookAdmissionType `json:"type"`
175
+ DeploymentName string `json:"deploymentName,omitempty"`
176
+ // +kubebuilder:validation:Maximum=65535
177
+ // +kubebuilder:validation:Minimum=1
176
178
ContainerPort int32 `json:"containerPort,omitempty"`
177
179
TargetPort * intstr.IntOrString `json:"targetPort,omitempty"`
178
180
Rules []admissionregistrationv1.RuleWithOperations `json:"rules,omitempty"`
@@ -189,6 +191,9 @@ type WebhookDescription struct {
189
191
190
192
// GetValidatingWebhook returns a ValidatingWebhook generated from the WebhookDescription
191
193
func (w * WebhookDescription ) GetValidatingWebhook (namespace string , namespaceSelector * metav1.LabelSelector , caBundle []byte ) admissionregistrationv1.ValidatingWebhook {
194
+ if w .ContainerPort == 0 {
195
+ w .ContainerPort = 443
196
+ }
192
197
return admissionregistrationv1.ValidatingWebhook {
193
198
Name : w .GenerateName ,
194
199
Rules : w .Rules ,
@@ -213,6 +218,9 @@ func (w *WebhookDescription) GetValidatingWebhook(namespace string, namespaceSel
213
218
214
219
// GetMutatingWebhook returns a MutatingWebhook generated from the WebhookDescription
215
220
func (w * WebhookDescription ) GetMutatingWebhook (namespace string , namespaceSelector * metav1.LabelSelector , caBundle []byte ) admissionregistrationv1.MutatingWebhook {
221
+ if w .ContainerPort == 0 {
222
+ w .ContainerPort = 443
223
+ }
216
224
return admissionregistrationv1.MutatingWebhook {
217
225
Name : w .GenerateName ,
218
226
Rules : w .Rules ,
0 commit comments