DeploymentConfig's init containers are removed from pod when sidecar injection is enabled

I’m trying to define some init containers in DeploymentConfig but they are automatically removed from pod when I enable sidecar injection. However, they are present in ReplicationController.

Redhat Openshift Service Mesh : 2.1.0
Istio : 1.9.8

DeploymentConfig.yaml

kind: DeploymentConfig
apiVersion: apps.openshift.io/v1
metadata:
  namespace: spiro--exemples-dev
  labels:
    app: cakephp
    app.kubernetes.io/instance: spiro-exemples-cakephp-dev-ocpv4vdrs2
spec:
  triggers:
    - type: ImageChange
      imageChangeParams:
        automatic: true
        containerNames:
          - cakephp-init
        from:
          kind: ImageStreamTag
          namespace: spiro--exemples-dev
          name: 'php-example-cakephp:dev'
        lastTriggeredImage: >-
          image-registry.openshift-image-registry.svc:5000/spiro--exemples-dev/php-example-cakephp@sha256:3620db619238ad700f20c508bd493d4c3f822fb386161d6ccbbe854209dbc6bb
  replicas: 1
  selector:
    app: cakephp
  template:
    metadata:
      labels:
        app: cakephp
        version: dev
      annotations:
        rollme: gfuEndw7OZ
        sidecar.istio.io/inject: 'true'
        sidecar.istio.io/proxyCPU: 50m
        sidecar.istio.io/proxyCPULimit: 950m
        sidecar.istio.io/proxyMemory: 100Mi
        sidecar.istio.io/proxyMemoryLimit: 1300Mi
        traffic.sidecar.istio.io/excludeOutboundPorts: '9092'
    spec:
      restartPolicy: Always
      initContainers:
        - resources: {}
          terminationMessagePath: /dev/termination-log
          name: cakephp-init
          command:
            - /bin/sh
            - '-c'
          ports:
            - containerPort: 9096
              protocol: TCP
          imagePullPolicy: Always
          volumeMounts:
            - name: www-data
              mountPath: /volume/php
          terminationMessagePolicy: File
          image: >-
            image-registry.openshift-image-registry.svc:5000/spiro--exemples-dev/php-example-cakephp@sha256:3620db619238ad700f20c508bd493d4c3f822fb386161d6ccbbe854209dbc6bb
          args:
            - cp -r /var/www/php /volume/php
      volumes:
           - name: www-data
             emptyDir: {}
      containers:
      ...

Any idea how to debug this is appreciated.

1 Like

Same here using

Red Hat OpenShift Service Mesh
2.1.0-0 provided by Red Hat, Inc.
based on Istio 1.9.8

It looks like, there was once remove init containers with CNI enabled · Issue #28700 · istio/istio · GitHub “remove init containers with CNI enabled #28700”, but was just automatically closed due to inactivity. Perhaps there was elsewhere a change?