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 apply -f functionality #64

Closed
silasbw opened this issue Jan 26, 2017 · 4 comments
Closed

kubectl apply -f functionality #64

silasbw opened this issue Jan 26, 2017 · 4 comments
Labels
help wanted request for example kubernetes-client user is requesting an example implementation

Comments

@silasbw
Copy link
Contributor

silasbw commented Jan 26, 2017

From @therynamo:

"Another nicety would be being able to do something like kubectl apply -f, programatically. So instead of seeing, Error: deployment "insert_deployment_name_here" already exists, it would just overwrite with the new config. However, I may have yet again misread the docs."

@silasbw silasbw added help wanted request for example kubernetes-client user is requesting an example implementation labels Mar 17, 2018
@cfellin1
Copy link
Contributor

I'm interested in looking into this @silasbw.

@cfellin1
Copy link
Contributor

cfellin1 commented Jul 30, 2018

RE apply, this seems to get the job done:

const deploymentManifest = require('./nginx-deployment.json')
client.apis.apps.v1.namespaces('default').deployments('nginx-deployment').put({ body: deploymentManifest });

Though please correct me if there's a requirement I'm missing here.

@cfellin1
Copy link
Contributor

Though I suppose it has the downside of working exclusively for replace and not working for create in the way apply does.

@silasbw
Copy link
Contributor Author

silasbw commented Aug 1, 2018

Yeah, what about adding a pattern to examples/? Something like:

try {
  await client.apis.apps.v1.namespaces.post(...);
} catch (err) {
  if (err.code !== 409) throw err;
  await client.apis.apps.v1.namespaces.put(...);
}

I'm reluctant to include it in the kubernetes-client library because it would be introducing a "high-level wrapper" to what is currently a pretty straightforward REST API wrapper.

@silasbw silasbw closed this as completed in 2014d27 Aug 1, 2018
kdamedhaar pushed a commit to kdamedhaar/k8-client that referenced this issue Dec 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted request for example kubernetes-client user is requesting an example implementation
Projects
None yet
Development

No branches or pull requests

2 participants