Skip to content

Commit

Permalink
Add documentation on why proxy configuration is disabled in DWO
Browse files Browse the repository at this point in the history
Co-authored-by: Anatolii Bazko <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
  • Loading branch information
amisevsk and tolusha committed Oct 19, 2023
1 parent 85da474 commit 851f110
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion controllers/usernamespace/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func TestCreatesDataInNamespace(t *testing.T) {
assert.Equal(t, "true", proxySettings.GetLabels()[dwconstants.DevWorkspaceMountLabel],
"proxy settings should be labeled as mounted")

assert.Equal(t, 2, len(proxySettings.Data), "Expecting just 1 element in the default proxy settings")
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")

Expand Down
8 changes: 6 additions & 2 deletions pkg/deploy/dev-workspace-config/dev_workspace_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,15 @@ func updateWorkspaceConfig(ctx *chetypes.DeployContext, operatorConfig *controll

updateWorkspaceImagePullPolicy(devEnvironments.ImagePullPolicy, operatorConfig.Workspace)

// If the CheCluster has a configured proxy, or if the Che Operator has detected a proxy configuration,
// we need to disable automatic proxy handling in the DevWorkspace Operator as its implementation collides
// with ours -- they set environment variables the deployment spec explicitly, which overrides the proxy-settings
// automount configmap.
if ctx.Proxy.HttpProxy != "" || ctx.Proxy.HttpsProxy != "" {
if operatorConfig.Routing == nil {
operatorConfig.Routing = &controllerv1alpha1.RoutingConfig{}
}
updateProxyConfig(operatorConfig.Routing)
disableDWOProxy(operatorConfig.Routing)
}

operatorConfig.Workspace.DeploymentStrategy = v1.DeploymentStrategyType(utils.GetValue(string(devEnvironments.DeploymentStrategy), constants.DefaultDeploymentStrategy))
Expand Down Expand Up @@ -221,7 +225,7 @@ func updateProjectCloneConfig(devEnvironments *chev2.CheClusterDevEnvironments,
workspaceConfig.ProjectCloneConfig.Resources = cheResourcesToCoreV1Resources(container.Resources)
}

func updateProxyConfig(routingConfig *controllerv1alpha1.RoutingConfig) {
func disableDWOProxy(routingConfig *controllerv1alpha1.RoutingConfig) {
// Since we create proxy configmaps to mount proxy settings, we want to disable
// proxy handling in DWO; otherwise the env vars added by DWO will override the env
// vars we intend to mount via configmap.
Expand Down

0 comments on commit 851f110

Please sign in to comment.