Configure GUI Schema for Manifests

Introduction

In Devtron, you can create CRDs for defining the GUI schema. Your GUI schema will be used to determine the fields displayed to the user when they edit the manifest in GUI mode.

Editing GUI Schema

  1. Go to Resource Browser and select your cluster.

  2. Use the searchbox labelled 'Jump to Kind' and search for Guischema.

    Figure 1: Searching GUI Schema
  3. Click the GUI schema you wish to edit. In case no GUI schema exists, you may create a GUI schema for your resource kind.

    Figure 2: Click GUI Schema
  4. Click Edit Live Manifest to modify the YAML.

    Figure 3: Edit Live Manifest
  5. Locate the schema object and customize it according to your requirements.

    Figure 4: Modifying Schema
  6. Click Apply Changes.


Create your own GUI Schema

  1. Go to Resource Browser and select your cluster.

  2. Click Create Resource at the top.

  3. Use the following template and define your schema in the schema object, also specify the resource kinds in applyTo. Once done, click Apply.

    GUI Schema for Pod Manifest
    apiVersion: crd.devtron.ai/alpha1
    kind: GuiSchema
    metadata:
    creationTimestamp: 2024-11-08T13:01:00Z
    generation: 1
    name: devtron-pod-gui
    resourceVersion: "216257"
    uid: 70e91158-288e-4c4a-8448-012e820148ca
    spec:
    applyTo:
        - group: ""
        kind: Pod
        version: v1
    schema: |
        {
        "title": "Pod Configuration",
        "description": "A form to create a Kubernetes pod manifest",
        "type": "object",
        "required": [
            "metadata",
            "spec"
        ],
        "properties": {
            "metadata": {
            "type": "object",
            "properties": {
                "name": {
                "type": "string",
                "title": "Pod Name",
                "default": "my-pod",
                "pattern": "^[a-z0-9][a-z0-9-]*[a-z0-9]$",
                "description": "Lower case letters, numbers, and hyphens only"
                }
            }
            },
            "spec": {
            "type": "object",
            "required": [
                "containers"
            ],
            "properties": {
                "containers": {
                "type": "array",
                "minItems": 1,
                "items": {
                    "type": "object",
                    "required": [
                    "name",
                    "image"
                    ],
                    "properties": {
                    "name": {
                        "type": "string",
                        "title": "Container Name",
                        "default": "container-1",
                        "pattern": "^[a-z0-9][a-z0-9-]*[a-z0-9]$",
                        "description": "Lower case letters, numbers, and hyphens only"
                    },
                    "image": {
                        "type": "string",
                        "title": "Container Image",
                        "description": "Docker image name with optional tag (e.g., nginx:1.14.2)"
                    },
                    "ports": {
                        "type": "array",
                        "title": "Container Ports",
                        "items": {
                        "type": "object",
                        "required": [
                            "containerPort"
                        ],
                        "properties": {
                            "containerPort": {
                            "type": "integer",
                            "title": "Port Number",
                            "minimum": 1,
                            "maximum": 65535
                            }
                        }
                        }
                    }
                    }
                }
                }
            }
            }
        }
        }

Last updated