Add Kubernetes host to the no proxy list (#1800)
Add Kubernetes host to the no proxy listpull/1801/head
parent
c738dc70fc
commit
7c7bd4f796
|
|
@ -77,7 +77,7 @@ metadata:
|
|||
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
|
||||
repository: https://github.com/eclipse-che/che-operator
|
||||
support: Eclipse Foundation
|
||||
name: eclipse-che.v7.79.0-828.next
|
||||
name: eclipse-che.v7.81.0-829.next
|
||||
namespace: placeholder
|
||||
spec:
|
||||
apiservicedefinitions: {}
|
||||
|
|
@ -1240,7 +1240,7 @@ spec:
|
|||
minKubeVersion: 1.19.0
|
||||
provider:
|
||||
name: Eclipse Foundation
|
||||
version: 7.79.0-828.next
|
||||
version: 7.81.0-829.next
|
||||
webhookdefinitions:
|
||||
- admissionReviewVersions:
|
||||
- v1
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
package che
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/devfile/devworkspace-operator/pkg/infrastructure"
|
||||
"github.com/eclipse-che/che-operator/pkg/common/chetypes"
|
||||
"github.com/eclipse-che/che-operator/pkg/deploy"
|
||||
|
|
@ -50,9 +52,15 @@ func GetProxyConfiguration(deployContext *chetypes.DeployContext) (*chetypes.Pro
|
|||
}
|
||||
// Add cluster-wide trusted CA certs, if any
|
||||
cheClusterProxyConf.TrustedCAMapName = clusterWideProxyConf.TrustedCAMapName
|
||||
// Add kubernetes host to the no proxy list.
|
||||
cheClusterProxyConf.NoProxy = deploy.MergeNonProxy(cheClusterProxyConf.NoProxy, os.Getenv("KUBERNETES_SERVICE_HOST"))
|
||||
return cheClusterProxyConf, nil
|
||||
} else {
|
||||
clusterWideProxyConf.NoProxy = deploy.MergeNonProxy(clusterWideProxyConf.NoProxy, cheClusterProxyConf.NoProxy)
|
||||
if clusterWideProxyConf.HttpProxy != "" {
|
||||
// Add kubernetes host to the no proxy list.
|
||||
clusterWideProxyConf.NoProxy = deploy.MergeNonProxy(clusterWideProxyConf.NoProxy, os.Getenv("KUBERNETES_SERVICE_HOST"))
|
||||
clusterWideProxyConf.NoProxy = deploy.MergeNonProxy(clusterWideProxyConf.NoProxy, cheClusterProxyConf.NoProxy)
|
||||
}
|
||||
return clusterWideProxyConf, nil
|
||||
}
|
||||
}
|
||||
|
|
@ -62,6 +70,10 @@ func GetProxyConfiguration(deployContext *chetypes.DeployContext) (*chetypes.Pro
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cheClusterProxyConf.NoProxy = deploy.MergeNonProxy(cheClusterProxyConf.NoProxy, ".svc")
|
||||
if cheClusterProxyConf.HttpProxy != "" {
|
||||
// Add kubernetes host to the no proxy list.
|
||||
cheClusterProxyConf.NoProxy = deploy.MergeNonProxy(cheClusterProxyConf.NoProxy, os.Getenv("KUBERNETES_SERVICE_HOST"))
|
||||
cheClusterProxyConf.NoProxy = deploy.MergeNonProxy(cheClusterProxyConf.NoProxy, ".svc")
|
||||
}
|
||||
return cheClusterProxyConf, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -332,19 +332,6 @@ func TestCreatesDataInNamespace(t *testing.T) {
|
|||
|
||||
assert.False(t, res.Requeue, "The reconciliation request should have succeeded but it is requesting a requeue")
|
||||
|
||||
proxySettings := corev1.ConfigMap{}
|
||||
assert.NoError(t, cl.Get(ctx, client.ObjectKey{Name: "che-proxy-settings", Namespace: namespace.GetName()}, &proxySettings))
|
||||
|
||||
assert.Equal(t, "env", proxySettings.GetAnnotations()[dwconstants.DevWorkspaceMountAsAnnotation],
|
||||
"proxy settings should be annotated as mount as 'env'")
|
||||
|
||||
assert.Equal(t, "true", proxySettings.GetLabels()[dwconstants.DevWorkspaceMountLabel],
|
||||
"proxy settings should be labeled as mounted")
|
||||
|
||||
assert.Equal(t, 2, len(proxySettings.Data), "Expecting 2 elements in the default proxy settings")
|
||||
|
||||
assert.Equal(t, ".svc", proxySettings.Data["NO_PROXY"], "Unexpected proxy settings")
|
||||
|
||||
idleSettings := corev1.ConfigMap{}
|
||||
assert.NoError(t, cl.Get(ctx, client.ObjectKey{Name: "che-idle-settings", Namespace: namespace.GetName()}, &idleSettings))
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ package server
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
|
|
@ -89,11 +88,6 @@ func (s *CheServerReconciler) getCheConfigMapData(ctx *chetypes.DeployContext) (
|
|||
proxyJavaOpts := ""
|
||||
cheWorkspaceNoProxy := ctx.Proxy.NoProxy
|
||||
if ctx.Proxy.HttpProxy != "" {
|
||||
if ctx.Proxy.NoProxy == "" {
|
||||
cheWorkspaceNoProxy = os.Getenv("KUBERNETES_SERVICE_HOST")
|
||||
} else {
|
||||
cheWorkspaceNoProxy = cheWorkspaceNoProxy + "," + os.Getenv("KUBERNETES_SERVICE_HOST")
|
||||
}
|
||||
proxyJavaOpts, err = deploy.GenerateProxyJavaOpts(ctx.Proxy, cheWorkspaceNoProxy)
|
||||
if err != nil {
|
||||
logrus.Errorf("Failed to generate java proxy options: %v", err)
|
||||
|
|
|
|||
Loading…
Reference in New Issue