Skip to content

Generate Forms from Kubernetes Schema to Create and Edit Resources  #2087

@Guilamb

Description

@Guilamb

Objective:

The objective is to have a simple way to create CR/Kubernetes resources without using YAML.

Solution:

My solution is to generate a form from the Custom Resource Definition (CRD) schema using an existing library that can generate forms from a JSON schema. On CRD, json schema are defined in the base definition. CRD schema doc

This could be extended to other Kubernetes resources to simplify resource creation and make it more accessible since we can retrieve kubernetes resources schemas from the Kubernetes API.

What I Have Done So Far:

I have developed an initial version of this feature, only for CRD, in our plugin, which is available at Headlamp-plugin. All elements used to dynamically create the form are located under Headlamp-plugin/src/Components/Form/.

To create this version, I've used react-jsonschema-form (@rjsf-core) to generate the forms. Currently, I couldn't use the Material 5 theme, but it is available with react-Jsonschema-form, as mentioned here: RJSF/Themes.

I've added a simple "plus" button on the CRD details page that, when pressed, makes a popup with the form appear.

Here is what it looks like on a simple example CRD, with a basic name and description string: image

I think this would be an interesting feature for base Headlamp that would make the creation of CR and Kubernetes resources more user-friendly.
I've just remembered this related issue : #1220

Metadata

Metadata

Assignees

Labels

CRDCustom Resource DefinitionsfrontendIssues related to the frontendkind/featureCategorizes issue or PR as related to a new feature.priority/important-longtermImportant over the long term, but may not be staffed and/or may need multiple releases to complete.

Type

No type

Projects

Status

Queued

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions