mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 18:24:07 +00:00
pkg/printers: drop deprecated pointer package
Signed-off-by: ZhangYu <zhang.yu61@zte.com.cn>
This commit is contained in:
parent
9d63e575f8
commit
190664f758
@ -50,7 +50,6 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/apis/storage"
|
"k8s.io/kubernetes/pkg/apis/storage"
|
||||||
"k8s.io/kubernetes/pkg/apis/storagemigration"
|
"k8s.io/kubernetes/pkg/apis/storagemigration"
|
||||||
"k8s.io/kubernetes/pkg/printers"
|
"k8s.io/kubernetes/pkg/printers"
|
||||||
utilpointer "k8s.io/utils/pointer"
|
|
||||||
"k8s.io/utils/ptr"
|
"k8s.io/utils/ptr"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -973,7 +972,7 @@ func TestPrintIngress(t *testing.T) {
|
|||||||
CreationTimestamp: metav1.Time{Time: time.Now().Add(time.Duration(-10 * 365 * 24 * time.Hour))},
|
CreationTimestamp: metav1.Time{Time: time.Now().Add(time.Duration(-10 * 365 * 24 * time.Hour))},
|
||||||
},
|
},
|
||||||
Spec: networking.IngressSpec{
|
Spec: networking.IngressSpec{
|
||||||
IngressClassName: utilpointer.StringPtr("foo"),
|
IngressClassName: ptr.To("foo"),
|
||||||
DefaultBackend: &networking.IngressBackend{
|
DefaultBackend: &networking.IngressBackend{
|
||||||
Service: &networking.IngressServiceBackend{
|
Service: &networking.IngressServiceBackend{
|
||||||
Name: "default-backend",
|
Name: "default-backend",
|
||||||
@ -1036,7 +1035,7 @@ func TestPrintIngressClass(t *testing.T) {
|
|||||||
Spec: networking.IngressClassSpec{
|
Spec: networking.IngressClassSpec{
|
||||||
Controller: "example.com/controller",
|
Controller: "example.com/controller",
|
||||||
Parameters: &networking.IngressClassParametersReference{
|
Parameters: &networking.IngressClassParametersReference{
|
||||||
APIGroup: utilpointer.StringPtr("example.com"),
|
APIGroup: ptr.To("example.com"),
|
||||||
Kind: "customgroup",
|
Kind: "customgroup",
|
||||||
Name: "example",
|
Name: "example",
|
||||||
},
|
},
|
||||||
@ -1564,14 +1563,14 @@ func TestPrintPodWithRestartableInitContainer(t *testing.T) {
|
|||||||
Ready: false,
|
Ready: false,
|
||||||
RestartCount: 3,
|
RestartCount: 3,
|
||||||
State: api.ContainerState{Running: &api.ContainerStateRunning{}},
|
State: api.ContainerState{Running: &api.ContainerStateRunning{}},
|
||||||
Started: utilpointer.Bool(false),
|
Started: ptr.To(false),
|
||||||
LastTerminationState: api.ContainerState{Terminated: &api.ContainerStateTerminated{FinishedAt: metav1.NewTime(time.Now().Add(-10 * time.Second))}},
|
LastTerminationState: api.ContainerState{Terminated: &api.ContainerStateTerminated{FinishedAt: metav1.NewTime(time.Now().Add(-10 * time.Second))}},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "restartable-init-2",
|
Name: "restartable-init-2",
|
||||||
Ready: false,
|
Ready: false,
|
||||||
State: api.ContainerState{Waiting: &api.ContainerStateWaiting{}},
|
State: api.ContainerState{Waiting: &api.ContainerStateWaiting{}},
|
||||||
Started: utilpointer.Bool(false),
|
Started: ptr.To(false),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ContainerStatuses: []api.ContainerStatus{
|
ContainerStatuses: []api.ContainerStatus{
|
||||||
@ -1605,14 +1604,14 @@ func TestPrintPodWithRestartableInitContainer(t *testing.T) {
|
|||||||
Ready: false,
|
Ready: false,
|
||||||
RestartCount: 3,
|
RestartCount: 3,
|
||||||
State: api.ContainerState{Running: &api.ContainerStateRunning{}},
|
State: api.ContainerState{Running: &api.ContainerStateRunning{}},
|
||||||
Started: utilpointer.Bool(true),
|
Started: ptr.To(true),
|
||||||
LastTerminationState: api.ContainerState{Terminated: &api.ContainerStateTerminated{FinishedAt: metav1.NewTime(time.Now().Add(-10 * time.Second))}},
|
LastTerminationState: api.ContainerState{Terminated: &api.ContainerStateTerminated{FinishedAt: metav1.NewTime(time.Now().Add(-10 * time.Second))}},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "restartable-init-2",
|
Name: "restartable-init-2",
|
||||||
Ready: false,
|
Ready: false,
|
||||||
State: api.ContainerState{Running: &api.ContainerStateRunning{}},
|
State: api.ContainerState{Running: &api.ContainerStateRunning{}},
|
||||||
Started: utilpointer.Bool(false),
|
Started: ptr.To(false),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ContainerStatuses: []api.ContainerStatus{
|
ContainerStatuses: []api.ContainerStatus{
|
||||||
@ -1646,14 +1645,14 @@ func TestPrintPodWithRestartableInitContainer(t *testing.T) {
|
|||||||
Ready: false,
|
Ready: false,
|
||||||
RestartCount: 3,
|
RestartCount: 3,
|
||||||
State: api.ContainerState{Running: &api.ContainerStateRunning{}},
|
State: api.ContainerState{Running: &api.ContainerStateRunning{}},
|
||||||
Started: utilpointer.Bool(true),
|
Started: ptr.To(true),
|
||||||
LastTerminationState: api.ContainerState{Terminated: &api.ContainerStateTerminated{FinishedAt: metav1.NewTime(time.Now().Add(-10 * time.Second))}},
|
LastTerminationState: api.ContainerState{Terminated: &api.ContainerStateTerminated{FinishedAt: metav1.NewTime(time.Now().Add(-10 * time.Second))}},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "restartable-init-2",
|
Name: "restartable-init-2",
|
||||||
Ready: false,
|
Ready: false,
|
||||||
State: api.ContainerState{Running: &api.ContainerStateRunning{}},
|
State: api.ContainerState{Running: &api.ContainerStateRunning{}},
|
||||||
Started: utilpointer.Bool(true),
|
Started: ptr.To(true),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ContainerStatuses: []api.ContainerStatus{
|
ContainerStatuses: []api.ContainerStatus{
|
||||||
@ -1688,14 +1687,14 @@ func TestPrintPodWithRestartableInitContainer(t *testing.T) {
|
|||||||
Ready: false,
|
Ready: false,
|
||||||
RestartCount: 3,
|
RestartCount: 3,
|
||||||
State: api.ContainerState{Terminated: &api.ContainerStateTerminated{Reason: "Error", ExitCode: 137}},
|
State: api.ContainerState{Terminated: &api.ContainerStateTerminated{Reason: "Error", ExitCode: 137}},
|
||||||
Started: utilpointer.Bool(false),
|
Started: ptr.To(false),
|
||||||
LastTerminationState: api.ContainerState{Terminated: &api.ContainerStateTerminated{FinishedAt: metav1.NewTime(time.Now().Add(-10 * time.Second))}},
|
LastTerminationState: api.ContainerState{Terminated: &api.ContainerStateTerminated{FinishedAt: metav1.NewTime(time.Now().Add(-10 * time.Second))}},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "restartable-init-2",
|
Name: "restartable-init-2",
|
||||||
Ready: false,
|
Ready: false,
|
||||||
State: api.ContainerState{Terminated: &api.ContainerStateTerminated{Reason: "Error", ExitCode: 137}},
|
State: api.ContainerState{Terminated: &api.ContainerStateTerminated{Reason: "Error", ExitCode: 137}},
|
||||||
Started: utilpointer.Bool(false),
|
Started: ptr.To(false),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ContainerStatuses: []api.ContainerStatus{
|
ContainerStatuses: []api.ContainerStatus{
|
||||||
@ -5880,8 +5879,8 @@ func TestPrintEndpointSlice(t *testing.T) {
|
|||||||
},
|
},
|
||||||
AddressType: discovery.AddressTypeIPv4,
|
AddressType: discovery.AddressTypeIPv4,
|
||||||
Ports: []discovery.EndpointPort{{
|
Ports: []discovery.EndpointPort{{
|
||||||
Name: utilpointer.StringPtr("http"),
|
Name: ptr.To("http"),
|
||||||
Port: utilpointer.Int32Ptr(80),
|
Port: ptr.To[int32](80),
|
||||||
Protocol: &tcpProtocol,
|
Protocol: &tcpProtocol,
|
||||||
}},
|
}},
|
||||||
Endpoints: []discovery.Endpoint{{
|
Endpoints: []discovery.Endpoint{{
|
||||||
@ -5898,12 +5897,12 @@ func TestPrintEndpointSlice(t *testing.T) {
|
|||||||
},
|
},
|
||||||
AddressType: discovery.AddressTypeIPv6,
|
AddressType: discovery.AddressTypeIPv6,
|
||||||
Ports: []discovery.EndpointPort{{
|
Ports: []discovery.EndpointPort{{
|
||||||
Name: utilpointer.StringPtr("http"),
|
Name: ptr.To("http"),
|
||||||
Port: utilpointer.Int32Ptr(80),
|
Port: ptr.To[int32](80),
|
||||||
Protocol: &tcpProtocol,
|
Protocol: &tcpProtocol,
|
||||||
}, {
|
}, {
|
||||||
Name: utilpointer.StringPtr("https"),
|
Name: ptr.To("https"),
|
||||||
Port: utilpointer.Int32Ptr(443),
|
Port: ptr.To[int32](443),
|
||||||
Protocol: &tcpProtocol,
|
Protocol: &tcpProtocol,
|
||||||
}},
|
}},
|
||||||
Endpoints: []discovery.Endpoint{{
|
Endpoints: []discovery.Endpoint{{
|
||||||
@ -5922,20 +5921,20 @@ func TestPrintEndpointSlice(t *testing.T) {
|
|||||||
},
|
},
|
||||||
AddressType: discovery.AddressTypeIPv4,
|
AddressType: discovery.AddressTypeIPv4,
|
||||||
Ports: []discovery.EndpointPort{{
|
Ports: []discovery.EndpointPort{{
|
||||||
Name: utilpointer.StringPtr("http"),
|
Name: ptr.To("http"),
|
||||||
Port: utilpointer.Int32Ptr(80),
|
Port: ptr.To[int32](80),
|
||||||
Protocol: &tcpProtocol,
|
Protocol: &tcpProtocol,
|
||||||
}, {
|
}, {
|
||||||
Name: utilpointer.StringPtr("https"),
|
Name: ptr.To("https"),
|
||||||
Port: utilpointer.Int32Ptr(443),
|
Port: ptr.To[int32](443),
|
||||||
Protocol: &tcpProtocol,
|
Protocol: &tcpProtocol,
|
||||||
}, {
|
}, {
|
||||||
Name: utilpointer.StringPtr("extra1"),
|
Name: ptr.To("extra1"),
|
||||||
Port: utilpointer.Int32Ptr(3000),
|
Port: ptr.To[int32](3000),
|
||||||
Protocol: &tcpProtocol,
|
Protocol: &tcpProtocol,
|
||||||
}, {
|
}, {
|
||||||
Name: utilpointer.StringPtr("extra2"),
|
Name: ptr.To("extra2"),
|
||||||
Port: utilpointer.Int32Ptr(3001),
|
Port: ptr.To[int32](3001),
|
||||||
Protocol: &tcpProtocol,
|
Protocol: &tcpProtocol,
|
||||||
}},
|
}},
|
||||||
Endpoints: []discovery.Endpoint{{
|
Endpoints: []discovery.Endpoint{{
|
||||||
|
Loading…
Reference in New Issue
Block a user