mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 01:40:07 +00:00
client-go: rename Resize to UpdateResize
This commit is contained in:
parent
3b91edb660
commit
79f45bce19
@ -4911,7 +4911,7 @@ type PodStatusResult struct {
|
|||||||
|
|
||||||
// +genclient
|
// +genclient
|
||||||
// +genclient:method=UpdateEphemeralContainers,verb=update,subresource=ephemeralcontainers
|
// +genclient:method=UpdateEphemeralContainers,verb=update,subresource=ephemeralcontainers
|
||||||
// +genclient:method=Resize,verb=update,subresource=resize
|
// +genclient:method=UpdateResize,verb=update,subresource=resize
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
// +k8s:prerelease-lifecycle-gen:introduced=1.0
|
// +k8s:prerelease-lifecycle-gen:introduced=1.0
|
||||||
|
|
||||||
|
@ -208,8 +208,8 @@ func (c *FakePods) UpdateEphemeralContainers(ctx context.Context, podName string
|
|||||||
return obj.(*v1.Pod), err
|
return obj.(*v1.Pod), err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resize takes the representation of a pod and updates it. Returns the server's representation of the pod, and an error, if there is any.
|
// UpdateResize takes the representation of a pod and updates it. Returns the server's representation of the pod, and an error, if there is any.
|
||||||
func (c *FakePods) Resize(ctx context.Context, podName string, pod *v1.Pod, opts metav1.UpdateOptions) (result *v1.Pod, err error) {
|
func (c *FakePods) UpdateResize(ctx context.Context, podName string, pod *v1.Pod, opts metav1.UpdateOptions) (result *v1.Pod, err error) {
|
||||||
emptyResult := &v1.Pod{}
|
emptyResult := &v1.Pod{}
|
||||||
obj, err := c.Fake.
|
obj, err := c.Fake.
|
||||||
Invokes(testing.NewUpdateSubresourceActionWithOptions(podsResource, "resize", c.ns, pod, opts), &v1.Pod{})
|
Invokes(testing.NewUpdateSubresourceActionWithOptions(podsResource, "resize", c.ns, pod, opts), &v1.Pod{})
|
||||||
|
@ -52,7 +52,7 @@ type PodInterface interface {
|
|||||||
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
|
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
|
||||||
ApplyStatus(ctx context.Context, pod *applyconfigurationscorev1.PodApplyConfiguration, opts metav1.ApplyOptions) (result *corev1.Pod, err error)
|
ApplyStatus(ctx context.Context, pod *applyconfigurationscorev1.PodApplyConfiguration, opts metav1.ApplyOptions) (result *corev1.Pod, err error)
|
||||||
UpdateEphemeralContainers(ctx context.Context, podName string, pod *corev1.Pod, opts metav1.UpdateOptions) (*corev1.Pod, error)
|
UpdateEphemeralContainers(ctx context.Context, podName string, pod *corev1.Pod, opts metav1.UpdateOptions) (*corev1.Pod, error)
|
||||||
Resize(ctx context.Context, podName string, pod *corev1.Pod, opts metav1.UpdateOptions) (*corev1.Pod, error)
|
UpdateResize(ctx context.Context, podName string, pod *corev1.Pod, opts metav1.UpdateOptions) (*corev1.Pod, error)
|
||||||
|
|
||||||
PodExpansion
|
PodExpansion
|
||||||
}
|
}
|
||||||
@ -93,8 +93,8 @@ func (c *pods) UpdateEphemeralContainers(ctx context.Context, podName string, po
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resize takes the top resource name and the representation of a pod and updates it. Returns the server's representation of the pod, and an error, if there is any.
|
// UpdateResize takes the top resource name and the representation of a pod and updates it. Returns the server's representation of the pod, and an error, if there is any.
|
||||||
func (c *pods) Resize(ctx context.Context, podName string, pod *corev1.Pod, opts metav1.UpdateOptions) (result *corev1.Pod, err error) {
|
func (c *pods) UpdateResize(ctx context.Context, podName string, pod *corev1.Pod, opts metav1.UpdateOptions) (result *corev1.Pod, err error) {
|
||||||
result = &corev1.Pod{}
|
result = &corev1.Pod{}
|
||||||
err = c.GetClient().Put().
|
err = c.GetClient().Put().
|
||||||
UseProtobufAsDefault().
|
UseProtobufAsDefault().
|
||||||
|
@ -766,7 +766,7 @@ func TestPodResizeRBAC(t *testing.T) {
|
|||||||
v1.ResourceEphemeralStorage: resource.MustParse("2Gi"),
|
v1.ResourceEphemeralStorage: resource.MustParse("2Gi"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
_, err = saClient.CoreV1().Pods(ns.Name).Resize(context.TODO(), resp.Name, resp, metav1.UpdateOptions{})
|
_, err = saClient.CoreV1().Pods(ns.Name).UpdateResize(context.TODO(), resp.Name, resp, metav1.UpdateOptions{})
|
||||||
if tc.allowResize && err != nil {
|
if tc.allowResize && err != nil {
|
||||||
t.Fatalf("Unexpected pod resize failure: %v", err)
|
t.Fatalf("Unexpected pod resize failure: %v", err)
|
||||||
integration.DeletePodOrErrorf(t, adminClient, ns.Name, pod.Name)
|
integration.DeletePodOrErrorf(t, adminClient, ns.Name, pod.Name)
|
||||||
@ -878,7 +878,7 @@ func TestPodResize(t *testing.T) {
|
|||||||
integration.DeletePodOrErrorf(t, client, ns.Name, pod.Name)
|
integration.DeletePodOrErrorf(t, client, ns.Name, pod.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err = client.CoreV1().Pods(ns.Name).Resize(context.TODO(), resp.Name, resp, metav1.UpdateOptions{})
|
resp, err = client.CoreV1().Pods(ns.Name).UpdateResize(context.TODO(), resp.Name, resp, metav1.UpdateOptions{})
|
||||||
if tc.valid && err != nil {
|
if tc.valid && err != nil {
|
||||||
t.Fatalf("Unexpected pod resize failure: %v", err)
|
t.Fatalf("Unexpected pod resize failure: %v", err)
|
||||||
integration.DeletePodOrErrorf(t, client, ns.Name, pod.Name)
|
integration.DeletePodOrErrorf(t, client, ns.Name, pod.Name)
|
||||||
@ -894,7 +894,7 @@ func TestPodResize(t *testing.T) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
resp.Spec.Containers[0].Resources = tc.originalRes
|
resp.Spec.Containers[0].Resources = tc.originalRes
|
||||||
_, err = client.CoreV1().Pods(ns.Name).Resize(context.TODO(), resp.Name, resp, metav1.UpdateOptions{})
|
_, err = client.CoreV1().Pods(ns.Name).UpdateResize(context.TODO(), resp.Name, resp, metav1.UpdateOptions{})
|
||||||
if tc.valid && err != nil {
|
if tc.valid && err != nil {
|
||||||
t.Fatalf("Unexpected pod resize failure: %v", err)
|
t.Fatalf("Unexpected pod resize failure: %v", err)
|
||||||
integration.DeletePodOrErrorf(t, client, ns.Name, pod.Name)
|
integration.DeletePodOrErrorf(t, client, ns.Name, pod.Name)
|
||||||
|
@ -406,7 +406,7 @@ func TestCoreResourceEnqueue(t *testing.T) {
|
|||||||
triggerFn: func(testCtx *testutils.TestContext) (map[framework.ClusterEvent]uint64, error) {
|
triggerFn: func(testCtx *testutils.TestContext) (map[framework.ClusterEvent]uint64, error) {
|
||||||
// Trigger a PodUpdate event by reducing cpu requested by pod1.
|
// Trigger a PodUpdate event by reducing cpu requested by pod1.
|
||||||
// It makes Pod1 schedulable.
|
// It makes Pod1 schedulable.
|
||||||
if _, err := testCtx.ClientSet.CoreV1().Pods(testCtx.NS.Name).Resize(testCtx.Ctx, "pod1", st.MakePod().Name("pod1").Req(map[v1.ResourceName]string{v1.ResourceCPU: "2"}).Container("image").Obj(), metav1.UpdateOptions{}); err != nil {
|
if _, err := testCtx.ClientSet.CoreV1().Pods(testCtx.NS.Name).UpdateResize(testCtx.Ctx, "pod1", st.MakePod().Name("pod1").Req(map[v1.ResourceName]string{v1.ResourceCPU: "2"}).Container("image").Obj(), metav1.UpdateOptions{}); err != nil {
|
||||||
return nil, fmt.Errorf("failed to resize the pod: %w", err)
|
return nil, fmt.Errorf("failed to resize the pod: %w", err)
|
||||||
}
|
}
|
||||||
return map[framework.ClusterEvent]uint64{{Resource: unschedulablePod, ActionType: framework.UpdatePodScaleDown}: 1}, nil
|
return map[framework.ClusterEvent]uint64{{Resource: unschedulablePod, ActionType: framework.UpdatePodScaleDown}: 1}, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user