diff --git a/docs/book/src/cronjob-tutorial/testdata/project/cmd/main.go b/docs/book/src/cronjob-tutorial/testdata/project/cmd/main.go index 4b38ad74df8..470e949255d 100644 --- a/docs/book/src/cronjob-tutorial/testdata/project/cmd/main.go +++ b/docs/book/src/cronjob-tutorial/testdata/project/cmd/main.go @@ -79,6 +79,7 @@ func main() { var metricsAddr string var metricsCertPath, metricsCertName, metricsCertKey string var webhookCertPath, webhookCertName, webhookCertKey string + var webhookPort int var enableLeaderElection bool var probeAddr string var secureMetrics bool @@ -95,6 +96,7 @@ func main() { flag.StringVar(&webhookCertPath, "webhook-cert-path", "", "The directory that contains the webhook certificate.") flag.StringVar(&webhookCertName, "webhook-cert-name", "tls.crt", "The name of the webhook certificate file.") flag.StringVar(&webhookCertKey, "webhook-cert-key", "tls.key", "The name of the webhook key file.") + flag.IntVar(&webhookPort, "webhook-port", 9443, "The port that the webhook endpoint binds to.") flag.StringVar(&metricsCertPath, "metrics-cert-path", "", "The directory that contains the metrics server certificate.") flag.StringVar(&metricsCertName, "metrics-cert-name", "tls.crt", "The name of the metrics server certificate file.") @@ -151,6 +153,7 @@ func main() { webhookServer := webhook.NewServer(webhook.Options{ TLSOpts: webhookTLSOpts, + Port: webhookPort, }) // Metrics endpoint is enabled in 'config/default/kustomization.yaml'. The Metrics options configure the server. diff --git a/docs/book/src/cronjob-tutorial/testdata/project/dist/chart/templates/manager/manager.yaml b/docs/book/src/cronjob-tutorial/testdata/project/dist/chart/templates/manager/manager.yaml index d21ba52a883..f934fd8a1e5 100644 --- a/docs/book/src/cronjob-tutorial/testdata/project/dist/chart/templates/manager/manager.yaml +++ b/docs/book/src/cronjob-tutorial/testdata/project/dist/chart/templates/manager/manager.yaml @@ -47,7 +47,7 @@ spec: {{- toYaml .Values.controllerManager.container.readinessProbe | nindent 12 }} {{- if .Values.webhook.enable }} ports: - - containerPort: 9443 + - containerPort: {{ .Values.webhook.port }} name: webhook-server protocol: TCP {{- end }} diff --git a/docs/book/src/cronjob-tutorial/testdata/project/dist/chart/templates/metrics/metrics-service.yaml b/docs/book/src/cronjob-tutorial/testdata/project/dist/chart/templates/metrics/metrics-service.yaml index ea32e21785b..a8a6559d818 100644 --- a/docs/book/src/cronjob-tutorial/testdata/project/dist/chart/templates/metrics/metrics-service.yaml +++ b/docs/book/src/cronjob-tutorial/testdata/project/dist/chart/templates/metrics/metrics-service.yaml @@ -9,8 +9,8 @@ metadata: control-plane: controller-manager spec: ports: - - port: 8443 - targetPort: 8443 + - port: {{ .Values.metrics.port }} + targetPort: {{ .Values.metrics.port }} protocol: TCP name: https selector: diff --git a/docs/book/src/cronjob-tutorial/testdata/project/dist/chart/templates/webhook/service.yaml b/docs/book/src/cronjob-tutorial/testdata/project/dist/chart/templates/webhook/service.yaml index 9dae918ebd1..63f1bcfc908 100644 --- a/docs/book/src/cronjob-tutorial/testdata/project/dist/chart/templates/webhook/service.yaml +++ b/docs/book/src/cronjob-tutorial/testdata/project/dist/chart/templates/webhook/service.yaml @@ -10,7 +10,7 @@ spec: ports: - port: 443 protocol: TCP - targetPort: 9443 + targetPort: {{ .Values.webhook.port }} selector: control-plane: controller-manager {{- end }} diff --git a/docs/book/src/cronjob-tutorial/testdata/project/dist/chart/values.yaml b/docs/book/src/cronjob-tutorial/testdata/project/dist/chart/values.yaml index 6f6e23f083c..aff8e833261 100644 --- a/docs/book/src/cronjob-tutorial/testdata/project/dist/chart/values.yaml +++ b/docs/book/src/cronjob-tutorial/testdata/project/dist/chart/values.yaml @@ -7,8 +7,9 @@ controllerManager: tag: latest args: - "--leader-elect" - - "--metrics-bind-address=:8443" + - "--metrics-bind-address=:{{ .Values.metrics.port }}" - "--health-probe-bind-address=:8081" + - "--webhook-port={{ .Values.webhook.port }}" resources: limits: cpu: 500m @@ -62,6 +63,7 @@ crd: # ControllerManager argument "--metrics-bind-address=:8443" is removed. metrics: enable: true + port: 8443 # [WEBHOOKS]: Webhooks configuration # The following configuration is automatically generated from the manifests @@ -69,6 +71,7 @@ metrics: # the edit command with the '--force' flag webhook: enable: true + port: 9443 # [PROMETHEUS]: To enable a ServiceMonitor to export metrics to Prometheus set true prometheus: diff --git a/docs/book/src/getting-started/testdata/project/cmd/main.go b/docs/book/src/getting-started/testdata/project/cmd/main.go index c752599b65d..e5a505a54e6 100644 --- a/docs/book/src/getting-started/testdata/project/cmd/main.go +++ b/docs/book/src/getting-started/testdata/project/cmd/main.go @@ -59,6 +59,7 @@ func main() { var metricsAddr string var metricsCertPath, metricsCertName, metricsCertKey string var webhookCertPath, webhookCertName, webhookCertKey string + var webhookPort int var enableLeaderElection bool var probeAddr string var secureMetrics bool @@ -75,6 +76,7 @@ func main() { flag.StringVar(&webhookCertPath, "webhook-cert-path", "", "The directory that contains the webhook certificate.") flag.StringVar(&webhookCertName, "webhook-cert-name", "tls.crt", "The name of the webhook certificate file.") flag.StringVar(&webhookCertKey, "webhook-cert-key", "tls.key", "The name of the webhook key file.") + flag.IntVar(&webhookPort, "webhook-port", 9443, "The port that the webhook endpoint binds to.") flag.StringVar(&metricsCertPath, "metrics-cert-path", "", "The directory that contains the metrics server certificate.") flag.StringVar(&metricsCertName, "metrics-cert-name", "tls.crt", "The name of the metrics server certificate file.") @@ -131,6 +133,7 @@ func main() { webhookServer := webhook.NewServer(webhook.Options{ TLSOpts: webhookTLSOpts, + Port: webhookPort, }) // Metrics endpoint is enabled in 'config/default/kustomization.yaml'. The Metrics options configure the server. diff --git a/docs/book/src/getting-started/testdata/project/dist/chart/templates/metrics/metrics-service.yaml b/docs/book/src/getting-started/testdata/project/dist/chart/templates/metrics/metrics-service.yaml index ea32e21785b..a8a6559d818 100644 --- a/docs/book/src/getting-started/testdata/project/dist/chart/templates/metrics/metrics-service.yaml +++ b/docs/book/src/getting-started/testdata/project/dist/chart/templates/metrics/metrics-service.yaml @@ -9,8 +9,8 @@ metadata: control-plane: controller-manager spec: ports: - - port: 8443 - targetPort: 8443 + - port: {{ .Values.metrics.port }} + targetPort: {{ .Values.metrics.port }} protocol: TCP name: https selector: diff --git a/docs/book/src/getting-started/testdata/project/dist/chart/values.yaml b/docs/book/src/getting-started/testdata/project/dist/chart/values.yaml index f1817cdd495..4cebdbb3ab0 100644 --- a/docs/book/src/getting-started/testdata/project/dist/chart/values.yaml +++ b/docs/book/src/getting-started/testdata/project/dist/chart/values.yaml @@ -7,7 +7,7 @@ controllerManager: tag: latest args: - "--leader-elect" - - "--metrics-bind-address=:8443" + - "--metrics-bind-address=:{{ .Values.metrics.port }}" - "--health-probe-bind-address=:8081" resources: limits: @@ -62,6 +62,7 @@ crd: # ControllerManager argument "--metrics-bind-address=:8443" is removed. metrics: enable: true + port: 8443 # [PROMETHEUS]: To enable a ServiceMonitor to export metrics to Prometheus set true prometheus: diff --git a/docs/book/src/multiversion-tutorial/testdata/project/cmd/main.go b/docs/book/src/multiversion-tutorial/testdata/project/cmd/main.go index 92a3dd9e95c..bd619515211 100644 --- a/docs/book/src/multiversion-tutorial/testdata/project/cmd/main.go +++ b/docs/book/src/multiversion-tutorial/testdata/project/cmd/main.go @@ -78,6 +78,7 @@ func main() { var metricsAddr string var metricsCertPath, metricsCertName, metricsCertKey string var webhookCertPath, webhookCertName, webhookCertKey string + var webhookPort int var enableLeaderElection bool var probeAddr string var secureMetrics bool @@ -94,6 +95,7 @@ func main() { flag.StringVar(&webhookCertPath, "webhook-cert-path", "", "The directory that contains the webhook certificate.") flag.StringVar(&webhookCertName, "webhook-cert-name", "tls.crt", "The name of the webhook certificate file.") flag.StringVar(&webhookCertKey, "webhook-cert-key", "tls.key", "The name of the webhook key file.") + flag.IntVar(&webhookPort, "webhook-port", 9443, "The port that the webhook endpoint binds to.") flag.StringVar(&metricsCertPath, "metrics-cert-path", "", "The directory that contains the metrics server certificate.") flag.StringVar(&metricsCertName, "metrics-cert-name", "tls.crt", "The name of the metrics server certificate file.") @@ -150,6 +152,7 @@ func main() { webhookServer := webhook.NewServer(webhook.Options{ TLSOpts: webhookTLSOpts, + Port: webhookPort, }) // Metrics endpoint is enabled in 'config/default/kustomization.yaml'. The Metrics options configure the server. diff --git a/docs/book/src/multiversion-tutorial/testdata/project/dist/chart/templates/manager/manager.yaml b/docs/book/src/multiversion-tutorial/testdata/project/dist/chart/templates/manager/manager.yaml index d21ba52a883..f934fd8a1e5 100644 --- a/docs/book/src/multiversion-tutorial/testdata/project/dist/chart/templates/manager/manager.yaml +++ b/docs/book/src/multiversion-tutorial/testdata/project/dist/chart/templates/manager/manager.yaml @@ -47,7 +47,7 @@ spec: {{- toYaml .Values.controllerManager.container.readinessProbe | nindent 12 }} {{- if .Values.webhook.enable }} ports: - - containerPort: 9443 + - containerPort: {{ .Values.webhook.port }} name: webhook-server protocol: TCP {{- end }} diff --git a/docs/book/src/multiversion-tutorial/testdata/project/dist/chart/templates/metrics/metrics-service.yaml b/docs/book/src/multiversion-tutorial/testdata/project/dist/chart/templates/metrics/metrics-service.yaml index ea32e21785b..a8a6559d818 100644 --- a/docs/book/src/multiversion-tutorial/testdata/project/dist/chart/templates/metrics/metrics-service.yaml +++ b/docs/book/src/multiversion-tutorial/testdata/project/dist/chart/templates/metrics/metrics-service.yaml @@ -9,8 +9,8 @@ metadata: control-plane: controller-manager spec: ports: - - port: 8443 - targetPort: 8443 + - port: {{ .Values.metrics.port }} + targetPort: {{ .Values.metrics.port }} protocol: TCP name: https selector: diff --git a/docs/book/src/multiversion-tutorial/testdata/project/dist/chart/templates/webhook/service.yaml b/docs/book/src/multiversion-tutorial/testdata/project/dist/chart/templates/webhook/service.yaml index 9dae918ebd1..63f1bcfc908 100644 --- a/docs/book/src/multiversion-tutorial/testdata/project/dist/chart/templates/webhook/service.yaml +++ b/docs/book/src/multiversion-tutorial/testdata/project/dist/chart/templates/webhook/service.yaml @@ -10,7 +10,7 @@ spec: ports: - port: 443 protocol: TCP - targetPort: 9443 + targetPort: {{ .Values.webhook.port }} selector: control-plane: controller-manager {{- end }} diff --git a/docs/book/src/multiversion-tutorial/testdata/project/dist/chart/values.yaml b/docs/book/src/multiversion-tutorial/testdata/project/dist/chart/values.yaml index 6f6e23f083c..aff8e833261 100644 --- a/docs/book/src/multiversion-tutorial/testdata/project/dist/chart/values.yaml +++ b/docs/book/src/multiversion-tutorial/testdata/project/dist/chart/values.yaml @@ -7,8 +7,9 @@ controllerManager: tag: latest args: - "--leader-elect" - - "--metrics-bind-address=:8443" + - "--metrics-bind-address=:{{ .Values.metrics.port }}" - "--health-probe-bind-address=:8081" + - "--webhook-port={{ .Values.webhook.port }}" resources: limits: cpu: 500m @@ -62,6 +63,7 @@ crd: # ControllerManager argument "--metrics-bind-address=:8443" is removed. metrics: enable: true + port: 8443 # [WEBHOOKS]: Webhooks configuration # The following configuration is automatically generated from the manifests @@ -69,6 +71,7 @@ metrics: # the edit command with the '--force' flag webhook: enable: true + port: 9443 # [PROMETHEUS]: To enable a ServiceMonitor to export metrics to Prometheus set true prometheus: diff --git a/pkg/plugins/golang/v4/scaffolds/internal/templates/cmd/main.go b/pkg/plugins/golang/v4/scaffolds/internal/templates/cmd/main.go index 52cf3886a8f..4df8cd84934 100644 --- a/pkg/plugins/golang/v4/scaffolds/internal/templates/cmd/main.go +++ b/pkg/plugins/golang/v4/scaffolds/internal/templates/cmd/main.go @@ -267,6 +267,7 @@ func main() { var metricsAddr string var metricsCertPath, metricsCertName, metricsCertKey string var webhookCertPath, webhookCertName, webhookCertKey string + var webhookPort int var enableLeaderElection bool var probeAddr string var secureMetrics bool @@ -283,6 +284,7 @@ func main() { flag.StringVar(&webhookCertPath, "webhook-cert-path", "", "The directory that contains the webhook certificate.") flag.StringVar(&webhookCertName, "webhook-cert-name", "tls.crt", "The name of the webhook certificate file.") flag.StringVar(&webhookCertKey, "webhook-cert-key", "tls.key", "The name of the webhook key file.") + flag.IntVar(&webhookPort, "webhook-port", 9443, "The port that the webhook endpoint binds to.") flag.StringVar(&metricsCertPath, "metrics-cert-path", "", "The directory that contains the metrics server certificate.") flag.StringVar(&metricsCertName, "metrics-cert-name", "tls.crt", "The name of the metrics server certificate file.") @@ -339,6 +341,7 @@ func main() { webhookServer := webhook.NewServer(webhook.Options{ TLSOpts: webhookTLSOpts, + Port: webhookPort, }) // Metrics endpoint is enabled in 'config/default/kustomization.yaml'. The Metrics options configure the server. diff --git a/pkg/plugins/optional/helm/v1alpha/scaffolds/internal/templates/chart-templates/manager/manager.go b/pkg/plugins/optional/helm/v1alpha/scaffolds/internal/templates/chart-templates/manager/manager.go index e6b2cdf36ba..7b8121ec21f 100644 --- a/pkg/plugins/optional/helm/v1alpha/scaffolds/internal/templates/chart-templates/manager/manager.go +++ b/pkg/plugins/optional/helm/v1alpha/scaffolds/internal/templates/chart-templates/manager/manager.go @@ -105,7 +105,7 @@ spec: {{- if .HasWebhooks }} {{ "{{- if .Values.webhook.enable }}" }} ports: - - containerPort: 9443 + - containerPort: {{ "{{ .Values.webhook.port }}" }} name: webhook-server protocol: TCP {{ "{{- end }}" }} diff --git a/pkg/plugins/optional/helm/v1alpha/scaffolds/internal/templates/chart-templates/metrics/metrics_service.go b/pkg/plugins/optional/helm/v1alpha/scaffolds/internal/templates/chart-templates/metrics/metrics_service.go index 06edd0d0757..02ecca36ca1 100644 --- a/pkg/plugins/optional/helm/v1alpha/scaffolds/internal/templates/chart-templates/metrics/metrics_service.go +++ b/pkg/plugins/optional/helm/v1alpha/scaffolds/internal/templates/chart-templates/metrics/metrics_service.go @@ -53,8 +53,8 @@ metadata: control-plane: controller-manager spec: ports: - - port: 8443 - targetPort: 8443 + - port: {{ "{{ .Values.metrics.port }}" }} + targetPort: {{ "{{ .Values.metrics.port }}" }} protocol: TCP name: https selector: diff --git a/pkg/plugins/optional/helm/v1alpha/scaffolds/internal/templates/chart-templates/webhook/service.go b/pkg/plugins/optional/helm/v1alpha/scaffolds/internal/templates/chart-templates/webhook/service.go index f29dac307f1..28c66f236eb 100644 --- a/pkg/plugins/optional/helm/v1alpha/scaffolds/internal/templates/chart-templates/webhook/service.go +++ b/pkg/plugins/optional/helm/v1alpha/scaffolds/internal/templates/chart-templates/webhook/service.go @@ -57,7 +57,7 @@ spec: ports: - port: 443 protocol: TCP - targetPort: 9443 + targetPort: {{ "{{ .Values.webhook.port }}" }} selector: control-plane: controller-manager {{` + "`" + `{{- end }}` + "`" + `}} diff --git a/pkg/plugins/optional/helm/v1alpha/scaffolds/internal/templates/values.go b/pkg/plugins/optional/helm/v1alpha/scaffolds/internal/templates/values.go index 86942894636..aa668125f79 100644 --- a/pkg/plugins/optional/helm/v1alpha/scaffolds/internal/templates/values.go +++ b/pkg/plugins/optional/helm/v1alpha/scaffolds/internal/templates/values.go @@ -61,8 +61,9 @@ controllerManager: tag: latest args: - "--leader-elect" - - "--metrics-bind-address=:8443" - - "--health-probe-bind-address=:8081" + - "--metrics-bind-address=:{{ "{{" }} .Values.metrics.port {{ "}}" }}" + - "--health-probe-bind-address=:8081"{{ if .HasWebhooks }} + - "--webhook-port={{ "{{" }} .Values.webhook.port {{ "}}" }}"{{ end }} resources: limits: cpu: 500m @@ -122,6 +123,7 @@ crd: # ControllerManager argument "--metrics-bind-address=:8443" is removed. metrics: enable: true + port: 8443 {{ if .HasWebhooks }} # [WEBHOOKS]: Webhooks configuration # The following configuration is automatically generated from the manifests @@ -129,6 +131,7 @@ metrics: # the edit command with the '--force' flag webhook: enable: true + port: 9443 {{ end }} # [PROMETHEUS]: To enable a ServiceMonitor to export metrics to Prometheus set true prometheus: diff --git a/testdata/project-v4-multigroup/cmd/main.go b/testdata/project-v4-multigroup/cmd/main.go index 4e230025f84..72ba38cc08f 100644 --- a/testdata/project-v4-multigroup/cmd/main.go +++ b/testdata/project-v4-multigroup/cmd/main.go @@ -100,6 +100,7 @@ func main() { var metricsAddr string var metricsCertPath, metricsCertName, metricsCertKey string var webhookCertPath, webhookCertName, webhookCertKey string + var webhookPort int var enableLeaderElection bool var probeAddr string var secureMetrics bool @@ -116,6 +117,7 @@ func main() { flag.StringVar(&webhookCertPath, "webhook-cert-path", "", "The directory that contains the webhook certificate.") flag.StringVar(&webhookCertName, "webhook-cert-name", "tls.crt", "The name of the webhook certificate file.") flag.StringVar(&webhookCertKey, "webhook-cert-key", "tls.key", "The name of the webhook key file.") + flag.IntVar(&webhookPort, "webhook-port", 9443, "The port that the webhook endpoint binds to.") flag.StringVar(&metricsCertPath, "metrics-cert-path", "", "The directory that contains the metrics server certificate.") flag.StringVar(&metricsCertName, "metrics-cert-name", "tls.crt", "The name of the metrics server certificate file.") @@ -172,6 +174,7 @@ func main() { webhookServer := webhook.NewServer(webhook.Options{ TLSOpts: webhookTLSOpts, + Port: webhookPort, }) // Metrics endpoint is enabled in 'config/default/kustomization.yaml'. The Metrics options configure the server. diff --git a/testdata/project-v4-with-plugins/cmd/main.go b/testdata/project-v4-with-plugins/cmd/main.go index f5c6727c399..c052f7f0610 100644 --- a/testdata/project-v4-with-plugins/cmd/main.go +++ b/testdata/project-v4-with-plugins/cmd/main.go @@ -65,6 +65,7 @@ func main() { var metricsAddr string var metricsCertPath, metricsCertName, metricsCertKey string var webhookCertPath, webhookCertName, webhookCertKey string + var webhookPort int var enableLeaderElection bool var probeAddr string var secureMetrics bool @@ -81,6 +82,7 @@ func main() { flag.StringVar(&webhookCertPath, "webhook-cert-path", "", "The directory that contains the webhook certificate.") flag.StringVar(&webhookCertName, "webhook-cert-name", "tls.crt", "The name of the webhook certificate file.") flag.StringVar(&webhookCertKey, "webhook-cert-key", "tls.key", "The name of the webhook key file.") + flag.IntVar(&webhookPort, "webhook-port", 9443, "The port that the webhook endpoint binds to.") flag.StringVar(&metricsCertPath, "metrics-cert-path", "", "The directory that contains the metrics server certificate.") flag.StringVar(&metricsCertName, "metrics-cert-name", "tls.crt", "The name of the metrics server certificate file.") @@ -137,6 +139,7 @@ func main() { webhookServer := webhook.NewServer(webhook.Options{ TLSOpts: webhookTLSOpts, + Port: webhookPort, }) // Metrics endpoint is enabled in 'config/default/kustomization.yaml'. The Metrics options configure the server. diff --git a/testdata/project-v4-with-plugins/dist/chart/templates/manager/manager.yaml b/testdata/project-v4-with-plugins/dist/chart/templates/manager/manager.yaml index f37cfc16711..73ac3f6b6b4 100644 --- a/testdata/project-v4-with-plugins/dist/chart/templates/manager/manager.yaml +++ b/testdata/project-v4-with-plugins/dist/chart/templates/manager/manager.yaml @@ -47,7 +47,7 @@ spec: {{- toYaml .Values.controllerManager.container.readinessProbe | nindent 12 }} {{- if .Values.webhook.enable }} ports: - - containerPort: 9443 + - containerPort: {{ .Values.webhook.port }} name: webhook-server protocol: TCP {{- end }} diff --git a/testdata/project-v4-with-plugins/dist/chart/templates/metrics/metrics-service.yaml b/testdata/project-v4-with-plugins/dist/chart/templates/metrics/metrics-service.yaml index d4ea4d3eed5..053b5b2b456 100644 --- a/testdata/project-v4-with-plugins/dist/chart/templates/metrics/metrics-service.yaml +++ b/testdata/project-v4-with-plugins/dist/chart/templates/metrics/metrics-service.yaml @@ -9,8 +9,8 @@ metadata: control-plane: controller-manager spec: ports: - - port: 8443 - targetPort: 8443 + - port: {{ .Values.metrics.port }} + targetPort: {{ .Values.metrics.port }} protocol: TCP name: https selector: diff --git a/testdata/project-v4-with-plugins/dist/chart/templates/webhook/service.yaml b/testdata/project-v4-with-plugins/dist/chart/templates/webhook/service.yaml index b3b2957e969..130579f3a7b 100644 --- a/testdata/project-v4-with-plugins/dist/chart/templates/webhook/service.yaml +++ b/testdata/project-v4-with-plugins/dist/chart/templates/webhook/service.yaml @@ -10,7 +10,7 @@ spec: ports: - port: 443 protocol: TCP - targetPort: 9443 + targetPort: {{ .Values.webhook.port }} selector: control-plane: controller-manager {{- end }} diff --git a/testdata/project-v4-with-plugins/dist/chart/values.yaml b/testdata/project-v4-with-plugins/dist/chart/values.yaml index 89757cd37f7..af4805d384d 100644 --- a/testdata/project-v4-with-plugins/dist/chart/values.yaml +++ b/testdata/project-v4-with-plugins/dist/chart/values.yaml @@ -7,8 +7,9 @@ controllerManager: tag: latest args: - "--leader-elect" - - "--metrics-bind-address=:8443" + - "--metrics-bind-address=:{{ .Values.metrics.port }}" - "--health-probe-bind-address=:8081" + - "--webhook-port={{ .Values.webhook.port }}" resources: limits: cpu: 500m @@ -65,6 +66,7 @@ crd: # ControllerManager argument "--metrics-bind-address=:8443" is removed. metrics: enable: true + port: 8443 # [WEBHOOKS]: Webhooks configuration # The following configuration is automatically generated from the manifests @@ -72,6 +74,7 @@ metrics: # the edit command with the '--force' flag webhook: enable: true + port: 9443 # [PROMETHEUS]: To enable a ServiceMonitor to export metrics to Prometheus set true prometheus: diff --git a/testdata/project-v4/cmd/main.go b/testdata/project-v4/cmd/main.go index 952eaeb6680..be923882381 100644 --- a/testdata/project-v4/cmd/main.go +++ b/testdata/project-v4/cmd/main.go @@ -65,6 +65,7 @@ func main() { var metricsAddr string var metricsCertPath, metricsCertName, metricsCertKey string var webhookCertPath, webhookCertName, webhookCertKey string + var webhookPort int var enableLeaderElection bool var probeAddr string var secureMetrics bool @@ -81,6 +82,7 @@ func main() { flag.StringVar(&webhookCertPath, "webhook-cert-path", "", "The directory that contains the webhook certificate.") flag.StringVar(&webhookCertName, "webhook-cert-name", "tls.crt", "The name of the webhook certificate file.") flag.StringVar(&webhookCertKey, "webhook-cert-key", "tls.key", "The name of the webhook key file.") + flag.IntVar(&webhookPort, "webhook-port", 9443, "The port that the webhook endpoint binds to.") flag.StringVar(&metricsCertPath, "metrics-cert-path", "", "The directory that contains the metrics server certificate.") flag.StringVar(&metricsCertName, "metrics-cert-name", "tls.crt", "The name of the metrics server certificate file.") @@ -137,6 +139,7 @@ func main() { webhookServer := webhook.NewServer(webhook.Options{ TLSOpts: webhookTLSOpts, + Port: webhookPort, }) // Metrics endpoint is enabled in 'config/default/kustomization.yaml'. The Metrics options configure the server.