Skip to content

Commit

Permalink
Rebase one more time
Browse files Browse the repository at this point in the history
Signed-off-by: Alejandro Pedraza <[email protected]>
  • Loading branch information
alpeb committed Mar 25, 2019
1 parent ae6f6b6 commit 570f1bc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/inject/inject.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,9 @@ func (conf *ResourceConfig) complete(template *v1.PodTemplateSpec) {

// injectPodSpec adds linkerd sidecars to the provided PodSpec.
func (conf *ResourceConfig) injectPodSpec(patch *Patch) {
saVolumeMount := conf.serviceAccountVolumeMount()
if !conf.configs.GetGlobal().GetCniEnabled() {
conf.injectProxyInit(patch)
conf.injectProxyInit(patch, saVolumeMount)
}

proxyUID := conf.proxyUID()
Expand Down Expand Up @@ -460,6 +461,10 @@ func (conf *ResourceConfig) injectPodSpec(patch *Patch) {
}
}

if saVolumeMount != nil {
sidecar.VolumeMounts = []v1.VolumeMount{*saVolumeMount}
}

idctx := conf.configs.GetGlobal().GetIdentityContext()
if idctx == nil {
sidecar.Env = append(sidecar.Env, v1.EnvVar{
Expand Down Expand Up @@ -532,7 +537,7 @@ func (conf *ResourceConfig) injectPodSpec(patch *Patch) {
patch.addContainer(&sidecar)
}

func (conf *ResourceConfig) injectProxyInit(patch *Patch) {
func (conf *ResourceConfig) injectProxyInit(patch *Patch, saVolumeMount *v1.VolumeMount) {
nonRoot := false
runAsUser := int64(0)
initContainer := &v1.Container{
Expand All @@ -550,7 +555,6 @@ func (conf *ResourceConfig) injectProxyInit(patch *Patch) {
RunAsUser: &runAsUser,
},
}
saVolumeMount := conf.serviceAccountVolumeMount()
if saVolumeMount != nil {
initContainer.VolumeMounts = []v1.VolumeMount{*saVolumeMount}
}
Expand Down

0 comments on commit 570f1bc

Please sign in to comment.