Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
lib/resourcemerge: Add support for hostUsers flag
When a pod spec is being ensured, hostUsers flag is not taken into
account. This is now fixed and hostUsers is copied into the resulting
pod spec.
  • Loading branch information
tchap committed Nov 6, 2025
commit ce5cac7520705ff78f46d6d8c41e35e479ce9e05
1 change: 1 addition & 0 deletions lib/resourcemerge/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func ensurePodSpec(modified *bool, existing *corev1.PodSpec, required corev1.Pod

setStringIfSet(modified, &existing.ServiceAccountName, required.ServiceAccountName)
setBool(modified, &existing.HostNetwork, required.HostNetwork)
setBoolPtr(modified, &existing.HostUsers, required.HostUsers)
mergeMap(modified, &existing.NodeSelector, required.NodeSelector)
ensurePodSecurityContextPtr(modified, &existing.SecurityContext, required.SecurityContext)
ensureAffinityPtr(modified, &existing.Affinity, required.Affinity)
Expand Down
11 changes: 11 additions & 0 deletions lib/resourcemerge/core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ func TestEnsurePodSpec(t *testing.T) {
Containers: []corev1.Container{
{Name: "test"}}},
},
{
name: "hostUsers flag is set",
existing: corev1.PodSpec{},
input: corev1.PodSpec{
HostUsers: boolPtr(false),
},
expectedModified: true,
expected: corev1.PodSpec{
HostUsers: boolPtr(false),
},
},
{
name: "PodSecurityContext empty",
existing: corev1.PodSpec{
Expand Down