From b7ae59fda504506ba3b1fc474ad9869b33aaf349 Mon Sep 17 00:00:00 2001 From: Camila Macedo Date: Mon, 20 May 2024 23:28:31 +0100 Subject: [PATCH] fix: preserve existing flags when applying metrics patch Ensure that enabling the manager_metrics_patch.yaml in config/default/kustomization.yaml does not overwrite existing arguments in config/manager/manager.yaml. The patch now appends the --metrics-bind-address argument without replacing other arguments. More info: https://github.com/kubernetes-sigs/kubebuilder/issues/3934 --- docs/book/src/cronjob-tutorial/testdata/project/cmd/main.go | 2 +- docs/book/src/getting-started/testdata/project/cmd/main.go | 2 +- pkg/plugins/golang/v4/scaffolds/internal/templates/main.go | 2 +- testdata/project-v4-multigroup-with-deploy-image/cmd/main.go | 2 +- testdata/project-v4-multigroup/cmd/main.go | 2 +- testdata/project-v4-with-deploy-image/cmd/main.go | 2 +- testdata/project-v4-with-grafana/cmd/main.go | 2 +- testdata/project-v4/cmd/main.go | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) 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 47916012091..0980ddc2894 100644 --- a/docs/book/src/cronjob-tutorial/testdata/project/cmd/main.go +++ b/docs/book/src/cronjob-tutorial/testdata/project/cmd/main.go @@ -77,7 +77,7 @@ func main() { var secureMetrics bool var enableHTTP2 bool flag.StringVar(&metricsAddr, "metrics-bind-address", "0", "The address the metric endpoint binds to. "+ - "Use the port :8080. If not set, it will be '0 in order to disable the metrics server") + "Use the port :8080. If not set, it will be '0' in order to disable the metrics server") flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.") flag.BoolVar(&enableLeaderElection, "leader-elect", false, "Enable leader election for controller manager. "+ 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 4080fea876f..3d097771792 100644 --- a/docs/book/src/getting-started/testdata/project/cmd/main.go +++ b/docs/book/src/getting-started/testdata/project/cmd/main.go @@ -58,7 +58,7 @@ func main() { var secureMetrics bool var enableHTTP2 bool flag.StringVar(&metricsAddr, "metrics-bind-address", "0", "The address the metric endpoint binds to. "+ - "Use the port :8080. If not set, it will be '0 in order to disable the metrics server") + "Use the port :8080. If not set, it will be '0' in order to disable the metrics server") flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.") flag.BoolVar(&enableLeaderElection, "leader-elect", false, "Enable leader election for controller manager. "+ diff --git a/pkg/plugins/golang/v4/scaffolds/internal/templates/main.go b/pkg/plugins/golang/v4/scaffolds/internal/templates/main.go index e645a7833ce..a4e94d804dd 100644 --- a/pkg/plugins/golang/v4/scaffolds/internal/templates/main.go +++ b/pkg/plugins/golang/v4/scaffolds/internal/templates/main.go @@ -223,7 +223,7 @@ func main() { var secureMetrics bool var enableHTTP2 bool flag.StringVar(&metricsAddr, "metrics-bind-address", "0", "The address the metric endpoint binds to. " + - "Use the port :8080. If not set, it will be '0 in order to disable the metrics server") + "Use the port :8080. If not set, it will be '0' in order to disable the metrics server") flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.") flag.BoolVar(&enableLeaderElection, "leader-elect", false, "Enable leader election for controller manager. " + diff --git a/testdata/project-v4-multigroup-with-deploy-image/cmd/main.go b/testdata/project-v4-multigroup-with-deploy-image/cmd/main.go index ca4f395ce28..f65a54556e5 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/cmd/main.go +++ b/testdata/project-v4-multigroup-with-deploy-image/cmd/main.go @@ -83,7 +83,7 @@ func main() { var secureMetrics bool var enableHTTP2 bool flag.StringVar(&metricsAddr, "metrics-bind-address", "0", "The address the metric endpoint binds to. "+ - "Use the port :8080. If not set, it will be '0 in order to disable the metrics server") + "Use the port :8080. If not set, it will be '0' in order to disable the metrics server") flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.") flag.BoolVar(&enableLeaderElection, "leader-elect", false, "Enable leader election for controller manager. "+ diff --git a/testdata/project-v4-multigroup/cmd/main.go b/testdata/project-v4-multigroup/cmd/main.go index d52dc885d69..65d7f957a8e 100644 --- a/testdata/project-v4-multigroup/cmd/main.go +++ b/testdata/project-v4-multigroup/cmd/main.go @@ -83,7 +83,7 @@ func main() { var secureMetrics bool var enableHTTP2 bool flag.StringVar(&metricsAddr, "metrics-bind-address", "0", "The address the metric endpoint binds to. "+ - "Use the port :8080. If not set, it will be '0 in order to disable the metrics server") + "Use the port :8080. If not set, it will be '0' in order to disable the metrics server") flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.") flag.BoolVar(&enableLeaderElection, "leader-elect", false, "Enable leader election for controller manager. "+ diff --git a/testdata/project-v4-with-deploy-image/cmd/main.go b/testdata/project-v4-with-deploy-image/cmd/main.go index 69c4e59787e..bf0bda4b972 100644 --- a/testdata/project-v4-with-deploy-image/cmd/main.go +++ b/testdata/project-v4-with-deploy-image/cmd/main.go @@ -58,7 +58,7 @@ func main() { var secureMetrics bool var enableHTTP2 bool flag.StringVar(&metricsAddr, "metrics-bind-address", "0", "The address the metric endpoint binds to. "+ - "Use the port :8080. If not set, it will be '0 in order to disable the metrics server") + "Use the port :8080. If not set, it will be '0' in order to disable the metrics server") flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.") flag.BoolVar(&enableLeaderElection, "leader-elect", false, "Enable leader election for controller manager. "+ diff --git a/testdata/project-v4-with-grafana/cmd/main.go b/testdata/project-v4-with-grafana/cmd/main.go index 0be97f24e67..58dd6866133 100644 --- a/testdata/project-v4-with-grafana/cmd/main.go +++ b/testdata/project-v4-with-grafana/cmd/main.go @@ -54,7 +54,7 @@ func main() { var secureMetrics bool var enableHTTP2 bool flag.StringVar(&metricsAddr, "metrics-bind-address", "0", "The address the metric endpoint binds to. "+ - "Use the port :8080. If not set, it will be '0 in order to disable the metrics server") + "Use the port :8080. If not set, it will be '0' in order to disable the metrics server") flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.") flag.BoolVar(&enableLeaderElection, "leader-elect", false, "Enable leader election for controller manager. "+ diff --git a/testdata/project-v4/cmd/main.go b/testdata/project-v4/cmd/main.go index cf3ed516747..0d955645583 100644 --- a/testdata/project-v4/cmd/main.go +++ b/testdata/project-v4/cmd/main.go @@ -58,7 +58,7 @@ func main() { var secureMetrics bool var enableHTTP2 bool flag.StringVar(&metricsAddr, "metrics-bind-address", "0", "The address the metric endpoint binds to. "+ - "Use the port :8080. If not set, it will be '0 in order to disable the metrics server") + "Use the port :8080. If not set, it will be '0' in order to disable the metrics server") flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.") flag.BoolVar(&enableLeaderElection, "leader-elect", false, "Enable leader election for controller manager. "+