kubernetes / apiserver

Library for writing a Kubernetes-style API server.
Apache License 2.0
655 stars 407 forks source link

MutatingWebHook Configuration Changing Name of Resource #38

Closed rawkode closed 6 years ago

rawkode commented 6 years ago

Hey,

I've been working on a MutatingWebHookConfiguration that modifies the name of a resource (Only on CREATE, I know it's immutable beyond that), depending on the metadata. I'm happy to get into the use-case, if we feel it's pertinent to provide more context.

The problem is, when the next CREATE comes in, I want to modify the name again and UPDATE the existing resource. Is it / will it be possible to "upgrade", for lack of a better term, a CREATE to an UPDATE during this phase?

erictune commented 6 years ago

I would advise you not to do this. Please.

On Sun, Apr 22, 2018 at 1:33 PM David McKay notifications@github.com wrote:

Hey,

I've been working on a MutatingWebHookConfiguration that modifies the name of a resource (Only on CREATE, I know it's immutable beyond that), depending on the metadata. I'm happy to get into the use-case, if we feel it's pertinent to provide more context.

The problem is, when the next CREATE comes in, I want to modify the name again and UPDATE the existing resource. Is it / will it be possible to "upgrade", for lack of a better term, a CREATE to an UPDATE during this phase?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kubernetes/apiserver/issues/38, or mute the thread https://github.com/notifications/unsubscribe-auth/AHuudiS2bi_IHCNLSZkw0gpFFwvQnLUrks5trOkxgaJpZM4TfBCF .

rawkode commented 6 years ago

Hi @erictune,

I do understand why you say that - but it's in-order to provide blue / green deployment automation from within Kubernetes. I was hoping I could allow developers to deploy as normal, but behind the scenes be creating a new deployment and launching a job (or using an operator) to monitor the new deployment for the configured annotation time and then remove the old deployment

rawkode commented 6 years ago

Hmm. Perhaps I could try this another route, and add a new updateStrategy for deployments

erictune commented 6 years ago

You can make your own version of Deployment that does what you want. Here is are two starting points:

On Mon, Apr 23, 2018 at 11:45 PM David McKay notifications@github.com wrote:

Hmm. Perhaps I could try this another route, and add a new updateStrategy for deployments

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

rawkode commented 6 years ago

Thanks for your assistance, @erictune :+1: