1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-14 11:57:51 +00:00

Merge pull request #1836 from marquiz/devel/e2e-ptr

test/e2e: use ptr.To to get pointer to bool
This commit is contained in:
Kubernetes Prow Robot 2024-09-27 18:54:01 +01:00 committed by GitHub
commit 4dbe9c8951
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -120,8 +120,6 @@ type SpecOption func(spec *corev1.PodSpec)
// NFDMaster provide NFD master pod definition // NFDMaster provide NFD master pod definition
func NFDMaster(opts ...SpecOption) *corev1.Pod { func NFDMaster(opts ...SpecOption) *corev1.Pod {
yes := true
no := false
p := &corev1.Pod{ p := &corev1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
GenerateName: "nfd-master-", GenerateName: "nfd-master-",
@ -147,10 +145,10 @@ func NFDMaster(opts ...SpecOption) *corev1.Pod {
Capabilities: &corev1.Capabilities{ Capabilities: &corev1.Capabilities{
Drop: []corev1.Capability{"ALL"}, Drop: []corev1.Capability{"ALL"},
}, },
Privileged: &no, Privileged: ptr.To[bool](false),
RunAsNonRoot: &yes, RunAsNonRoot: ptr.To[bool](true),
ReadOnlyRootFilesystem: &yes, ReadOnlyRootFilesystem: ptr.To[bool](true),
AllowPrivilegeEscalation: &no, AllowPrivilegeEscalation: ptr.To[bool](false),
SeccompProfile: &corev1.SeccompProfile{ SeccompProfile: &corev1.SeccompProfile{
Type: corev1.SeccompProfileTypeRuntimeDefault, Type: corev1.SeccompProfileTypeRuntimeDefault,
}, },
@ -252,8 +250,6 @@ func SpecWithConfigMap(name, mountPath string) SpecOption {
} }
func nfdWorkerSpec(opts ...SpecOption) *corev1.PodSpec { func nfdWorkerSpec(opts ...SpecOption) *corev1.PodSpec {
yes := true
no := false
p := &corev1.PodSpec{ p := &corev1.PodSpec{
Containers: []corev1.Container{ Containers: []corev1.Container{
{ {
@ -291,10 +287,10 @@ func nfdWorkerSpec(opts ...SpecOption) *corev1.PodSpec {
Capabilities: &corev1.Capabilities{ Capabilities: &corev1.Capabilities{
Drop: []corev1.Capability{"ALL"}, Drop: []corev1.Capability{"ALL"},
}, },
Privileged: &no, Privileged: ptr.To[bool](false),
RunAsNonRoot: &yes, RunAsNonRoot: ptr.To[bool](true),
ReadOnlyRootFilesystem: &yes, ReadOnlyRootFilesystem: ptr.To[bool](true),
AllowPrivilegeEscalation: &no, AllowPrivilegeEscalation: ptr.To[bool](false),
SeccompProfile: &corev1.SeccompProfile{ SeccompProfile: &corev1.SeccompProfile{
Type: corev1.SeccompProfileTypeRuntimeDefault, Type: corev1.SeccompProfileTypeRuntimeDefault,
}, },
@ -372,8 +368,6 @@ func nfdWorkerSpec(opts ...SpecOption) *corev1.PodSpec {
} }
func NFDGCSpec(opts ...SpecOption) *corev1.PodSpec { func NFDGCSpec(opts ...SpecOption) *corev1.PodSpec {
yes := true
no := false
p := &corev1.PodSpec{ p := &corev1.PodSpec{
Containers: []corev1.Container{ Containers: []corev1.Container{
{ {
@ -384,10 +378,10 @@ func NFDGCSpec(opts ...SpecOption) *corev1.PodSpec {
Capabilities: &corev1.Capabilities{ Capabilities: &corev1.Capabilities{
Drop: []corev1.Capability{"ALL"}, Drop: []corev1.Capability{"ALL"},
}, },
Privileged: &no, Privileged: ptr.To[bool](false),
RunAsNonRoot: &yes, RunAsNonRoot: ptr.To[bool](true),
ReadOnlyRootFilesystem: &yes, ReadOnlyRootFilesystem: ptr.To[bool](true),
AllowPrivilegeEscalation: &no, AllowPrivilegeEscalation: ptr.To[bool](false),
SeccompProfile: &corev1.SeccompProfile{ SeccompProfile: &corev1.SeccompProfile{
Type: corev1.SeccompProfileTypeRuntimeDefault, Type: corev1.SeccompProfileTypeRuntimeDefault,
}, },