Provide internal network urls for plugin registry, devfile registry and internal che api endpoint url. (#468)
* Provide internal network urls for plugin, devfile registries and internal che api endpoint url. Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>pull/507/head
parent
2e957457f5
commit
73053b2bc4
|
|
@ -80,6 +80,7 @@ function run() {
|
|||
# OPERATOR_IMAGE In CI is defined in .github/workflows/che-nightly.yaml
|
||||
export OPERATOR_IMAGE="quay.io/eclipse/che-operator:test"
|
||||
|
||||
rm -rf tmp
|
||||
# prepare template folder
|
||||
mkdir -p "${OPERATOR_REPO}/tmp/che-operator" && chmod 777 "${OPERATOR_REPO}/tmp"
|
||||
cp -rf ${OPERATOR_REPO}/deploy/* "${OPERATOR_REPO}/tmp/che-operator"
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ function init() {
|
|||
export lastOperatorTemplate=${lastOperatorPath}/chectl/templates
|
||||
export previousOperatorTemplate=${previousOperatorPath}/chectl/templates
|
||||
|
||||
rm -rf tmp
|
||||
# Create tmp folder to save "operator" installer templates
|
||||
mkdir -p "${OPERATOR_REPO}/tmp" && chmod 777 "${OPERATOR_REPO}/tmp"
|
||||
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@
|
|||
"program": "${file}"
|
||||
},
|
||||
{
|
||||
"name": "Launch Current File",
|
||||
"name": "Launch Current Test *.go File",
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"mode": "test",
|
||||
|
|
@ -148,6 +148,12 @@
|
|||
"MOCK_API": true
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "Launch Main *.go File",
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"program": "${file}",
|
||||
},
|
||||
{
|
||||
"useApiV1": false,
|
||||
"dlvLoadConfig": {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,42 @@
|
|||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Update vendor folder",
|
||||
"command": "go mod vendor",
|
||||
"options": {
|
||||
"env": {
|
||||
"MOCK_API": "true"
|
||||
}
|
||||
},
|
||||
"type": "shell",
|
||||
"args": [],
|
||||
"problemMatcher": [
|
||||
"$go"
|
||||
],
|
||||
"presentation": {
|
||||
"reveal": "always"
|
||||
},
|
||||
"group": "build"
|
||||
},
|
||||
{
|
||||
"label": "Run mock tests",
|
||||
"command": "go test -mod=vendor -v ./...",
|
||||
"options": {
|
||||
"env": {
|
||||
"MOCK_API": "true"
|
||||
}
|
||||
},
|
||||
"type": "shell",
|
||||
"args": [],
|
||||
"problemMatcher": [
|
||||
"$go"
|
||||
],
|
||||
"presentation": {
|
||||
"reveal": "always"
|
||||
},
|
||||
"group": "build"
|
||||
},
|
||||
{
|
||||
"label": "Update cr/crd files",
|
||||
"command": "./olm/update-crd-files.sh",
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ metadata:
|
|||
name: eclipse-che
|
||||
spec:
|
||||
server:
|
||||
# use internal host names provided by cluster dns.
|
||||
useInternalClusterSVCNames: true
|
||||
# server image used in Che deployment
|
||||
cheImage: ''
|
||||
# tag of an image used in Che deployment
|
||||
|
|
|
|||
|
|
@ -576,6 +576,11 @@ spec:
|
|||
TLS mode. This is enabled by default. Disabling TLS may 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`.
|
||||
type: boolean
|
||||
workspaceNamespaceDefault:
|
||||
description: 'Defines Kubernetes default namespace in which user''s
|
||||
workspaces are created if user does not override it. It''s possible
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ metadata:
|
|||
"singleHostGatewayConfigSidecarImage": "",
|
||||
"singleHostGatewayImage": "",
|
||||
"tlsSupport": true,
|
||||
"useInternalClusterSVCNames": true,
|
||||
"workspaceNamespaceDefault": ""
|
||||
},
|
||||
"storage": {
|
||||
|
|
@ -82,13 +83,13 @@ metadata:
|
|||
categories: Developer Tools
|
||||
certified: "false"
|
||||
containerImage: quay.io/eclipse/che-operator:nightly
|
||||
createdAt: "2020-11-17T10:26:58Z"
|
||||
createdAt: "2020-11-25T12:37:35Z"
|
||||
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-operator
|
||||
support: Eclipse Foundation
|
||||
name: eclipse-che-preview-kubernetes.v7.22.0-33.nightly
|
||||
name: eclipse-che-preview-kubernetes.v7.23.0-36.nightly
|
||||
namespace: placeholder
|
||||
spec:
|
||||
apiservicedefinitions: {}
|
||||
|
|
@ -470,4 +471,4 @@ spec:
|
|||
maturity: stable
|
||||
provider:
|
||||
name: Eclipse Foundation
|
||||
version: 7.22.0-33.nightly
|
||||
version: 7.23.0-36.nightly
|
||||
|
|
|
|||
|
|
@ -576,6 +576,11 @@ spec:
|
|||
TLS mode. This is enabled by default. Disabling TLS may 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`.
|
||||
type: boolean
|
||||
workspaceNamespaceDefault:
|
||||
description: 'Defines Kubernetes default namespace in which user''s
|
||||
workspaces are created if user does not override it. It''s possible
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ metadata:
|
|||
"singleHostGatewayConfigSidecarImage": "",
|
||||
"singleHostGatewayImage": "",
|
||||
"tlsSupport": true,
|
||||
"useInternalClusterSVCNames": true,
|
||||
"workspaceNamespaceDefault": ""
|
||||
},
|
||||
"storage": {
|
||||
|
|
@ -74,13 +75,13 @@ metadata:
|
|||
categories: Developer Tools, OpenShift Optional
|
||||
certified: "false"
|
||||
containerImage: quay.io/eclipse/che-operator:nightly
|
||||
createdAt: "2020-11-17T10:27:06Z"
|
||||
createdAt: "2020-11-25T12:37:42Z"
|
||||
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-operator
|
||||
support: Eclipse Foundation
|
||||
name: eclipse-che-preview-openshift.v7.22.0-33.nightly
|
||||
name: eclipse-che-preview-openshift.v7.23.0-36.nightly
|
||||
namespace: placeholder
|
||||
spec:
|
||||
apiservicedefinitions: {}
|
||||
|
|
@ -490,4 +491,4 @@ spec:
|
|||
maturity: stable
|
||||
provider:
|
||||
name: Eclipse Foundation
|
||||
version: 7.22.0-33.nightly
|
||||
version: 7.23.0-36.nightly
|
||||
|
|
|
|||
|
|
@ -577,6 +577,11 @@ spec:
|
|||
TLS mode. This is enabled by default. Disabling TLS may 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`.
|
||||
type: boolean
|
||||
workspaceNamespaceDefault:
|
||||
description: 'Defines Kubernetes default namespace in which user''s
|
||||
workspaces are created if user does not override it. It''s possible
|
||||
|
|
|
|||
|
|
@ -119,7 +119,9 @@ func newCheCluster() (cr *orgv1.CheCluster) {
|
|||
Kind: kind,
|
||||
},
|
||||
Spec: orgv1.CheClusterSpec{
|
||||
Server: orgv1.CheClusterSpecServer{},
|
||||
Server: orgv1.CheClusterSpecServer{
|
||||
UseInternalClusterSVCNames: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
return cr
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ $ export IMAGE_REGISTRY_HOST="localhost:5000" && \
|
|||
> Tips: If minikube was installed locally(driver 'none', local installation minikube), then registry is available on the host 0.0.0.0 without port forwarding.
|
||||
But local installation minikube required 'sudo'.
|
||||
|
||||
### 8. Test script arguments
|
||||
### 8. Test scripts arguments
|
||||
There are some often used test script arguments:
|
||||
- `platform` - 'openshift' or 'kubernetes'
|
||||
- `channel` - installation Olm channel: 'nightly' or 'stable'
|
||||
|
|
|
|||
|
|
@ -141,6 +141,12 @@ type CheClusterSpecServer struct {
|
|||
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Tls support"
|
||||
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
|
||||
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`.
|
||||
UseInternalClusterSVCNames bool `json:"useInternalClusterSVCNames"`
|
||||
|
||||
// Public URL of the Devfile registry, that serves sample, ready-to-use devfiles.
|
||||
// You should set it ONLY if you use an external devfile registry (see the `externalDevfileRegistry` field).
|
||||
// By default this will be automatically calculated by the operator.
|
||||
|
|
|
|||
|
|
@ -294,6 +294,7 @@ func (r *ReconcileChe) Reconcile(request reconcile.Request) (reconcile.Result, e
|
|||
deployContext := &deploy.DeployContext{
|
||||
ClusterAPI: clusterAPI,
|
||||
CheCluster: instance,
|
||||
InternalService: deploy.InternalService{},
|
||||
}
|
||||
|
||||
isOpenShift, isOpenShift4, err := util.DetectOpenShift()
|
||||
|
|
@ -754,6 +755,8 @@ func (r *ReconcileChe) Reconcile(request reconcile.Request) (reconcile.Result, e
|
|||
}
|
||||
}
|
||||
|
||||
deployContext.InternalService.CheHost = fmt.Sprintf("http://%s.%s.svc:8080", deploy.CheServiceName, deployContext.CheCluster.Namespace)
|
||||
|
||||
exposedServiceName := getServerExposingServiceName(instance)
|
||||
cheHost := ""
|
||||
if !isOpenShift {
|
||||
|
|
@ -779,19 +782,17 @@ func (r *ReconcileChe) Reconcile(request reconcile.Request) (reconcile.Result, e
|
|||
|
||||
additionalLabels := deployContext.CheCluster.Spec.Server.CheServerRoute.Labels
|
||||
route, err := deploy.SyncRouteToCluster(deployContext, cheFlavor, customHost, exposedServiceName, 8080, additionalLabels)
|
||||
if !tests {
|
||||
if route == nil {
|
||||
logrus.Infof("Waiting on route '%s' to be ready", cheFlavor)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
}
|
||||
if route == nil {
|
||||
logrus.Infof("Waiting on route '%s' to be ready", cheFlavor)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
}
|
||||
|
||||
return reconcile.Result{RequeueAfter: time.Second * 1}, err
|
||||
}
|
||||
cheHost = route.Spec.Host
|
||||
if customHost == "" {
|
||||
deployContext.DefaultCheHost = cheHost
|
||||
}
|
||||
return reconcile.Result{RequeueAfter: time.Second * 1}, err
|
||||
}
|
||||
cheHost = route.Spec.Host
|
||||
if customHost == "" {
|
||||
deployContext.DefaultCheHost = cheHost
|
||||
}
|
||||
}
|
||||
if instance.Spec.Server.CheHost != cheHost {
|
||||
|
|
|
|||
|
|
@ -84,10 +84,23 @@ func TestCheController(t *testing.T) {
|
|||
Namespace: namespace,
|
||||
},
|
||||
}
|
||||
|
||||
_, err := r.Reconcile(req)
|
||||
if err != nil {
|
||||
t.Fatalf("reconcile: (%v)", err)
|
||||
}
|
||||
_, err = r.Reconcile(req)
|
||||
if err != nil {
|
||||
t.Fatalf("reconcile: (%v)", err)
|
||||
}
|
||||
_, err = r.Reconcile(req)
|
||||
if err != nil {
|
||||
t.Fatalf("reconcile: (%v)", err)
|
||||
}
|
||||
_, err = r.Reconcile(req)
|
||||
if err != nil {
|
||||
t.Fatalf("reconcile: (%v)", err)
|
||||
}
|
||||
|
||||
// get devfile-registry configmap
|
||||
devfilecm := &corev1.ConfigMap{}
|
||||
|
|
@ -106,6 +119,14 @@ func TestCheController(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("reconcile: (%v)", err)
|
||||
}
|
||||
_, err = r.Reconcile(req)
|
||||
if err != nil {
|
||||
t.Fatalf("reconcile: (%v)", err)
|
||||
}
|
||||
_, err = r.Reconcile(req)
|
||||
if err != nil {
|
||||
t.Fatalf("reconcile: (%v)", err)
|
||||
}
|
||||
|
||||
// get configmap
|
||||
cm := &corev1.ConfigMap{}
|
||||
|
|
@ -115,12 +136,6 @@ func TestCheController(t *testing.T) {
|
|||
|
||||
customCm := &corev1.ConfigMap{}
|
||||
|
||||
// Reconcile to delete legacy custom configmap
|
||||
_, err = r.Reconcile(req)
|
||||
if err != nil {
|
||||
t.Fatalf("reconcile: (%v)", err)
|
||||
}
|
||||
|
||||
// Custom ConfigMap should be gone
|
||||
err = cl.Get(context.TODO(), types.NamespacedName{Name: "custom", Namespace: cheCR.Namespace}, customCm)
|
||||
if !errors.IsNotFound(err) {
|
||||
|
|
@ -150,6 +165,7 @@ func TestCheController(t *testing.T) {
|
|||
if err := cl.Update(context.TODO(), cheCR); err != nil {
|
||||
t.Error("Failed to update CheCluster custom resource")
|
||||
}
|
||||
|
||||
_, err = r.Reconcile(req)
|
||||
if err != nil {
|
||||
t.Fatalf("reconcile: (%v)", err)
|
||||
|
|
@ -318,6 +334,145 @@ func TestConfiguringLabelsForRoutes(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestConfiguringInternalNetworkTest(t *testing.T) {
|
||||
// Set the logger to development mode for verbose logs.
|
||||
logf.SetLogger(logf.ZapLogger(true))
|
||||
|
||||
cl, scheme := Init()
|
||||
|
||||
// Create a ReconcileChe object with the scheme and fake client
|
||||
r := &ReconcileChe{client: cl, nonCachedClient: cl, scheme: &scheme, tests: true}
|
||||
|
||||
// get CR
|
||||
cheCR := &orgv1.CheCluster{}
|
||||
|
||||
// get CR
|
||||
if err := cl.Get(context.TODO(), types.NamespacedName{Name: name, Namespace: namespace}, cheCR); err != nil {
|
||||
t.Errorf("CR not found")
|
||||
}
|
||||
cheCR.Spec.Server.UseInternalClusterSVCNames = true
|
||||
if err := cl.Update(context.TODO(), cheCR); err != nil {
|
||||
t.Errorf("Failed to update CheCluster custom resource")
|
||||
}
|
||||
|
||||
// Mock request to simulate Reconcile() being called on an event for a
|
||||
// watched resource .
|
||||
req := reconcile.Request{
|
||||
NamespacedName: types.NamespacedName{
|
||||
Name: name,
|
||||
Namespace: namespace,
|
||||
},
|
||||
}
|
||||
// reconcile to delete che route
|
||||
_, err := r.Reconcile(req)
|
||||
if err != nil {
|
||||
t.Fatalf("reconcile: (%v)", err)
|
||||
}
|
||||
|
||||
// reconcile to create che-route
|
||||
_, err = r.Reconcile(req)
|
||||
if err != nil {
|
||||
t.Fatalf("reconcile: (%v)", err)
|
||||
}
|
||||
|
||||
clusterAPI := deploy.ClusterAPI{
|
||||
Client: r.client,
|
||||
Scheme: r.scheme,
|
||||
}
|
||||
deployContext := &deploy.DeployContext{
|
||||
CheCluster: cheCR,
|
||||
ClusterAPI: clusterAPI,
|
||||
}
|
||||
|
||||
// Set up che host for route
|
||||
cheRoute, _ := deploy.GetSpecRoute(deployContext, "che", "che-host", "che-host", 8080, "")
|
||||
cl.Update(context.TODO(), cheRoute)
|
||||
|
||||
// reconsile to update Che route
|
||||
_, err = r.Reconcile(req)
|
||||
if err != nil {
|
||||
t.Fatalf("reconcile: (%v)", err)
|
||||
}
|
||||
|
||||
// Set up keycloak host for route
|
||||
keycloakRoute, _ := deploy.GetSpecRoute(deployContext, "keycloak", "keycloak", "keycloak", 8080, "")
|
||||
cl.Update(context.TODO(), keycloakRoute)
|
||||
|
||||
// Set up devfile registry host for route
|
||||
devfileRegistryRoute, _ := deploy.GetSpecRoute(deployContext, "devfile-registry", "devfile-registry", "devfile-registry", 8080, "")
|
||||
cl.Update(context.TODO(), devfileRegistryRoute)
|
||||
|
||||
// Set up plugin registry host for route
|
||||
pluginRegistryRoute, _ := deploy.GetSpecRoute(deployContext, "plugin-registry", "plugin-registry", "plugin-registry", 8080, "")
|
||||
cl.Update(context.TODO(), pluginRegistryRoute)
|
||||
|
||||
_, err = r.Reconcile(req)
|
||||
if err != nil {
|
||||
t.Fatalf("reconcile: (%v)", err)
|
||||
}
|
||||
_, err = r.Reconcile(req)
|
||||
if err != nil {
|
||||
t.Fatalf("reconcile: (%v)", err)
|
||||
}
|
||||
|
||||
cheCm := &corev1.ConfigMap{}
|
||||
if err := cl.Get(context.TODO(), types.NamespacedName{Name: "che", Namespace: cheCR.Namespace}, cheCm); err != nil {
|
||||
t.Errorf("ConfigMap %s not found: %s", cheCm.Name, err)
|
||||
}
|
||||
|
||||
cheAPIInternal := cheCm.Data["CHE_API_INTERNAL"]
|
||||
cheAPIInternalExpected := "http://che-host.eclipse-che.svc:8080/api"
|
||||
if cheAPIInternal != cheAPIInternalExpected {
|
||||
t.Fatalf("Che API internal url must be %s", cheAPIInternalExpected)
|
||||
}
|
||||
|
||||
pluginRegistryInternal := cheCm.Data["CHE_WORKSPACE_PLUGIN__REGISTRY__INTERNAL__URL"]
|
||||
pluginRegistryInternalExpected := "http://plugin-registry.eclipse-che.svc:8080/v3"
|
||||
if pluginRegistryInternal != pluginRegistryInternalExpected {
|
||||
t.Fatalf("Plugin registry internal url must be %s", pluginRegistryInternalExpected)
|
||||
}
|
||||
|
||||
devRegistryInternal := cheCm.Data["CHE_WORKSPACE_DEVFILE__REGISTRY__INTERNAL__URL"]
|
||||
devRegistryInternalExpected := "http://devfile-registry.eclipse-che.svc:8080"
|
||||
if devRegistryInternal != devRegistryInternalExpected {
|
||||
t.Fatalf("Devfile registry internal url must be %s", pluginRegistryInternalExpected)
|
||||
}
|
||||
|
||||
// update CR and make sure Che configmap has been updated
|
||||
cheCR.Spec.Server.UseInternalClusterSVCNames = false
|
||||
if err := cl.Update(context.TODO(), cheCR); err != nil {
|
||||
t.Error("Failed to update CheCluster custom resource")
|
||||
}
|
||||
|
||||
_, err = r.Reconcile(req)
|
||||
if err != nil {
|
||||
t.Fatalf("reconcile: (%v)", err)
|
||||
}
|
||||
|
||||
cheCmWithDisabledInternalClusterSVCNames := &corev1.ConfigMap{}
|
||||
if err := cl.Get(context.TODO(), types.NamespacedName{Name: "che", Namespace: cheCR.Namespace}, cheCmWithDisabledInternalClusterSVCNames); err != nil {
|
||||
t.Errorf("ConfigMap %s not found: %s", cheCm.Name, err)
|
||||
}
|
||||
|
||||
cheAPIInternal = cheCmWithDisabledInternalClusterSVCNames.Data["CHE_API_INTERNAL"]
|
||||
cheAPIInternalExpected = "http://che-host/api"
|
||||
if cheAPIInternal != cheAPIInternalExpected {
|
||||
t.Fatalf("Che API internal url must be %s", cheAPIInternalExpected)
|
||||
}
|
||||
|
||||
pluginRegistryInternal = cheCmWithDisabledInternalClusterSVCNames.Data["CHE_WORKSPACE_PLUGIN__REGISTRY__INTERNAL__URL"]
|
||||
pluginRegistryInternalExpected = "http://plugin-registry/v3"
|
||||
if pluginRegistryInternal != pluginRegistryInternalExpected {
|
||||
t.Fatalf("Plugin registry internal url must be %s", pluginRegistryInternalExpected)
|
||||
}
|
||||
|
||||
devRegistryInternal = cheCmWithDisabledInternalClusterSVCNames.Data["CHE_WORKSPACE_DEVFILE__REGISTRY__INTERNAL__URL"]
|
||||
devRegistryInternalExpected = "http://devfile-registry"
|
||||
if devRegistryInternal != devRegistryInternalExpected {
|
||||
t.Fatalf("Plugin registry internal url must be %s", pluginRegistryInternalExpected)
|
||||
}
|
||||
}
|
||||
|
||||
func Init() (client.Client, runtime.Scheme) {
|
||||
pgPod := &corev1.Pod{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
|
|
|
|||
|
|
@ -25,12 +25,19 @@ type ProvisioningStatus struct {
|
|||
}
|
||||
|
||||
type DeployContext struct {
|
||||
CheCluster *orgv1.CheCluster
|
||||
ClusterAPI ClusterAPI
|
||||
Proxy *Proxy
|
||||
CheCluster *orgv1.CheCluster
|
||||
ClusterAPI ClusterAPI
|
||||
Proxy *Proxy
|
||||
InternalService InternalService
|
||||
DefaultCheHost string
|
||||
}
|
||||
|
||||
type InternalService struct {
|
||||
DevfileRegistryHost string
|
||||
PluginRegistryHost string
|
||||
CheHost string
|
||||
}
|
||||
|
||||
type ClusterAPI struct {
|
||||
Client client.Client
|
||||
Scheme *runtime.Scheme
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ const (
|
|||
DefaultPluginRegistryMemoryLimit = "256Mi"
|
||||
DefaultPluginRegistryMemoryRequest = "16Mi"
|
||||
|
||||
// DefaultKube
|
||||
DefaultDevfileRegistryMemoryLimit = "256Mi"
|
||||
DefaultDevfileRegistryMemoryRequest = "16Mi"
|
||||
DefaultKeycloakAdminUserName = "admin"
|
||||
|
|
|
|||
|
|
@ -73,6 +73,8 @@ func SyncDevfileRegistryToCluster(deployContext *deploy.DeployContext, cheHost s
|
|||
}
|
||||
}
|
||||
|
||||
deployContext.InternalService.DevfileRegistryHost = fmt.Sprintf("http://%s.%s.svc:8080", deploy.DevfileRegistry, deployContext.CheCluster.Namespace)
|
||||
|
||||
// Deploy devfile registry
|
||||
deploymentStatus := SyncDevfileRegistryDeploymentToCluster(deployContext)
|
||||
if !util.IsTestMode() {
|
||||
|
|
|
|||
|
|
@ -98,22 +98,19 @@ func Expose(deployContext *deploy.DeployContext, cheHost string, endpointName st
|
|||
} else {
|
||||
// the empty string for a host is intentional here - we let OpenShift decide on the hostname
|
||||
route, err := deploy.SyncRouteToCluster(deployContext, endpointName, "", endpointName, 8080, additionalLabels)
|
||||
if !util.IsTestMode() {
|
||||
if route == nil {
|
||||
logrus.Infof("Waiting on route '%s' to be ready", endpointName)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
}
|
||||
|
||||
return "", false, err
|
||||
if route == nil {
|
||||
logrus.Infof("Waiting on route '%s' to be ready", endpointName)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
}
|
||||
return "", false, err
|
||||
}
|
||||
|
||||
if err := gateway.DeleteGatewayRouteConfig(gatewayConfig, deployContext); !util.IsTestMode() && err != nil {
|
||||
logrus.Error(err)
|
||||
}
|
||||
if !util.IsTestMode() {
|
||||
endpoint = route.Spec.Host
|
||||
}
|
||||
|
||||
endpoint = route.Spec.Host
|
||||
}
|
||||
}
|
||||
return endpoint, true, nil
|
||||
|
|
|
|||
|
|
@ -74,6 +74,8 @@ func SyncPluginRegistryToCluster(deployContext *deploy.DeployContext, cheHost st
|
|||
}
|
||||
}
|
||||
|
||||
deployContext.InternalService.PluginRegistryHost = fmt.Sprintf("http://%s.%s.svc:8080/v3", deploy.PluginRegistry, deployContext.CheCluster.Namespace)
|
||||
|
||||
// Deploy plugin registry
|
||||
deploymentStatus := SyncPluginRegistryDeploymentToCluster(deployContext)
|
||||
if !util.IsTestMode() {
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ type CheConfigMap struct {
|
|||
CheMultiUser string `json:"CHE_MULTIUSER"`
|
||||
ChePort string `json:"CHE_PORT"`
|
||||
CheApi string `json:"CHE_API"`
|
||||
CheApiInternal string `json:"CHE_API_INTERNAL"`
|
||||
CheWebSocketEndpoint string `json:"CHE_WEBSOCKET_ENDPOINT"`
|
||||
CheDebugServer string `json:"CHE_DEBUG_SERVER"`
|
||||
CheMetricsEnabled string `json:"CHE_METRICS_ENABLED"`
|
||||
|
|
@ -70,7 +71,9 @@ type CheConfigMap struct {
|
|||
WorkspaceHttpsProxy string `json:"CHE_WORKSPACE_HTTPS__PROXY"`
|
||||
WorkspaceNoProxy string `json:"CHE_WORKSPACE_NO__PROXY"`
|
||||
PluginRegistryUrl string `json:"CHE_WORKSPACE_PLUGIN__REGISTRY__URL,omitempty"`
|
||||
PluginRegistryInternalUrl string `json:"CHE_WORKSPACE_PLUGIN__REGISTRY__INTERNAL__URL,omitempty"`
|
||||
DevfileRegistryUrl string `json:"CHE_WORKSPACE_DEVFILE__REGISTRY__URL,omitempty"`
|
||||
DevfileRegistryInternalUrl string `json:"CHE_WORKSPACE_DEVFILE__REGISTRY__INTERNAL__URL,omitempty"`
|
||||
WebSocketEndpointMinor string `json:"CHE_WEBSOCKET_ENDPOINT__MINOR"`
|
||||
CheWorkspacePluginBrokerMetadataImage string `json:"CHE_WORKSPACE_PLUGIN__BROKER_METADATA_IMAGE,omitempty"`
|
||||
CheWorkspacePluginBrokerArtifactsImage string `json:"CHE_WORKSPACE_PLUGIN__BROKER_ARTIFACTS_IMAGE,omitempty"`
|
||||
|
|
@ -168,8 +171,8 @@ func GetCheConfigMapData(deployContext *deploy.DeployContext) (cheEnv map[string
|
|||
keycloakClientId := util.GetValue(deployContext.CheCluster.Spec.Auth.IdentityProviderClientId, cheFlavor+"-public")
|
||||
ingressStrategy := util.GetServerExposureStrategy(deployContext.CheCluster, deploy.DefaultServerExposureStrategy)
|
||||
ingressClass := util.GetValue(deployContext.CheCluster.Spec.K8s.IngressClass, deploy.DefaultIngressClass)
|
||||
devfileRegistryUrl := deployContext.CheCluster.Status.DevfileRegistryURL
|
||||
pluginRegistryUrl := deployContext.CheCluster.Status.PluginRegistryURL
|
||||
devfileRegistryURL:= deployContext.CheCluster.Status.DevfileRegistryURL
|
||||
pluginRegistryURL := deployContext.CheCluster.Status.PluginRegistryURL
|
||||
cheLogLevel := util.GetValue(deployContext.CheCluster.Spec.Server.CheLogLevel, deploy.DefaultCheLogLevel)
|
||||
cheDebug := util.GetValue(deployContext.CheCluster.Spec.Server.CheDebug, deploy.DefaultCheDebug)
|
||||
cheMetrics := strconv.FormatBool(deployContext.CheCluster.Spec.Metrics.Enable)
|
||||
|
|
@ -178,11 +181,26 @@ func GetCheConfigMapData(deployContext *deploy.DeployContext) (cheEnv map[string
|
|||
workspaceExposure := deploy.GetSingleHostExposureType(deployContext.CheCluster)
|
||||
singleHostGatewayConfigMapLabels := labels.FormatLabels(util.GetMapValue(deployContext.CheCluster.Spec.Server.SingleHostGatewayConfigMapLabels, deploy.DefaultSingleHostGatewayConfigMapLabels))
|
||||
|
||||
cheAPI := protocol + "://" + cheHost + "/api"
|
||||
|
||||
var pluginRegistryInternalURL, devfileRegistryInternalURL, cheInternalAPI string
|
||||
|
||||
if deployContext.CheCluster.Spec.Server.UseInternalClusterSVCNames {
|
||||
devfileRegistryInternalURL = deployContext.InternalService.DevfileRegistryHost
|
||||
pluginRegistryInternalURL = deployContext.InternalService.PluginRegistryHost
|
||||
cheInternalAPI = deployContext.InternalService.CheHost + "/api"
|
||||
} else {
|
||||
devfileRegistryInternalURL = devfileRegistryURL
|
||||
pluginRegistryInternalURL = pluginRegistryURL
|
||||
cheInternalAPI = cheAPI
|
||||
}
|
||||
|
||||
data := &CheConfigMap{
|
||||
CheMultiUser: cheMultiUser,
|
||||
CheHost: cheHost,
|
||||
ChePort: "8080",
|
||||
CheApi: protocol + "://" + cheHost + "/api",
|
||||
CheApi: cheAPI,
|
||||
CheApiInternal: cheInternalAPI,
|
||||
CheWebSocketEndpoint: wsprotocol + "://" + cheHost + "/api/websocket",
|
||||
WebSocketEndpointMinor: wsprotocol + "://" + cheHost + "/api/websocket-minor",
|
||||
CheDebugServer: cheDebug,
|
||||
|
|
@ -206,8 +224,10 @@ func GetCheConfigMapData(deployContext *deploy.DeployContext) (cheEnv map[string
|
|||
WorkspaceHttpProxy: deployContext.Proxy.HttpProxy,
|
||||
WorkspaceHttpsProxy: deployContext.Proxy.HttpsProxy,
|
||||
WorkspaceNoProxy: cheWorkspaceNoProxy,
|
||||
PluginRegistryUrl: pluginRegistryUrl,
|
||||
DevfileRegistryUrl: devfileRegistryUrl,
|
||||
PluginRegistryUrl: pluginRegistryURL,
|
||||
PluginRegistryInternalUrl: pluginRegistryInternalURL,
|
||||
DevfileRegistryUrl: devfileRegistryURL,
|
||||
DevfileRegistryInternalUrl: devfileRegistryInternalURL,
|
||||
CheWorkspacePluginBrokerMetadataImage: deploy.DefaultCheWorkspacePluginBrokerMetadataImage(deployContext.CheCluster),
|
||||
CheWorkspacePluginBrokerArtifactsImage: deploy.DefaultCheWorkspacePluginBrokerArtifactsImage(deployContext.CheCluster),
|
||||
CheServerSecureExposerJwtProxyImage: deploy.DefaultCheServerSecureExposerJwtProxyImage(deployContext.CheCluster),
|
||||
|
|
|
|||
Loading…
Reference in New Issue