Skip to content

Commit 440679c

Browse files
committed
Edit onboarding flow to rewite image names in helm chart
1 parent 9c4d960 commit 440679c

File tree

3 files changed

+119
-8
lines changed

3 files changed

+119
-8
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
In the HelmChart v2 custom resource, configure the `values` key to inject the Replicated image pull secret into your Helm values. This provides authentication for the proxy registry. Use the KOTS [ImagePullSecretName](/reference/template-functions-config-context#imagepullsecretname) template function to get the pull secret name.
2+
3+
<details>
4+
<summary>What is the Replicated image pull secret?</summary>
5+
<p>During application deployment, KOTS automatically creates an `imagePullSecret` with `type: kubernetes.io/dockerconfigjson` that is based on the customer license. This secret is used to authenticate with the proxy registry and grant proxy access to private images. For information about how Kubernetes uses the `kubernetes.io/dockerconfigjson` Secret type to authenticate to a private image registry, see [Pull an Image from a Private Registry](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) in the Kubernetes documentation.</p>
6+
</details>
7+
8+
**Example**:
9+
10+
```yaml
11+
# kots.io/v1beta2 HelmChart custom resource
12+
13+
apiVersion: kots.io/v1beta2
14+
kind: HelmChart
15+
metadata:
16+
name: samplechart
17+
spec:
18+
values:
19+
image:
20+
# Get the pull secret name with ImagePullSecretName
21+
pullSecrets:
22+
- name: '{{repl ImagePullSecretName }}'
23+
```
24+
Ensure that you provide this pull secret in any Pod definitions that reference images to be pulled through the proxy registry.
25+
26+
**Example**:
27+
28+
```yaml
29+
apiVersion: v1
30+
kind: Pod
31+
metadata:
32+
name: nginx
33+
spec:
34+
containers:
35+
- name: nginx
36+
image: {{ .Values.image.registry }}/{{ .Values.image.repository }}
37+
# Access the value to provide the KOTS pull secret
38+
{{- with .Values.image.pullSecrets }}
39+
imagePullSecrets:
40+
{{- toYaml . | nindent 2 }}
41+
{{- end }}
42+
```
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
In your Helm chart values file, set your image repository URL to the location of the image on the proxy registry. If you added a custom domain, use your custom domain. Otherwise, use `proxy.replicated.com`.
2+
3+
The proxy registry URL has the following format: `DOMAIN/proxy/APP_SLUG/EXTERNAL_REGISTRY_IMAGE_URL`
4+
5+
Where:
6+
* `DOMAIN` is either `proxy.replicated.com` or your custom domain.
7+
* `APP_SLUG` is the unique slug of your application.
8+
* `EXTERNAL_REGISTRY_IMAGE_URL` is the path to the private image on your external registry.
9+
10+
**Example:**
11+
12+
```yaml
13+
# values.yaml
14+
api:
15+
image:
16+
# proxy.replicated.com or your custom domain
17+
registry: proxy.replicated.com
18+
repository: proxy/your-app/ghcr.io/cloudnative-pg/cloudnative-pg
19+
tag: catalog-1.24.0
20+
```
21+
22+
Ensure that any references to the image in your Helm chart access the field from your values file.
23+
24+
**Example**:
25+
26+
```yaml
27+
apiVersion: v1
28+
kind: Pod
29+
spec:
30+
containers:
31+
- name: api
32+
# Access the registry, repository, and tag fields from the values file
33+
image: {{ .Values.images.api.registry }}/{{ .Values.images.api.repository }}:{{ .Values.images.api.tag }}

docs/vendor/replicated-onboarding.mdx

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import Requirements from "../partials/embedded-cluster/_requirements.mdx"
66
import SDKOverview from "../partials/replicated-sdk/_overview.mdx"
77
import TestYourChanges from "../partials/getting-started/_test-your-changes.mdx"
88
import UnauthorizedError from "../partials/replicated-sdk/_401-unauthorized.mdx"
9+
import StepCreds from "../partials/proxy-service/_step-creds.mdx"
10+
import RewriteHelmValues from "../partials/proxy-service/_step-rewrite-helm-values.mdx"
11+
import InjectPullSecret from "../partials/proxy-service/_step-inject-pull-secret.mdx"
912

1013
# Onboard to the Replicated Platform
1114

@@ -83,11 +86,25 @@ To create an application:
8386
export REPLICATED_APP=my-app
8487
```
8588

86-
### Task 2: Connect Your Image Registry
89+
### Task 2: Rewrite Image Names in Helm Values to Use the Proxy Registry
8790

88-
Add credentials for your image registry to the Vendor Portal. This will allow you to use the Replicated proxy registry in a later step so that you can grant proxy access to application images without exposing registry credentials to your customers.
91+
Update your Helm values to rewrite image names to use the Replicated proxy registry. The proxy regsitry allows you can grant proxy access to application images without exposing registry credentials to your customers.
8992

90-
For more information, see [Connect to an External Registry](/vendor/packaging-private-images).
93+
:::note
94+
You will add a custom domain for the proxy registry as part of [Task 9: Alias Replicated Endpoints with Your Own Domains](#task-9-alias-replicated-endpoints-with-your-own-domains).
95+
:::
96+
97+
To rewrite image names to use the proxy registry:
98+
99+
1. <StepCreds/>
100+
101+
1. <RewriteHelmValues/>
102+
103+
1. If your application is deployed as multiple Helm charts, repeat the previous step to rewrite image names in the Helm values for each of your charts.
104+
105+
1. Continue to the next task.
106+
107+
As part of [Task 4: Create the Initial Release with KOTS HelmChart and Embedded Cluster Config](#first-release), you will inject a Replicated-generated pull secret into your Helm values that grants authentication to pull your private images through the proxy registry.
91108

92109
### Task 3: Add the Replicated SDK and Package your Chart
93110

@@ -146,15 +163,32 @@ To create the first release for your application:
146163

147164
For more information, see [Use Embedded Cluster](/vendor/embedded-overview).
148165

149-
1. Create a new YAML file. In this file, configure the KOTS HelmChart custom resource by completing the workflow in [Configuring the HelmChart Custom Resource](helm-native-v2-using).
166+
1. Create a new YAML file named `YOUR_CHART_NAME.yaml`. For example, `samplechart.yaml`. In the file, add the following to create the KOTS HelmChart v2 custom resource for your primary Helm chart, updating the fields as needed to match the name and version of the chart:
167+
168+
```yaml
169+
# KOTS HelmChart custom resource
170+
apiVersion: kots.io/v1beta2
171+
kind: HelmChart
172+
metadata:
173+
name: samplechart
174+
spec:
175+
chart:
176+
# name must match the chart name from the .tgz chart archive
177+
name: samplechart
178+
# chartVersion must match the chart version from the .tgz chart archive
179+
chartVersion: 1.2.3
180+
```
181+
For more information about configuring these fields, see [HelmChart v2](custom-resource-helmchart-v2).
150182
151183
<details>
152184
<summary>What is the KOTS HelmChart custom resource?</summary>
153185
154-
The KOTS HelmChart custom resource is required to install Helm charts with KOTS and Embedded Cluster. As part of configuring the KOTS HelmChart custom resource, you will rewrite image names and add image pull secrets to allow your application images to be accessed through the Replicated proxy registry.
186+
The KOTS HelmChart custom resource is required to install Helm charts with KOTS and Embedded Cluster.
155187
</details>
156188
157-
1. If your application is deployed as multiple Helm charts, repeat the step above to add a separate HelmChart custom resource for each Helm chart archive in the release.
189+
1. <InjectPullSecret/>
190+
191+
1. If your application is deployed as multiple Helm charts, repeat the previous steps to add and configure a separate HelmChart custom resource for each Helm chart archive in the release.
158192
159193
1. If there are values in any of your Helm charts that need to be set for the installation to succeed, you can set those values using the `values` key in the corresponding HelmChart custom resource. See [Set Helm Values with KOTS](/vendor/helm-optional-value-keys).
160194

@@ -464,9 +498,11 @@ To add support for air gap installations:
464498
For many applications, running `helm template` with the default values would not yield all the images required to install. In these cases, vendors can pass the additional values in the `builder` key to ensure that the air gap bundle includes all the necessary images.
465499
</details>
466500

467-
1. If you have not done so already as part of [Task 4: Create and Install the Initial Release](#first-release), ensure that the `values` key in the KOTS HelmChart custom resource correctly rewrites image names for air gap installations. This is done using the KOTS HasLocalRegistry, LocalRegistryHost, and LocalRegistryNamespace template functions to render the location of the given image in the user's own local registry.
501+
1. For each Helm chart in your release, update the KOTS HelmChart custom resource `optionalValues` key to conditionally rewrite image names for air gap installations. This is done using the KOTS HasLocalRegistry, LocalRegistryHost, and LocalRegistryNamespace template functions to render the location of the given image in the user's own local registry.
502+
503+
For more information, see [Rewrite Image Names with HelmChart v2 for Local Registries](/vendor/helmchart-local-registries).
468504

469-
For more information, see [Rewrite Image Names](/vendor/helm-native-v2-using#rewrite-image-names) in _Configuring the HelmChart Custom Resource v2_.
505+
1. If your application uses any public Docker Hub images that are rate limited, configure the HelmChart v2 custom resource `values` key to add a Replicated image pull secret to any Docker images that could be rate-limited. This pull secret allows any users that configure a local registry to avoid rate limits. For more information, see [Avoid Docker Hub Rate Limits](/enterprise/image-registry-rate-limits).
470506

471507
1. Create and promote a new release with your changes. For more information, see [Manage Releases with the Vendor Portal](releases-creating-releases) or [Managing Releases with the CLI](releases-creating-cli).
472508

0 commit comments

Comments
 (0)