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

Include additional cluster-wide trusted CA into Che #718

Merged
merged 3 commits into from
Mar 18, 2021
Merged
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
7 changes: 3 additions & 4 deletions pkg/controller/che/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,13 @@ func (r *ReconcileChe) getProxyConfiguration(checluster *orgv1.CheCluster) (*dep
} else {
cheClusterProxyConf.NoProxy = deploy.MergeNonProxy(cheClusterProxyConf.NoProxy, ".svc")
}
// Add cluster-wide trusted CA certs, if any
cheClusterProxyConf.TrustedCAMapName = clusterWideProxyConf.TrustedCAMapName
return cheClusterProxyConf, nil
} else if clusterWideProxyConf.HttpProxy != "" {
} else {
clusterWideProxyConf.NoProxy = deploy.MergeNonProxy(clusterWideProxyConf.NoProxy, cheClusterProxyConf.NoProxy)
return clusterWideProxyConf, nil
}

// proxy isn't configured
return &deploy.Proxy{}, nil
}

// OpenShift 3.x and k8s
Expand Down
30 changes: 29 additions & 1 deletion pkg/controller/che/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ func TestReadProxyConfiguration(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{
Name: "cluster",
},
Spec: configv1.ProxySpec{
TrustedCA: configv1.ConfigMapNameReference{
Name: "additional-cluster-ca-bundle",
},
},
Status: configv1.ProxyStatus{
HTTPProxy: "http://proxy:3128",
HTTPSProxy: "http://proxy:3128",
Expand Down Expand Up @@ -169,7 +174,30 @@ func TestReadProxyConfiguration(t *testing.T) {
HttpsHost: "proxy",
HttpsPort: "3128",
NoProxy: "host1",
TrustedCAMapName: "",
TrustedCAMapName: "additional-cluster-ca-bundle",
},
},
{
name: "Test cluster wide proxy is not configured, but cluster wide CA certs added, OpenShift 4.x",
openShiftVersion: "4",
clusterProxy: &configv1.Proxy{
ObjectMeta: metav1.ObjectMeta{
Name: "cluster",
},
Spec: configv1.ProxySpec{
TrustedCA: configv1.ConfigMapNameReference{
Name: "additional-cluster-ca-bundle",
},
},
},
cheCluster: &orgv1.CheCluster{
ObjectMeta: metav1.ObjectMeta{
Namespace: "eclipse-che",
},
},
initObjects: []runtime.Object{},
expectedProxyConf: &deploy.Proxy{
TrustedCAMapName: "additional-cluster-ca-bundle",
},
},
{
Expand Down