Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic form docs #1228

Merged
merged 3 commits into from
Oct 17, 2019
Merged

Basic form docs #1228

merged 3 commits into from
Oct 17, 2019

Conversation

andresmgot
Copy link
Contributor

Ref: #1182

Copy link
Contributor

@absoludity absoludity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff! A couple of wording thoughts but feel free to ignore as you like. One question about allowing defaults even though they can be specified in the values, that I'm keen to understand.


**NOTE:** This feature is under heavy development. Some of the described below may change in the future.

Since Kubeapps 1.6.0, it's possible to attach a chart with a JSON schema that defines the structure of the `values.yaml` file. This JSON schema is used with two goals:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/attach/include/


Since Kubeapps 1.6.0, it's possible to attach a chart with a JSON schema that defines the structure of the `values.yaml` file. This JSON schema is used with two goals:

- Validate that the given values satisfy the schema defined. In case the submitted values are not valid, the installation or upgrade will fail.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth mentioning that this is actually the helm 3 use-case.

Since Kubeapps 1.6.0, it's possible to attach a chart with a JSON schema that defines the structure of the `values.yaml` file. This JSON schema is used with two goals:

- Validate that the given values satisfy the schema defined. In case the submitted values are not valid, the installation or upgrade will fail.
- Present the user with a simple (basic) form so the chart is easier to deploy and configure.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"with a simpler form" rather than "with a simple (basic) form"

- Validate that the given values satisfy the schema defined. In case the submitted values are not valid, the installation or upgrade will fail.
- Present the user with a simple (basic) form so the chart is easier to deploy and configure.

The goal of the basic form is to define the most common parameters that users typically modify before deploying a chart (like username and password) so they are able to modify them with a more user-friendly form.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The form itself isn't defining the most common properties - the schema is, right? So perhaps, "The goal of this feature is to present the user with the most common parameters which are typically modified before deploying a chart (like username and password) in a more user-friendly form."


## Additional annotations used to identify basic parameters

In order to identify, among all the values specified in the schema, the values that should be presented in the form, it's necessary to include some special tags.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simpler: In order to identify which values should be presented in the form, ...


In order to identify, among all the values specified in the schema, the values that should be presented in the form, it's necessary to include some special tags.

First of all, it's necessary to specify the tag `form`. This field should be unique and it should identify the parameter. All the properties marked with this key in the schema will be represented in the form. For example:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/This field/The value of the form tag/ (and standardise on either field or tag or key)

},
```

With the definition above, we are marking the value `wordpressUsername` as a value to be represented in the form (with the ID `username`). Note that we are also specifying the `type` that will be used to render the proper HTML components to represent the input in the form:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't type part of the jsonschema, and it's also being used here to render? In which case "Note that the type is also used to render..." (the current sentence implies that we're only specifying it for the rendering, rather than because it's part of the schema).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, yes, it's used for both


In addition to the `type`, there are other tags that can be used to customize the way the parameter is represented:

- `title` is used to render the title of the parameter. If it's not specified, Kubeapps will use the ID of the component.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Kubeapps will use the ID of the component (ie. the value of the form field)." (it wasn't 100% clear, but I see now that's what you're referring to).


- `title` is used to render the title of the parameter. If it's not specified, Kubeapps will use the ID of the component.
- `description` is used to include additional information of the parameter.
- `default` is used to set a default value. If it's not set, the default value from the `values.yaml` file will be used.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ... not sure that's a good idea? Why have two places to specify a default, so that you'll get different defaults depending on what UI you use? What is the reason for having a second default here rather than just using the one from the values.yaml always?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, I expressed it the other way. If the value is set in the values.yaml it will always be used as the default. In case that is not set and the default value is set in the schema, that one will be used.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but is there any reason to enable setting a default in the schema for a field at all, given the right place for that is already in the values.yaml? If not, I'd personally update this sentence removing any mention of default (or just saying the default is set in the values) and later remove support for a separate default in the schema. +1 either way, but I'm keen to know if there's a need at all for a second way to set the default for a field.

Copy link
Contributor Author

@andresmgot andresmgot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the review!

},
```

With the definition above, we are marking the value `wordpressUsername` as a value to be represented in the form (with the ID `username`). Note that we are also specifying the `type` that will be used to render the proper HTML components to represent the input in the form:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, yes, it's used for both


- `title` is used to render the title of the parameter. If it's not specified, Kubeapps will use the ID of the component.
- `description` is used to include additional information of the parameter.
- `default` is used to set a default value. If it's not set, the default value from the `values.yaml` file will be used.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, I expressed it the other way. If the value is set in the values.yaml it will always be used as the default. In case that is not set and the default value is set in the schema, that one will be used.

@andresmgot andresmgot merged commit 939959f into vmware-tanzu:master Oct 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants