Skip to content
Open
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
1 change: 1 addition & 0 deletions lib/resourcemerge/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func ensurePodSpec(modified *bool, existing *corev1.PodSpec, required corev1.Pod
}
}

setBoolPtr(modified, &existing.AutomountServiceAccountToken, required.AutomountServiceAccountToken)
setStringIfSet(modified, &existing.ServiceAccountName, required.ServiceAccountName)
setBool(modified, &existing.HostNetwork, required.HostNetwork)
setBoolPtr(modified, &existing.HostUsers, required.HostUsers)
Expand Down
50 changes: 50 additions & 0 deletions lib/resourcemerge/core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,56 @@ func TestEnsurePodSpec(t *testing.T) {
HostUsers: boolPtr(false),
},
},
{
name: "automountServiceAccountToken is set",
existing: corev1.PodSpec{},
input: corev1.PodSpec{
AutomountServiceAccountToken: boolPtr(false),
},

expectedModified: true,
expected: corev1.PodSpec{
AutomountServiceAccountToken: boolPtr(false),
},
},
{
name: "automountServiceAccountToken is unset",
existing: corev1.PodSpec{
AutomountServiceAccountToken: boolPtr(false),
},
input: corev1.PodSpec{},

expectedModified: true,
expected: corev1.PodSpec{},
},
{
name: "automountServiceAccountToken is changed",
existing: corev1.PodSpec{
AutomountServiceAccountToken: boolPtr(true),
},
input: corev1.PodSpec{
AutomountServiceAccountToken: boolPtr(false),
},

expectedModified: true,
expected: corev1.PodSpec{
AutomountServiceAccountToken: boolPtr(false),
},
},
{
name: "automountServiceAccountToken is unchanged",
existing: corev1.PodSpec{
AutomountServiceAccountToken: boolPtr(false),
},
input: corev1.PodSpec{
AutomountServiceAccountToken: boolPtr(false),
},

expectedModified: false,
expected: corev1.PodSpec{
AutomountServiceAccountToken: boolPtr(false),
},
},
{
name: "PodSecurityContext empty",
existing: corev1.PodSpec{
Expand Down