Giter Site home page Giter Site logo

Comments (7)

Arnavion avatar Arnavion commented on July 4, 2024 1

Yes, IIUC @dpc 's use case wasn't directly related to merge patches, just a custom merge-like thing they were doing locally, so they didn't implement it to follow the Kubernetes strategy specifically. But also IIUC their use case would be unaffected if we did implement the strategy for Vec<T> in accordance with Kubernetes. ie we can repurpose the trait rather than making a whole new one.

So it seems the generated impl incorporate the x-kubernetes-patch-merge-key and x-kubernetes-patch-strategy properties of the fields, and DeepMerge::merge_from would need to take them as a parameter.

from k8s-openapi.

Arnavion avatar Arnavion commented on July 4, 2024

d3718bf ?

from k8s-openapi.

nightkr avatar nightkr commented on July 4, 2024

Oh wow, managed to miss that completely. Will have to investigate!

from k8s-openapi.

nightkr avatar nightkr commented on July 4, 2024

Hm, it looks like this doesn't implement strategic merges, right? So merging the following two documents:

apiVersion: v1
kind: Pod
spec:
  containers:
  - name: nginx
    image: nginx
---
apiVersion: v1
kind: Pod
spec:
  containers:
  - name: nginx
    args: ["-t"]

Would give you the following document:

apiVersion: v1
kind: Pod
spec:
  containers:
  - name: nginx
    image: nginx
  - name: nginx
    args: ["-t"]

But containers is actually an ordered map, so the correct behaviour would have been to merge the two container definitions with the same name, like so:

apiVersion: v1
kind: Pod
spec:
  containers:
  - name: nginx
    image: nginx
    args: ["-t"]

from k8s-openapi.

nightkr avatar nightkr commented on July 4, 2024

In fact, the documented concat behaviour doesn't match any of K8s' merge strategies (see x-kubernetes-map-type and x-kubernetes-list-type).

from k8s-openapi.

nightkr avatar nightkr commented on July 4, 2024

Either that or you could use the strategy to replace the DeepMerge::merge_from call.

from k8s-openapi.

lfrancke avatar lfrancke commented on July 4, 2024

Thank you both for your work on this!

from k8s-openapi.

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.