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

Systems with conflicting mutators may not converge #1216

Closed
maxsmythe opened this issue Apr 1, 2021 · 3 comments · Fixed by #1364 or #1569
Closed

Systems with conflicting mutators may not converge #1216

maxsmythe opened this issue Apr 1, 2021 · 3 comments · Fixed by #1364 or #1569
Assignees
Labels
bug Something isn't working mutation
Milestone

Comments

@maxsmythe
Copy link
Contributor

If a system has conflicting mutators (i.e. they disagree as to the schema of the resource they're mutating), currently the first mutator to be ingested is recognized and the second is ignored.

In an eventually consistent system with mutiple pods, this is broken and will not converge. If mutators A and B are in conflict and pod 1 recognizes mutator A, while pod 2 recognizes mutator B, the system will not be idempotent... it's answer may change depending on which pod processes the request.

The solution is to disallow all conflicting mutators. Such a rule would lead to convergence regardless of order.

@maxsmythe maxsmythe added bug Something isn't working mutation labels Apr 1, 2021
@maxsmythe maxsmythe added this to the Mutation Beta milestone Apr 1, 2021
@willbeason
Copy link
Member

I can take this

@willbeason
Copy link
Member

An example of mutators with conflicting schemas would be:

spec.containers[name: "foo"].bar = "hello"
spec.containers.foo.bar = "hello"

The first assumes spec.containers is a list, and the second assumes spec.containers is an object.

The following class of conflict is considered out of scope for this issue (it is left to the user to prevent this):

spec.containers.azure.bar = "hi"
spec.containers.azure.bar = "hello"

willbeason pushed a commit to willbeason/gatekeeper that referenced this issue Jun 15, 2021
When multiple Pods are running mutators, it is possible that they will
ingest mutators in different orders. Before this PR, we would
essentially randomly pick which mutator to honor and discard future
mutators which conflicted.

Fixes: open-policy-agent#1216

Signed-off-by: Will Beason <willbeason@google.com>
willbeason pushed a commit to willbeason/gatekeeper that referenced this issue Jun 15, 2021
When multiple Pods are running mutators, it is possible that they will
ingest mutators in different orders. Before this PR, we would
essentially randomly pick which mutator to honor and discard future
mutators which conflicted.

Fixes: open-policy-agent#1216

Signed-off-by: Will Beason <willbeason@google.com>
willbeason pushed a commit to willbeason/gatekeeper that referenced this issue Jun 16, 2021
When multiple Pods are running mutators, it is possible that they will
ingest mutators in different orders. Before this PR, we would
essentially randomly pick which mutator to honor and discard future
mutators which conflicted.

Fixes: open-policy-agent#1216

Signed-off-by: Will Beason <willbeason@google.com>
willbeason pushed a commit to willbeason/gatekeeper that referenced this issue Jun 16, 2021
When multiple Pods are running mutators, it is possible that they will
ingest mutators in different orders. Before this PR, we would
essentially randomly pick which mutator to honor and discard future
mutators which conflicted.

Fixes: open-policy-agent#1216

Signed-off-by: Will Beason <willbeason@google.com>
willbeason pushed a commit to willbeason/gatekeeper that referenced this issue Jun 16, 2021
When multiple Pods are running mutators, it is possible that they will
ingest mutators in different orders. Before this PR, we would
essentially randomly pick which mutator to honor and discard future
mutators which conflicted.

Fixes: open-policy-agent#1216

Signed-off-by: Will Beason <willbeason@google.com>
willbeason pushed a commit to willbeason/gatekeeper that referenced this issue Jun 16, 2021
When multiple Pods are running mutators, it is possible that they will
ingest mutators in different orders. Before this PR, we would
essentially randomly pick which mutator to honor and discard future
mutators which conflicted.

Fixes: open-policy-agent#1216

Signed-off-by: Will Beason <willbeason@google.com>
willbeason pushed a commit to willbeason/gatekeeper that referenced this issue Jun 16, 2021
When multiple Pods are running mutators, it is possible that they will
ingest mutators in different orders. Before this PR, we would
essentially randomly pick which mutator to honor and discard future
mutators which conflicted.

Fixes: open-policy-agent#1216

Signed-off-by: Will Beason <willbeason@google.com>
willbeason pushed a commit to willbeason/gatekeeper that referenced this issue Jun 16, 2021
When multiple Pods are running mutators, it is possible that they will
ingest mutators in different orders. Before this PR, we would
essentially randomly pick which mutator to honor and discard future
mutators which conflicted.

Fixes: open-policy-agent#1216

Signed-off-by: Will Beason <willbeason@google.com>
willbeason pushed a commit to willbeason/gatekeeper that referenced this issue Jun 16, 2021
When multiple Pods are running mutators, it is possible that they will
ingest mutators in different orders. Before this PR, we would
essentially randomly pick which mutator to honor and discard future
mutators which conflicted.

Fixes: open-policy-agent#1216

Signed-off-by: Will Beason <willbeason@google.com>
willbeason pushed a commit to willbeason/gatekeeper that referenced this issue Jun 16, 2021
When multiple Pods are running mutators, it is possible that they will
ingest mutators in different orders. Before this PR, we would
essentially randomly pick which mutator to honor and discard future
mutators which conflicted.

Fixes: open-policy-agent#1216

Signed-off-by: Will Beason <willbeason@google.com>
willbeason pushed a commit to willbeason/gatekeeper that referenced this issue Jun 17, 2021
When multiple Pods are running mutators, it is possible that they will
ingest mutators in different orders. Before this PR, we would
essentially randomly pick which mutator to honor and discard future
mutators which conflicted.

Fixes: open-policy-agent#1216

Signed-off-by: Will Beason <willbeason@google.com>
willbeason pushed a commit to willbeason/gatekeeper that referenced this issue Jun 17, 2021
When multiple Pods are running mutators, it is possible that they will
ingest mutators in different orders. Before this PR, we would
essentially randomly pick which mutator to honor and discard future
mutators which conflicted.

Fixes: open-policy-agent#1216

Signed-off-by: Will Beason <willbeason@google.com>
willbeason pushed a commit to willbeason/gatekeeper that referenced this issue Jun 17, 2021
When multiple Pods are running mutators, it is possible that they will
ingest mutators in different orders. Before this PR, we would
essentially randomly pick which mutator to honor and discard future
mutators which conflicted.

Fixes: open-policy-agent#1216

Signed-off-by: Will Beason <willbeason@google.com>
willbeason pushed a commit to willbeason/gatekeeper that referenced this issue Jun 18, 2021
When multiple Pods are running mutators, it is possible that they will
ingest mutators in different orders. Before this PR, we would
essentially randomly pick which mutator to honor and discard future
mutators which conflicted.

Fixes: open-policy-agent#1216

Signed-off-by: Will Beason <willbeason@google.com>
willbeason pushed a commit to willbeason/gatekeeper that referenced this issue Jun 18, 2021
When multiple Pods are running mutators, it is possible that they will
ingest mutators in different orders. Before this PR, we would
essentially randomly pick which mutator to honor and discard future
mutators which conflicted.

Fixes: open-policy-agent#1216

Signed-off-by: Will Beason <willbeason@google.com>
willbeason pushed a commit to willbeason/gatekeeper that referenced this issue Jun 21, 2021
When multiple Pods are running mutators, it is possible that they will
ingest mutators in different orders. Before this PR, we would
essentially randomly pick which mutator to honor and discard future
mutators which conflicted.

Fixes: open-policy-agent#1216

Signed-off-by: Will Beason <willbeason@google.com>
willbeason pushed a commit to willbeason/gatekeeper that referenced this issue Jun 22, 2021
When multiple Pods are running mutators, it is possible that they will
ingest mutators in different orders. Before this PR, we would
essentially randomly pick which mutator to honor and discard future
mutators which conflicted.

Fixes: open-policy-agent#1216

Signed-off-by: Will Beason <willbeason@google.com>
willbeason pushed a commit to willbeason/gatekeeper that referenced this issue Jun 29, 2021
When multiple Pods are running mutators, it is possible that they will
ingest mutators in different orders. Before this PR, we would
essentially randomly pick which mutator to honor and discard future
mutators which conflicted.

Fixes: open-policy-agent#1216

Signed-off-by: Will Beason <willbeason@google.com>
willbeason pushed a commit to willbeason/gatekeeper that referenced this issue Jul 8, 2021
When multiple Pods are running mutators, it is possible that they will
ingest mutators in different orders. Before this PR, we would
essentially randomly pick which mutator to honor and discard future
mutators which conflicted.

Fixes: open-policy-agent#1216

Signed-off-by: Will Beason <willbeason@google.com>
willbeason pushed a commit to willbeason/gatekeeper that referenced this issue Jul 12, 2021
When multiple Pods are running mutators, it is possible that they will
ingest mutators in different orders. Before this PR, we would
essentially randomly pick which mutator to honor and discard future
mutators which conflicted.

Fixes: open-policy-agent#1216

Signed-off-by: Will Beason <willbeason@google.com>
willbeason pushed a commit to willbeason/gatekeeper that referenced this issue Jul 13, 2021
When multiple Pods are running mutators, it is possible that they will
ingest mutators in different orders. Before this PR, we would
essentially randomly pick which mutator to honor and discard future
mutators which conflicted.

Fixes: open-policy-agent#1216

Signed-off-by: Will Beason <willbeason@google.com>
willbeason pushed a commit to willbeason/gatekeeper that referenced this issue Jul 13, 2021
When multiple Pods are running mutators, it is possible that they will
ingest mutators in different orders. Before this PR, we would
essentially randomly pick which mutator to honor and discard future
mutators which conflicted.

Fixes: open-policy-agent#1216

Signed-off-by: Will Beason <willbeason@google.com>
willbeason pushed a commit that referenced this issue Jul 13, 2021
When multiple Pods are running mutators, it is possible that they will
ingest mutators in different orders. Before this PR, we would
essentially randomly pick which mutator to honor and discard future
mutators which conflicted.

Fixes: #1216

Signed-off-by: Will Beason <willbeason@google.com>
@maxsmythe maxsmythe reopened this Jul 13, 2021
@maxsmythe
Copy link
Contributor Author

This issue isn't yet closed... #1364 sets the stage for fixing the issue, but we still:

  • Accept the first conflicting mutators and reject subsequent ones:

err := s.schemaDB.Upsert(withSchema)
if err != nil {
s.schemaDB.Remove(withSchema.ID())
return errors.Wrapf(err, "Schema upsert caused conflict for %v", m.ID())

  • Have no way of reporting conflicting mutators, or that those conflicts have resolved

IIRC those issues were going to be addressed in a follow-on PR

julianKatz pushed a commit to julianKatz/gatekeeper that referenced this issue Jul 27, 2021
…1364)

When multiple Pods are running mutators, it is possible that they will
ingest mutators in different orders. Before this PR, we would
essentially randomly pick which mutator to honor and discard future
mutators which conflicted.

Fixes: open-policy-agent#1216

Signed-off-by: Will Beason <willbeason@google.com>
Signed-off-by: juliankatz <juliankatz@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mutation
Projects
None yet
2 participants