mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 09:52:49 +00:00
test/e2e: Replace deprecated pointer function
Signed-off-by: TommyStarK <thomasmilox@gmail.com>
This commit is contained in:
parent
7fd0ff5761
commit
a46cfe5d1e
@ -149,8 +149,8 @@ var _ = SIGDescribe("CustomResourceConversionWebhook [Privileged:ClusterAdmin]",
|
||||
Service: &apiextensionsv1.ServiceReference{
|
||||
Namespace: f.Namespace.Name,
|
||||
Name: serviceCRDName,
|
||||
Path: pointer.StringPtr("/crdconvert"),
|
||||
Port: pointer.Int32Ptr(servicePort),
|
||||
Path: pointer.String("/crdconvert"),
|
||||
Port: pointer.Int32(servicePort),
|
||||
},
|
||||
},
|
||||
ConversionReviewVersions: []string{"v1", "v1beta1"},
|
||||
@ -184,8 +184,8 @@ var _ = SIGDescribe("CustomResourceConversionWebhook [Privileged:ClusterAdmin]",
|
||||
Service: &apiextensionsv1.ServiceReference{
|
||||
Namespace: f.Namespace.Name,
|
||||
Name: serviceCRDName,
|
||||
Path: pointer.StringPtr("/crdconvert"),
|
||||
Port: pointer.Int32Ptr(servicePort),
|
||||
Path: pointer.String("/crdconvert"),
|
||||
Port: pointer.Int32(servicePort),
|
||||
},
|
||||
},
|
||||
ConversionReviewVersions: []string{"v1", "v1beta1"},
|
||||
|
@ -78,11 +78,11 @@ var _ = SIGDescribe("Lease", func() {
|
||||
Name: name,
|
||||
},
|
||||
Spec: coordinationv1.LeaseSpec{
|
||||
HolderIdentity: pointer.StringPtr("holder"),
|
||||
LeaseDurationSeconds: pointer.Int32Ptr(30),
|
||||
HolderIdentity: pointer.String("holder"),
|
||||
LeaseDurationSeconds: pointer.Int32(30),
|
||||
AcquireTime: &metav1.MicroTime{Time: time.Time{}.Add(2 * time.Second)},
|
||||
RenewTime: &metav1.MicroTime{Time: time.Time{}.Add(5 * time.Second)},
|
||||
LeaseTransitions: pointer.Int32Ptr(0),
|
||||
LeaseTransitions: pointer.Int32(0),
|
||||
},
|
||||
}
|
||||
|
||||
@ -96,11 +96,11 @@ var _ = SIGDescribe("Lease", func() {
|
||||
}
|
||||
|
||||
createdLease.Spec = coordinationv1.LeaseSpec{
|
||||
HolderIdentity: pointer.StringPtr("holder2"),
|
||||
LeaseDurationSeconds: pointer.Int32Ptr(30),
|
||||
HolderIdentity: pointer.String("holder2"),
|
||||
LeaseDurationSeconds: pointer.Int32(30),
|
||||
AcquireTime: &metav1.MicroTime{Time: time.Time{}.Add(20 * time.Second)},
|
||||
RenewTime: &metav1.MicroTime{Time: time.Time{}.Add(50 * time.Second)},
|
||||
LeaseTransitions: pointer.Int32Ptr(1),
|
||||
LeaseTransitions: pointer.Int32(1),
|
||||
}
|
||||
|
||||
_, err = leaseClient.Update(ctx, createdLease, metav1.UpdateOptions{})
|
||||
@ -114,11 +114,11 @@ var _ = SIGDescribe("Lease", func() {
|
||||
|
||||
patchedLease := readLease.DeepCopy()
|
||||
patchedLease.Spec = coordinationv1.LeaseSpec{
|
||||
HolderIdentity: pointer.StringPtr("holder3"),
|
||||
LeaseDurationSeconds: pointer.Int32Ptr(60),
|
||||
HolderIdentity: pointer.String("holder3"),
|
||||
LeaseDurationSeconds: pointer.Int32(60),
|
||||
AcquireTime: &metav1.MicroTime{Time: time.Time{}.Add(50 * time.Second)},
|
||||
RenewTime: &metav1.MicroTime{Time: time.Time{}.Add(70 * time.Second)},
|
||||
LeaseTransitions: pointer.Int32Ptr(2),
|
||||
LeaseTransitions: pointer.Int32(2),
|
||||
}
|
||||
patchBytes, err := getPatchBytes(readLease, patchedLease)
|
||||
framework.ExpectNoError(err, "creating patch failed")
|
||||
@ -139,11 +139,11 @@ var _ = SIGDescribe("Lease", func() {
|
||||
Labels: map[string]string{"deletecollection": "true"},
|
||||
},
|
||||
Spec: coordinationv1.LeaseSpec{
|
||||
HolderIdentity: pointer.StringPtr("holder"),
|
||||
LeaseDurationSeconds: pointer.Int32Ptr(30),
|
||||
HolderIdentity: pointer.String("holder"),
|
||||
LeaseDurationSeconds: pointer.Int32(30),
|
||||
AcquireTime: &metav1.MicroTime{Time: time.Time{}.Add(2 * time.Second)},
|
||||
RenewTime: &metav1.MicroTime{Time: time.Time{}.Add(5 * time.Second)},
|
||||
LeaseTransitions: pointer.Int32Ptr(0),
|
||||
LeaseTransitions: pointer.Int32(0),
|
||||
},
|
||||
}
|
||||
_, err = leaseClient.Create(ctx, lease2, metav1.CreateOptions{})
|
||||
|
@ -141,14 +141,14 @@ const DefaultNonRootUserName = "ContainerUser"
|
||||
// Tests that require a specific user ID should override this.
|
||||
func GetRestrictedPodSecurityContext() *v1.PodSecurityContext {
|
||||
psc := &v1.PodSecurityContext{
|
||||
RunAsNonRoot: pointer.BoolPtr(true),
|
||||
RunAsNonRoot: pointer.Bool(true),
|
||||
RunAsUser: GetDefaultNonRootUser(),
|
||||
SeccompProfile: &v1.SeccompProfile{Type: v1.SeccompProfileTypeRuntimeDefault},
|
||||
}
|
||||
|
||||
if NodeOSDistroIs("windows") {
|
||||
psc.WindowsOptions = &v1.WindowsSecurityContextOptions{}
|
||||
psc.WindowsOptions.RunAsUserName = pointer.StringPtr(DefaultNonRootUserName)
|
||||
psc.WindowsOptions.RunAsUserName = pointer.String(DefaultNonRootUserName)
|
||||
}
|
||||
|
||||
return psc
|
||||
@ -157,7 +157,7 @@ func GetRestrictedPodSecurityContext() *v1.PodSecurityContext {
|
||||
// GetRestrictedContainerSecurityContext returns a minimal restricted container security context.
|
||||
func GetRestrictedContainerSecurityContext() *v1.SecurityContext {
|
||||
return &v1.SecurityContext{
|
||||
AllowPrivilegeEscalation: pointer.BoolPtr(false),
|
||||
AllowPrivilegeEscalation: pointer.Bool(false),
|
||||
Capabilities: &v1.Capabilities{Drop: []v1.Capability{"ALL"}},
|
||||
}
|
||||
}
|
||||
@ -181,7 +181,7 @@ func MixinRestrictedPodSecurity(pod *v1.Pod) error {
|
||||
pod.Spec.SecurityContext = GetRestrictedPodSecurityContext()
|
||||
} else {
|
||||
if pod.Spec.SecurityContext.RunAsNonRoot == nil {
|
||||
pod.Spec.SecurityContext.RunAsNonRoot = pointer.BoolPtr(true)
|
||||
pod.Spec.SecurityContext.RunAsNonRoot = pointer.Bool(true)
|
||||
}
|
||||
if pod.Spec.SecurityContext.RunAsUser == nil {
|
||||
pod.Spec.SecurityContext.RunAsUser = GetDefaultNonRootUser()
|
||||
@ -191,7 +191,7 @@ func MixinRestrictedPodSecurity(pod *v1.Pod) error {
|
||||
}
|
||||
if NodeOSDistroIs("windows") && pod.Spec.SecurityContext.WindowsOptions == nil {
|
||||
pod.Spec.SecurityContext.WindowsOptions = &v1.WindowsSecurityContextOptions{}
|
||||
pod.Spec.SecurityContext.WindowsOptions.RunAsUserName = pointer.StringPtr(DefaultNonRootUserName)
|
||||
pod.Spec.SecurityContext.WindowsOptions.RunAsUserName = pointer.String(DefaultNonRootUserName)
|
||||
}
|
||||
}
|
||||
for i := range pod.Spec.Containers {
|
||||
|
@ -176,11 +176,11 @@ var _ = common.SIGDescribe("IngressClass [Feature:Ingress]", func() {
|
||||
Spec: networkingv1.IngressClassSpec{
|
||||
Controller: "example.com/controller",
|
||||
Parameters: &networkingv1.IngressClassParametersReference{
|
||||
Scope: utilpointer.StringPtr("Namespace"),
|
||||
Namespace: utilpointer.StringPtr("foo-ns"),
|
||||
Scope: utilpointer.String("Namespace"),
|
||||
Namespace: utilpointer.String("foo-ns"),
|
||||
Kind: "fookind",
|
||||
Name: "fooname",
|
||||
APIGroup: utilpointer.StringPtr("example.com"),
|
||||
APIGroup: utilpointer.String("example.com"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user