Description
When deploying the HAProxy Ingress Controller as a DaemonSet with a name that contains no hyphen (e.g. zzz99), the controller fails to parse the Pod name and enters a crash-restart loop.
The controller appears to expect Pod names in the format {name}-{replicaset-hash}-{pod-hash} (3 parts, as generated by a Deployment), but DaemonSet Pods follow the format {name}-{pod-hash} (2 parts). When the DaemonSet name itself contains no hyphen, splitting by - yields only 2 parts total, which causes the parsing to fail.
Error Log
ERROR controller/builder.go:175 incorrect podName format: 'zzz99-csj48'
Followed by a graceful shutdown and restart loop:
/src/main.go:169 Graceful shutdown requested ....
INFO controller/controller.go:111 Stopping Ingress Controller
/src/main.go:172 Graceful shutdown done, exiting
Ingress Controller exited with code 0, restarting...
Steps to Reproduce
- Deploy HAProxy Ingress Controller as a DaemonSet with a single-word name (no hyphen), e.g.:
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: zzz99 # <-- no hyphen in name
namespace: haproxy-controller
spec:
selector:
matchLabels:
app: zzz99
template:
metadata:
labels:
app: zzz99
spec:
containers:
- name: haproxy-ingress
image: haproxytech/kubernetes-ingress:latest
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- Observe the Pod name generated:
zzz99-csj48 (2 parts when split by -)
- Controller logs show
incorrect podName format and the controller immediately exits and restarts
Expected Behavior
The controller should handle Pod names with only 2 hyphen-separated parts, as is the case for DaemonSet Pods whose name contains no hyphen.
Alternatively, if --pod-name / POD_NAME env var is explicitly provided, the controller should use that value directly without attempting to parse it by format.
Actual Behavior
The controller crashes with incorrect podName format and enters a restart loop, making it completely non-functional.
Environment
- HAProxy version:
3.1.9-38cc406
- Controller image:
haproxytech/kubernetes-ingress:latest
- Kubernetes resource type:
DaemonSet
- DaemonSet name:
zzz99 (no hyphen)
- Generated Pod name:
zzz99-csj48
Workaround
Adding a hyphen to the DaemonSet name (e.g. zzz99-ingress) causes the Pod name to become zzz99-ingress-csj48 (3 parts), which the parser accepts.
This is consistent with the official DaemonSet example in the repository (haproxy-kubernetes-ingress), which also uses a hyphenated name — suggesting the parser implicitly assumes a hyphen is always present.
Root Cause (suspected)
In controller/builder.go:175, the Pod name is split by - and the result is expected to have at least 3 parts. DaemonSet Pod names only produce 2 parts when the DaemonSet name itself has no hyphen.
// Deployment Pod: {name}-{rs-hash}-{pod-hash} → 3+ parts ✅
// DaemonSet Pod: {name}-{pod-hash} → 2 parts if name has no hyphen ❌
Suggested Fix
- Update
builder.go to gracefully handle 2-part Pod names for DaemonSet deployments
- Or, if
POD_NAME env var or --pod-name arg is provided, skip format validation entirely and use the value as-is
Description
When deploying the HAProxy Ingress Controller as a DaemonSet with a name that contains no hyphen (e.g.
zzz99), the controller fails to parse the Pod name and enters a crash-restart loop.The controller appears to expect Pod names in the format
{name}-{replicaset-hash}-{pod-hash}(3 parts, as generated by a Deployment), but DaemonSet Pods follow the format{name}-{pod-hash}(2 parts). When the DaemonSet name itself contains no hyphen, splitting by-yields only 2 parts total, which causes the parsing to fail.Error Log
Followed by a graceful shutdown and restart loop:
Steps to Reproduce
zzz99-csj48(2 parts when split by-)incorrect podName formatand the controller immediately exits and restartsExpected Behavior
The controller should handle Pod names with only 2 hyphen-separated parts, as is the case for DaemonSet Pods whose name contains no hyphen.
Alternatively, if
--pod-name/POD_NAMEenv var is explicitly provided, the controller should use that value directly without attempting to parse it by format.Actual Behavior
The controller crashes with
incorrect podName formatand enters a restart loop, making it completely non-functional.Environment
3.1.9-38cc406haproxytech/kubernetes-ingress:latestDaemonSetzzz99(no hyphen)zzz99-csj48Workaround
Adding a hyphen to the DaemonSet name (e.g.
zzz99-ingress) causes the Pod name to becomezzz99-ingress-csj48(3 parts), which the parser accepts.This is consistent with the official DaemonSet example in the repository (
haproxy-kubernetes-ingress), which also uses a hyphenated name — suggesting the parser implicitly assumes a hyphen is always present.Root Cause (suspected)
In
controller/builder.go:175, the Pod name is split by-and the result is expected to have at least 3 parts. DaemonSet Pod names only produce 2 parts when the DaemonSet name itself has no hyphen.Suggested Fix
builder.goto gracefully handle 2-part Pod names for DaemonSet deploymentsPOD_NAMEenv var or--pod-namearg is provided, skip format validation entirely and use the value as-is