aws / aws-app-mesh-controller-for-k8s

A controller to help manage App Mesh resources for a Kubernetes cluster.
Apache License 2.0
187 stars 109 forks source link

Cannot create sidecar containers #774

Open m15o opened 4 months ago

m15o commented 4 months ago

Describe the bug restartPolicy: Always is dropped from initContainer.

https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/

Steps to reproduce

Apply following deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: appmesh-test
  labels:
    component: appmesh-test
spec:
  replicas: 1
  selector:
    matchLabels:
      component: appmesh-test
  template:
    metadata:
      labels:
        component: appmesh-test

    spec:
      containers:
        - name: main
          image: debian:stable-slim
          command: ["/bin/bash"]
          args:
            - -c
            - |
              echo [main] started
              trap 'echo [main] finished' EXIT
              while true; do echo [main] sleep; sleep 1; done

      initContainers:
        - name: init
          image: debian:stable-slim
          command: ["/bin/bash"]
          args:
            - -c
            - |
              echo [init] started
              trap 'echo [init] finished' EXIT
              while true; do echo [init] sleep; sleep 1; done
          restartPolicy: Always
      enableServiceLinks: false

Only init container runs, and the pod never become ready.

Expected outcome

init container and main container run concurrently.

Environment

Additional Context: