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

"delete patch type with no merge key defined" when removing mountPath #36024

Closed
msmans opened this issue Nov 1, 2016 · 10 comments
Closed

"delete patch type with no merge key defined" when removing mountPath #36024

msmans opened this issue Nov 1, 2016 · 10 comments
Labels
area/kubectl priority/backlog Higher priority than priority/awaiting-more-evidence.

Comments

@msmans
Copy link

msmans commented Nov 1, 2016

Is this a request for help? (If yes, you should use our troubleshooting guide and community support channels, see http://kubernetes.io/docs/troubleshooting/.): No

What keywords did you search in Kubernetes issues before filing this one? (If you have found any duplicates, you should instead reply there.):

  • delete patch type with no merge key defined
  • cannot apply deleted mountpath kubernetes

Is this a BUG REPORT or FEATURE REQUEST? (choose one): BUG REPORT

Kubernetes version (use kubectl version):

Client Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.1", GitCommit:"33cf7b9acbb2cb7c9c72a10d6636321fb180b159", GitTreeState:"clean", BuildDate:"2016-10-10T18:19:49Z", GoVersion:"go1.6.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.4", GitCommit:"3b417cc4ccd1b8f38ff9ec96bb50a81ca0ea9d56", GitTreeState:"clean", BuildDate:"2016-10-21T02:42:39Z", GoVersion:"go1.6.3", Compiler:"gc", Platform:"linux/amd64"}

Environment:

  • Cloud provider or hardware configuration: AWS
  • OS (e.g. from /etc/os-release): Arch Linux
  • Kernel (e.g. uname -a): Linux niagara 4.8.4-1-ARCH #1 SMP PREEMPT Sat Oct 22 18:26:57 CEST 2016 x86_64 GNU/Linux
  • Install tools: ?
  • Others: ?

What happened: After removing one of the pod container's volumeMounts from a deployment spec file and attempted to apply it using kubectl apply -f test-deploy.yaml, I got the following error message:

"test-deploy.yaml": delete patch type with no merge key defined

What you expected to happen: changes to take effect successfully

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

  1. Create a deployment below:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: rm-mount-test
spec:
  replicas: 1
  template:
    metadata:
      labels:
        uid: abcdefght
    spec:
      containers:
      - name: debian
        image: debian
        args:
        - sleep
        - "100000"
        volumeMounts:
        - mountPath: /empty
          name: empty
        - mountPath: /empty2
          name: empty2
      volumes:
      - name: empty
        emptyDir:
      - name: empty2
        emptyDir:

Once successfully up, remove the lines below and use kubectl apply to update it:

        - mountPath: /empty2
          name: empty2

Anything else do we need to know:

@msmans
Copy link
Author

msmans commented Nov 2, 2016

kubectl replace seems to work but I'm not sure if it has the same effect.

@bgrant0607
Copy link
Member

cc @ymqytw @pwittrock

@mengqiy
Copy link
Member

mengqiy commented Nov 17, 2016

I guess you are using kubectl create without --save-config to create the resource.

To use ‘apply’, always create the resource initially with either ‘apply’ or ‘create –save-config’.

See: http://kubernetes.io/docs/user-guide/kubectl/kubectl_apply/

@msmans
Copy link
Author

msmans commented Nov 17, 2016

@ymqytw I created and updated the resource using kubectl apply.

@mengqiy
Copy link
Member

mengqiy commented Nov 17, 2016

@msmans Can you paste the output of kubectl get deployment rm-mount-test -o yaml after creating the resource using kubectl apply?

@msmans
Copy link
Author

msmans commented Nov 17, 2016

[mike@niagara tmp]$ kubectl apply -f rm-mount-test.yaml 
deployment "rm-mount-test" created
[mike@niagara tmp]$ kubectl get deployment rm-mount-test -o yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "1"
    kubectl.kubernetes.io/last-applied-configuration: '{"kind":"Deployment","apiVersion":"extensions/v1beta1","metadata":{"name":"rm-mount-test","creationTimestamp":null},"spec":{"replicas":1,"template":{"metadata":{"creationTimestamp":null,"labels":{"uid":"abcdefght"}},"spec":{"volumes":[{"name":"empty"},{"name":"empty2"}],"containers":[{"name":"debian","image":"debian","args":["sleep","100000"],"resources":{},"volumeMounts":[{"name":"empty","mountPath":"/empty"},{"name":"empty2","mountPath":"/empty2"}]}]}},"strategy":{}},"status":{}}'
  creationTimestamp: 2016-11-17T06:17:27Z
  generation: 2
  labels:
    uid: abcdefght
  name: rm-mount-test
  namespace: default
  resourceVersion: "3205481"
  selfLink: /apis/extensions/v1beta1/namespaces/default/deployments/rm-mount-test
  uid: 83949185-ac8d-11e6-beb2-06a0234536c7
spec:
  replicas: 1
  selector:
    matchLabels:
      uid: abcdefght
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        uid: abcdefght
    spec:
      containers:
      - args:
        - sleep
        - "100000"
        image: debian
        imagePullPolicy: Always
        name: debian
        resources: {}
        terminationMessagePath: /dev/termination-log
        volumeMounts:
        - mountPath: /empty
          name: empty
        - mountPath: /empty2
          name: empty2
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
      - emptyDir: {}
        name: empty
      - emptyDir: {}
        name: empty2
status:
  availableReplicas: 1
  observedGeneration: 2
  replicas: 1
  updatedReplicas: 1

@msmans
Copy link
Author

msmans commented Nov 17, 2016

And this is after the second kubectl apply having removed the lines from step 2:

[mike@niagara tmp]$ vim rm-mount-test.yaml 
[mike@niagara tmp]$ kubectl apply -f rm-mount-test.yaml 
Error from server: error when applying patch:
{"metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"kind\":\"Deployment\",\"apiVersion\":\"extensions/v1beta1\",\"metadata\":{\"name\":\"rm-mount-test\",\"creationTimestamp\":null},\"spec\":{\"replicas\":1,\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"uid\":\"abcdefght\"}},\"spec\":{\"volumes\":[{\"name\":\"empty\"},{\"name\":\"empty2\"}],\"containers\":[{\"name\":\"debian\",\"image\":\"debian\",\"args\":[\"sleep\",\"100000\"],\"resources\":{},\"volumeMounts\":[{\"name\":\"empty\",\"mountPath\":\"/empty\"}]}]}},\"strategy\":{}},\"status\":{}}"},"creationTimestamp":null},"spec":{"template":{"spec":{"containers":[{"name":"debian","volumeMounts":[{"$patch":"delete","name":"empty2"}]}]}}}}
to:
&{0xc82062fd40 0xc82033a930 default rm-mount-test rm-mount-test.yaml &Deployment{ObjectMeta:k8s_io_kubernetes_pkg_api_v1.ObjectMeta{Name:rm-mount-test,GenerateName:,Namespace:,SelfLink:,UID:,ResourceVersion:,Generation:0,CreationTimestamp:0001-01-01 00:00:00 +0000 UTC,DeletionTimestamp:<nil>,DeletionGracePeriodSeconds:nil,Labels:map[string]string{},Annotations:map[string]string{kubectl.kubernetes.io/last-applied-configuration: ,},OwnerReferences:[],Finalizers:[],ClusterName:,},Spec:DeploymentSpec{Replicas:*1,Selector:nil,Template:k8s_io_kubernetes_pkg_api_v1.PodTemplateSpec{ObjectMeta:ObjectMeta{Name:,GenerateName:,Namespace:,SelfLink:,UID:,ResourceVersion:,Generation:0,CreationTimestamp:0001-01-01 00:00:00 +0000 UTC,DeletionTimestamp:<nil>,DeletionGracePeriodSeconds:nil,Labels:map[string]string{uid: abcdefght,},Annotations:map[string]string{},OwnerReferences:[],Finalizers:[],ClusterName:,},Spec:PodSpec{Volumes:[{empty {nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil}} {empty2 {nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil}}],Containers:[{debian debian [] [sleep 100000]  [] [] {map[] map[]} [{empty false /empty }] nil nil nil   nil false false false}],RestartPolicy:,TerminationGracePeriodSeconds:nil,ActiveDeadlineSeconds:nil,DNSPolicy:,NodeSelector:map[string]string{},ServiceAccountName:,DeprecatedServiceAccount:,NodeName:,HostNetwork:false,HostPID:false,HostIPC:false,SecurityContext:nil,ImagePullSecrets:[],Hostname:,Subdomain:,},},Strategy:DeploymentStrategy{Type:,RollingUpdate:nil,},MinReadySeconds:0,RevisionHistoryLimit:nil,Paused:false,RollbackTo:nil,},Status:DeploymentStatus{ObservedGeneration:0,Replicas:0,UpdatedReplicas:0,AvailableReplicas:0,UnavailableReplicas:0,},} &TypeMeta{Kind:,APIVersion:,} 3205481 false}
for: "rm-mount-test.yaml": delete patch type with no merge key defined

@mengqiy
Copy link
Member

mengqiy commented Nov 17, 2016

We changed the merge key of volumeMounts from name to mountPath in #35071 and it has been cherrypicked into 1.4 #35208. This why you are broken using 1.4.1 kubectl with 1.4.4 server.
cc: @pwittrock @thockin

@pwittrock
Copy link
Member

@msmans If you use the same kubectl client version as the server, does this resolve the issue?

@pwittrock pwittrock added the priority/backlog Higher priority than priority/awaiting-more-evidence. label Nov 17, 2016
@msmans
Copy link
Author

msmans commented Nov 17, 2016

@pwittrock yep — upgrading the client fixed the issue. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubectl priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
None yet
Development

No branches or pull requests

5 participants