This procedure demonstrates how to generate a devfile from an existing Kubernetes application using the chectl tool.

Prerequisites
Procedure
  1. 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
  2. Use the generated devfile to start a Che workspace with chectl.