Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

initContainers are overwritten in deployment #47

Closed
divyangjp opened this issue Mar 21, 2021 · 2 comments
Closed

initContainers are overwritten in deployment #47

divyangjp opened this issue Mar 21, 2021 · 2 comments

Comments

@divyangjp
Copy link

A deployment manifest looks like this

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      annotations:
        secrets.k8s.aws/sidecarInjectorWebhook: enabled
        secrets.k8s.aws/secret-arn: arn:aws:secretsmanager:xxx:000000:secret:sxjxkx-UOBckr
      labels:
        app: nginx
    spec:
      serviceAccountName: aws-eks-secrets-sa
      containers:
      - name: nginx
        image: nginx:1.7.9
        ports:
        - containerPort: 80
        - containerPort: 443
        volumeMounts:
        - name: tmpconfig
          mountPath: /tmp/config
      initContainers:
      - name: db-init
        image: busybox
        command: ['/bin/sh', '-c']
        args:
         - echo "HELLO WORLD";

But when this manifest is applied and pod is running,
doing Kubectl describe pod nginx-deployment-xxxx has no db-init in initContainers list.
There's only secrets-init-container in initContainers list!

Does the admission-controller webhook overwrites all other initContainers !!!

@jicowan
Copy link
Contributor

jicowan commented Mar 21, 2021

@amit0701 when we inject the init container, does it overwrite or append to the list of init containers?

@amit0701
Copy link
Contributor

The above PR should have fixed the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants