kubernetes: kubectl edit brokenness editing volumeMounts (list of struct)

Start with:

       volumeMounts:
        - mountPath: /vol
          name: vol 
        - mountPath: /vol-456                                                                                                                                 
          name: vol 
          subPath: d456

Edit to:

        volumeMounts:
        - mountPath: /vol
          name: vol 
        - mountPath: /vol-d2
          name: vol
          subPath: d2     

Read back what happened:

        volumeMounts:
        - mountPath: /vol-d2
          name: vol 
          subPath: d2
        - mountPath: /vol-456
          name: vol 
          subPath: d456

It synthesized a COMPLETELY WRONG result. At this point, I can not, in good conscience, advocate using kubectl edit.

Can I please have kubectl edit --replace that doesn’t go through patch brokenness. Or better, make that default for 1.5 and make kubectl edit --patch be the broken (but eventually fixed) path.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16 (15 by maintainers)

Commits related to this issue

Most upvoted comments

Change the key to mountPath is better. I’m not sure it’s guaranteed unique, but at least duplicate values there are not useful.

I can send a PR for that.

I 100% agree that edit == replace. We should just fix that. It’s human-centric - patch is too clever.

In this particular case, I’d rather see the whole list replaced, rather than an attempted patch, anyway.

On Mon, Oct 17, 2016 at 2:46 PM, Phillip Wittrock notifications@github.com wrote:

@thockin https://github.com/thockin Patch definitely has its share of issues. It sounds like the one you encountered here is actually an issue with how VolumeMount is implemented. I still think there is little value with using patch for edit generally beyond catching these sorts of issues.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kubernetes/kubernetes/issues/34800#issuecomment-254344089, or mute the thread https://github.com/notifications/unsubscribe-auth/AFVgVPQGzMQZDCQWNQm9-Kms1CTIFVX5ks5q0-zTgaJpZM4KWqpF .