From 72d46873f498e4ba3c6ec6abad04152772a399d3 Mon Sep 17 00:00:00 2001 From: Christopher Pitstick Date: Mon, 17 Jun 2024 15:39:00 -0400 Subject: [PATCH] Add bindPort Allows customization of the metrics bind port for the operator container. Signed-off-by: Christopher Pitstick --- chart/open-feature-operator/README.md | 3 +- chart/open-feature-operator/values.yaml | 6 +- config/manager/controller_manager_config.yaml | 3 +- .../helm/controller_manager_config.yaml | 2 +- config/overlays/helm/manager.yaml | 133 +++++++++--------- 5 files changed, 76 insertions(+), 71 deletions(-) diff --git a/chart/open-feature-operator/README.md b/chart/open-feature-operator/README.md index 5435e1d0a..72ca460fe 100644 --- a/chart/open-feature-operator/README.md +++ b/chart/open-feature-operator/README.md @@ -175,5 +175,6 @@ The command removes all the Kubernetes components associated with the chart and | `controllerManager.replicas` | Sets number of replicas of the OpenFeature operator pod. | `1` | | `managerConfig.flagsValidatonEnabled` | Enables the validating webhook for FeatureFlag CR. | `true` | | `managerConfig.controllerManagerConfigYaml.health.healthProbeBindAddress` | Sets the bind address for health probes. | `:8081` | -| `managerConfig.controllerManagerConfigYaml.metrics.bindAddress` | Sets the bind address for metrics. | `127.0.0.1:8080` | +| `managerConfig.controllerManagerConfigYaml.metrics.bindAddress` | Sets the bind address for metrics. | `127.0.0.1` | +| `managerConfig.controllerManagerConfigYaml.metrics.bindPort` | Sets the bind port for metrics. Distinct from address | `:8080` | | `managerConfig.controllerManagerConfigYaml.webhook.port` | Sets the bind address for webhook. | `9443` | diff --git a/chart/open-feature-operator/values.yaml b/chart/open-feature-operator/values.yaml index d05579c1f..95b66e874 100644 --- a/chart/open-feature-operator/values.yaml +++ b/chart/open-feature-operator/values.yaml @@ -148,8 +148,10 @@ managerConfig: ## @param managerConfig.controllerManagerConfigYaml.health.healthProbeBindAddress Sets the bind address for health probes. healthProbeBindAddress: :8081 metrics: - ## @param managerConfig.controllerManagerConfigYaml.metrics.bindAddress Sets the bind address for metrics. - bindAddress: 127.0.0.1:8080 + ## @param managerConfig.controllerManagerConfigYaml.metrics.bindAddress Sets the bind address for metrics (combined with bindPort). + bindAddress: 127.0.0.1 + ## @param managerConfig.controllerManagerConfigYaml.metrics.bindPort Sets the bind port for metrics. + bindPort: :8080 webhook: ## @param managerConfig.controllerManagerConfigYaml.webhook.port Sets the bind address for webhook. port: 9443 diff --git a/config/manager/controller_manager_config.yaml b/config/manager/controller_manager_config.yaml index ac7af565e..6e82e9901 100644 --- a/config/manager/controller_manager_config.yaml +++ b/config/manager/controller_manager_config.yaml @@ -3,7 +3,8 @@ kind: ControllerManagerConfig health: healthProbeBindAddress: :8081 metrics: - bindAddress: 127.0.0.1:8080 + bindAddress: 127.0.0.1 + bindPort: :8080 webhook: port: 9443 leaderElection: diff --git a/config/overlays/helm/controller_manager_config.yaml b/config/overlays/helm/controller_manager_config.yaml index 7c51b9112..d22dfac5c 100644 --- a/config/overlays/helm/controller_manager_config.yaml +++ b/config/overlays/helm/controller_manager_config.yaml @@ -3,6 +3,6 @@ kind: ControllerManagerConfig health: healthProbeBindAddress: "{{ .Values.managerConfig.controllerManagerConfigYaml.health.healthProbeBindAddress }}" metrics: - bindAddress: "{{ .Values.managerConfig.controllerManagerConfigYaml.metrics.bindAddress }}" + bindAddress: "{{ .Values.managerConfig.controllerManagerConfigYaml.metrics.bindAddress }}{{ .Values.managerConfig.controllerManagerConfigYaml.metrics.bindPort }}" webhook: port: 0{{ .Values.managerConfig.controllerManagerConfigYaml.webhook.port }} diff --git a/config/overlays/helm/manager.yaml b/config/overlays/helm/manager.yaml index ee92bbbd0..f3d8dc52f 100644 --- a/config/overlays/helm/manager.yaml +++ b/config/overlays/helm/manager.yaml @@ -20,72 +20,72 @@ spec: cpu: "{{ .Values.controllerManager.manager.resources.requests.cpu }}" memory: "{{ .Values.controllerManager.manager.resources.requests.memory }}" env: - - name: SIDECAR_MANAGEMENT_PORT - value: "{{ .Values.sidecarConfiguration.managementPort }}" - - name: SIDECAR_PORT - value: "{{ .Values.sidecarConfiguration.port }}" - - name: SIDECAR_SOCKET_PATH - value: "{{ .Values.sidecarConfiguration.socketPath }}" - - name: SIDECAR_IMAGE - value: "{{ .Values.sidecarConfiguration.image.repository }}" - - name: SIDECAR_TAG - value: "{{ .Values.sidecarConfiguration.image.tag }}" - - name: SIDECAR_PROVIDER_ARGS - value: "{{ .Values.sidecarConfiguration.providerArgs }}" - - name: SIDECAR_ENV_VAR_PREFIX - value: "{{ .Values.sidecarConfiguration.envVarPrefix }}" - - name: SIDECAR_SYNC_PROVIDER - value: "{{ .Values.sidecarConfiguration.defaultSyncProvider }}" - - name: SIDECAR_EVALUATOR - value: "{{ .Values.sidecarConfiguration.evaluator }}" - - name: SIDECAR_LOG_FORMAT - value: "{{ .Values.sidecarConfiguration.logFormat }}" - - name: SIDECAR_PROBES_ENABLED - value: "{{ .Values.sidecarConfiguration.probesEnabled }}" - - name: FLAGD_PROXY_IMAGE - value: "{{ .Values.flagdProxyConfiguration.image.repository }}" - - name: FLAGD_PROXY_TAG - value: "{{ .Values.flagdProxyConfiguration.image.tag }}" - - name: FLAGD_PROXY_PORT - value: "{{ .Values.flagdProxyConfiguration.port }}" - - name: FLAGD_PROXY_MANAGEMENT_PORT - value: "{{ .Values.flagdProxyConfiguration.managementPort }}" - - name: FLAGD_PROXY_DEBUG_LOGGING - value: "{{ .Values.flagdProxyConfiguration.debugLogging }}" - - name: FLAGD_IMAGE - value: "{{ .Values.flagdConfiguration.image.repository }}" - - name: FLAGD_TAG - value: "{{ .Values.flagdConfiguration.image.tag }}" - - name: FLAGD_PORT - value: "{{ .Values.flagdConfiguration.port }}" - - name: FLAGD_OFREP_PORT - value: "{{ .Values.flagdConfiguration.ofrepPort }}" - - name: FLAGD_SYNC_PORT - value: "{{ .Values.flagdConfiguration.syncPort }}" - - name: FLAGD_MANAGEMENT_PORT - value: "{{ .Values.flagdConfiguration.managementPort }}" - - name: FLAGD_DEBUG_LOGGING - value: "{{ .Values.flagdConfiguration.debugLogging }}" - - name: FLAGS_VALIDATION_ENABLED - value: "{{ .Values.managerConfig.flagsValidatonEnabled }}" - - name: IN_PROCESS_PORT - value: "{{ .Values.inProcessConfiguration.port }}" - - name: IN_PROCESS_HOST - value: "{{ .Values.inProcessConfiguration.host }}" - - name: IN_PROCESS_SOCKET_PATH - value: "{{ .Values.inProcessConfiguration.socketPath }}" - - name: IN_PROCESS_TLS - value: "{{ .Values.inProcessConfiguration.tls }}" - - name: IN_PROCESS_OFFLINE_FLAG_SOURCE_PATH - value: "{{ .Values.inProcessConfiguration.offlineFlagSourcePath }}" - - name: IN_PROCESS_SELECTOR - value: "{{ .Values.inProcessConfiguration.selector }}" - - name: IN_PROCESS_CACHE - value: "{{ .Values.inProcessConfiguration.cache.type }}" - - name: IN_PROCESS_ENV_VAR_PREFIX - value: "{{ .Values.inProcessConfiguration.envVarPrefix }}" - - name: IN_PROCESS_CACHE_MAX_SIZE - value: "{{ .Values.inProcessConfiguration.cache.size }}" + - name: SIDECAR_MANAGEMENT_PORT + value: "{{ .Values.sidecarConfiguration.managementPort }}" + - name: SIDECAR_PORT + value: "{{ .Values.sidecarConfiguration.port }}" + - name: SIDECAR_SOCKET_PATH + value: "{{ .Values.sidecarConfiguration.socketPath }}" + - name: SIDECAR_IMAGE + value: "{{ .Values.sidecarConfiguration.image.repository }}" + - name: SIDECAR_TAG + value: "{{ .Values.sidecarConfiguration.image.tag }}" + - name: SIDECAR_PROVIDER_ARGS + value: "{{ .Values.sidecarConfiguration.providerArgs }}" + - name: SIDECAR_ENV_VAR_PREFIX + value: "{{ .Values.sidecarConfiguration.envVarPrefix }}" + - name: SIDECAR_SYNC_PROVIDER + value: "{{ .Values.sidecarConfiguration.defaultSyncProvider }}" + - name: SIDECAR_EVALUATOR + value: "{{ .Values.sidecarConfiguration.evaluator }}" + - name: SIDECAR_LOG_FORMAT + value: "{{ .Values.sidecarConfiguration.logFormat }}" + - name: SIDECAR_PROBES_ENABLED + value: "{{ .Values.sidecarConfiguration.probesEnabled }}" + - name: FLAGD_PROXY_IMAGE + value: "{{ .Values.flagdProxyConfiguration.image.repository }}" + - name: FLAGD_PROXY_TAG + value: "{{ .Values.flagdProxyConfiguration.image.tag }}" + - name: FLAGD_PROXY_PORT + value: "{{ .Values.flagdProxyConfiguration.port }}" + - name: FLAGD_PROXY_MANAGEMENT_PORT + value: "{{ .Values.flagdProxyConfiguration.managementPort }}" + - name: FLAGD_PROXY_DEBUG_LOGGING + value: "{{ .Values.flagdProxyConfiguration.debugLogging }}" + - name: FLAGD_IMAGE + value: "{{ .Values.flagdConfiguration.image.repository }}" + - name: FLAGD_TAG + value: "{{ .Values.flagdConfiguration.image.tag }}" + - name: FLAGD_PORT + value: "{{ .Values.flagdConfiguration.port }}" + - name: FLAGD_OFREP_PORT + value: "{{ .Values.flagdConfiguration.ofrepPort }}" + - name: FLAGD_SYNC_PORT + value: "{{ .Values.flagdConfiguration.syncPort }}" + - name: FLAGD_MANAGEMENT_PORT + value: "{{ .Values.flagdConfiguration.managementPort }}" + - name: FLAGD_DEBUG_LOGGING + value: "{{ .Values.flagdConfiguration.debugLogging }}" + - name: FLAGS_VALIDATION_ENABLED + value: "{{ .Values.managerConfig.flagsValidatonEnabled }}" + - name: IN_PROCESS_PORT + value: "{{ .Values.inProcessConfiguration.port }}" + - name: IN_PROCESS_HOST + value: "{{ .Values.inProcessConfiguration.host }}" + - name: IN_PROCESS_SOCKET_PATH + value: "{{ .Values.inProcessConfiguration.socketPath }}" + - name: IN_PROCESS_TLS + value: "{{ .Values.inProcessConfiguration.tls }}" + - name: IN_PROCESS_OFFLINE_FLAG_SOURCE_PATH + value: "{{ .Values.inProcessConfiguration.offlineFlagSourcePath }}" + - name: IN_PROCESS_SELECTOR + value: "{{ .Values.inProcessConfiguration.selector }}" + - name: IN_PROCESS_CACHE + value: "{{ .Values.inProcessConfiguration.cache.type }}" + - name: IN_PROCESS_ENV_VAR_PREFIX + value: "{{ .Values.inProcessConfiguration.envVarPrefix }}" + - name: IN_PROCESS_CACHE_MAX_SIZE + value: "{{ .Values.inProcessConfiguration.cache.size }}" args: - --leader-elect - --sidecar-cpu-limit={{ .Values.sidecarConfiguration.resources.limits.cpu }} @@ -93,6 +93,7 @@ spec: - --sidecar-cpu-request={{ .Values.sidecarConfiguration.resources.requests.cpu }} - --sidecar-ram-request={{ .Values.sidecarConfiguration.resources.requests.memory }} - --image-pull-secrets={{ range .Values.imagePullSecrets }}{{ .name }},{{- end }} + - --metrics-bind-address={{ .Values.managerConfig.controllerManagerConfigYaml.metrics.bindPort }} - name: kube-rbac-proxy image: "{{ .Values.controllerManager.kubeRbacProxy.image.repository }}:{{ .Values.controllerManager.kubeRbacProxy.image.tag }}" resources: