<p>I have a strange issue where I am trying to apply a PodAntiAffinity to make sure that no 2 pods of the specific deploymentConfig ever end up on the same node:</p>

<p>I attempt to edit the dc with:</p>

<pre><code>spec:
  replicas: 1
  selector:
    app: server-config
    deploymentconfig: server-config
  strategy:
    activeDeadlineSeconds: 21600
    resources: {}
    rollingParams:
      intervalSeconds: 1
      maxSurge: 25%
      maxUnavailable: 25%
      timeoutSeconds: 600
      updatePeriodSeconds: 1
    type: Rolling
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: server-config
        deploymentconfig: server-config
    spec:
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: app
                operator: In
                values:
                - server-config
            topologyKey: "kubernetes.io/hostname"
</code></pre>

<p>but on saving that, I get a :</p>

<pre><code>"/tmp/oc-edit-34z56.yaml" 106L, 3001C written
deploymentconfig "server-config" skipped
</code></pre>

<p>and the changes dont stick. My openshift/Kubernetes versions are:</p>

<pre><code>[root@master1 ~]# oc version
oc v1.5.1
kubernetes v1.5.2+43a9be4
features: Basic-Auth GSSAPI Kerberos SPNEGO
</code></pre>

<p>Thanks in advance.</p>

<p>This seems to work, the syntax is wildly different and the "scheduler.alpha.kubernetes.io/affinity" annotation needs to be added to work:</p>

<pre><code>spec:
  replicas: 1
  selector:
    app: server-config
    deploymentconfig: server-config
  strategy:
    activeDeadlineSeconds: 21600
    resources: {}
    rollingParams:
      intervalSeconds: 1
      maxSurge: 25%
      maxUnavailable: 25%
      timeoutSeconds: 600
      updatePeriodSeconds: 1
    type: Rolling
  template:
    metadata:
      annotations:
        scheduler.alpha.kubernetes.io/affinity: |
          {
            "podAntiAffinity": {
              "requiredDuringSchedulingIgnoredDuringExecution": [{
                "labelSelector": {
                  "matchExpressions": [{
                    "key": "app",
                    "operator": "In",
                    "values":["server-config"]
                  }]
                },
                "topologyKey": "kubernetes.io/hostname"
              }]
            }
          }
</code></pre>

<p>Working as intended and spreading out properly between nodes:</p>

<pre><code>[root@master1 ~]# oc get pods -o wide |grep server-config
server-config-22-4ktvf                      1/1       Running   0          3h        10.1.1.73    10.0.4.101
server-config-22-fz31j                      1/1       Running   0          3h        10.1.0.3     10.0.4.100
server-config-22-mrw09                      1/1       Running   0          3h        10.1.2.64    10.0.4.102
</code></pre>
