Skip to content

Commit 96b2a36

Browse files
csweichelroboquat
authored andcommitted
[ws-daemon] Support GIT_SSL_CAINFO
1 parent fc40211 commit 96b2a36

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

components/content-service/pkg/git/git.go

+3
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ func (c *Client) GitWithOutput(ctx context.Context, subcommand string, args ...s
181181
if os.Getenv("https_proxy") != "" {
182182
env = append(env, fmt.Sprintf("https_proxy=%s", os.Getenv("https_proxy")))
183183
}
184+
if v := os.Getenv("GIT_SSL_CAINFO"); v != "" {
185+
env = append(env, fmt.Sprintf("GIT_SSL_CAINFO=%s", v))
186+
}
184187

185188
cmd := exec.Command("git", fullArgs...)
186189
cmd.Dir = c.Location

components/ws-daemon/pkg/content/initializer.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ func RunInitializer(ctx context.Context, destination string, initializer *csapi.
190190
spec.Process.User.GID = opts.GID
191191
spec.Process.Args = []string{"/app/content-initializer"}
192192
for _, e := range os.Environ() {
193-
if strings.HasPrefix(e, "JAEGER_") {
193+
if strings.HasPrefix(e, "JAEGER_") || strings.HasPrefix(e, "GIT_SSL_CAINFO=") {
194194
spec.Process.Env = append(spec.Process.Env, e)
195195
}
196196
}

install/installer/pkg/common/ca.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func InternalCAContainer(ctx *RenderContext, mod ...func(*corev1.Container)) *co
5757
}
5858

5959
// CustomCACertVolume produces the objects required to mount custom CA certificates
60-
func CustomCACertVolume(ctx *RenderContext) (vol *corev1.Volume, mnt *corev1.VolumeMount, env *corev1.EnvVar, ok bool) {
60+
func CustomCACertVolume(ctx *RenderContext) (vol *corev1.Volume, mnt *corev1.VolumeMount, env []corev1.EnvVar, ok bool) {
6161
if ctx.Config.CustomCACert == nil {
6262
return nil, nil, nil, false
6363
}
@@ -86,9 +86,9 @@ func CustomCACertVolume(ctx *RenderContext) (vol *corev1.Volume, mnt *corev1.Vol
8686
MountPath: mountPath,
8787
SubPath: "ca.crt",
8888
}
89-
env = &corev1.EnvVar{
90-
Name: "NODE_EXTRA_CA_CERTS",
91-
Value: mountPath,
89+
env = []corev1.EnvVar{
90+
{Name: "NODE_EXTRA_CA_CERTS", Value: mountPath},
91+
{Name: "GIT_SSL_CAINFO", Value: mountPath},
9292
}
9393
ok = true
9494
return

install/installer/pkg/components/server/deployment.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
160160
if vol, mnt, envv, ok := common.CustomCACertVolume(ctx); ok {
161161
volumes = append(volumes, *vol)
162162
volumeMounts = append(volumeMounts, *mnt)
163-
env = append(env, *envv)
163+
env = append(env, envv...)
164164
}
165165

166166
return []runtime.Object{

install/installer/pkg/components/ws-daemon/daemonset.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,11 @@ fi
340340
return nil, err
341341
}
342342

343-
if vol, mnt, _, ok := common.CustomCACertVolume(ctx); ok {
343+
if vol, mnt, env, ok := common.CustomCACertVolume(ctx); ok {
344344
podSpec.Volumes = append(podSpec.Volumes, *vol)
345345
pod := podSpec.Containers[0]
346346
pod.VolumeMounts = append(pod.VolumeMounts, *mnt)
347+
pod.Env = append(pod.Env, env...)
347348
podSpec.Containers[0] = pod
348349
}
349350

0 commit comments

Comments
 (0)