Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

overrides op: add seems not to work as expected for array values #1224

Closed
ArchangelX360 opened this issue May 7, 2020 · 2 comments · Fixed by #1232
Closed

overrides op: add seems not to work as expected for array values #1224

ArchangelX360 opened this issue May 7, 2020 · 2 comments · Fixed by #1232
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@ArchangelX360
Copy link
Contributor

What happened:

Let say I have:

spec:
  template:
    spec:
      template:
        spec:
          initContainers:
            - name: myinitcontainer
              args:
                - --logtostderr

Adding an override on an array key using op: add:

spec:
  overrides:
    - clusterName: mycluster
      clusterOverrides:
        - path: "/spec/template/spec/initContainers/0/args"
          op: add
          value:
            - --init
  template:
    spec:
      template:
        spec:
          initContainers:
            - name: myinitcontainer
              args:
                - --logtostderr

Created this object in mycluster:

spec:
    initContainers:
      - name: myinitcontainer
         args:
          - --init

What you expected to happen:

Merging the two arguments in the array, thus creating this object in mycluster instead:

spec:
    initContainers:
      - name: myinitcontainer
         args:
          - --init
          - --logtostderr

How to reproduce it (as minimally and precisely as possible):

Apply the earlier described manifests.

Anything else we need to know?:

I don't think so, if anything missing, please comment :).

Environment:

  • KubeFed version: v0.3.0

/kind bug

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label May 7, 2020
@xunpan
Copy link
Contributor

xunpan commented May 14, 2020

@ArchangelX360
It seems you did not follow the convention of https://tools.ietf.org/html/rfc6902#page-12
Please have another try to make path as below.

spec:
  overrides:
    - clusterName: mycluster
      clusterOverrides:
        - path: "/spec/template/spec/initContainers/0/args/0"
          op: add
          value:
            - --init

@ArchangelX360
Copy link
Contributor Author

Oh I see, you meant:

spec:
  overrides:
    - clusterName: mycluster
      clusterOverrides:
        - path: "/spec/template/spec/initContainers/0/args/0"
          op: add
          value: --init

This works, thanks, I'll PR to add this to the override documentation to avoid future user's confusion.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants