Skip to content

Commit 873d5b7

Browse files
authored
Merge pull request #3357 from replicatedhq/onboarding-first-release-edit
Edit onboarding flow to rewite image names in helm chart
2 parents 0eff97f + 5523d22 commit 873d5b7

File tree

3 files changed

+159
-23
lines changed

3 files changed

+159
-23
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+
For each image reference in your Helm chart values file, set the image repository URL to the location of the image in the proxy registry. The domain for this URL is either `proxy.replicated.com` or your custom domain.
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.image.api.registry }}/{{ .Values.image.api.repository }}:{{ .Values.image.api.tag }}

docs/vendor/replicated-onboarding.mdx

Lines changed: 84 additions & 23 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

@@ -81,11 +84,21 @@ To create an application:
8184
export REPLICATED_APP=my-app
8285
```
8386

84-
### Task 2: Connect Your Image Registry
87+
### Task 2: Modify Image References in Helm Values to Point to the Proxy Registry {#task-2}
8588

86-
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.
89+
Update your Helm values so that image references point to the Replicated proxy registry rather than to your default registry. The proxy regsitry allows you can grant proxy access to application images without exposing registry credentials to your customers.
8790

88-
For more information, see [Connect to an External Registry](/vendor/packaging-private-images).
91+
To modify image references to point to the proxy registry:
92+
93+
1. <StepCreds/>
94+
95+
1. <RewriteHelmValues/>
96+
97+
1. If your application is deployed as multiple Helm charts, repeat the previous step to modify image references in the Helm values for each of your charts.
98+
99+
1. Continue to the next task.
100+
101+
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.
89102

90103
### Task 3: Add the Replicated SDK and Package your Chart
91104

@@ -139,20 +152,37 @@ To create the first release for your application:
139152
<details>
140153
<summary>What is the Embedded Cluster Config?</summary>
141154

142-
The Embedded Cluster Config is required to install with Embedded Cluster.
155+
An Embedded Cluster Config must be included in the release to install with Embedded Cluster. The Embedded Cluster Config lets you define several aspects of the Kubernetes cluster that is created.
143156
</details>
144157

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

147-
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).
160+
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:
161+
162+
```yaml
163+
# KOTS HelmChart custom resource
164+
apiVersion: kots.io/v1beta2
165+
kind: HelmChart
166+
metadata:
167+
name: samplechart
168+
spec:
169+
chart:
170+
# name must match the chart name from the .tgz chart archive
171+
name: samplechart
172+
# chartVersion must match the chart version from the .tgz chart archive
173+
chartVersion: 1.2.3
174+
```
175+
For more information about configuring these fields, see [HelmChart v2](/reference/custom-resource-helmchart-v2).
148176
149177
<details>
150178
<summary>What is the KOTS HelmChart custom resource?</summary>
151179
152-
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.
180+
The HelmChart custom resource provides the necessary instructions for processing and preparing the chart for deployment.
153181
</details>
154182
155-
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.
183+
1. <InjectPullSecret/>
184+
185+
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.
156186
157187
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).
158188

@@ -406,6 +436,8 @@ To add the default support bundle spec to your application:
406436

407437
Your customers are exposed to several Replicated domains by default. Replicated recommends you use custom domains to unify the customer's experience with your brand and simplify security reviews.
408438

439+
After adding a custom domain for the Replicated proxy registry, be sure to update any image references in your Helm chart values to point to your custom domain rather than the proxy registry at `proxy.replicated.com`. For more information, see [Task 2: Modify Image References in Helm Values to Point to the Proxy Registry](#task-2).
440+
409441
For more information, see [Use Custom Domains](/vendor/custom-domains-using).
410442

411443
## Next Steps
@@ -440,20 +472,16 @@ To support and test Helm installations:
440472

441473
### Add Support for Air Gap Installations
442474

443-
Replicated Embedded Cluster and KOTS support installations in _air gap_ environments with no outbound internet access. Users can install with Embedded Cluster and KOTS in air gap environments by providing air gap bundles that contain the required images for the installers and for your application.
444-
445-
:::note
446-
Replicated also offers Alpha support for air gap installations with Helm. If you are interested in trying Helm air gap installations and providing feedback, please reach out to your account rep to enable this feature.
447-
:::
475+
Replicated supports installations in _air gap_ environments with little or no outbound internet access. For Embedded Cluster and KOTS, users install by providing an air gap bundle which contains the required images for the Replicated installer and your application. For Helm installations, users install by following automatically-generated instructions provided in the Replicated Enterprise Portal to pull all images and push them to their local image registry.
448476

449477
To add support for air gap installations:
450478

451479
1. If there are any images for your application that are not listed in your Helm chart, list these images in the `additionalImages` attribute of the KOTS Application custom resource. This ensures that the images are included in the air gap bundle for the release. One common use case for this is applications that use Kubernetes Operators. See [Define Additional Images](/vendor/operator-defining-additional-images).
452480

453-
1. In the KOTS HelmChart custom resource `builder` key, pass any values that are required in order for `helm template` to yield all the images needed to successfully install your application. See [Package Air Gap Bundles for Helm Charts](/vendor/helm-packaging-airgap-bundles).
481+
1. For each Helm chart in your release, configure the corresponding KOTS HelmChart custom resource `builder` key. In the `builder` key, define any Helm values that must be set so that the output of `helm template` exposes all container images needed to install the chart in an air-gapped environment. This ensures that the Vendor Portal can build the air gap bundle for the release. See [Package Air Gap Bundles for Helm Charts](/vendor/helm-packaging-airgap-bundles) and [builder](/reference/custom-resource-helmchart-v2#builder).
454482

455483
:::note
456-
If the default values in your Helm chart already enable all the images needed to successfully deploy, then you do not need to configure the `builder` key.
484+
If the default values in your Helm chart already expose all the images for air gap installations, then you do not need to configure the `builder` key.
457485
:::
458486

459487
<details>
@@ -464,27 +492,60 @@ To add support for air gap installations:
464492
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.
465493
</details>
466494

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.
495+
1. For each Helm chart in your release, configure the corresponding KOTS HelmChart custom resource `optionalValues` key to conditionally rewrite image names to the user's local image registry. This is done using 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 render the location of the given image in the user's own local registry.
468496

469-
For more information, see [Rewrite Image Names](/vendor/helm-native-v2-using#rewrite-image-names) in _Configuring the HelmChart Custom Resource v2_.
497+
**Example:**
498+
499+
```yaml
500+
# KOTS HelmChart custom resource
501+
502+
apiVersion: kots.io/v1beta2
503+
kind: HelmChart
504+
metadata:
505+
name: samplechart
506+
spec:
507+
optionalValues:
508+
# Define the conditional statement in the when field
509+
- when: 'repl{{ HasLocalRegistry }}'
510+
values:
511+
postgres:
512+
image:
513+
registry: '{{repl LocalRegistryHost }}'
514+
repository: '{{repl LocalRegistryNamespace }}'/cloudnative-pg/cloudnative-pg
515+
```
516+
517+
1. Configure the HelmChart `optionalValues` key to conditionally rewrite the Replicated SDK image to the user's local registry. The default location for the image used by the Replicated SDK Helm chart is `registry.replicated.com/library/replicated-sdk-image`.
518+
519+
```yaml
520+
# KOTS HelmChart custom resource
521+
apiVersion: kots.io/v1beta2
522+
kind: HelmChart
523+
metadata:
524+
name: samplechart
525+
spec:
526+
optionalValues:
527+
# Rewrite Replicated SDK image to local registry
528+
- when: 'repl{{ HasLocalRegistry }}'
529+
values:
530+
replicated:
531+
image:
532+
registry: '{{repl LocalRegistryHost }}'
533+
repository: '{{repl LocalRegistryNamespace }}/library/replicated-sdk-image'
534+
```
470535

471536
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).
472537

473538
1. In the [Vendor Portal](https://vendor.replicated.com), go the channel where the release was promoted to build the air gap bundle. Do one of the following:
474539
* If the **Automatically create airgap builds for newly promoted releases in this channel** setting is enabled on the channel, watch for the build status to complete.
475540
* If automatic air gap builds are not enabled, go to the **Release history** page for the channel and build the air gap bundle manually.
476541

477-
1. Create a customer with the **Airgap Download Enabled** entitlement enabled so that you can test air gap installations. See [Create and Manage Customers](/vendor/releases-creating-customer).
542+
1. Create or edit a customer with the **Airgap Download Enabled** entitlement enabled so that you can test air gap installations. See [Create and Manage Customers](/vendor/releases-creating-customer).
478543

479544
1. Download the Embedded Cluster air gap installation assets, then install with Embedded Cluster on an air gap VM to test. See [Install in Air Gap Environments with Embedded Cluster](/enterprise/installing-embedded-air-gap).
480545

481-
1. (Optional) Download the `.airgap` bundle for the release and the air gap bundle for the KOTS Admin Console. You can also download both bundles from the Download Portal for the target customer. Then, install in an air gap existing cluster to test. See [Air Gap Installation in Existing Clusters with KOTS](/enterprise/installing-existing-cluster-airgapped).
546+
1. Follow the steps in [Install and Update with Helm in Air Gap Environments](/vendor/helm-install-airgap) to access the Enterprise Portal for the customer and test air gap installation in a cluster with Helm.
482547

483-
1. (Optional) Follow the steps in [Installing and Updating with Helm in Air Gap Environments (Alpha)](/vendor/helm-install-airgap) to test air gap installation with Helm.
484-
485-
:::note
486-
Air gap Helm installations are an Alpha feature. If you are interested in trying Helm air gap installations and providing feedback, please reach out to your account rep to enable this feature.
487-
:::
548+
1. (Optional) Download the `.airgap` bundle for the release and the air gap bundle for the KOTS Admin Console. You can also download both bundles from the Download Portal for the target customer. Then, install with KOTS in an air gap existing cluster to test. See [Air Gap Installation in Existing Clusters with KOTS](/enterprise/installing-existing-cluster-airgapped).
488549

489550
### Add Roles for Multi-Node Clusters in Embedded Cluster Installations
490551

0 commit comments

Comments
 (0)