Skip to content

buildSmbMetricsContainer: pass --port to smbmetrics container#371

Open
BenEstrabaud wants to merge 1 commit intosamba-in-kubernetes:masterfrom
BenEstrabaud:fix-smbmetrics-port-resubmit
Open

buildSmbMetricsContainer: pass --port to smbmetrics container#371
BenEstrabaud wants to merge 1 commit intosamba-in-kubernetes:masterfrom
BenEstrabaud:fix-smbmetrics-port-resubmit

Conversation

@BenEstrabaud
Copy link
Copy Markdown

This fix is about buildSmbMetricsContainer in internal/resources/metrics.go: when the smbmetrics sidecar container is enabled, the samba share pod always crashes (CrashLoopBackoff).

buildSmbMetricsContainer() configures liveness and readiness probes on port 8080 but does not pass --port to the smbmetrics binary, which defaults to port 9922. The probes therefore always fail, putting the samba-metrics sidecar into a CrashLoopBackOff immediately after startup.

Fixed by passing --port= as an argument so the binary listens on the same port the probes expect.

This fix was tested on a live k3s cluster:

NAME                           STATUS    CONTAINERS
storage-6695849ccc-vgcph       Running   samba,watch-update-config,samba-metrics
timemachine-6cb85c447d-7fs9f   Running   samba,watch-update-config,samba-metrics```

This fix is about buildSmbMetricsContainer in internal/resources/metrics.go:
when the smbmetrics sidecar container is enabled, the samba share pod always crashes (CrashLoopBackoff).

buildSmbMetricsContainer() configures liveness and readiness probes on port 8080 but does not pass --port to the smbmetrics binary, which defaults to port 9922. The probes therefore always fail, putting the samba-metrics sidecar into a CrashLoopBackOff immediately after startup.

Fixed by passing --port= as an argument so the binary listens on the same port the probes expect.

Signed-off-by: Ben Estrabaud <benestrabaud@gmail.com>
@phlogistonjohn
Copy link
Copy Markdown
Collaborator

The CI checks are rejecting long lines in the commit description.

In addition there was a failure due to an older Go version in the dockerfile. I have filed #372 to fix that issue.

Copy link
Copy Markdown
Collaborator

@synarete synarete left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix itself is in-place but the commit message does not follow the projects conversions:

  1. Split long lines
  2. Single white-line between commit title and body
  3. Title should be shorter and correlate to actual change. Something like: "resources: pass '--port' option to smbmetrics container"

Comment on lines +16 to +23
t.Run("name", func(t *testing.T) {
assert.Equal(t, "samba-metrics", ctr.Name)
})

t.Run("image", func(t *testing.T) {
assert.Equal(t, "quay.io/samba.org/samba-metrics:latest", ctr.Image)
})

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using t.Run() for such checks is too much. A simple assert.Equal is good enough here.

@anoopcs9
Copy link
Copy Markdown
Collaborator

anoopcs9 commented Feb 23, 2026

@BenEstrabaud While addressing the review comments, please ensure that the branch is rebased onto the latest master to incorporate the fix from #372.

@BenEstrabaud
Copy link
Copy Markdown
Author

No problem, I won't be able to do it for a few days but I'll incorporate all the suggestions when I get to it.

@mergify mergify Bot added the priority-review This PR deserves a look label Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority-review This PR deserves a look

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants