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

feat: enable internal cluster SVC names usage by default #919

Merged
merged 3 commits into from
Jul 15, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 1 addition & 3 deletions deploy/crds/org_v1_che_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ metadata:
name: eclipse-che
spec:
server:
# Use internal cluster SVC names to communicate between components to speed up the traffic and avoid proxy issues.
useInternalClusterSVCNames: true
# Specifies a variation of the installation. The options are `che` for upstream Che installations, or `codeready` for link:https://developers.redhat.com/products/codeready-workspaces/overview[CodeReady Workspaces] installation.
# Override the default value only on necessary occasions.
cheFlavor: ''
Expand Down Expand Up @@ -161,7 +159,7 @@ spec:
# All the endpoints whether backed by the ingress or gateway `route` always point to the subpaths on the same domain. Defaults to `native`.
singleHostExposureType: ''
metrics:
# Enables `metrics` the Che server endpoint.
# Enables `metrics` the Che server endpoint.
enable: true
devWorkspace:
# Deploys the DevWorkspace Operator in the cluster.
Expand Down
8 changes: 5 additions & 3 deletions deploy/crds/org_v1_che_crd-v1beta1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,10 @@ spec:
description: Deprecated in favor of `externalDevfileRegistries`
fields.
type: string
disableInternalClusterSVCNames:
description: Disable internal cluster SVC names usage to communicate
between components to speed up the traffic and avoid proxy issues.
type: boolean
externalDevfileRegistries:
description: External devfile registries, that serves sample, ready-to-use
devfiles. Configure this in addition to a dedicated devfile registry
Expand Down Expand Up @@ -913,9 +917,7 @@ spec:
cause malfunction of some Che components.
type: boolean
useInternalClusterSVCNames:
description: Use internal cluster SVC names to communicate between
components to speed up the traffic and avoid proxy issues. The
default value is `true`.
description: Deprecated in favor of `disableInternalClusterSVCNames`.
type: boolean
workspaceNamespaceDefault:
description: Defines Kubernetes default namespace in which user's
Expand Down
8 changes: 5 additions & 3 deletions deploy/crds/org_v1_che_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,10 @@ spec:
description: Deprecated in favor of `externalDevfileRegistries`
fields.
type: string
disableInternalClusterSVCNames:
description: Disable internal cluster SVC names usage to communicate
between components to speed up the traffic and avoid proxy issues.
type: boolean
externalDevfileRegistries:
description: External devfile registries, that serves sample,
ready-to-use devfiles. Configure this in addition to a dedicated
Expand Down Expand Up @@ -930,9 +934,7 @@ spec:
cause malfunction of some Che components.
type: boolean
useInternalClusterSVCNames:
description: Use internal cluster SVC names to communicate between
components to speed up the traffic and avoid proxy issues. The
default value is `true`.
description: Deprecated in favor of `disableInternalClusterSVCNames`.
type: boolean
workspaceNamespaceDefault:
description: Defines Kubernetes default namespace in which user's
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ metadata:
"serverExposureStrategy": "",
"serverTrustStoreConfigMapName": "",
"tlsSupport": true,
"useInternalClusterSVCNames": true,
"workspaceNamespaceDefault": "<username>-che"
},
"storage": {
Expand All @@ -86,13 +85,13 @@ metadata:
categories: Developer Tools
certified: "false"
containerImage: quay.io/eclipse/che-operator:next
createdAt: "2021-07-14T07:19:58Z"
createdAt: "2021-07-15T07:38:13Z"
description: A Kube-native development solution that delivers portable and collaborative
developer workspaces.
operatorframework.io/suggested-namespace: eclipse-che
repository: https://github.com/eclipse-che/che-operator
support: Eclipse Foundation
name: eclipse-che-preview-kubernetes.v7.33.0-256.nightly
name: eclipse-che-preview-kubernetes.v7.33.0-258.nightly
namespace: placeholder
spec:
apiservicedefinitions: {}
Expand Down Expand Up @@ -1227,4 +1226,4 @@ spec:
maturity: stable
provider:
name: Eclipse Foundation
version: 7.33.0-256.nightly
version: 7.33.0-258.nightly
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,10 @@ spec:
description: Deprecated in favor of `externalDevfileRegistries`
fields.
type: string
disableInternalClusterSVCNames:
description: Disable internal cluster SVC names usage to communicate
between components to speed up the traffic and avoid proxy issues.
type: boolean
externalDevfileRegistries:
description: External devfile registries, that serves sample,
ready-to-use devfiles. Configure this in addition to a dedicated
Expand Down Expand Up @@ -930,9 +934,7 @@ spec:
cause malfunction of some Che components.
type: boolean
useInternalClusterSVCNames:
description: Use internal cluster SVC names to communicate between
components to speed up the traffic and avoid proxy issues. The
default value is `true`.
description: Deprecated in favor of `disableInternalClusterSVCNames`.
type: boolean
workspaceNamespaceDefault:
description: Defines Kubernetes default namespace in which user's
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ metadata:
"serverExposureStrategy": "",
"serverTrustStoreConfigMapName": "",
"tlsSupport": true,
"useInternalClusterSVCNames": true,
"workspaceNamespaceDefault": "<username>-che"
},
"storage": {
Expand All @@ -77,13 +76,13 @@ metadata:
categories: Developer Tools, OpenShift Optional
certified: "false"
containerImage: quay.io/eclipse/che-operator:next
createdAt: "2021-07-14T07:20:04Z"
createdAt: "2021-07-15T07:38:20Z"
description: A Kube-native development solution that delivers portable and collaborative
developer workspaces in OpenShift.
operatorframework.io/suggested-namespace: eclipse-che
repository: https://github.com/eclipse-che/che-operator
support: Eclipse Foundation
name: eclipse-che-preview-openshift.v7.33.0-256.nightly
name: eclipse-che-preview-openshift.v7.33.0-258.nightly
namespace: placeholder
spec:
apiservicedefinitions: {}
Expand Down Expand Up @@ -1304,4 +1303,4 @@ spec:
maturity: stable
provider:
name: Eclipse Foundation
version: 7.33.0-256.nightly
version: 7.33.0-258.nightly
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,11 @@ spec:
description: Deprecated in favor of `externalDevfileRegistries`
fields.
type: string
disableInternalClusterSVCNames:
description: Disable internal cluster SVC names usage to communicate
between components to speed up the traffic and avoid proxy
issues.
type: boolean
externalDevfileRegistries:
description: External devfile registries, that serves sample,
ready-to-use devfiles. Configure this in addition to a dedicated
Expand Down Expand Up @@ -946,9 +951,7 @@ spec:
cause malfunction of some Che components.
type: boolean
useInternalClusterSVCNames:
description: Use internal cluster SVC names to communicate between
components to speed up the traffic and avoid proxy issues.
The default value is `true`.
description: Deprecated in favor of `disableInternalClusterSVCNames`.
type: boolean
workspaceNamespaceDefault:
description: Defines Kubernetes default namespace in which user's
Expand Down
10 changes: 8 additions & 2 deletions pkg/apis/org/v1/che_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,12 @@ type CheClusterSpecServer struct {
// Deprecated. Instructs the Operator to deploy Che in TLS mode. This is enabled by default. Disabling TLS sometimes cause malfunction of some Che components.
// +optional
TlsSupport bool `json:"tlsSupport"`
// Use internal cluster SVC names to communicate between components to speed up the traffic and avoid proxy issues.
// The default value is `true`.
// Deprecated in favor of `disableInternalClusterSVCNames`.
// +optional
UseInternalClusterSVCNames bool `json:"useInternalClusterSVCNames"`
// Disable internal cluster SVC names usage to communicate between components to speed up the traffic and avoid proxy issues.
// +optional
DisableInternalClusterSVCNames *bool `json:"disableInternalClusterSVCNames"`
// Overrides the container image used in the dashboard deployment.
// This includes the image tag. Omit it or leave it empty to use the default container image provided by the Operator.
// +optional
Expand Down Expand Up @@ -753,3 +755,7 @@ func (c *CheCluster) IsImagePullerSpecEmpty() bool {
func (c *CheCluster) IsImagePullerImagesEmpty() bool {
return len(c.Spec.ImagePuller.Spec.Images) == 0
}

func (c *CheCluster) IsInternalClusterSVCNamesEnabled() bool {
return c.Spec.Server.DisableInternalClusterSVCNames == nil || !*c.Spec.Server.DisableInternalClusterSVCNames
}
5 changes: 5 additions & 0 deletions pkg/apis/org/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/controller/che/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (r *ReconcileChe) getProxyConfiguration(deployContext *deploy.DeployContext
if err != nil {
return nil, err
}
if deployContext.CheCluster.Spec.Server.UseInternalClusterSVCNames {
if deployContext.CheCluster.IsInternalClusterSVCNamesEnabled() {
cheClusterProxyConf.NoProxy = deploy.MergeNonProxy(cheClusterProxyConf.NoProxy, ".svc")
}
return cheClusterProxyConf, nil
Expand Down
15 changes: 8 additions & 7 deletions pkg/controller/che/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
fakeDiscovery "k8s.io/client-go/discovery/fake"
fakeclientset "k8s.io/client-go/kubernetes/fake"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/utils/pointer"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
Expand Down Expand Up @@ -249,9 +250,10 @@ func TestReadProxyConfiguration(t *testing.T) {
},
Spec: orgv1.CheClusterSpec{
Server: orgv1.CheClusterSpecServer{
ProxyURL: "http://proxy",
ProxyPort: "3128",
NonProxyHosts: "host1",
DisableInternalClusterSVCNames: pointer.BoolPtr(true),
ProxyURL: "http://proxy",
ProxyPort: "3128",
NonProxyHosts: "host1",
},
},
},
Expand Down Expand Up @@ -281,10 +283,9 @@ func TestReadProxyConfiguration(t *testing.T) {
},
Spec: orgv1.CheClusterSpec{
Server: orgv1.CheClusterSpecServer{
ProxyURL: "http://proxy",
ProxyPort: "3128",
NonProxyHosts: "host1",
UseInternalClusterSVCNames: true,
ProxyURL: "http://proxy",
ProxyPort: "3128",
NonProxyHosts: "host1",
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/deploy/identity-provider/deployment_keycloak.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ func GetSpecKeycloakDeployment(
}

var enableFixedHostNameProvider string
if deployContext.CheCluster.Spec.Server.UseInternalClusterSVCNames {
if deployContext.CheCluster.IsInternalClusterSVCNamesEnabled() {
if cheFlavor == "che" {
keycloakURL, err := url.Parse(deployContext.CheCluster.Status.KeycloakURL)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions pkg/deploy/server/server_configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,28 +189,28 @@ func (s *Server) getCheConfigMapData() (cheEnv map[string]string, err error) {
cheAPI := protocol + "://" + cheHost + "/api"
var keycloakInternalURL, pluginRegistryInternalURL, devfileRegistryInternalURL, cheInternalAPI, webSocketEndpoint, webSocketEndpointMinor string

if s.deployContext.CheCluster.Spec.Server.UseInternalClusterSVCNames && !s.deployContext.CheCluster.Spec.Auth.ExternalIdentityProvider {
if s.deployContext.CheCluster.IsInternalClusterSVCNamesEnabled() && !s.deployContext.CheCluster.Spec.Auth.ExternalIdentityProvider {
keycloakInternalURL = fmt.Sprintf("%s://%s.%s.svc:8080/auth", "http", deploy.IdentityProviderName, s.deployContext.CheCluster.Namespace)
} else {
keycloakInternalURL = keycloakURL
}

// If there is a devfile registry deployed by operator
if !s.deployContext.CheCluster.Spec.Server.ExternalDevfileRegistry {
if s.deployContext.CheCluster.Spec.Server.UseInternalClusterSVCNames {
if s.deployContext.CheCluster.IsInternalClusterSVCNamesEnabled() {
devfileRegistryInternalURL = fmt.Sprintf("http://%s.%s.svc:8080", deploy.DevfileRegistryName, s.deployContext.CheCluster.Namespace)
} else {
devfileRegistryInternalURL = s.deployContext.CheCluster.Status.DevfileRegistryURL
}
}

if s.deployContext.CheCluster.Spec.Server.UseInternalClusterSVCNames && !s.deployContext.CheCluster.Spec.Server.ExternalPluginRegistry {
if s.deployContext.CheCluster.IsInternalClusterSVCNamesEnabled() && !s.deployContext.CheCluster.Spec.Server.ExternalPluginRegistry {
pluginRegistryInternalURL = fmt.Sprintf("http://%s.%s.svc:8080/v3", deploy.PluginRegistryName, s.deployContext.CheCluster.Namespace)
} else {
pluginRegistryInternalURL = pluginRegistryURL
}

if s.deployContext.CheCluster.Spec.Server.UseInternalClusterSVCNames {
if s.deployContext.CheCluster.IsInternalClusterSVCNamesEnabled() {
cheInternalAPI = fmt.Sprintf("http://%s.%s.svc:8080/api", deploy.CheServiceName, s.deployContext.CheCluster.Namespace)
webSocketEndpoint = fmt.Sprintf("ws://%s.%s.svc:8080/api/websocket", deploy.CheServiceName, s.deployContext.CheCluster.Namespace)
webSocketEndpointMinor = fmt.Sprintf("ws://%s.%s.svc:8080/api/websocket-minor", deploy.CheServiceName, s.deployContext.CheCluster.Namespace)
Expand Down
Loading