Skip to content

Mutation: introduce "priority" parameter to enforce ordering of mutations #1133

@mmirecki

Description

@mmirecki

The mutations are always applied as an ordered list to ensure the same mutation result. It can be however difficult for the user to predict this order and therefore the outcome.
I was asked what the result of the following mutations would be:

Mutation A:

    location: "spec.containers[name:networking]"
    parameters:
      assign:
        value:
          name: "networking"
          image: "myrepo/myimage"
          ...
          command:
          - init

Mutation B:

    location: "spec.containers[name:*].imagePullPolicy"
    parameters:
      assign
           value: “Always”

The mutations add a sidecar and modify the imagePullPolicy. Depending on the order of the mutations, the created sidecar will, or will not have the imagePullPolicy mutation applied.

A solution for this could be an additional "priority" parameter, which would allow the user to have influence on the order of applying the mutations.
The mutations would be sorted by "priority" first. The parameter can be optional, elements with no "priority" specified being the last to be applied.

For example, modifying the above example, we could give mutation B a higher priority, therefore ensuring that the new sidecar has no imagePullPolicy:

Mutation A:

    location: "spec.containers[name:networking]"
    parameters:
      priority: 10
      assign:
        value:
          name: "networking"
          image: "myrepo/myimage"
          ...
          command:
          - init

Mutation B:

    location: "spec.containers[name:*].imagePullPolicy"
    parameters:
      priority 100
      assign
           value: “Always”

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions