Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pkg/addons/adminconsole/integration/hostcabundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,15 @@ func TestHostCABundle(t *testing.T) {
if assert.NotNil(t, sslCertDirEnv, "Admin Console SSL_CERT_DIR environment variable should not be nil") {
assert.Equal(t, sslCertDirEnv.Value, "/certs")
}

// Check for HOST_CA_BUNDLE_PATH environment variable
var hostCABundlePathEnv *corev1.EnvVar
for _, env := range adminDeployment.Spec.Template.Spec.Containers[0].Env {
if env.Name == "HOST_CA_BUNDLE_PATH" {
hostCABundlePathEnv = &env
}
}
if assert.NotNil(t, hostCABundlePathEnv, "Admin Console HOST_CA_BUNDLE_PATH environment variable should not be nil") {
assert.Equal(t, hostCABundlePathEnv.Value, "/etc/ssl/certs/ca-certificates.crt")
}
}
5 changes: 5 additions & 0 deletions pkg/addons/adminconsole/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ func (a *AdminConsole) GenerateHelmValues(ctx context.Context, kcli client.Clien
"name": "SSL_CERT_DIR",
"value": "/certs",
})

extraEnv = append(extraEnv, map[string]interface{}{
"name": "HOST_CA_BUNDLE_PATH",
"value": a.HostCABundlePath,
})
}

copiedValues["extraEnv"] = extraEnv
Expand Down
12 changes: 12 additions & 0 deletions pkg/addons/adminconsole/values_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ func TestGenerateHelmValues_HostCABundlePath(t *testing.T) {
}
}
assert.True(t, foundSSLCertDir, "SSL_CERT_DIR environment variable should be set")

// Verify HOST_CA_BUNDLE_PATH environment variable
var foundHostCABundlePath bool
for _, env := range extraEnv {
if env["name"] == "HOST_CA_BUNDLE_PATH" {
foundHostCABundlePath = true
assert.Equal(t, "/etc/ssl/certs/ca-certificates.crt", env["value"])
break
}
}
assert.True(t, foundHostCABundlePath, "HOST_CA_BUNDLE_PATH environment variable should be set")
})

t.Run("without host CA bundle path", func(t *testing.T) {
Expand All @@ -77,6 +88,7 @@ func TestGenerateHelmValues_HostCABundlePath(t *testing.T) {
extraEnv := values["extraEnv"].([]map[string]interface{})
for _, env := range extraEnv {
assert.NotEqual(t, "SSL_CERT_DIR", env["name"], "SSL_CERT_DIR environment variable should not be set")
assert.NotEqual(t, "HOST_CA_BUNDLE_PATH", env["name"], "HOST_CA_BUNDLE_PATH environment variable should not be set")
}
})
}
4 changes: 4 additions & 0 deletions tests/dryrun/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,10 @@ func TestHTTPProxyWithCABundleConfiguration(t *testing.T) {
"name": "SSL_CERT_DIR",
"value": "/certs",
},
{
"name": "HOST_CA_BUNDLE_PATH",
"value": hostCABundle,
},
},
"extraVolumes": []map[string]any{{
"name": "host-ca-bundle",
Expand Down
Loading