Skip to content

Commit

Permalink
Merge pull request #1836 from marquiz/devel/e2e-ptr
Browse files Browse the repository at this point in the history
test/e2e: use ptr.To to get pointer to bool
  • Loading branch information
k8s-ci-robot authored Sep 27, 2024
2 parents bbd4ac8 + 8a6853f commit 4dbe9c8
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions test/e2e/utils/pod/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ type SpecOption func(spec *corev1.PodSpec)

// NFDMaster provide NFD master pod definition
func NFDMaster(opts ...SpecOption) *corev1.Pod {
yes := true
no := false
p := &corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "nfd-master-",
Expand All @@ -147,10 +145,10 @@ func NFDMaster(opts ...SpecOption) *corev1.Pod {
Capabilities: &corev1.Capabilities{
Drop: []corev1.Capability{"ALL"},
},
Privileged: &no,
RunAsNonRoot: &yes,
ReadOnlyRootFilesystem: &yes,
AllowPrivilegeEscalation: &no,
Privileged: ptr.To[bool](false),
RunAsNonRoot: ptr.To[bool](true),
ReadOnlyRootFilesystem: ptr.To[bool](true),
AllowPrivilegeEscalation: ptr.To[bool](false),
SeccompProfile: &corev1.SeccompProfile{
Type: corev1.SeccompProfileTypeRuntimeDefault,
},
Expand Down Expand Up @@ -252,8 +250,6 @@ func SpecWithConfigMap(name, mountPath string) SpecOption {
}

func nfdWorkerSpec(opts ...SpecOption) *corev1.PodSpec {
yes := true
no := false
p := &corev1.PodSpec{
Containers: []corev1.Container{
{
Expand Down Expand Up @@ -291,10 +287,10 @@ func nfdWorkerSpec(opts ...SpecOption) *corev1.PodSpec {
Capabilities: &corev1.Capabilities{
Drop: []corev1.Capability{"ALL"},
},
Privileged: &no,
RunAsNonRoot: &yes,
ReadOnlyRootFilesystem: &yes,
AllowPrivilegeEscalation: &no,
Privileged: ptr.To[bool](false),
RunAsNonRoot: ptr.To[bool](true),
ReadOnlyRootFilesystem: ptr.To[bool](true),
AllowPrivilegeEscalation: ptr.To[bool](false),
SeccompProfile: &corev1.SeccompProfile{
Type: corev1.SeccompProfileTypeRuntimeDefault,
},
Expand Down Expand Up @@ -372,8 +368,6 @@ func nfdWorkerSpec(opts ...SpecOption) *corev1.PodSpec {
}

func NFDGCSpec(opts ...SpecOption) *corev1.PodSpec {
yes := true
no := false
p := &corev1.PodSpec{
Containers: []corev1.Container{
{
Expand All @@ -384,10 +378,10 @@ func NFDGCSpec(opts ...SpecOption) *corev1.PodSpec {
Capabilities: &corev1.Capabilities{
Drop: []corev1.Capability{"ALL"},
},
Privileged: &no,
RunAsNonRoot: &yes,
ReadOnlyRootFilesystem: &yes,
AllowPrivilegeEscalation: &no,
Privileged: ptr.To[bool](false),
RunAsNonRoot: ptr.To[bool](true),
ReadOnlyRootFilesystem: ptr.To[bool](true),
AllowPrivilegeEscalation: ptr.To[bool](false),
SeccompProfile: &corev1.SeccompProfile{
Type: corev1.SeccompProfileTypeRuntimeDefault,
},
Expand Down

0 comments on commit 4dbe9c8

Please sign in to comment.