Skip to content

Commit 8468664

Browse files
committed
wip
1 parent 172161c commit 8468664

File tree

1 file changed

+38
-63
lines changed

1 file changed

+38
-63
lines changed

docs/vendor/helm-native-v2-using.md

Lines changed: 38 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
11
import KotsHelmCrDescription from "../partials/helm/_kots-helm-cr-description.mdx"
22

3-
# Configure the HelmChart Custom Resource v2
3+
# Configure the HelmChart Custom Resource
44

5-
This topic describes how to configure the Replicated HelmChart custom resource version `kots.io/v1beta2` to support Helm chart installations with Replicated KOTS.
5+
This topic describes how to configure the Replicated KOTS HelmChart custom resource. The information in this topic applies to existing cluster KOTS installations, Replicated Embedded Cluster installations, and Replicated kURL installations for applications packaged with Helm.
6+
7+
For more information about how KOTS uses the HelmChart custom resource to install Helm charts, see [About Distributing Helm Charts with KOTS](/vendor/helm-native-about).
68

79
## Workflow
810

9-
To support Helm chart installations with the KOTS `kots.io/v1beta2` HelmChart custom resource, do the following:
10-
1. Rewrite image names to use the Replicated proxy registry. See [Rewrite Image Names](#rewrite-image-names).
11-
1. Inject a KOTS-generated image pull secret that grants proxy access to private images. See [Inject Image Pull Secrets](#inject-image-pull-secrets).
11+
To configure the HelmChart custom resource, do the following:
12+
13+
1. Rewrite image names and Inject a KOTS-generated image pull secret they can be pulled through the Replicated proxy registry. See [Rewrite Image Names](#rewrite-image-names).
14+
1. Inject a KOTS-generated image pull secret that grants proxy access to private images through the Replicated proxy registry. See [Inject Image Pull Secrets](#inject-image-pull-secrets).
1215
1. Add a pull secret for any Docker Hub images that could be rate limited. See [Add Pull Secret for Rate-Limited Docker Hub Images](#docker-secret).
13-
1. Configure the `builder` key to allow your users to push images to their own local registries. See [Support Local Image Registries](#local-registries).
16+
1. Configure the `builder` key to allow your users to push images to their own local registries, such as in air gap installations. See [Configure the `builder` key to Support Local Image Registries](#local-registries).
1417
1. (KOTS Existing Cluster and kURL Installations Only) Add backup labels to your resources to support backup and restore with the KOTS snapshots feature. See [Add Backup Labels for Snapshots](#add-backup-labels-for-snapshots).
1518
:::note
1619
Snapshots is not supported for installations with Replicated Embedded Cluster. For more information about configuring disaster recovery for Embedded Cluster, see [Disaster Recovery for Embedded Cluster](/vendor/embedded-disaster-recovery).
1720
:::
1821

1922
## Task 1: Rewrite Image Names {#rewrite-image-names}
2023

21-
Configure the KOTS HelmChart custom resource `values` key so that KOTS rewrites the names for both private and public images in your Helm values during deployment. This allows images to be accessed at one of the following locations, depending on where they were pushed:
24+
### Overview
25+
26+
Configure the HelmChart custom resource so that KOTS rewrites the names of images in your Helm values during deployment.
27+
28+
This allows images to be accessed at one of the following locations, depending on where they were pushed:
2229
* The [Replicated proxy registry](private-images-about) (`proxy.replicated.com` or your custom domain)
2330
* A public image registry
2431
* Your customer's local registry
@@ -37,66 +44,34 @@ You will use the following KOTS template functions to conditionally rewrite imag
3744

3845
### Task 1a: Rewrite Private Image Names
3946

40-
For any private images used by your application, configure the HelmChart custom resource so that image names are rewritten to either the Replicated proxy registry (for online installations) or to the local registry in the user's installation environment (for air gap installations or online installations where the user configured a local registry).
41-
42-
To rewrite image names to the location of the image in the proxy registry, use the format `<proxy-domain>/proxy/<app-slug>/<image>`, where:
43-
* `<proxy-domain>` is `proxy.replicated.com` or your custom domain. For more information about configuring a custom domain for the proxy registry, see [Use Custom Domains](/vendor/custom-domains-using).
44-
* `<app-slug>` is the unique application slug in the Vendor Portal
45-
* `<image>` is the path to the image in your registry
47+
To rewrite image names to the location of the image in the proxy registry:
4648

47-
For example, if the private image is `quay.io/my-org/nginx:v1.0.1` and `images.yourcompany.com` is the custom proxy registry domain, then the image name should be rewritten to `images.yourcompany.com/proxy/my-app-slug/quay.io/my-org/nginx:v1.0.1`.
49+
1. In the HelmChart custom resource, under the `values` key, rewrite image names using the format `<proxy-domain>/proxy/<app-slug>/<image>`, where:
50+
* `<proxy-domain>` is `proxy.replicated.com` or your custom domain. For more information about configuring a custom domain for the proxy registry, see [Using Custom Domains](/vendor/custom-domains-using).
51+
* `<app-slug>` is the unique application slug in the Vendor Portal
52+
* `<image>` is the path to the image in your registry
4853

49-
For more information, see the example below.
54+
For example, if the private image is `quay.io/my-org/nginx:v1.0.1` and `images.yourcompany.com` is the custom proxy registry domain, then the image name should be rewritten to `images.yourcompany.com/proxy/my-app-slug/quay.io/my-org/nginx:v1.0.1`.
5055

51-
#### Example
52-
53-
The following HelmChart custom resource uses the KOTS [HasLocalRegistry](/reference/template-functions-config-context#haslocalregistry), [LocalRegistryHost](/reference/template-functions-config-context#localregistryhost), and [LocalRegistryNamespace](/reference/template-functions-config-context#localregistrynamespace) template functions to conditionally rewrite an image registry and repository depending on if a local registry is used:
54-
55-
```yaml
56-
# kots.io/v1beta2 HelmChart custom resource
56+
```yaml
57+
values:
58+
image:
59+
registry: '{{repl LocalRegistryHost }}'
60+
repository: '{{repl LocalRegistryNamespace }}/gitea'
61+
```
5762
58-
apiVersion: kots.io/v1beta2
59-
kind: HelmChart
60-
metadata:
61-
name: samplechart
62-
spec:
63-
...
64-
values:
65-
image:
66-
# If a registry is configured by the user or by Embedded Cluster/kURL, use that registry's hostname
67-
# Else use proxy.replicated.com or your custom proxy registry domain
68-
registry: '{{repl HasLocalRegistry | ternary LocalRegistryHost "images.yourcompany.com" }}'
69-
# If a registry is configured by the user or by Embedded Cluster/kURL, use that registry namespace
70-
# Else use the image's namespace at the proxy registry domain
71-
repository: '{{repl HasLocalRegistry | ternary LocalRegistryNamespace "proxy/my-app/quay.io/my-org" }}/nginx'
72-
tag: v1.0.1
73-
```
63+
1. Under the `optionalValues` key, use the KOTS [HasLocalRegistry](/reference/template-functions-config-context#haslocalregistry), [LocalRegistryHost](/reference/template-functions-config-context#localregistryhost), and [LocalRegistryNamespace](/reference/template-functions-config-context#localregistrynamespace) template functions to conditionally rewrite image names.
7464

75-
The `spec.values.image.registry` and `spec.values.image.repository` fields in the HelmChart custom resource above correspond to `image.registry` and `image.repository` fields in the Helm chart `values.yaml` file, as shown below:
76-
77-
```yaml
78-
# Helm chart values.yaml file
79-
80-
image:
81-
registry: quay.io
82-
repository: my-org/nginx
83-
tag: v1.0.1
84-
```
85-
86-
During installation, KOTS renders the template functions and sets the `image.registry` and `image.repository` fields in the Helm chart `values.yaml` file based on the value of the corresponding fields in the HelmChart custom resource.
87-
88-
Any templates in the Helm chart that access the `image.registry` and `image.repository` fields are updated to use the appropriate value, as shown in the example below:
89-
90-
```yaml
91-
apiVersion: v1
92-
kind: Pod
93-
metadata:
94-
name: nginx
95-
spec:
96-
containers:
97-
- name:
98-
image: {{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}
99-
```
65+
```yaml
66+
optionalValues:
67+
- when: 'repl{{ HasLocalRegistry }}'
68+
values:
69+
image:
70+
registry: '{{repl LocalRegistryHost }}'
71+
repository: '{{repl LocalRegistryNamespace }}/gitea'
72+
pullSecrets:
73+
- name: '{{repl ImagePullSecretName }}'
74+
```
10075

10176
### Task 1b: Rewrite Public Image Names
10277

@@ -332,7 +307,7 @@ For more information about the HelmChart custom resource, including the unique r
332307
333308
To support the use of local registries with version `kots.io/v1beta2` of the HelmChart custom resource, provide the necessary values in the builder field to render the Helm chart with all of the necessary images so that KOTS knows where to pull the images from to push them into the local registry.
334309

335-
For more information about how to configure the `builder` key, see [Package Air Gap Bundles for Helm Charts](/vendor/helm-packaging-airgap-bundles) and [`builder`](/reference/custom-resource-helmchart-v2#builder) in _HelmChart v2_.
310+
For more information about how to configure the `builder` key, see [Packaging Air Gap Bundles for Helm Charts](/vendor/helm-packaging-airgap-bundles) and [`builder`](/reference/custom-resource-helmchart-v2#builder) in _HelmChart v2_.
336311

337312
The `kots.io/v1beta2` HelmChart custom resource has the following differences from `kots.io/v1beta1`:
338313

0 commit comments

Comments
 (0)