Git Product home page Git Product logo

Comments (5)

tintoy avatar tintoy commented on July 17, 2024 1

Ah, I think I see the source of the confusion :)

The idea is that you call Update with a callback delegate, and it passes your delegate a patch document in the delegate (makes it easier to use inline):

await depClient.Update("my-deployment-name", patch =>
{
    patch.Replace(deployment => deployment.Spec.Replicas, 2);
});

from dotnet-kube-client.

brobichaud avatar brobichaud commented on July 17, 2024 1

Perfect, exactly what I needed. Thanks!

from dotnet-kube-client.

tintoy avatar tintoy commented on July 17, 2024 1

Hi - I'm going to close this issue, but feel free to reopen it if you need to :)

from dotnet-kube-client.

tintoy avatar tintoy commented on July 17, 2024

Hi. It's unfortunate, but the K8s API makes it painful to do updates that aren't JSON-PATCH-based (which is why the update API looks like it does).

I don't think we have a specific example, but I'll see if I can write one up.

from dotnet-kube-client.

brobichaud avatar brobichaud commented on July 17, 2024

That would be great @tintoy. Below is some pseudo code of where I am headed currently. I have no idea what to do in the Action delegate...

var depClient = GetDeploymentClient();
var dep = await depClient.Get("my-deployment-name");
var patchDoc = new JsonPatchDocument<DeploymentV1>();
patchDoc.Replace(e => e.Spec.Replicas, 2);
Action<JsonPatchDocument<DeploymentV1>> act = (JsonPatchDocument<DeploymentV1> p) => Console.WriteLine(p.Operations.Count);
await depClient.Update(dep.Metadata.Name, act);

from dotnet-kube-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.