mongodb / mongodb-kubernetes-operator

MongoDB Community Kubernetes Operator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect merging of tolerations

aikoven opened this issue · comments

What did you do to encounter the bug?

Created a MongoDBCommunity resource like this:

apiVersion: mongodbcommunity.mongodb.com/v1
kind: MongoDBCommunity
spec:
  statefulSet:
    spec:
      template:
        spec:
          tolerations:
            - effect: NoSchedule
              key: pool
              operator: Equal
              value: my-pool
            - effect: NoExecute
              key: pool
              operator: Equal
              value: my-pool

What did you expect?

StatefulSet has the tolerations as specified.

What happened instead?

StatefulSet has only the second toleration.

Operator Information

  • Operator Version: 0.7.4

Additional context

The reason lies in problematic merging of tolerations, where they are put to a map keyed by Key, effectively not allowing to have multiple tolerations with the same key.

Hey @aikoven - that indeed looks like a bug. Would you mind submitting a fix PR.

Quick headsup for people that might end up here after v0.8.1 released, this is potentially broken.

See #1344