Skip to content

Disable or have a fixed port for the metrics server on the operator #508

@karampok

Description

@karampok

This part on the code
https://github.com/metallb/metallb-operator/blob/main/main.go#L129-L132

		metricsAddr          = flag.String("metrics-addr", ":0", "The address the metric endpoint binds to.")

...
	mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
		Scheme: scheme,
		Metrics: metricsserver.Options{
			BindAddress: *metricsAddr,
		},

when ":0" it opens a random high port in the container

 ss -natp |grep LISTEN
LISTEN    0      4096                     *:8080                    *:*
LISTEN    0      4096                     *:33391                   *:*
LISTEN    0      4096                     *:9443                    *:*

which is not ideal. We should improve that part either

  1. Disable fully the metrics server when there is no argument
  2. Fix a high random static port, so at least a grep search will show what it is
  3. Something else

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions