mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-17 07:03:31 +00:00
Added TerminationGracePeriod field to PodSpec and grace-period flag to kubectl stop
Those are changes which touch users required by Termination Notice Addresses #6804
This commit is contained in:
@@ -32,7 +32,7 @@ type PodsNamespacer interface {
|
||||
type PodInterface interface {
|
||||
List(label labels.Selector, field fields.Selector) (*api.PodList, error)
|
||||
Get(name string) (*api.Pod, error)
|
||||
Delete(name string) error
|
||||
Delete(name string, options *api.DeleteOptions) error
|
||||
Create(pod *api.Pod) (*api.Pod, error)
|
||||
Update(pod *api.Pod) (*api.Pod, error)
|
||||
Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
|
||||
@@ -69,8 +69,16 @@ func (c *pods) Get(name string) (result *api.Pod, err error) {
|
||||
}
|
||||
|
||||
// Delete takes the name of the pod, and returns an error if one occurs
|
||||
func (c *pods) Delete(name string) error {
|
||||
return c.r.Delete().Namespace(c.ns).Resource("pods").Name(name).Do().Error()
|
||||
func (c *pods) Delete(name string, options *api.DeleteOptions) error {
|
||||
// TODO: to make this reusable in other client libraries
|
||||
if options == nil {
|
||||
return c.r.Delete().Namespace(c.ns).Resource("pods").Name(name).Do().Error()
|
||||
}
|
||||
body, err := api.Scheme.EncodeToVersion(options, c.r.APIVersion())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return c.r.Delete().Namespace(c.ns).Resource("pods").Name(name).Body(body).Do().Error()
|
||||
}
|
||||
|
||||
// Create takes the representation of a pod. Returns the server's representation of the pod, and an error, if it occurs.
|
||||
|
@@ -136,7 +136,7 @@ func TestDeletePod(t *testing.T) {
|
||||
Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath("pods", ns, "foo"), Query: buildQueryValues(ns, nil)},
|
||||
Response: Response{StatusCode: 200},
|
||||
}
|
||||
err := c.Setup().Pods(ns).Delete("foo")
|
||||
err := c.Setup().Pods(ns).Delete("foo", nil)
|
||||
c.Validate(t, nil, err)
|
||||
}
|
||||
|
||||
|
@@ -40,7 +40,7 @@ func (c *FakePods) Get(name string) (*api.Pod, error) {
|
||||
return obj.(*api.Pod), err
|
||||
}
|
||||
|
||||
func (c *FakePods) Delete(name string) error {
|
||||
func (c *FakePods) Delete(name string, options *api.DeleteOptions) error {
|
||||
_, err := c.Fake.Invokes(FakeAction{Action: "delete-pod", Value: name}, &api.Pod{})
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user