Uploaded image for project: 'OpenShift Service Mesh'
  1. OpenShift Service Mesh
  2. OSSM-8399

Even if we specify "preferredDuringSchedulingIgnoredDuringExecution" or "requiredDuringSchedulingIgnoredDuringExecution" as "smcp.spec.gateways.egress.runtime.pod.affinity.podAntiAffinity", it will be ignored

XMLWordPrintable

    • Icon: Ticket Ticket
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • OSSM 2.5.7
    • Maistra
    • None
    • False
    • None
    • False

      Even if we specify "preferredDuringSchedulingIgnoredDuringExecution" or "requiredDuringSchedulingIgnoredDuringExecution" as "smcp.spec.gateways.egress.runtime.pod.affinity.podAntiAffinity", it will be ignored.

      1. doc[1] explains that "preferredDuringScheduling" and "requiredDuringScheduling" can be specified.

      [1] https://github.com/maistra/api/blob/ffa91c76514384d6197f669322aa009f8b9118cd/docs/crd/maistra.io_ServiceMeshControlPlane_ControlPlaneRuntimeConfig_v2.adoc#podantiaffinity

      2. On the other hand, according to the "oc explain" command output, "preferredDuringSchedulingIgnoredDuringExecution" and "requiredDuringSchedulingIgnoredDuringExecution" can be specified as "smcp.spec.gateways.egress.runtime.pod.affinity.podAntiAffinity".
         Is this a code bug?

      $ oc explain smcp.spec.gateways.egress.runtime.pod.affinity.podAntiAffinity
      GROUP:      maistra.io
      KIND:       ServiceMeshControlPlane
      VERSION:    v2
      FIELD: podAntiAffinity <Object>
      DESCRIPTION:
          <empty>
      FIELDS:
        preferredDuringScheduling    <[]Object>
          <no description>
        preferredDuringSchedulingIgnoredDuringExecution    <[]Object>
          <no description>
        requiredDuringScheduling    <[]Object>
          <no description>
        requiredDuringSchedulingIgnoredDuringExecution    <[]Object>
          <no description>
      

      3. Here is the result when using "requiredDuringSchedulingIgnoredDuringExecution":

      $ cat basic-01.yaml
      apiVersion: maistra.io/v2
      kind: ServiceMeshControlPlane
      metadata:
        name: basic
        namespace: istio-system
      spec:
      ...
        gateways:
      ... 
          egress:
            enabled: true
            runtime:
              deployment:
                replicas: 3
              pod:
                affinity:
                  podAntiAffinity:
                    requiredDuringSchedulingIgnoredDuringExecution:
                    - labelSelector:
                        matchExpressions:
                        - key: app
                          operator: In
                          values:
                          - istio-egressgateway
                      topologyKey: kubernetes.io/hostname
      ...
        version: v2.5
      $ oc apply -f basic-01.yaml
      

      In this case, istio-egressgateway-* pods do NOT have a "podAntiAffinity" entry.
      Shouldn't a message be output when applying oc apply, saying that there is a problem with the contents of the yaml file?

      $ oc get pod -A | grep istio-egress | while read n p dum; do echo == $n $p; oc get pod -n $n $p -o yaml | grep -A5 podAnti; done
      == istio-system istio-egressgateway-78d6456f5-5sgww
      == istio-system istio-egressgateway-78d6456f5-cmq5t
      == istio-system istio-egressgateway-78d6456f5-tg5ww

      4. Here is the result when using "requiredDuringScheduling":

       

      $ cat basic-02.yaml
      apiVersion: maistra.io/v2
      kind: ServiceMeshControlPlane
      metadata:
        name: basic
        namespace: istio-system
      spec:
      ...
        gateways:
      ... 
          egress:
            enabled: true
            runtime:
              deployment:
                replicas: 3
              pod:
                affinity:
                  podAntiAffinity:
                    requiredDuringScheduling:
                      - key: app
                        operator: In
                        values:
                        - istio-egressgateway
                        topologyKey: kubernetes.io/hostname
      ...
        version: v2.5
      $ oc apply -f basic-02.yaml
      

      In this case, istio-egressgateway-* pods have a "podAntiAffinity" entry.

      $ oc get pod -A | grep istio-egress | while read n p dum; do echo == $n $p; oc get pod -n $n $p -o yaml | grep -A5 podAnti; done
      == istio-system istio-egressgateway-d7d57bccd-5nq59
          podAntiAffinity:
            requiredDuringSchedulingIgnoredDuringExecution:
            - labelSelector:
                matchExpressions:
                - key: app
                  operator: In
      == istio-system istio-egressgateway-d7d57bccd-sc85h
          podAntiAffinity:
            requiredDuringSchedulingIgnoredDuringExecution:
            - labelSelector:
                matchExpressions:
                - key: app
                  operator: In
      == istio-system istio-egressgateway-d7d57bccd-xg2dr
          podAntiAffinity:
            requiredDuringSchedulingIgnoredDuringExecution:
            - labelSelector:
                matchExpressions:
                - key: app
                  operator: In

              rh-ee-yannliu Yann Liu
              rhn-support-hfukumot Hideshi Fukumoto
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: