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

Support for apply command #358

Closed
jhavero opened this issue Oct 29, 2018 · 5 comments · Fixed by #448
Closed

Support for apply command #358

jhavero opened this issue Oct 29, 2018 · 5 comments · Fixed by #448

Comments

@jhavero
Copy link

jhavero commented Oct 29, 2018

Does this gem support applying yaml files declaratively? For example 'kubectl apply -f file.yml'

@cben
Copy link
Collaborator

cben commented Oct 30, 2018

Not currently.
You can completely replace an object with update_pod() etc.
You can patch specific parts of an object with patch_pod() etc. (currently using "strategic merge patch", want to add others, see #357).
There are several hurdles to process a yaml file with many objects — #329. The next step to make that easier is #332.

But kubectl apply has considerate client-side smarts for not trampling over "external" changes to the object — it records the last applied input in an annotation, and then does something akin to 3-way merge of "last applied" — "new to apply" — "actual".
I'm not sure it's productive to replicate this merging in kubeclient...

Any PRs welcome of course :)

I must say at this point, if what you need is exactly the functionality of apply, shelling out to kubectl is the easy path...

@cben cben added the question label Oct 30, 2018
@rhysm
Copy link
Contributor

rhysm commented May 7, 2019

Server Side Apply is now available as Alpha in Kubernetes 1.14.

Server Side Apply allows clients other than kubectl to perform the Apply operation, and will eventually fully replace the complicated Client Side Apply logic that only exists in kubectl. If the Server Side Apply feature is enabled, the PATCH endpoint accepts the additional application/apply-patch+yaml content type. Users of Server Side Apply can send partially specified objects to this endpoint. An applied config should always include every field that the applier has an opinion about.

I haven't had a chance to look at it yet but if you can also specify application/apply-patch+json to the PATCH endpoint then this is supported already specifying apply-patch as the strategy to patch_entity.

@cben
Copy link
Collaborator

cben commented May 8, 2019

@grosser
Copy link
Contributor

grosser commented Dec 23, 2019

FYI: samson now uses server-side-apply via header-hacks to do this zendesk/samson#3676

@benlangfeld
Copy link
Contributor

Abstract server-side apply support is in #448. I didn't address any more generic interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants