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:
WanLinghao
2019-02-23 13:06:47 +08:00
parent 4a1da48d11
commit d0138ca3fe
20 changed files with 75 additions and 97 deletions

View File

@@ -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
}