diff --git a/assembly/assembly-wsmaster-war/src/main/webapp/WEB-INF/classes/che/che.properties b/assembly/assembly-wsmaster-war/src/main/webapp/WEB-INF/classes/che/che.properties index cefc8aa74e23..64c133be8397 100644 --- a/assembly/assembly-wsmaster-war/src/main/webapp/WEB-INF/classes/che/che.properties +++ b/assembly/assembly-wsmaster-war/src/main/webapp/WEB-INF/classes/che/che.properties @@ -566,6 +566,11 @@ che.workspace.plugin_broker.wait_timeout_min=3 # In case Che plugins tooling is not needed value 'NULL' should be used che.workspace.plugin_registry_url=https://che-plugin-registry.openshift.io/v3 +# Devfile Registry endpoint. Should be a valid HTTP URL. +# Example: http://che-devfile-registry-eclipse-che.192.168.65.2.nip.io +# In case Che plugins tooling is not needed value 'NULL' should be used +che.workspace.devfile_registry_url=https://che-devfile-registry.openshift.io/ + # Configures in which way secure servers will be protected with authentication. # Suitable values: # - 'default': no additionally authentication system will be enabled. diff --git a/deploy/openshift/deploy_che.sh b/deploy/openshift/deploy_che.sh index 9bf38eb16d9e..a8ab2f897487 100755 --- a/deploy/openshift/deploy_che.sh +++ b/deploy/openshift/deploy_che.sh @@ -59,6 +59,7 @@ HELP=" --secure | -s - Deploy Che with SSL enabled --setup-ocp-oauth - register OCP oauth client and setup Keycloak and Che to use OpenShift Identity Provider --deploy-che-plugin-registry - deploy Che plugin registry +--deploy-che-devfile-registry - deploy Che devfile registry --tracing - Deploy jaeger and enable tracing collection --monitoring - Deploy Grafana + Prometheus and enable metrics collection =================================== @@ -123,6 +124,10 @@ case $key in DEPLOY_CHE_PLUGIN_REGISTRY=true shift ;; + --deploy-che-devfile-registry) + DEPLOY_CHE_DEVFILE_REGISTRY=true + shift + ;; --help) echo -e "$HELP" exit 1 @@ -195,6 +200,9 @@ export KEYCLOAK_USER=${KEYCLOAK_USER:-${DEFAULT_KEYCLOAK_USER}} DEFAULT_KEYCLOAK_PASSWORD=admin export KEYCLOAK_PASSWORD=${KEYCLOAK_PASSWORD:-${DEFAULT_KEYCLOAK_PASSWORD}} +### +### Plugin Registry settings +### DEFAULT_PLUGIN_REGISTRY_IMAGE_TAG="latest" export PLUGIN_REGISTRY_IMAGE_TAG=${PLUGIN_REGISTRY_IMAGE_TAG:-${DEFAULT_PLUGIN_REGISTRY_IMAGE_TAG}} @@ -207,6 +215,22 @@ export PLUGIN_REGISTRY_IMAGE_PULL_POLICY=${PLUGIN_REGISTRY_IMAGE_PULL_POLICY:-${ DEFAULT_PLUGIN__REGISTRY__URL="https://che-plugin-registry.openshift.io/v3" export PLUGIN__REGISTRY__URL=${PLUGIN__REGISTRY__URL:-${DEFAULT_PLUGIN__REGISTRY__URL}} +### +### Devfile Registry settings +### +DEFAULT_DEVFILE_REGISTRY_IMAGE_TAG="latest" +export DEVFILE_REGISTRY_IMAGE_TAG=${DEVFILE_REGISTRY_IMAGE_TAG:-${DEFAULT_DEVFILE_REGISTRY_IMAGE_TAG}} + +DEFAULT_DEVFILE_REGISTRY_IMAGE="quay.io/openshiftio/che-devfile-registry" +export DEVFILE_REGISTRY_IMAGE=${DEVFILE_REGISTRY_IMAGE:-${DEFAULT_DEVFILE_REGISTRY_IMAGE}} + +DEFAULT_DEVFILE_REGISTRY_IMAGE_PULL_POLICY="Always" +export DEVFILE_REGISTRY_IMAGE_PULL_POLICY=${DEVFILE_REGISTRY_IMAGE_PULL_POLICY:-${DEFAULT_DEVFILE_REGISTRY_IMAGE_PULL_POLICY}} + +DEFAULT_DEVFILE__REGISTRY__URL="NULL" +export DEVFILE__REGISTRY__URL=${DEVFILE__REGISTRY__URL:-${DEFAULT_DEVFILE__REGISTRY__URL}} + + DEFAULT_CHE_METRICS_ENABLED="false" export CHE_METRICS_ENABLED=${CHE_METRICS_ENABLED:-${DEFAULT_CHE_METRICS_ENABLED}} @@ -449,6 +473,19 @@ if [ "${DEPLOY_CHE_PLUGIN_REGISTRY}" == "true" ]; then fi } +deployCheDevfileRegistry() { +if [ "${DEPLOY_CHE_DEVFILE_REGISTRY}" == "true" ]; then + echo "Deploying Che devfile registry..." + ${OC_BINARY} new-app -f ${BASE_DIR}/templates/che-devfile-registry.yml \ + -p IMAGE=${DEVFILE_REGISTRY_IMAGE} \ + -p IMAGE_TAG=${DEVFILE_REGISTRY_IMAGE_TAG} \ + -p PULL_POLICY=${DEVFILE_REGISTRY_IMAGE_PULL_POLICY} + + DEVFILE_REGISTRY_ROUTE=$($OC_BINARY get route/che-devfile-registry --namespace=${CHE_OPENSHIFT_PROJECT} -o=jsonpath={'.spec.host'}) + echo "Che devfile registry deployment complete. $DEVFILE_REGISTRY_ROUTE" +fi +} + deployJaeger(){ if [ "${CHE_TRACING_ENABLED}" == "true" ]; then echo "Deploying Jaeger..." @@ -566,6 +603,11 @@ ${CHE_VAR_ARRAY}" PLUGIN__REGISTRY__URL="${HTTP_PROTOCOL}://${PLUGIN_REGISTRY_ROUTE}/v3" fi + if [ "${DEPLOY_CHE_DEVFILE_REGISTRY}" == "true" ]; then + DEVFILE_REGISTRY_ROUTE=$($OC_BINARY get route/che-devfile-registry --namespace=${CHE_OPENSHIFT_PROJECT} -o=jsonpath={'.spec.host'}) + DEVFILE__REGISTRY__URL="${HTTP_PROTOCOL}://${DEVFILE_REGISTRY_ROUTE}/" + fi + if [ ! -z ${CHE_INFRA_OPENSHIFT_PROJECT} ]; then # create workspace service account in the predefined workspace ${OC_BINARY} new-app -f ${BASE_DIR}/templates/che-workspace-service-account.yaml \ @@ -587,6 +629,7 @@ ${CHE_VAR_ARRAY}" -p CHE_INFRA_OPENSHIFT_OAUTH__IDENTITY__PROVIDER=${CHE_INFRA_OPENSHIFT_OAUTH__IDENTITY__PROVIDER} \ -p TLS=${TLS} \ -p CHE_WORKSPACE_PLUGIN__REGISTRY__URL=${PLUGIN__REGISTRY__URL} \ + -p CHE_WORKSPACE_DEVFILE__REGISTRY__URL=${DEVFILE__REGISTRY__URL} \ -p CHE_INFRA_KUBERNETES_SERVICE__ACCOUNT__NAME=${WORKSPACE_SERVICE_ACCOUNT_NAME} \ -p CHE_DEBUG_SERVER=${CHE_DEBUG_SERVER} \ -p CHE_TRACING_ENABLED=${CHE_TRACING_ENABLED} \ @@ -617,6 +660,7 @@ isLoggedIn createNewProject getRoutingSuffix deployChePluginRegistry +deployCheDevfileRegistry deployJaeger deployMetrics deployChe diff --git a/deploy/openshift/templates/che-devfile-registry.yml b/deploy/openshift/templates/che-devfile-registry.yml new file mode 100644 index 000000000000..63bd70d4b4f4 --- /dev/null +++ b/deploy/openshift/templates/che-devfile-registry.yml @@ -0,0 +1,100 @@ +# +# Copyright (c) 2018 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +--- +apiVersion: v1 +kind: Template +metadata: + name: che-devfile-registry +objects: +- apiVersion: v1 + kind: DeploymentConfig + metadata: + labels: + app: che-devfile-registry + name: che-devfile-registry + spec: + replicas: 1 + selector: + app: che-devfile-registry + deploymentconfig: che-devfile-registry + strategy: + rollingParams: + intervalSeconds: 1 + maxSurge: 25% + maxUnavailable: 25% + timeoutSeconds: 600 + updatePeriodSeconds: 1 + type: Rolling + template: + metadata: + labels: + app: che-devfile-registry + deploymentconfig: che-devfile-registry + spec: + containers: + - image: ${IMAGE}:${IMAGE_TAG} + imagePullPolicy: "${PULL_POLICY}" + name: che-devfile-registry + ports: + - containerPort: 8080 + livenessProbe: + httpGet: + path: /devfiles/ + port: 8080 + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 3 + readinessProbe: + httpGet: + path: /devfiles/ + port: 8080 + initialDelaySeconds: 3 + periodSeconds: 10 + timeoutSeconds: 3 + resources: + limits: + memory: ${MEMORY_LIMIT} + triggers: + - type: ConfigChange +- apiVersion: v1 + kind: Service + metadata: + name: che-devfile-registry + spec: + ports: + - protocol: TCP + port: 80 + targetPort: 8080 + selector: + deploymentconfig: che-devfile-registry +- apiVersion: v1 + kind: Route + metadata: + name: che-devfile-registry + spec: + to: + kind: Service + name: che-devfile-registry +parameters: +- name: IMAGE + value: eclipse/che-devfile-registry + displayName: Eclipse Che devfile registry image + description: Che devfile registry Docker image. Defaults to eclipse/che-devfile-registry +- name: IMAGE_TAG + value: latest + displayName: Eclipse Che devfile registry version + description: Eclipse Che devfile registry version which defaults to latest +- name: MEMORY_LIMIT + value: 256Mi + displayName: Memory Limit + description: Maximum amount of memory the container can use. Defaults 256Mi +- name: PULL_POLICY + value: Always + displayName: Eclipse Che devfile registry image pull policy + description: Always pull by default. Can be IfNotPresent diff --git a/deploy/openshift/templates/che-server-template.yaml b/deploy/openshift/templates/che-server-template.yaml index c63e321344f3..f83d18f1dc1f 100644 --- a/deploy/openshift/templates/che-server-template.yaml +++ b/deploy/openshift/templates/che-server-template.yaml @@ -163,6 +163,8 @@ objects: optional: true - name: CHE_WORKSPACE_PLUGIN__REGISTRY__URL value: "${CHE_WORKSPACE_PLUGIN__REGISTRY__URL}" + - name: CHE_WORKSPACE_DEVFILE__REGISTRY__URL + value: "${CHE_WORKSPACE_DEVFILE__REGISTRY__URL}" - name: CHE_TRACING_ENABLED value: "${CHE_TRACING_ENABLED}" - name: CHE_METRICS_ENABLED @@ -329,6 +331,10 @@ parameters: displayName: Eclipse Che plugin registry URL description: Url that used to get meta information about Eclipse Che tooling value: 'NULL' +- name: CHE_WORKSPACE_DEVFILE__REGISTRY__URL + displayName: Eclipse Che devfile registry URL + description: Url that used to get meta information about predefined devfiles for workspaces + value: 'NULL' - name: CHE_WORKSPACE_SIDECAR_DEFAULT__MEMORY__LIMIT__MB displayName: Plugin sidecar default memory limit description: Plugin sidecar default memory limit in megabytes diff --git a/wsmaster/che-core-api-workspace-shared/src/main/java/org/eclipse/che/api/workspace/shared/Constants.java b/wsmaster/che-core-api-workspace-shared/src/main/java/org/eclipse/che/api/workspace/shared/Constants.java index 6ea6185a8def..4c8122b0ba21 100644 --- a/wsmaster/che-core-api-workspace-shared/src/main/java/org/eclipse/che/api/workspace/shared/Constants.java +++ b/wsmaster/che-core-api-workspace-shared/src/main/java/org/eclipse/che/api/workspace/shared/Constants.java @@ -43,12 +43,14 @@ public final class Constants { public static final String CHE_WORKSPACE_AUTO_START = "che.workspace.auto_start"; - /** - * Property name for Che plugin registry url. Key name of api workspace/settings method results. - */ + /** Property name for Che plugin registry url. */ public static final String CHE_WORKSPACE_PLUGIN_REGISTRY_URL_PROPERTY = "che.workspace.plugin_registry_url"; + /** Property name for Che Devfile Registry URL. */ + public static final String CHE_WORKSPACE_DEVFILE_REGISTRY_URL_PROPERTY = + "che.workspace.devfile_registry_url"; + /** Name for environment variable of machine name */ public static final String CHE_MACHINE_NAME_ENV_VAR = "CHE_MACHINE_NAME"; /** diff --git a/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/WorkspaceService.java b/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/WorkspaceService.java index a84cb2b6e2eb..7d30a606ab48 100644 --- a/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/WorkspaceService.java +++ b/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/WorkspaceService.java @@ -19,6 +19,7 @@ import static org.eclipse.che.api.workspace.server.DtoConverter.asDto; import static org.eclipse.che.api.workspace.server.WorkspaceKeyValidator.validateKey; import static org.eclipse.che.api.workspace.shared.Constants.CHE_WORKSPACE_AUTO_START; +import static org.eclipse.che.api.workspace.shared.Constants.CHE_WORKSPACE_DEVFILE_REGISTRY_URL_PROPERTY; import static org.eclipse.che.api.workspace.shared.Constants.CHE_WORKSPACE_PLUGIN_REGISTRY_URL_PROPERTY; import com.google.common.annotations.Beta; @@ -96,6 +97,7 @@ public class WorkspaceService extends Service { private final MachineTokenProvider machineTokenProvider; private final WorkspaceLinksGenerator linksGenerator; private final String pluginRegistryUrl; + private final String devfileRegistryUrl; private final String apiEndpoint; private final boolean cheWorkspaceAutoStart; @@ -106,13 +108,15 @@ public WorkspaceService( WorkspaceManager workspaceManager, MachineTokenProvider machineTokenProvider, WorkspaceLinksGenerator linksGenerator, - @Named(CHE_WORKSPACE_PLUGIN_REGISTRY_URL_PROPERTY) @Nullable String pluginRegistryUrl) { + @Named(CHE_WORKSPACE_PLUGIN_REGISTRY_URL_PROPERTY) @Nullable String pluginRegistryUrl, + @Named(CHE_WORKSPACE_DEVFILE_REGISTRY_URL_PROPERTY) @Nullable String devfileRegistryUrl) { this.apiEndpoint = apiEndpoint; this.cheWorkspaceAutoStart = cheWorkspaceAutoStart; this.workspaceManager = workspaceManager; this.machineTokenProvider = machineTokenProvider; this.linksGenerator = linksGenerator; this.pluginRegistryUrl = pluginRegistryUrl; + this.devfileRegistryUrl = devfileRegistryUrl; } @POST @@ -800,6 +804,10 @@ public Map getSettings() { settings.put("cheWorkspacePluginRegistryUrl", pluginRegistryUrl); } + if (devfileRegistryUrl != null) { + settings.put("cheDevfileRegistryUrl", devfileRegistryUrl); + } + return settings.build(); }