Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubectl failed to delete uninitialized resources #51185

Closed
dixudx opened this issue Aug 23, 2017 · 0 comments · Fixed by #51186
Closed

kubectl failed to delete uninitialized resources #51185

dixudx opened this issue Aug 23, 2017 · 0 comments · Fixed by #51186
Labels
kind/bug Categorizes issue or PR as related to a bug. sig/cli Categorizes an issue or PR as relevant to SIG CLI.

Comments

@dixudx
Copy link
Member

dixudx commented Aug 23, 2017

Is this a BUG REPORT or FEATURE REQUEST?:

/kind bug
/sig cli

What happened:

This is not a dup of #49035.

kubectl cannot delete resources of Deployment/ReplicaSet/StatefulSet when enabling initializers. But works well for other kind of resources.

What you expected to happen:
Successfully delete them.

How to reproduce it (as minimally and precisely as possible):

  1. Create a deployment with initializer:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: web
  labels:
    run: web
  initializers:
    pending:
    - name: podimage.initializer.com
spec:
  replicas: 5
  selector:
    matchLabels:
      run: web
  template:
    metadata:
      labels:
        run: web
    spec:
      containers:
      - image: nginx:1.10
        name: web
        ports:
        - containerPort: 80
          protocol: TCP

Then create using

$ kubectl create -f above.yaml

Currently you cannot see it using kubectl get deploy before #50497 get merged (kubectl get deploy --include-unintialized).

But getting a single resource still works,

$ kubectl get deploy web
NAME      DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
web       5         0         0            0           1m
  1. Delete the deployment
$ kubectl delete -v 10 deploy web
I0823 17:41:35.870114   84221 loader.go:357] Config loaded from file /Users/xxx/.kube/config
I0823 17:41:35.873297   84221 cached_discovery.go:119] returning cached discovery info from /Users/xxx/.kube/cache/discovery/172.17.8.101/servergroups.json
...
I0823 17:41:35.884925   84221 cached_discovery.go:119] returning cached discovery info from /Users/xxx/.kube/cache/discovery/172.17.8.101/servergroups.json
I0823 17:41:35.899609   84221 round_trippers.go:386] curl -k -v -XGET  -H "Accept: application/json, */*" -H "User-Agent: kubectl/v1.7.2 (darwin/amd64) kubernetes/922a86c" https://172.17.8.101/apis/extensions/v1beta1/namespaces/default/deployments/web
I0823 17:41:35.916715   84221 round_trippers.go:405] GET https://172.17.8.101/apis/extensions/v1beta1/namespaces/default/deployments/web 200 OK in 17 milliseconds
I0823 17:41:35.916734   84221 round_trippers.go:411] Response Headers:
I0823 17:41:35.916738   84221 round_trippers.go:414]     Content-Type: application/json
I0823 17:41:35.916742   84221 round_trippers.go:414]     Content-Length: 1011
I0823 17:41:35.916751   84221 round_trippers.go:414]     Date: Wed, 23 Aug 2017 09:41:35 GMT
I0823 17:41:35.916778   84221 request.go:991] Response Body: {"kind":"Deployment","apiVersion":"extensions/v1beta1","metadata":{"name":"web","namespace":"default","selfLink":"/apis/extensions/v1beta1/namespaces/default/deployments/web","uid":"2ece5dec-87e7-11e7-919e-080027b3b3af","resourceVersion":"88712","generation":1,"creationTimestamp":"2017-08-23T09:41:05Z","labels":{"run":"web"},"initializers":{"pending":[{"name":"podimage.initializer.com"}]}},"spec":{"replicas":5,"selector":{"matchLabels":{"run":"web"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"run":"web"}},"spec":{"containers":[{"name":"web","image":"nginx:1.10","ports":[{"containerPort":80,"protocol":"TCP"}],"resources":{},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"IfNotPresent"}],"restartPolicy":"Always","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","securityContext":{},"schedulerName":"default-scheduler"}},"strategy":{"type":"RollingUpdate","rollingUpdate":{"maxUnavailable":1,"maxSurge":1}}},"status":{}}
I0823 17:41:35.920746   84221 request.go:991] Request Body: {"kind":"Deployment","apiVersion":"extensions/v1beta1","metadata":{"name":"web","namespace":"default","selfLink":"/apis/extensions/v1beta1/namespaces/default/deployments/web","uid":"2ece5dec-87e7-11e7-919e-080027b3b3af","resourceVersion":"88712","generation":1,"creationTimestamp":"2017-08-23T09:41:05Z","labels":{"run":"web"},"initializers":{"pending":[{"name":"podimage.initializer.com"}]}},"spec":{"replicas":0,"selector":{"matchLabels":{"run":"web"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"run":"web"}},"spec":{"containers":[{"name":"web","image":"nginx:1.10","ports":[{"containerPort":80,"protocol":"TCP"}],"resources":{},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"IfNotPresent"}],"restartPolicy":"Always","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","securityContext":{},"schedulerName":"default-scheduler"}},"strategy":{"type":"RollingUpdate","rollingUpdate":{"maxUnavailable":1,"maxSurge":1}},"revisionHistoryLimit":0,"paused":true},"status":{}}
I0823 17:41:35.920827   84221 round_trippers.go:386] curl -k -v -XPUT  -H "Accept: application/json, */*" -H "Content-Type: application/json" -H "User-Agent: kubectl/v1.7.2 (darwin/amd64) kubernetes/922a86c" https://172.17.8.101/apis/extensions/v1beta1/namespaces/default/deployments/web
I0823 17:41:35.924697   84221 round_trippers.go:405] PUT https://172.17.8.101/apis/extensions/v1beta1/namespaces/default/deployments/web 200 OK in 3 milliseconds
I0823 17:41:35.924712   84221 round_trippers.go:411] Response Headers:
I0823 17:41:35.924716   84221 round_trippers.go:414]     Content-Type: application/json
I0823 17:41:35.924719   84221 round_trippers.go:414]     Content-Length: 1050
I0823 17:41:35.924722   84221 round_trippers.go:414]     Date: Wed, 23 Aug 2017 09:41:35 GMT
I0823 17:41:35.924743   84221 request.go:991] Response Body: {"kind":"Deployment","apiVersion":"extensions/v1beta1","metadata":{"name":"web","namespace":"default","selfLink":"/apis/extensions/v1beta1/namespaces/default/deployments/web","uid":"2ece5dec-87e7-11e7-919e-080027b3b3af","resourceVersion":"88748","generation":2,"creationTimestamp":"2017-08-23T09:41:05Z","labels":{"run":"web"},"initializers":{"pending":[{"name":"podimage.initializer.com"}]}},"spec":{"replicas":0,"selector":{"matchLabels":{"run":"web"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"run":"web"}},"spec":{"containers":[{"name":"web","image":"nginx:1.10","ports":[{"containerPort":80,"protocol":"TCP"}],"resources":{},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"IfNotPresent"}],"restartPolicy":"Always","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","securityContext":{},"schedulerName":"default-scheduler"}},"strategy":{"type":"RollingUpdate","rollingUpdate":{"maxUnavailable":1,"maxSurge":1}},"revisionHistoryLimit":0,"paused":true},"status":{}}
I0823 17:41:36.926410   84221 round_trippers.go:386] curl -k -v -XGET  -H "Accept: application/json, */*" -H "User-Agent: kubectl/v1.7.2 (darwin/amd64) kubernetes/922a86c" https://172.17.8.101/apis/extensions/v1beta1/namespaces/default/deployments/web
I0823 17:41:36.928309   84221 round_trippers.go:405] GET https://172.17.8.101/apis/extensions/v1beta1/namespaces/default/deployments/web 200 OK in 1 milliseconds
I0823 17:41:36.928324   84221 round_trippers.go:411] Response Headers:
I0823 17:41:36.928327   84221 round_trippers.go:414]     Content-Type: application/json
I0823 17:41:36.928330   84221 round_trippers.go:414]     Content-Length: 1050
I0823 17:41:36.928332   84221 round_trippers.go:414]     Date: Wed, 23 Aug 2017 09:41:36 GMT
I0823 17:41:36.928353   84221 request.go:991] Response Body: {"kind":"Deployment","apiVersion":"extensions/v1beta1","metadata":{"name":"web","namespace":"default","selfLink":"/apis/extensions/v1beta1/namespaces/default/deployments/web","uid":"2ece5dec-87e7-11e7-919e-080027b3b3af","resourceVersion":"88748","generation":2,"creationTimestamp":"2017-08-23T09:41:05Z","labels":{"run":"web"},"initializers":{"pending":[{"name":"podimage.initializer.com"}]}},"spec":{"replicas":0,"selector":{"matchLabels":{"run":"web"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"run":"web"}},"spec":{"containers":[{"name":"web","image":"nginx:1.10","ports":[{"containerPort":80,"protocol":"TCP"}],"resources":{},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"IfNotPresent"}],"restartPolicy":"Always","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","securityContext":{},"schedulerName":"default-scheduler"}},"strategy":{"type":"RollingUpdate","rollingUpdate":{"maxUnavailable":1,"maxSurge":1}},"revisionHistoryLimit":0,"paused":true},"status":{}}

The deployment web cannot be deleted and the requests keep performing GET https://172.17.8.101/apis/extensions/v1beta1/namespaces/default/deployments/web. And the response body stays unchanged.

Anything else we need to know?:

Environment:

  • Kubernetes version (use kubectl version):
Client Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.2", GitCommit:"922a86cfcd65915a9b2f69f3f193b8907d741d9c", GitTreeState:"clean", BuildDate:"2017-07-21T08:23:22Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.2", GitCommit:"922a86cfcd65915a9b2f69f3f193b8907d741d9c", GitTreeState:"clean", BuildDate:"2017-07-21T08:08:00Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
  • Cloud provider or hardware configuration**:
  • OS (e.g. from /etc/os-release):
  • Kernel (e.g. uname -a):
  • Install tools:
  • Others:
@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. sig/cli Categorizes an issue or PR as relevant to SIG CLI. labels Aug 23, 2017
k8s-github-robot pushed a commit that referenced this issue Sep 6, 2017
Automatic merge from submit-queue (batch tested with PRs 51186, 50350, 51751, 51645, 51837)

fix bug on kubectl deleting uninitialized resources

**What this PR does / why we need it**:

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #51185

**Special notes for your reviewer**:
/assign @caesarxuchao @ahmetb 

**Release note**:

```release-note
fix bug on kubectl deleting uninitialized resources
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. sig/cli Categorizes an issue or PR as relevant to SIG CLI.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants