mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-03 03:38:15 +00:00
This commit does two things in pkg package:
1. Remove unused ptr functions. 2. Replace ptr functions with k8s.io/utils/pointer
This commit is contained in:
@@ -12560,7 +12560,7 @@ func TestValidateSecurityContext(t *testing.T) {
|
||||
runAsUser := int64(1)
|
||||
fullValidSC := func() *core.SecurityContext {
|
||||
return &core.SecurityContext{
|
||||
Privileged: boolPtr(false),
|
||||
Privileged: utilpointer.BoolPtr(false),
|
||||
Capabilities: &core.Capabilities{
|
||||
Add: []core.Capability{"foo"},
|
||||
Drop: []core.Capability{"bar"},
|
||||
@@ -12605,19 +12605,19 @@ func TestValidateSecurityContext(t *testing.T) {
|
||||
}
|
||||
|
||||
privRequestWithGlobalDeny := fullValidSC()
|
||||
privRequestWithGlobalDeny.Privileged = boolPtr(true)
|
||||
privRequestWithGlobalDeny.Privileged = utilpointer.BoolPtr(true)
|
||||
|
||||
negativeRunAsUser := fullValidSC()
|
||||
negativeUser := int64(-1)
|
||||
negativeRunAsUser.RunAsUser = &negativeUser
|
||||
|
||||
privWithoutEscalation := fullValidSC()
|
||||
privWithoutEscalation.Privileged = boolPtr(true)
|
||||
privWithoutEscalation.AllowPrivilegeEscalation = boolPtr(false)
|
||||
privWithoutEscalation.Privileged = utilpointer.BoolPtr(true)
|
||||
privWithoutEscalation.AllowPrivilegeEscalation = utilpointer.BoolPtr(false)
|
||||
|
||||
capSysAdminWithoutEscalation := fullValidSC()
|
||||
capSysAdminWithoutEscalation.Capabilities.Add = []core.Capability{"CAP_SYS_ADMIN"}
|
||||
capSysAdminWithoutEscalation.AllowPrivilegeEscalation = boolPtr(false)
|
||||
capSysAdminWithoutEscalation.AllowPrivilegeEscalation = utilpointer.BoolPtr(false)
|
||||
|
||||
errorCases := map[string]struct {
|
||||
sc *core.SecurityContext
|
||||
@@ -13145,7 +13145,3 @@ func TestValidateOrSetClientIPAffinityConfig(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func boolPtr(b bool) *bool {
|
||||
return &b
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user