Skip to content

Commit

Permalink
Merge pull request rook#14609 from rook/mergify/bp/release-1.14/pr-14598
Browse files Browse the repository at this point in the history
core: add configuration option for metrics bindAddress (backport rook#14598)
  • Loading branch information
mergify[bot] authored Aug 20, 2024
2 parents dcba651 + 7569741 commit 421a952
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions deploy/charts/rook-ceph/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ data:
ROOK_LOG_LEVEL: {{ .Values.logLevel | quote }}
ROOK_CEPH_COMMANDS_TIMEOUT_SECONDS: {{ .Values.cephCommandsTimeoutSeconds | quote }}
ROOK_OBC_WATCH_OPERATOR_NAMESPACE: {{ .Values.enableOBCWatchOperatorNamespace | quote }}
{{- if .Values.operatorMetricsBindAddress }}
ROOK_OPERATOR_METRICS_BIND_ADDRESS: {{ .Values.operatorMetricsBindAddress | quote }}
{{- end }}
{{- if .Values.obcProvisionerNamePrefix }}
ROOK_OBC_PROVISIONER_NAME_PREFIX: {{ .Values.obcProvisionerNamePrefix | quote }}
{{- end }}
Expand Down
3 changes: 3 additions & 0 deletions deploy/examples/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ data:
# The logging level for the operator: ERROR | WARNING | INFO | DEBUG
ROOK_LOG_LEVEL: "INFO"

# The address for the operator's controller-runtime metrics. 0 is disabled. :8080 serves metrics on port 8080.
ROOK_OPERATOR_METRICS_BIND_ADDRESS: "0"

# Allow using loop devices for osds in test clusters.
ROOK_CEPH_ALLOW_LOOP_DEVICES: "false"

Expand Down
11 changes: 8 additions & 3 deletions pkg/operator/ceph/cr_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import (
"github.com/rook/rook/pkg/operator/ceph/object/zonegroup"
"github.com/rook/rook/pkg/operator/ceph/pool"
"github.com/rook/rook/pkg/operator/ceph/pool/radosnamespace"
"github.com/rook/rook/pkg/operator/k8sutil"
"k8s.io/apimachinery/pkg/runtime"

cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
Expand Down Expand Up @@ -141,13 +142,17 @@ func (o *Operator) startCRDManager(context context.Context, mgrErrorCh chan erro
}
}

metricsBindAddress, err := k8sutil.GetOperatorSetting(context, o.context.Clientset, opcontroller.OperatorSettingConfigMapName, "ROOK_OPERATOR_METRICS_BIND_ADDRESS", "0")
if err != nil {
mgrErrorCh <- errors.Wrap(err, "failed to get configmap value `ROOK_OPERATOR_METRICS_BIND_ADDRESS`.")
return
}
// Set up a manager
mgrOpts := manager.Options{
LeaderElection: false,
Metrics: metricsserver.Options{
// BindAddress is the bind address for controller runtime metrics server default is 8080. Since we don't use the
// controller runtime metrics server, we need to set the bind address 0 so that port 8080 is available.
BindAddress: "0",
// BindAddress is the bind address for controller runtime metrics server. Defaulted to "0" which is off.
BindAddress: metricsBindAddress,
},
Scheme: scheme,
}
Expand Down

0 comments on commit 421a952

Please sign in to comment.