Skip to content

Fix/metrics server not used#2

Merged
prashanthjos merged 3 commits into
prashanthjos:mainfrom
Fixer38:fix/metrics-server-not-used
Apr 22, 2026
Merged

Fix/metrics server not used#2
prashanthjos merged 3 commits into
prashanthjos:mainfrom
Fixer38:fix/metrics-server-not-used

Conversation

@Fixer38
Copy link
Copy Markdown
Contributor

@Fixer38 Fixer38 commented Apr 11, 2026

Pull request aiming to fix issue #1 by:

  • Passing the metrics server address already parsed into the controller manager instance.
  • Also a run of make fmt has been included.

@Fixer38
Copy link
Copy Markdown
Contributor Author

Fixer38 commented Apr 12, 2026

I've done some tests and can confirm the metrics server starts properly.
Here are the tests:

Port forwarding the metrics server endpoint and executing curl against it

# Port forward metrics server to be able to send a request against it
kubectl port-forward -n kflashback-system kflashback-controller-5c59f59ffb-t2kh2 8080:8080
# Sending a request to the forwarded metrics-server where output is clearly visible
curl http://localhost:8080/metrics
# HELP certwatcher_read_certificate_errors_total Total number of certificate read errors
# TYPE certwatcher_read_certificate_errors_total counter
certwatcher_read_certificate_errors_total 0
# HELP certwatcher_read_certificate_total Total number of certificate reads
# TYPE certwatcher_read_certificate_total counter
certwatcher_read_certificate_total 0
# HELP controller_runtime_active_workers Number of currently used workers per controller
# TYPE controller_runtime_active_workers gauge
controller_runtime_active_workers{controller="flashbackpolicy"} 0
# HELP controller_runtime_max_concurrent_reconciles Maximum number of concurrent reconciles per controller
# TYPE controller_runtime_max_concurrent_reconciles gauge
controller_runtime_max_concurrent_reconciles{controller="flashbackpolicy"} 1
# HELP controller_runtime_reconcile_errors_total Total number of reconciliation errors per controller
# TYPE controller_runtime_reconcile_errors_total counter
controller_runtime_reconcile_errors_total{controller="flashbackpolicy"} 0
# HELP controller_runtime_reconcile_total Total number of reconciliations per controller
# TYPE controller_runtime_reconcile_total counter
controller_runtime_reconcile_total{controller="flashbackpolicy",result="error"} 0
controller_runtime_reconcile_total{controller="flashbackpolicy",result="requeue"} 0
controller_runtime_reconcile_total{controller="flashbackpolicy",result="requeue_after"} 0
controller_runtime_reconcile_total{controller="flashbackpolicy",result="success"} 0

Modifying the bind address to make sure its picked up by the config

I've modified the address to bind to to port 8082 and the test above succeeded aswell so the config change is picked up by the code properly
Manifest:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: kflashback-controller
  namespace: kflashback-system
  labels:
    app.kubernetes.io/name: kflashback
    app.kubernetes.io/component: controller
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: kflashback
      app.kubernetes.io/component: controller
  template:
    metadata:
      labels:
        app.kubernetes.io/name: kflashback
        app.kubernetes.io/component: controller
    spec:
      serviceAccountName: kflashback-controller
      securityContext:
        runAsNonRoot: true
        seccompProfile:
          type: RuntimeDefault
      containers:
        - name: controller
          image: ghcr.io/kflashback/kflashback:latest
          args:
            - --config-name=kflashback
            - --storage-backend=sqlite
            - --storage-dsn=/data/kflashback.db
            - --api-bind-address=:9090
            - --metrics-bind-address=:8082
            - --health-probe-bind-address=:8081
            - --ui-dir=/ui
            - --leader-elect
...

pod logs indicating the metrics server starting at the right changed port:

2026-04-12T10:50:26Z	INFO	controller-runtime.metrics	Serving metrics server	{"bindAddress": ":8082", "secure": false}
2026-04-12T10:50:26Z	INFO	starting server	{"kind": "health probe", "addr": "[::]:8081"}

@prashanthjos
Copy link
Copy Markdown
Owner

@Fixer38 thank you for the PR, can you please add some unit tests too?

@prashanthjos
Copy link
Copy Markdown
Owner

This looks good to me, can you please take care of formatting also?

@prashanthjos prashanthjos merged commit 071bc5a into prashanthjos:main Apr 22, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants