Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] transferEnv doesn't seem to work with initContainers #875

Closed
BryanDollery opened this issue Jan 3, 2022 · 4 comments
Closed

[BUG] transferEnv doesn't seem to work with initContainers #875

BryanDollery opened this issue Jan 3, 2022 · 4 comments
Assignees
Labels
kind/bug Something isn't working

Comments

@BryanDollery
Copy link

BryanDollery commented Jan 3, 2022

What happened:
My init container doesn't get the transferred environment from the main container

What you expected to happen:
I expected the init container to get the environment

How to reproduce it (as minimally and precisely as possible):

apiVersion: apps.kruise.io/v1alpha1
kind: SidecarSet
metadata:
  name: event-registration-sidecarset
spec:
  selector:
    matchLabels:
      sidecar: registrar
  initContainers:
    - name: registrar
      image: registry.labs:5000/labs/event-registration-sidecar
      transferEnv:
        - sourceContainerName: main
          envName: NAMESPACE
        - sourceContainerName: main
          envName: SERVICE
        - sourceContainerName: main
          envName: VERSION
        - sourceContainerName: main
          envName: EVENT_REGISTRATION
      env:
        - name: REGISTRATION_CHANNEL
          valueFrom:
            configMapKeyRef:
              name: control-config
              key: registration

Anything else we need to know?:
I guess this is because the main container hasn't been created at the time the init container runs and so can't take the environment directly from it

Environment:
Nothing special

  • Kruise version:
    openkruise/kruise-manager:v1.0.0

  • Kubernetes version (use kubectl version):
    Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.4", GitCommit:"b695d79d4f967c403a96986f1750a35eb75e75f1", GitTreeState:"clean", BuildDate:"2021-11-17T15:48:33Z", GoVersion:"go1.16.10", Compiler:"gc", Platform:"linux/amd64"}
    Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.5+k3s1", GitCommit:"405bf79da97831749733ad99842da638c8ee4802", GitTreeState:"clean", BuildDate:"2021-12-18T00:43:30Z", GoVersion:"go1.16.10", Compiler:"gc", Platform:"linux/amd64"}

  • Install details (e.g. helm install args):
    kruise installed through official chart with no extra arguments

  • Others:

@BryanDollery BryanDollery added the kind/bug Something isn't working label Jan 3, 2022
@FillZpp
Copy link
Member

FillZpp commented Jan 4, 2022

Yep, it seems transferEnv and some other fields like shareVolumePolicy are not supported for initContainers yet.
https://github.com/openkruise/kruise/blob/master/pkg/webhook/pod/mutating/sidecarset.go#L267

@BryanDollery Are you interested in approving this? Or you may ask @zmberg to help you with it.

@pigletfly
Copy link
Contributor

I'd like to take a shot on this.

@pigletfly
Copy link
Contributor

/assign

@FillZpp
Copy link
Member

FillZpp commented Jan 26, 2022

Closed by #897
Good job!

@FillZpp FillZpp closed this as completed Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants