4.10. 대시보드 구성
4.10.1. 시작하기 샘플 구성 링크 복사링크가 클립보드에 복사되었습니다!
다음 절차에서는 사용자 정의 샘플을 표시하도록 OpenShift Dev Spaces 대시보드를 구성하는 방법을 설명합니다.
사전 요구 사항
-
OpenShift 클러스터에 대한 관리 권한이 있는 활성
oc세션. CLI 시작하기를 참조하십시오.
프로세스
샘플 구성으로 JSON 파일을 생성합니다. 파일에는 각 오브젝트가 샘플을 나타내는 오브젝트 배열이 포함되어야 합니다.
cat > my-samples.json <<EOF [ { "displayName": "<display_name>",1 "description": "<description>",2 "tags": <tags>,3 "url": "<url>",4 "icon": { "base64data": "<base64data>",5 "mediatype": "<mediatype>"6 } } ] EOF샘플 구성을 사용하여 ConfigMap을 생성합니다.
oc create configmap getting-started-samples --from-file=my-samples.json -n openshift-devspacesConfigMap에 필요한 라벨을 추가합니다.
oc label configmap getting-started-samples app.kubernetes.io/part-of=che.eclipse.org app.kubernetes.io/component=getting-started-samples -n openshift-devspaces- 새 샘플을 보려면 OpenShift Dev Spaces 대시보드 페이지를 새로 고칩니다.
4.10.2. 편집기 정의 구성 링크 복사링크가 클립보드에 복사되었습니다!
OpenShift Dev Spaces 편집기 정의를 구성하는 방법을 알아봅니다.
사전 요구 사항
-
OpenShift 클러스터에 대한 관리 권한이 있는 활성
oc세션. CLI 시작하기를 참조하십시오.
프로세스
편집기 정의 구성을 사용하여
my-editor-definition-devfile.yamlYAML 파일을 만듭니다.중요metadata.attributes에서게시자및버전의실제 값을 제공해야 합니다.게시자/이름/버전형식의 편집기 이름과 함께 편집기 ID를 구성하는 데 사용됩니다.아래에서 지원되는 값(선택 사항 포함)을 찾을 수 있습니다.
# Version of the devile schema schemaVersion: 2.2.2 # Meta information of the editor metadata: # (MANDATORY) The editor name # Must consist of lower case alphanumeric characters, '-' or '.' name: editor-name displayName: Display Name description: Run Editor Foo on top of Eclipse Che # (OPTIONAL) Array of tags of the current editor. The Tech-Preview tag means the option is considered experimental and is not recommended for production environments. While it can include new features and improvements, it may still contain bugs or undergo significant changes before reaching a stable version. tags: - Tech-Preview # Additional attributes attributes: title: This is my editor # (MANDATORY) The publisher name publisher: publisher # (MANDATORY) The editor version version: version repository: https://github.com/editor/repository/ firstPublicationDate: '2024-01-01' iconMediatype: image/svg+xml iconData: | <icon-content> # List of editor components components: # Name of the component - name: che-code-injector # Configuration of devworkspace-related container container: # Image of the container image: 'quay.io/che-incubator/che-code:insiders' # The command to run in the dockerimage component instead of the default one provided in the image command: - /entrypoint-init-container.sh # (OPTIONAL) List of volumes mounts that should be mounted in this container volumeMounts: # The name of the mount - name: checode # The path of the mount path: /checode # (OPTIONAL) The memory limit of the container memoryLimit: 256Mi # (OPTIONAL) The memory request of the container memoryRequest: 32Mi # (OPTIONAL) The CPU limit of the container cpuLimit: 500m # (OPTIONAL) The CPU request of the container cpuRequest: 30m # Name of the component - name: che-code-runtime-description # (OPTIONAL) Map of implementation-dependant free-form YAML attributes attributes: # The component within the architecture app.kubernetes.io/component: che-code-runtime # The name of a higher level application this one is part of app.kubernetes.io/part-of: che-code.eclipse.org # Defines a container component as a "container contribution". If a flattened DevWorkspace has a container component with the merge-contribution attribute, then any container contributions are merged into that container component controller.devfile.io/container-contribution: true container: # Can be a dummy image because the component is expected to be injected into workspace dev component image: quay.io/devfile/universal-developer-image:latest # (OPTIONAL) List of volume mounts that should be mounted in this container volumeMounts: # The name of the mount - name: checode # (OPTIONAL) The path in the component container where the volume should be mounted. If no path is defined, the default path is the is /<name> path: /checode # (OPTIONAL) The memory limit of the container memoryLimit: 1024Mi # (OPTIONAL) The memory request of the container memoryRequest: 256Mi # (OPTIONAL) The CPU limit of the container cpuLimit: 500m # (OPTIONAL) The CPU request of the container cpuRequest: 30m # (OPTIONAL) Environment variables used in this container env: - name: ENV_NAME value: value # Component endpoints endpoints: # Name of the editor - name: che-code # (OPTIONAL) Map of implementation-dependant string-based free-form attributes attributes: # Type of the endpoint. You can only set its value to main, indicating that the endpoint should be used as the mainUrl in the workspace status (i.e. it should be the URL used to access the editor in this context) type: main # An attribute that instructs the service to automatically redirect the unauthenticated requests for current user authentication. Setting this attribute to true has security consequences because it makes Cross-site request forgery (CSRF) attacks possible. The default value of the attribute is false. cookiesAuthEnabled: true # Defines an endpoint as "discoverable", meaning that a service should be created using the endpoint name (i.e. instead of generating a service name for all endpoints, this endpoint should be statically accessible) discoverable: false # Used to secure the endpoint with authorization on OpenShift, so that not anyone on the cluster can access the endpoint, the attribute enables authentication. urlRewriteSupported: true # Port number to be used within the container component targetPort: 3100 # (OPTIONAL) Describes how the endpoint should be exposed on the network (public, internal, none) exposure: public # (OPTIONAL) Describes whether the endpoint should be secured and protected by some authentication process secure: true # (OPTIONAL) Describes the application and transport protocols of the traffic that will go through this endpoint protocol: https # Mandatory name that allows referencing the component from other elements - name: checode # (OPTIONAL) Allows specifying the definition of a volume shared by several other components. Ephemeral volumes are not stored persistently across restarts. Defaults to false volume: {ephemeral: true} # (OPTIONAL) Bindings of commands to events. Each command is referred-to by its name events: # IDs of commands that should be executed before the devworkspace start. These commands would typically be executed in an init container preStart: - init-container-command # IDs of commands that should be executed after the devworkspace has completely started. In the case of Che-Code, these commands should be executed after all plugins and extensions have started, including project cloning. This means that those commands are not triggered until the user opens the IDE within the browser postStart: - init-che-code-command # (OPTIONAL) Predefined, ready-to-use, devworkspace-related commands commands: # Mandatory identifier that allows referencing this command - id: init-container-command apply: # Describes the component for the apply command component: che-code-injector # Mandatory identifier that allows referencing this command - id: init-che-code-command # CLI Command executed in an existing component container exec: # Describes component for the exec command component: che-code-runtime-description # The actual command-line string commandLine: 'nohup /checode/entrypoint-volume.sh > /checode/entrypoint-logs.txt 2>&1 &'편집기 정의 콘텐츠를 사용하여 ConfigMap을 생성합니다.
oc create configmap my-editor-definition --from-file=my-editor-definition-devfile.yaml -n openshift-devspacesConfigMap에 필요한 라벨을 추가합니다.
oc label configmap my-editor-definition app.kubernetes.io/part-of=che.eclipse.org app.kubernetes.io/component=editor-definition -n openshift-devspaces- 사용 가능한 새 편집기를 보려면 OpenShift Dev Spaces 대시보드 페이지를 새로 고칩니다.
4.10.2.1. 편집기 정의 검색 링크 복사링크가 클립보드에 복사되었습니다!
편집기 정의는 다음 URL의 OpenShift Dev Spaces 대시보드 API에서도 제공합니다.
https://<openshift_dev_spaces_fqdn>/dashboard/api/editors
4.10.2절. “편집기 정의 구성” 의 예제에서는 다음 URL에 액세스하여 편집기 정의를 검색할 수 있습니다.
https:// <openshift_dev_spaces_fqdn> /dashboard/api/editors/devfile?che-editor=publisher/editor-name/version
OpenShift 클러스터 내에서 편집기 정의를 검색할 때 대시보드 서비스를 통해 OpenShift Dev Spaces 대시보드 API에 액세스할 수 있습니다. http://devspaces-dashboard.openshift-devspaces.svc.cluster.local:8080/dashboard/api/editors
추가 리소스
- devfile 문서
- {editor-definition-samples-link}
4.10.3. 기본 편집기 정의 구성 링크 복사링크가 클립보드에 복사되었습니다!
OpenShift Dev Spaces 기본 편집기 정의를 구성하는 방법을 알아봅니다.
프로세스
사용 가능한 편집기의 ID를 확인합니다.
oc exec deploy/devspaces-dashboard -n openshift-devspaces \ -- curl -s http://localhost:8080/dashboard/api/editors | jq -r '.[] | "\(.metadata.attributes.publisher)/\(.metadata.name)/\(.metadata.attributes.version)"'defaultEditor를 구성합니다.oc patch checluster/devspaces \ --namespace openshift-devspaces \ --type='merge' \ -p '{"spec":{"devEnvironments":{"defaultEditor": "<default_editor>"}}}'1 - 1
- 작업 영역을 생성하는 기본 편집기는 플러그인 ID 또는 URI를 사용하여 지정할 수 있습니다. 플러그인 ID는
publisher/name/version형식을 따라야 합니다. 첫 번째 단계에서 사용 가능한 편집기 ID를 참조하십시오.
추가 리소스
- 4.10.2절. “편집기 정의 구성”
- 4.10.4절. “편집기 정의 숨기기”
- {editor-definition-samples-link}
4.10.4. 편집기 정의 숨기기 링크 복사링크가 클립보드에 복사되었습니다!
OpenShift Dev Spaces 편집기 정의를 숨기는 방법을 알아봅니다. 이 기능은 대시보드 UI에서 선택한 편집기를 숨기고, 예를 들어 IntelliJ IDEA Cryostat를 숨기고 Visual Studio Code - 오픈 소스만 표시하려는 경우에 유용합니다.
프로세스
OpenShift Dev Spaces Operator가 배포된 네임스페이스를 찾습니다.
OPERATOR_NAMESPACE=$(oc get pods -l app.kubernetes.io/component=devspaces-operator -o jsonpath={".items[0].metadata.namespace"} --all-namespaces)사용 가능한 편집기 정의 파일을 찾습니다.
oc exec -n $OPERATOR_NAMESPACE deploy/devspaces-operator -- ls /tmp/editors-definitions출력은 다음 예와 유사해야 합니다.
che-code-insiders.yaml che-code-latest.yaml che-idea-latest.yaml che-idea-next.yaml숨길 편집기 정의를 선택합니다. 예를 들어
che-idea-next.yaml편집기 정의를 숨기려면 편집기 정의 파일 이름을 설정합니다.CHE_EDITOR_CONCEAL_FILE_NAME=che-idea-next.yaml숨겨진 편집기 정의의 ConfigMap 이름을 정의합니다.
CHE_EDITOR_CONCEAL_CONFIGMAP_NAME=che-conceal-$CHE_EDITOR_CONCEAL_FILE_NAMEConfigMap을 생성합니다.
oc create configmap $CHE_EDITOR_CONCEAL_CONFIGMAP_NAME \ --namespace $OPERATOR_NAMESPACE \ --from-literal=$CHE_EDITOR_CONCEAL_FILE_NAME=""Operator 서브스크립션 이름과 네임스페이스(있는 경우)를 확인합니다.
SUBSCRIPTION=$(oc get subscriptions \ --all-namespaces \ --output json \ | jq -r '.items[] | select(.spec.name=="devspaces")') SUBSCRIPTION_NAMESPACE=$(echo $SUBSCRIPTION | jq -r '.metadata.namespace') SUBSCRIPTION_NAME=$(echo $SUBSCRIPTION | jq -r '.metadata.name')Kubernetes 리소스를 패치하여 빈 편집기 정의로 ConfigMap을 마운트합니다. 패치할 리소스는 Operator 서브스크립션이 있는지에 따라 다릅니다. 서브스크립션이 존재하는 경우 서브스크립션을 패치해야 합니다. 그렇지 않은 경우 Operator 배포를 패치합니다.
if [[ -n $SUBSCRIPTION_NAMESPACE ]]; then if [[ $(oc get subscription $SUBSCRIPTION_NAME --namespace $SUBSCRIPTION_NAMESPACE --output jsonpath='{.spec.config}') == "" ]]; then oc patch subscription $SUBSCRIPTION_NAME \ --namespace $SUBSCRIPTION_NAMESPACE \ --type json \ --patch '[{ "op":"add", "path":"/spec/config", "value": {} }]' fi if [[ $(oc get subscription $SUBSCRIPTION_NAME --namespace $SUBSCRIPTION_NAMESPACE --output jsonpath='{.spec.config.volumes}') == "" ]]; then oc patch subscription $SUBSCRIPTION_NAME \ --namespace $SUBSCRIPTION_NAMESPACE \ --type json \ --patch '[{ "op":"add", "path":"/spec/config/volumes", "value": [] }]' fi if [[ $(oc get subscription $SUBSCRIPTION_NAME --namespace $SUBSCRIPTION_NAMESPACE --output jsonpath='{.spec.config.volumeMounts}') == "" ]]; then oc patch subscription $SUBSCRIPTION_NAME \ --namespace $SUBSCRIPTION_NAMESPACE \ --type json \ --patch '[{ "op":"add", "path":"/spec/config/volumeMounts", "value": [] }]' fi oc patch subscription $SUBSCRIPTION_NAME \ --namespace $SUBSCRIPTION_NAMESPACE \ --type json \ --patch '[{ "op":"add", "path":"/spec/config/volumes/-", "value": { "name":"'$(echo ${CHE_EDITOR_CONCEAL_FILE_NAME%.*})'", "configMap": { "name": "'$CHE_EDITOR_CONCEAL_CONFIGMAP_NAME'" } } }, { "op":"add", "path":"/spec/config/volumeMounts/-", "value":{ "name": "'$(echo ${CHE_EDITOR_CONCEAL_FILE_NAME%.*})'", "subPath":"'$CHE_EDITOR_CONCEAL_FILE_NAME'", "mountPath": "/tmp/editors-definitions/'$CHE_EDITOR_CONCEAL_FILE_NAME'" } }]' else oc patch deployment devspaces-operator \ --namespace $OPERATOR_NAMESPACE \ --type json \ --patch '[{ "op":"add", "path":"/spec/template/spec/volumes/-", "value": { "name":"'$(echo ${CHE_EDITOR_CONCEAL_FILE_NAME%.*})'", "configMap": { "name": "'$CHE_EDITOR_CONCEAL_CONFIGMAP_NAME'" } } }, { "op":"add", "path":"/spec/template/spec/containers/0/volumeMounts/-", "value":{ "name": "'$(echo ${CHE_EDITOR_CONCEAL_FILE_NAME%.*})'", "subPath":"'$CHE_EDITOR_CONCEAL_FILE_NAME'", "mountPath": "/tmp/editors-definitions/'$CHE_EDITOR_CONCEAL_FILE_NAME'" } } ]' fi
추가 리소스
- 4.10.2절. “편집기 정의 구성”
- 4.10.3절. “기본 편집기 정의 구성”
- {editor-definition-samples-link}
4.10.5. OpenShift Eclipse Che ConsoleLink 아이콘 사용자 정의 링크 복사링크가 클립보드에 복사되었습니다!
다음 절차에서는 Red Hat OpenShift Dev Spaces ConsoleLink 아이콘을 사용자 지정하는 방법을 설명합니다.
사전 요구 사항
-
OpenShift 클러스터에 대한 관리 권한이 있는 활성
oc세션. CLI 시작하기를 참조하십시오.
프로세스
보안을 생성합니다.
oc apply -f - <<EOF apiVersion: v1 kind: Secret metadata: name: devspaces-dashboard-customization namespace: openshift-devspaces annotations: che.eclipse.org/mount-as: subpath che.eclipse.org/mount-path: /public/dashboard/assets/branding labels: app.kubernetes.io/component: devspaces-dashboard-secret app.kubernetes.io/part-of: che.eclipse.org data: loader.svg: <Base64_encoded_content_of_the_image>1 type: Opaque EOF- 1
- 비활성화된 줄 래핑을 사용한 Base64 인코딩.
- devspaces-dashboard의 롤아웃이 완료될 때까지 기다립니다.
추가 리소스