Helm: Upgrading statefulset affinity from annotation to spec.affinity fails from k8s 1.5 -> 1.6

Created on 18 Sep 2017  ·  3Comments  ·  Source: helm/helm

Problem

I just migrated my cluster from k8s 1.5 to 1.6 and I have to upgrade my zookeeper chart to use spec.affinity instead of 1.5 annotations.

Error: UPGRADE FAILED: StatefulSet.apps "zk" is invalid: spec: Forbidden: updates to statefulset spec for fields other than 'replicas' and 'containers' are forbidden.

Question

How can I proceed to upgrade the chart without deleting existing zookeeper cluster?
from

annotations:
    scheduler.alpha.kubernetes.io/affinity: >
      {
        "podAntiAffinity": {
          "requiredDuringSchedulingIgnoredDuringExecution": [
            {
              "labelSelector": {
                "matchExpressions": [
                  {
                    "key": "app",
                    "operator": "In",
                     "values": ["zk-headless"]
                  }
                ]
              },
              "topologyKey": "kubernetes.io/hostname"
            }
          ]
        }
}

to

affinity:
  podAntiAffinity:
        requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
                - key: "app"
                  operator: In
                  values: 
                  - zk-headless
  topologyKey: "kubernetes.io/hostname"
questiosupport

Most helpful comment

To add, StatefulSets are an alpha object (now-beta for 1.8), so there's no guarantee that these resources can be reliably upgraded with helm. We try to make it easy to upgrade unstable resources in kubernetes, but sometimes it's just out of our control due to backwards-incompatible changes and that's just the nature of the beast. Sorry!

All 3 comments

Also, I'm aware of https://github.com/kubernetes/features/blob/master/release-1.6/release-notes-draft.md#scheduling to keep using affinity by annotations in 1.6, but this issue will still exists when I'll want to upgrade to 1.7

This is an upstream issue with upgrading statefulset affinities so there's nothing we can do here, unfortunately. I'm sorry we're unable to help you here, but I would suggest opening a ticket or searching for existing tickets at https://github.com/kubernetes/kubernetes to resolve this issue. Thanks!

To add, StatefulSets are an alpha object (now-beta for 1.8), so there's no guarantee that these resources can be reliably upgraded with helm. We try to make it easy to upgrade unstable resources in kubernetes, but sometimes it's just out of our control due to backwards-incompatible changes and that's just the nature of the beast. Sorry!

Was this page helpful?
0 / 5 - 0 ratings