diff --git a/src/main/images/workspaces/configure-workspace-devfile.png b/src/main/images/workspaces/configure-workspace-devfile.png new file mode 100644 index 0000000000..683a0dcbe0 Binary files /dev/null and b/src/main/images/workspaces/configure-workspace-devfile.png differ diff --git a/src/main/images/workspaces/configure-workspace.png b/src/main/images/workspaces/configure-workspace.png new file mode 100644 index 0000000000..33d97cc933 Binary files /dev/null and b/src/main/images/workspaces/configure-workspace.png differ diff --git a/src/main/pages/che-7/end-user-guide/assembly_importing-a-kubernetes-application-into-a-che-workspace.adoc b/src/main/pages/che-7/end-user-guide/assembly_importing-a-kubernetes-application-into-a-che-workspace.adoc new file mode 100644 index 0000000000..0c6d3698af --- /dev/null +++ b/src/main/pages/che-7/end-user-guide/assembly_importing-a-kubernetes-application-into-a-che-workspace.adoc @@ -0,0 +1,38 @@ +:parent-context-of-importing-a-kubernetes-application-into-a-che-workspace: {context} + +[id='importing-a-kubernetes-application-into-a-che-workspace_{context}'] += Importing a Kubernetes application into a Che workspace + +:context: importing-a-kubernetes-application-into-a-che-workspace + +This section describes how to import a Kubernetes application in a Che workspace. + +For demonstration purposes, the section uses a sample Kubernetes application having the following two pods: + +* A NodeJS application specified by this link:https://raw.githubusercontent.com/redhat-developer/devfile/master/samples/web-nodejs-with-db-sample/nodejs-app.yaml[nodejs-app.yaml] + +* A MongoDB pod specified by this link:https://raw.githubusercontent.com/redhat-developer/devfile/master/samples/web-nodejs-with-db-sample/mongo-db.yaml[mongo-db.yaml] + +To run the application on a Kubernetes cluster: + +---- +$ node=https://raw.githubusercontent.com/redhat-developer/devfile/master/samples/web-nodejs-with-db-sample/nodejs-app.yaml && \ +mongo=https://raw.githubusercontent.com/redhat-developer/devfile/master/samples/web-nodejs-with-db-sample/mongo-db.yaml && \ +kubectl apply -f ${mongo} && \ +kubectl apply -f ${node} +---- + +To deploy a new instance of this application in a Che workspace, use one of the following three scenarios: + +* Starting from scratch: link:#including-a-kubernetes-application-in-a-workspace-devfile-definition_{context}[Writing a new devfile] +* Modifying an existing workspace: link:#adding-a-kubernetes-application-to-an-existing-workspace-using-the-dashboard_{context}[Using the dashboard UI] +* From a running application: link:#generating-a-devfile-from-an-existing-kubernetes-application_{context}[Generating a devfile with `chectl`] + +include::proc_including-a-kubernetes-application-in-a-workspace-devfile-definition.adoc[leveloffset=+1] + +include::proc_adding-a-kubernetes-application-to-an-existing-workspace-using-the-dashboard.adoc[leveloffset=+1] + +include::proc_generating-a-devfile-from-an-existing-kubernetes-application.adoc[leveloffset=+1] + + +:context: {parent-context-of-importing-a-kubernetes-application-into-a-che-workspace} diff --git a/src/main/pages/che-7/end-user-guide/assembly_using-developer-environments-workspaces.adoc b/src/main/pages/che-7/end-user-guide/assembly_using-developer-environments-workspaces.adoc index 28444780be..4250e18658 100644 --- a/src/main/pages/che-7/end-user-guide/assembly_using-developer-environments-workspaces.adoc +++ b/src/main/pages/che-7/end-user-guide/assembly_using-developer-environments-workspaces.adoc @@ -26,6 +26,8 @@ include::con_workspaces-overview.adoc[leveloffset=+1] include::assembly_making-a-workspace-portable-using-a-devfile.adoc[leveloffset=+1] +include::assembly_importing-a-kubernetes-application-into-a-che-workspace.adoc[leveloffset=+1] + // include::proc_using-and-customizing-a-workspace-template-stack.adoc[leveloffset=+1] // include::proc_exporting-a-workspace-with-a-che-factory.adoc[leveloffset=+1] diff --git a/src/main/pages/che-7/end-user-guide/proc_adding-a-kubernetes-application-to-an-existing-workspace-using-the-dashboard.adoc b/src/main/pages/che-7/end-user-guide/proc_adding-a-kubernetes-application-to-an-existing-workspace-using-the-dashboard.adoc new file mode 100644 index 0000000000..3a5b7031b9 --- /dev/null +++ b/src/main/pages/che-7/end-user-guide/proc_adding-a-kubernetes-application-to-an-existing-workspace-using-the-dashboard.adoc @@ -0,0 +1,19 @@ +// importing-a-kubernetes-application-into-a-che-workspace + +[id="adding-a-kubernetes-application-to-an-existing-workspace-using-the-dashboard_{context}"] += Adding a Kubernetes application to an existing workspace using the dashboard + +This procedure demonstrates how to modify an existing workspace and import the Kubernetes application using the newly created devfile. + +.Procedure + +. After the creation of a workspace, use the *Workspace* menu and then the *Configure workspace* icon to manage the workspace. ++ +image::workspaces/configure-workspace.png[link="{imagesdir}/workspaces/configure-workspace.png"] + +. To modify the workspace details, use the *Devfile* tab. The workspace details are displayed in this tab in the devfile format. ++ +image::workspaces/configure-workspace-devfile.png[link="{imagesdir}/workspaces/configure-workspace-devfile.png"] + +. To add a Kubernetes component, use the *Devfile* editor on the dashboard. +. For the changes to take effect, save the devfile and restart the Che workspace. diff --git a/src/main/pages/che-7/end-user-guide/proc_generating-a-devfile-from-an-existing-kubernetes-application.adoc b/src/main/pages/che-7/end-user-guide/proc_generating-a-devfile-from-an-existing-kubernetes-application.adoc new file mode 100644 index 0000000000..9228911eef --- /dev/null +++ b/src/main/pages/che-7/end-user-guide/proc_generating-a-devfile-from-an-existing-kubernetes-application.adoc @@ -0,0 +1,68 @@ +// importing-a-kubernetes-application-into-a-che-workspace + +[id="generating-a-devfile-from-an-existing-kubernetes-application_{context}"] += Generating a devfile from an existing Kubernetes application + +This procedure demonstrates how to generate a devfile from an existing Kubernetes application using the `chectl` tool. + +.Prerequisites + +* `chectl` is installed and running + +.Procedure + +. Use the `chectl devfile:generate` command to generate a devfile: ++ +---- +$ chectl devfile:generate +---- + +* The user can also use the `chectl devfile:generate` command to generate a devfile from, for example, the `NodeJS-MongoDB` application. ++ +The following example generates a devfile that includes the `NodeJS` component: ++ +---- +$ chectl devfile:generate --selector="app=nodejs" +apiVersion: 1.0.0 +metadata: + name: chectl-generated +components: + - type: kubernetes + alias: app=nodejs + referenceContent: | + kind: List + apiVersion: v1 + metadata: + name: app=nodejs + items: + - apiVersion: apps/v1 + kind: Deployment + metadata: + labels: + app: nodejs + name: web +(...) +---- ++ +The NodeJS application YAML definition is included in the devfile, inline, using the `referenceContent` attribute. + +* To include support for a language, use the `--language` parameter: ++ +---- +$ chectl devfile:generate --selector="app=nodejs" --language="typescript" +apiVersion: 1.0.0 +metadata: + name: chectl-generated +components: + - type: kubernetes + alias: app=nodejs + referenceContent: | + kind: List + apiVersion: v1 +(...) + - type: chePlugin + alias: typescript-ls + id: che-incubator/typescript/latest +---- + +. Use the generated devfile to start a Che workspace with `chectl`. diff --git a/src/main/pages/che-7/end-user-guide/proc_including-a-kubernetes-application-in-a-workspace-devfile-definition.adoc b/src/main/pages/che-7/end-user-guide/proc_including-a-kubernetes-application-in-a-workspace-devfile-definition.adoc new file mode 100644 index 0000000000..5551bc3ea7 --- /dev/null +++ b/src/main/pages/che-7/end-user-guide/proc_including-a-kubernetes-application-in-a-workspace-devfile-definition.adoc @@ -0,0 +1,71 @@ +// importing-a-kubernetes-application-into-a-che-workspace + +[id="including-a-kubernetes-application-in-a-workspace-devfile-definition_{context}"] += Including a Kubernetes application in a workspace devfile definition + +// TO DO Supply URL for that file location +The devfile format is used to define a Che workspace, and its format is described in the link:#making-a-workspace-portable-using-a-devfile_using-developer-environments-workspaces[Making a workspace portable using a devfile] section. The following is an example of the simplest devfile: + +[source,yaml] +---- +apiVersion: 1.0.0 +metadata: + name: minimal-workspace +---- + +Only the name (minimal-workspace) is specified. After the Che server processes this devfile, the devfile is converted to a minimal Che workspace that only has the default editor (Che-Theia) and the default editor plug-ins (example: the terminal). + +Use the `Kubernetes` type of components in the devfile to add Kubernetes applications to a workspace. + +For example, the user can embed the `NodeJS-Mongo` application in the minimal-workspace defined in this paragraph by adding a `components` section. + +[source,yaml] +---- +apiVersion: 1.0.0 +metadata: + name: minimal-workspace +components: + - type: kubernetes + reference: https://raw.githubusercontent.com/.../mongo-db.yaml + - alias: nodejs-app + type: kubernetes + reference: https://raw.githubusercontent.com/.../nodejs-app.yaml + entrypoints: + - command: ['sleep'] + args: ['infinity'] +---- + +Note that the `sleep infinity` command is added as the entry point of the NodeJS application. This prevents the application from starting at the workspace start phase, allowing the user to start it when needed for testing or debugging purposes. + +To make it easier for a developer to test the application, add the commands in the devfile: + +[source,yaml] +---- +apiVersion: 1.0.0 +metadata: + name: minimal-workspace +components: + - type: kubernetes + reference: https://raw.githubusercontent.com/.../mongo-db.yaml + - alias: nodejs-app + type: kubernetes + reference: https://raw.githubusercontent.com/.../nodejs-app.yaml + entrypoints: + - command: ['sleep'] + args: ['infinity'] +commands: + - name: run + actions: + - type: exec + component: nodejs-app + command: cd ${CHE_PROJECTS_ROOT}/nodejs-mongo-app/EmployeeDB/ && npm install && sed -i -- ''s/localhost/mongo/g'' app.js && node app.js +---- + +Use this devfile to create and start a workspace with the `chectl` command: + +[subs="+quotes"] +---- +$ chectl worspace:start --devfile __ +---- + +The `run` command added to the devfile is available as a task in Che-Theia from the command palette. When executed, the command starts the NodeJS application. diff --git a/src/main/pages/che-7/hands-on-guidance/assembly_end-user-tasks.adoc b/src/main/pages/che-7/hands-on-guidance/assembly_end-user-tasks.adoc index 975d9c934d..8f3786dc00 100644 --- a/src/main/pages/che-7/hands-on-guidance/assembly_end-user-tasks.adoc +++ b/src/main/pages/che-7/hands-on-guidance/assembly_end-user-tasks.adoc @@ -30,17 +30,12 @@ include::proc_creating-a-workspace-by-importing-source-code-of-your-project.adoc include::proc_configuring-a-che-workspace-using-a-devfile.adoc[leveloffset=+1] -// include::proc_importing-a-kubernetes-application-into-a-che-worskspace.adoc[leveloffset=+1] - -include::assembly_using-a-visual-studio-code-extension-in-che.adoc[leveloffset=+1] - // include::proc_configuring-plug-ins.adoc[leveloffset=+1] // // include::proc_remotely-accessing-your-workspace.adoc[leveloffset=+1] // // include::proc_configuring-your-vcs-credentials-for-your-workspaces.adoc[leveloffset=+1] - // [id='related-information-{context}'] // == Related information // diff --git a/src/main/pages/che-7/hands-on-guidance/proc_importing-a-kubernetes-application-into-a-che-worskspace.adoc b/src/main/pages/che-7/hands-on-guidance/proc_importing-a-kubernetes-application-into-a-che-worskspace.adoc deleted file mode 100644 index 6c5bf184fe..0000000000 --- a/src/main/pages/che-7/hands-on-guidance/proc_importing-a-kubernetes-application-into-a-che-worskspace.adoc +++ /dev/null @@ -1,27 +0,0 @@ -[id="importing-a-kubernetes-application-into-a-che-worskspace_{context}"] -= Importing a Kubernetes application into a Che worskspace - -This paragraph is the procedure module introduction: a short description of the procedure. - -[discrete] -== Prerequisites - -* A bulleted list of conditions that must be satisfied before the user starts following this assembly. -* You can also link to other modules or assemblies the user must follow before starting this assembly. -* Delete the section title and bullets if the assembly has no prerequisites. - -[discrete] -== Procedure - -. Start each step with an active verb. - -. Include one command or action per step. - -. Use an unnumbered bullet (*) if the procedure includes only one step. - -[discrete] -== Additional resources - -* A bulleted list of links to other material closely related to the contents of the procedure module. -* For more details on writing procedure modules, see the link:https://github.com/redhat-documentation/modular-docs#modular-documentation-reference-guide[Modular Documentation Reference Guide]. -* Use a consistent system for file names, IDs, and titles. For tips, see _Anchor Names and File Names_ in link:https://github.com/redhat-documentation/modular-docs#modular-documentation-reference-guide[Modular Documentation Reference Guide].