Skip to content

Commit acdbdc2

Browse files
author
Replicated Release Pipeline
committed
Update Replicated CMX docs for
1 parent 14826fd commit acdbdc2

File tree

348 files changed

+22229
-12776
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

348 files changed

+22229
-12776
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Adding Links to the Dashboard
2+
3+
This topic describes how to use the Kubernetes SIG Application custom resource to add links to the Replicated KOTS Admin Console dashboard.
4+
5+
## Overview
6+
7+
Replicated recommends that every application include a Kubernetes SIG Application custom resource. The Kubernetes SIG Application custom resource provides a standard API for creating, viewing, and managing applications. For more information, see [Kubernetes Applications](https://github.com/kubernetes-sigs/application#kubernetes-applications) in the kubernetes-sigs GitHub repository.
8+
9+
You can include the Kubernetes SIG Application custom resource in your releases to add links to the Admin Console dashboard. Common use cases include adding links to documentation, dashboards, or a landing page for the application.
10+
11+
For example, the following shows an **Open App** button on the dashboard of the Admin Console for an application named Gitea:
12+
13+
<img alt="Admin Console dashboard with Open App link" src="/images/gitea-open-app.png" width="700px"/>
14+
15+
[View a larger version of this image](/images/gitea-open-app.png)
16+
17+
:::note
18+
KOTS uses the Kubernetes SIG Application custom resource as metadata and does not require or use an in-cluster controller to handle this custom resource. An application that follows best practices does not require cluster admin privileges or any cluster-wide components to be installed.
19+
:::
20+
21+
## Add a Link
22+
23+
To add a link to the Admin Console dashboard, include a [Kubernetes SIG Application](https://github.com/kubernetes-sigs/application#kubernetes-applications) custom resource in the release with a `spec.descriptor.links` field. The `spec.descriptor.links` field is an array of links that are displayed on the Admin Console dashboard after the application is deployed.
24+
25+
Each link in the `spec.descriptor.links` array contains two fields:
26+
* `description`: The link text that will appear on the Admin Console dashboard.
27+
* `url`: The target URL.
28+
29+
For example:
30+
31+
```yaml
32+
# app.k8s.io/v1beta1 Application Custom resource
33+
34+
apiVersion: app.k8s.io/v1beta1
35+
kind: Application
36+
metadata:
37+
name: "gitea"
38+
spec:
39+
descriptor:
40+
links:
41+
- description: About Wordpress
42+
url: "https://wordpress.org/"
43+
```
44+
45+
When the application is deployed, the "About Wordpress" link is displayed on the Admin Console dashboard as shown below:
46+
47+
<img alt="About Wordpress link on the Admin Console dashboard" src="/images/dashboard-link-about-wordpress.png" width="450px"/>
48+
49+
[View a larger version of this image](/images/dashboard-link-about-wordpress.png)
50+
51+
For an additional example of a Kubernetes SIG Application custom resource, see [application.yaml](https://github.com/kubernetes-sigs/application/blob/master/docs/examples/wordpress/application.yaml) in the kubernetes-sigs GitHub repository.
52+
53+
### Create URLs with User-Supplied Values Using KOTS Template Functions {#url-template}
54+
55+
You can use KOTS template functions to template URLs in the Kubernetes SIG Application custom resource. This can be useful when all or some of the URL is a user-supplied value. For example, an application might allow users to provide their own ingress controller or load balancer. In this case, the URL can be templated to render the hostname that the user provides on the Admin Console Config screen.
56+
57+
The following examples show how to use the KOTS [ConfigOption](/reference/template-functions-config-context#configoption) template function in the Kubernetes SIG Application custom resource `spec.descriptor.links.url` field to render one or more user-supplied values:
58+
59+
* In the example below, the URL hostname is a user-supplied value for an ingress controller that the user configures during installation.
60+
61+
```yaml
62+
apiVersion: app.k8s.io/v1beta1
63+
kind: Application
64+
metadata:
65+
name: "my-app"
66+
spec:
67+
descriptor:
68+
links:
69+
- description: Open App
70+
url: 'http://{{repl ConfigOption "ingress_host" }}'
71+
```
72+
* In the example below, both the URL hostname and a node port are user-supplied values. It might be necessary to include a user-provided node port if you are exposing NodePort services for installations on VMs or bare metal servers with [Replicated Embedded Cluster](/vendor/embedded-overview) or [Replicated kURL](/vendor/kurl-about).
73+
74+
```yaml
75+
apiVersion: app.k8s.io/v1beta1
76+
kind: Application
77+
metadata:
78+
name: "my-app"
79+
spec:
80+
descriptor:
81+
links:
82+
- description: Open App
83+
url: 'http://{{repl ConfigOption "hostname" }}:{{repl ConfigOption "node_port"}}'
84+
```
85+
86+
For more information about working with KOTS template functions, see [About Template Functions](/reference/template-functions-about).
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Customizing the Application Icon
2+
3+
You can add a custom application icon that displays in the Replicated Admin Console and the download portal. Adding a custom icon helps ensure that your brand is reflected for your customers.
4+
5+
:::note
6+
You can also use a custom domain for the download portal. For more information, see [About Custom Domains](custom-domains).
7+
:::
8+
9+
## Add a Custom Icon
10+
11+
For information about how to choose an image file for your custom application icon that displays well in the Admin Console, see [Icon Image File Recommendations](#icon-image-file-recommendations) below.
12+
13+
To add a custom application icon:
14+
15+
1. In the [Vendor Portal](https://vendor.replicated.com/apps), click **Releases**. Click **Create release** to create a new release, or click **Edit YAML** to edit an existing release.
16+
1. Create or open the Application custom resource manifest file. An Application custom resource manifest file has `apiVersion: kots.io/v1beta1` and `kind: Application`.
17+
18+
1. In the preview section of the Help pane:
19+
20+
1. If your Application manifest file is already populated with an `icon` key, the icon displays in the preview. Click **Preview a different icon** to access the preview options.
21+
22+
1. Drag and drop an icon image file to the drop zone. Alternatively, paste a link or Base64 encoded data URL in the text box. Click **Preview**.
23+
24+
![Application icon preview](/images/app-icon-preview.png)
25+
26+
1. (Air gap only) If you paste a link to the image in the text box, click **Preview** and **Base64 encode icon** to convert the image to a Base64 encoded data URL. An encoded URL displays that you can copy and paste into the Application manifest. Base64 encoding is required for images used with air gap installations.
27+
28+
:::note
29+
If you pasted a Base64 encoded data URL into the text box, the **Base64 encode icon** button does not display because the image is already encoded. If you drag and drop an icon, the icon is automatically encoded for you.
30+
:::
31+
32+
![Base64 encode image button](/images/app-icon-preview-base64.png)
33+
34+
1. Click **Preview a different icon** to preview a different icon if needed.
35+
36+
1. In the Application manifest, under `spec`, add an `icon` key that includes a link or the Base64 encoded data URL to the desired image.
37+
38+
**Example**:
39+
40+
```yaml
41+
apiVersion: kots.io/v1beta1
42+
kind: Application
43+
metadata:
44+
name: my-application
45+
spec:
46+
title: My Application
47+
icon: https://kots.io/images/kotsadm-logo-large@2x.png
48+
```
49+
1. Click **Save Release**.
50+
51+
52+
## Icon Image File Recommendations
53+
54+
For your custom application icon to look best in the Admin Console, consider the following recommendations:
55+
56+
* Use a PNG or JPG file.
57+
* Use an image that is at least 250 by 250 pixels.
58+
* Export the image file at 2x.
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# Creating and Editing Configuration Fields
2+
3+
This topic describes how to use the KOTS Config custom resource manifest file to add and edit fields in the KOTS Admin Console configuration screen.
4+
5+
## About the Config Custom Resource
6+
7+
Applications distributed with Replicated KOTS can include a configuration screen in the Admin Console to collect required or optional values from your users that are used to run your application. For more information about the configuration screen, see [About the Configuration Screen](config-screen-about).
8+
9+
To include a configuration screen in the Admin Console for your application, you add a Config custom resource manifest file to a release for the application.
10+
11+
You define the fields that appear on the configuration screen as an array of `groups` and `items` in the Config custom resource:
12+
* `groups`: A set of `items`. Each group must have a `name`, `title`, `description`, and `items`. For example, you can create a group of several user input fields that are all related to configuring an SMTP mail server.
13+
* `items`: An array of user input fields. Each array under `items` must have a `name`, `title`, and `type`. You can also include several optional properties. For example, in a group for configuring a SMTP mail server, you can have user input fields under `items` for the SMTP hostname, port, username, and password.
14+
15+
There are several types of `items` supported in the Config manifest that allow you to collect different types of user inputs. For example, you can use the `password` input type to create a text field on the configuration screen that hides user input.
16+
17+
For more information about the syntax of the Config custom resource manifest, see [Config](/reference/custom-resource-config).
18+
19+
## About Regular Expression Validation
20+
21+
You can use [RE2 regular expressions](https://github.com/google/re2/wiki/Syntax) (regex) to validate user input for config items, ensuring conformity to certain standards, such as valid email addresses, password complexity rules, IP addresses, and URLs. This prevents users from deploying an application with a verifiably invalid configuration.
22+
23+
You add the `validation`, `regex`, `pattern` and `message` fields to items in the Config custom resource. Validation is supported for `text`, `textarea`, `password` and `file` config item types. For more information about regex validation fields, see [Item Validation](/reference/custom-resource-config#item-validation) in _Config_.
24+
25+
The following example shows a common password complexity rule:
26+
27+
```
28+
- name: smtp-settings
29+
title: SMTP Settings
30+
items:
31+
- name: smtp_password
32+
title: SMTP Password
33+
type: password
34+
help_text: Set SMTP password
35+
validation:
36+
regex:
37+
pattern: ^(?:[\w@#$%^&+=!*()_\-{}[\]:;"'<>,.?\/|]){8,16}$
38+
message: The password must be between 8 and 16 characters long and can contain a combination of uppercase letter, lowercase letters, digits, and special characters.
39+
```
40+
41+
## Add Fields to the Configuration Screen
42+
43+
To add fields to the Admin Console configuration screen:
44+
45+
1. In the [Vendor Portal](https://vendor.replicated.com/apps), click **Releases**. Then, either click **Create release** to create a new release, or click **Edit YAML** to edit an existing release.
46+
1. Create or open the Config custom resource manifest file in the desired release. A Config custom resource manifest file has `kind: Config`.
47+
1. In the Config custom resource manifest file, define custom user-input fields in an array of `groups` and `items`.
48+
49+
**Example**:
50+
51+
```yaml
52+
apiVersion: kots.io/v1beta1
53+
kind: Config
54+
metadata:
55+
name: my-application
56+
spec:
57+
groups:
58+
- name: smtp_settings
59+
title: SMTP Settings
60+
description: Configure SMTP Settings
61+
items:
62+
- name: enable_smtp
63+
title: Enable SMTP
64+
help_text: Enable SMTP
65+
type: bool
66+
default: "0"
67+
- name: smtp_host
68+
title: SMTP Hostname
69+
help_text: Set SMTP Hostname
70+
type: text
71+
- name: smtp_port
72+
title: SMTP Port
73+
help_text: Set SMTP Port
74+
type: text
75+
- name: smtp_user
76+
title: SMTP User
77+
help_text: Set SMTP User
78+
type: text
79+
- name: smtp_password
80+
title: SMTP Password
81+
type: password
82+
default: 'password'
83+
```
84+
85+
The example above includes a single group with the name `smtp_settings`.
86+
87+
The `items` array for the `smtp_settings` group includes the following user-input fields: `enable_smtp`, `smtp_host`, `smtp_port`, `smtp_user`, and `smtp_password`. Additional item properties are available, such as `affix` to make items appear horizontally on the same line. For more information about item properties, see [Item Properties](/reference/custom-resource-config#item-properties) in Config.
88+
89+
The following screenshot shows how the SMTP Settings group from the example YAML above displays in the Admin Console configuration screen during application installation:
90+
91+
![User input fields on the configuration screen for the SMTP settings](/images/config-screen-smtp-example-large.png)
92+
93+
1. (Optional) Add default values for the fields. You can add default values using one of the following properties:
94+
* **With the `default` property**: When you include the `default` key, KOTS uses this value when rendering the manifest files for your application. The value then displays as a placeholder on the configuration screen in the Admin Console for your users. KOTS only uses the default value if the user does not provide a different value.
95+
96+
:::note
97+
If you change the `default` value in a later release of your application, installed instances of your application receive the updated value only if your users did not change the default from what it was when they initially installed the application.
98+
99+
If a user did change a field from its default, the Admin Console does not overwrite the value they provided.
100+
:::
101+
102+
* **With the `value` property**: When you include the `value` key, KOTS does not overwrite this value during an application update. The value that you provide for the `value` key is visually indistinguishable from other values that your user provides on the Admin Console configuration screen. KOTS treats user-supplied values and the value that you provide for the `value` key as the same.
103+
104+
2. (Optional) Add regular expressions to validate user input for `text`, `textarea`, `password` and `file` config item types. For more information, see [About Regular Expression Validation](#about-regular-expression-validation).
105+
106+
**Example**:
107+
108+
```yaml
109+
- name: smtp_host
110+
title: SMTP Hostname
111+
help_text: Set SMTP Hostname
112+
type: text
113+
validation:
114+
regex: ​
115+
pattern: ^[a-zA-Z]([a-zA-Z0-9\-]+[\.]?)*[a-zA-Z0-9]$
116+
message: Valid hostname starts with a letter (uppercase/lowercase), followed by zero or more groups of letters (uppercase/lowercase), digits, or hyphens, optionally followed by a period. Ends with a letter or digit.
117+
```
118+
3. (Optional) Mark fields as required by including `required: true`. When there are required fields, the user is prevented from proceeding with the installation until they provide a valid value for required fields.
119+
120+
**Example**:
121+
122+
```yaml
123+
- name: smtp_password
124+
title: SMTP Password
125+
type: password
126+
required: true
127+
```
128+
129+
4. Save and promote the release to a development environment to test your changes.
130+
131+
## Next Steps
132+
133+
After you add user input fields to the configuration screen, you use template functions to map the user-supplied values to manifest files in your release. If you use a Helm chart for your application, you map the values to the Helm chart `values.yaml` file using the HelmChart custom resource.
134+
135+
For more information, see [Mapping User-Supplied Values](config-screen-map-inputs).

0 commit comments

Comments
 (0)