Skip to content

Commit 5329dfc

Browse files
committed
docs edits
1 parent 4e85738 commit 5329dfc

File tree

4 files changed

+85
-100
lines changed

4 files changed

+85
-100
lines changed

docs/partials/helm/_helmchart-installer-only-annotation.mdx

Lines changed: 0 additions & 77 deletions
This file was deleted.

docs/reference/custom-resource-helmchart-v2.mdx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import BuilderAirgapIntro from "../partials/helm/_helm-cr-builder-airgap-intro.m
1616
import BuilderExample from "../partials/helm/_helm-cr-builder-example.mdx"
1717
import V2Example from "../partials/helm/_v2-native-helm-cr-example.mdx"
1818
import KotsHelmCrDescription from "../partials/helm/_kots-helm-cr-description.mdx"
19-
import HelmChartInstallerOnlyAnnotation from "../partials/helm/_helmchart-installer-only-annotation.mdx"
2019

2120
# HelmChart v2
2221

@@ -112,6 +111,4 @@ The `builder` key is required to support the following installation types:
112111

113112
#### Example
114113

115-
<BuilderExample/>
116-
117-
<HelmChartInstallerOnlyAnnotation/>
114+
<BuilderExample/>

docs/vendor/enterprise-portal-configure.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@ To customize the pre- and post-install instructions for your application:
122122

123123
1. Click **Save changes**.
124124

125+
## Exclude Certain Images from Helm CLI Install Instructions
126+
127+
You can use the `kots.io/installer-only` annotation to exclude the images for an entire Helm chart or for one or more resoures in a Helm chart's templates from the Helm CLI installation instructions displayed in the Enterprise Portal. This annotation is useful for charts or resources that are required for deployments with a Replicated installer (KOTS, Embedded Cluster, kURL) but should not be visible or deployed when customers install with the Helm CLI.
128+
129+
For more information, see [`kots.io/installer-only` Annotation](/vendor/packaging-include-resources#installer-only) in _Conditionally Include or Exclude Resources_.
130+
125131
## Customize Channel-Specific Install Instructions (Alpha) {#customize-channel-install-instructions}
126132

127133
:::note

docs/vendor/packaging-include-resources.md

Lines changed: 78 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
1-
# Conditionally Including or Excluding Resources
1+
# Conditionally Include or Exclude Resources
22

3-
This topic describes how to include or exclude optional application resources based on one or more conditional statements. The information in this topic applies to Helm chart- and standard manifest-based applications.
3+
This topic describes how to use Replicated `kots.io` annotations to explicitly include or exclude application resources from deployments based on one or more conditions.
44

55
## Overview
66

7-
Software vendors often need a way to conditionally deploy resources for an application depending on users' configuration choices. For example, a common use case is giving the user the choice to use an external database or an embedded database. In this scenario, when a user chooses to use their own external database, it is not desirable to deploy the embedded database resources.
7+
Software vendors often need a way to conditionally deploy one or more application resources. One common use case is giving the user the choice to use an external database or an embedded database. In this scenario, when a user chooses to use their own external database, it is not desirable to deploy the embedded database resources.
88

9-
There are different options for creating conditional statements to include or exclude resources based on the application type (Helm chart- or standard manifest-based) and the installation method (Replicated KOTS or Helm CLI).
9+
Another common use case is needing to explicitly include or exclude a resource from a customer deployment depending on if they install with the Helm CLI or with a Replicated installer. For example, some vendors provide additional services when the user deploys with a Replicated installer like Embedded Cluster, but do not want those services included when users deploy with the Helm CLI.
1010

11-
### About Replicated Template Functions
12-
13-
For applications deployed with KOTS, Replicated template functions are available for creating the conditional statements that control which optional resources are deployed for a given user. Replicated template functions can be used in standard manifest files such as Replicated custom resources or Kubernetes resources like StatefulSets, Secrets, and Services.
14-
15-
For example, the Replicated ConfigOptionEquals template functions returns true if the specified configuration option value is equal to a supplied value. This is useful for creating conditional statements that include or exclude a resource based on a user's application configuration choices.
16-
17-
For more information about the available Replicated template functions, see [About Template Functions](/reference/template-functions-about).
11+
For applications distributed with Replicated, there are options for explicitly including and excluding entire Helm charts, resources within a Helm chart's templates, and resources defined by standalone Kubernetes manifests.
1812

1913
## Include or Exclude Helm Charts
2014

21-
This section describes methods for including or excluding Helm charts from your application deployment.
15+
This section describes methods for including or excluding Helm charts and resources within a chart's templates.
2216

2317
### Helm Optional Dependencies
2418

@@ -28,9 +22,9 @@ For more information about working with dependencies and defining optional depen
2822

2923
### HelmChart `exclude` Field
3024

31-
For Helm chart-based applications installed with KOTS, you can configure KOTS to exclude certain Helm charts from deployment using the HelmChart custom resource [`exclude`](/reference/custom-resource-helmchart#exclude) field. When the `exclude` field is set to a conditional statement, KOTS excludes the chart if the condition evaluates to `true`.
25+
For Helm chart applications installed with a Replicated installer (Embedded Cluster, KOTS, kURL), you can exclude certain Helm charts from deployment using the HelmChart custom resource [`exclude`](/reference/custom-resource-helmchart#exclude) field. When the `exclude` field is set to a conditional statement, the chart is excluded if the condition evaluates to `true`.
3226

33-
The following example uses the `exclude` field and the ConfigOptionEquals template function to exclude a postgresql Helm chart when the `external_postgres` option is selected on the Replicated Admin Console **Config** page:
27+
The following example uses the `exclude` field and the Replicated [ConfigOptionEquals](/reference/template-functions-config-context#configoptionequals) template function to exclude a postgresql Helm chart when the `external_postgres` option is selected on the Replicated Admin Console **Config** page:
3428

3529
```yaml
3630
apiVersion: kots.io/v1beta2
@@ -45,11 +39,76 @@ spec:
4539
releaseName: samplechart-release-1
4640
```
4741
48-
## Include or Exclude Standard Manifests
42+
### `kots.io/installer-only` Annotation {#installer-only}
43+
44+
You can use the `kots.io/installer-only` annotation to prevent an entire Helm chart or one or more resoures in a Helm chart's templates from being deployed in installations with the Helm CLI. Charts or resources with `kots.io/installer-only: "true"` are deployed _only_ when installing with a Replicated installer (Embedded Cluster, KOTS, and kURL).
45+
46+
The `kots.io/installer-only` annotation does the following:
47+
- Excludes the chart (or the resource in a chart's templates) from the Helm CLI installation and update instructions in the Enterprise Portal and Vendor Portal. For more information about how users can view these instructions in the Enterprise Portal, see [View Insall and Update Instructions](/vendor/enterprise-portal-use#view-install-and-update-instructions) in _Log In To and Use the Enterprise Portal_.
48+
- Excludes the chart (or the resource in a chart's templates) from Security Center reports for Helm CLI installations. For more information about the Security Center, see [About the Security Center (Alpha)](/vendor/security-center-about).
49+
50+
This annotation is useful for charts that are required for Replicated installer-based deployments but should not be visible or deployed when customers install with the Helm CLI.
51+
52+
:::note
53+
Any Kubernetes resources in your releases that are not part of a Helm chart are never included in Helm CLI installations. You do not need to add this annotation to standalone manifests.
54+
:::
55+
56+
#### Exclude an Entire Helm Chart from Helm CLI Installations
57+
58+
You can add `kots.io/installer-only` to a Replicated [HelmChart](/reference/custom-resource-helmchart) custom resource to prevent the associated Helm chart from being deployed in Helm CLI installations.
59+
60+
**Example:**
61+
62+
```yaml
63+
apiVersion: kots.io/v1beta2
64+
kind: HelmChart
65+
metadata:
66+
name: installers-only-chart
67+
annotations:
68+
kots.io/installer-only: "true"
69+
spec:
70+
chart:
71+
name: installers-only-chart
72+
chartVersion: 1.0.0
73+
```
74+
75+
:::note
76+
HelmChart custom resources are never deployed by Helm CLI. The annotation controls whether the chart they reference is included in Helm CLI installation and update instructions.
77+
:::
78+
79+
#### Exclude Resources Inside a Chart's Templates from Helm CLI Installations
80+
81+
You can add `kots.io/installer-only` to a Kubernetes resource in a Helm chart's templates directory to prevent the resource from being deployed in Helm CLI installations.
82+
83+
**Example:**
84+
85+
The following example shows a Kubernetes Job inside a Helm chart's templates that should only run during Replicated installer deployments:
86+
87+
```yaml
88+
# example-chart/templates/preflight-job.yaml
89+
90+
apiVersion: batch/v1
91+
kind: Job
92+
metadata:
93+
name: {{ .Release.Name }}-preflight
94+
annotations:
95+
kots.io/installer-only: "true"
96+
spec:
97+
template:
98+
spec:
99+
containers:
100+
- name: preflight-checks
101+
image: replicated/preflight:latest
102+
command: ["/bin/sh"]
103+
args: ["-c", "echo Running installer-specific preflight checks"]
104+
restartPolicy: Never
105+
```
106+
107+
## Include or Exclude Kubernetes Manifests
49108

50-
For standard manifest-based applications installed with KOTS, you can use the `kots.io/exclude` or `kots.io/when` annotations to include or exclude resources based on a conditional statement.
109+
You can use the `kots.io/exclude` or `kots.io/when` annotations to include or exclude standalone Kubernetes manifests that are not part of a Helm chart. By default, if neither `kots.io/exclude` nor `kots.io/when` is present on a resource, the resource is included.
51110

52-
By default, if neither `kots.io/exclude` nor `kots.io/when` is present on a resource, the resource is included.
111+
These annotations accept a boolean value. To create a conditional statement that evaluates to true or false, you can use Replicated template functions. For more information about working with Replicated template functions, see [About Template Functions](/reference/template-functions-about).
53112

54113
### Requirements
55114

@@ -63,7 +122,7 @@ The `kots.io/exclude` and `kots.io/when` annotations have the following requirem
63122

64123
When the `kots.io/exclude: '<bool>'` annotation is present on a resource and evaluates to true, the resource is excluded from the deployment.
65124
66-
The following example uses the `kots.io/exclude` annotation and the ConfigOptionEquals template function to exclude the postgresql `StatefulSet` when an `install_postgres` checkbox on the Admin Console **Config** page is disabled:
125+
The following example uses the `kots.io/exclude` annotation and the [ConfigOptionEquals](/reference/template-functions-config-context#configoptionequals) template function to exclude the postgresql `StatefulSet` when an `install_postgres` checkbox on the Admin Console **Config** page is disabled:
67126

68127
```yaml
69128
apiVersion: apps/v1
@@ -96,7 +155,7 @@ spec:
96155

97156
When the `kots.io/when: '<bool>'` annotation is present on a resource and evaluates to true, the resource is included in the deployment.
98157
99-
The following example uses the `kots.io/when` annotation and the ConfigOptionEquals template function to include the postgresql `StatefulSet` resource when the `install_postgres` checkbox on the Admin Console **Config** page is enabled:
158+
The following example uses the `kots.io/when` annotation and the [ConfigOptionEquals](/reference/template-functions-config-context#configoptionequals) template function to include the postgresql `StatefulSet` resource when the `install_postgres` checkbox on the Admin Console **Config** page is enabled:
100159

101160
```yaml
102161
apiVersion: apps/v1

0 commit comments

Comments
 (0)