Skip to content

Commit

Permalink
Addresses pre-Kubecon feedback from Marketing (#316)
Browse files Browse the repository at this point in the history
TL;DR
-----

Repairs several defects surfaced while reviewing labs before Kubecon

Details
-------

* Fixes lab setup to create a customer even when thee `vendor.json`
  file doesn't specify any files for the release.
* Uses a newer version of the Harbor chart for the "builder" labs
  to both sync back up and address some issues with Helm installs
* Creates release from chart tarball rather than from the YAML dir
* Assures created customers aren't KOTS enabled
* Corrects some lifecycle scripts that were leading to inconsistent
  lab instructions and some failures that weren't failures
* Clears a couple of typos
  • Loading branch information
crdant authored Nov 3, 2023
1 parent 6d1f8ed commit 646fad0
Show file tree
Hide file tree
Showing 49 changed files with 234 additions and 215 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
slug: working-with-preflight-checks
id: hbegc1xc0kld
id: vas7h6ypnrmy
type: challenge
title: Working with Preflight Checks
teaser: |-
Expand All @@ -16,7 +16,7 @@ tabs:
- title: Manifest Editor
type: code
hostname: shell
path: /home/replicant
path: /home
difficulty: basic
timelimit: 300
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
slug: checking-cluster-resources
id: ghsphablorib
id: fjch1mlffnx4
type: challenge
title: Checking Cluster Resources
teaser: Use preflight checks to validate minimum cluster requirements
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
slug: adding-preflights-to-the-chart
id: rey80xsp7n5p
id: lcpwe2dkxmr0
type: challenge
title: Adding Preflights to the Harbor Helm Chart
teaser: Learn how to incorporate your preflight checks into your chart
Expand Down Expand Up @@ -228,12 +228,12 @@ helm template harbor | kubectl preflight -
```

If you're satisfied with the tests, bump the version of your Helm chart in the file
`harbor/Chart.yaml` from `16.7.0` to `16.8.0`, then repackage it. You can edit
`harbor/Chart.yaml` from `19.2.0` to `19.3.0`, then repackage it. You can edit
the version in the Manifest Editor or run the following command to do it from
the shell:

```
yq -i '.version = "16.8.0"' harbor/Chart.yaml
yq -i '.version = "19.3.0"' harbor/Chart.yaml
```

Then run the `helm package` command to package the updated version:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ if [[ "${fails}" -ne "1" ]] ; then
fi

# look for the preflight template file
if [[ ! -f /home/replicant/release/harbor-16.8.0.tgz ]] ; then
if [[ ! -f /home/replicant/release/harbor-19.3.0.tgz ]] ; then
fail-message $'Please make sure you\'ve bumped the version of your Helm chart and re-packaged it'
let "result = result + 1"
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ stringData:
message: Your cluster has sufficient memory available to run Harbor
HARBOR_PREFLIGHTS

yq -i '.version = "16.8.0"' /home/replicant/harbor/Chart.yaml
yq -i '.version = "19.3.0"' /home/replicant/harbor/Chart.yaml
helm package /home/replicant/harbor --destination /home/replicant/release
chown -R replicant /home/replicant/harbor /home/replicant/release
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
slug: releasing-the-application
id: ivm88bvvie5l
id: 5jisluk3n6vr
type: challenge
title: Releasing the Application
teaser: Releasing with preflights on the Replicated Platform
Expand Down Expand Up @@ -88,11 +88,11 @@ use the `Unstable` channel for this lab, since the latter
approach is best for teams working with feature branches.

```
replicated release create --promote Unstable --yaml-dir ./release --version 16.8.0 \
replicated release create --promote Unstable --chart ./release/harbor-19.3.0.tgz --version 19.3.0 \
--release-notes "Adds preflight checks to enable customers to validate cluster prerequisites before installing"
```

This creates a release for version `16.8.0` of the Harbor Helm
This creates a release for version `19.3.0` of the Harbor Helm
chart, and promotes it to the `Unstable` channel. The `create`
command output a sequence number that you'll need for `promote` (it
will be `2` if you haven't explored releasing a bit more).
Expand All @@ -112,14 +112,14 @@ of those channels---your teams review and approval processes,
steps in a continuous delivery pipeline, or both. Run the following command to promote our release to the `Beta` channel:

```
replicated release promote 2 Beta --version 16.8.0 \
replicated release promote 2 Beta --version 19.3.0 \
--release-notes "Adds preflight checks to enable customers to validate cluster prerequisites before installing"
```

Then promote to the `Stable` channel:

```
replicated release promote 2 Stable --version 16.8.0 \
replicated release promote 2 Stable --version 19.3.0 \
--release-notes "Adds preflight checks to enable customers to validate cluster prerequisites before installing"
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ result=0
# check for release to Unstable
api_token=$(get_api_token)
unstable_version=$(curl --header "Accept: application/json" --header "Authorization: ${api_token}" https://api.replicated.com/vendor/v3/apps | jq -r '.apps[0].channels[] | select( .name == "Unstable" ) | .currentVersion')
if [[ ! "${unstable_version}" == "16.8.0" ]] ; then
fail-message $'Please be sure to release the applicaton to the \`Unstable\` channel with version \`16.8.0\`'
if [[ ! "${unstable_version}" == "19.3.0" ]] ; then
fail-message $'Please be sure to release the applicaton to the \`Unstable\` channel with version \`19.3.0\`'
let "result = result + 1"
fi

# check for promotion to Beta
beta_version=$(curl --header "Accept: application/json" --header "Authorization: ${api_token}" https://api.replicated.com/vendor/v3/apps | jq -r '.apps[0].channels[] | select( .name == "Beta" ) | .currentVersion')
if [[ ! "${beta_version}" == "16.8.0" ]] ; then
fail-message $'Please be sure to promote the applicaton to the \`Beta\` channel with version \`16.8.0\`'
if [[ ! "${beta_version}" == "19.3.0" ]] ; then
fail-message $'Please be sure to promote the applicaton to the \`Beta\` channel with version \`19.3.0\`'
let "result = result + 1"
fi

# check for promotion to Stable
stable_version=$(curl --header "Accept: application/json" --header "Authorization: ${api_token}" https://api.replicated.com/vendor/v3/apps | jq -r '.apps[0].channels[] | select( .name == "Stable" ) | .currentVersion')
if [[ ! "${stable_version}" == "16.8.0" ]] ; then
fail-message $'Please be sure to promote the applicaton to the \`Stable\` channel with version \`16.8.0\`'
if [[ ! "${stable_version}" == "19.3.0" ]] ; then
fail-message $'Please be sure to promote the applicaton to the \`Stable\` channel with version \`19.3.0\`'
let "result = result + 1"
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ api_token=$(get_api_token)
app_slug=$(curl --header "Accept: application/json" --header "Authorization: ${api_token}" https://api.replicated.com/vendor/v3/apps | jq -r '.apps[0].slug')

# release to the `Unstable` channel
replicated release create --promote Unstable --yaml-dir /home/replicant/release --version 16.8.0 \
replicated release create --promote Unstable --chart ./release/harbor-19.3.0.tgz --version 19.3.0 \
--release-notes "Adds preflight checks to enable customers to validate cluster prerequisites before installing" \
--app ${app_slug} --token ${api_token}

# get the sequence number for the release to promote
release_sequence=$(curl --header "Accept: application/json" --header "Authorization: ${api_token}" https://api.replicated.com/vendor/v3/apps | jq -r '.apps[0].channels[] | select( .name == "Unstable" ) | .releaseSequence')

# promote to the `Beta` channel
replicated release promote ${release_sequence} Beta --version 16.8.0 \
replicated release promote ${release_sequence} Beta --version 19.3.0 \
--release-notes "Adds preflight checks to enable customers to validate cluster prerequisites before installing" \
--app ${app_slug} --token ${api_token}

# promote to the `Stable` channel
replicated release promote ${release_sequence} Stable --version 16.8.0 \
replicated release promote ${release_sequence} Stable --version 19.3.0 \
--release-notes "Adds preflight checks to enable customers to validate cluster prerequisites before installing" \
--app ${app_slug} --token ${api_token}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
slug: validating-before-an-install
id: agnr2vn44qs0
id: gyzywxla7qt8
type: challenge
title: Validating Before an Install
teaser: How your customer uses preflights to validate their environment
Expand Down Expand Up @@ -44,7 +44,7 @@ Password: `[[ Instruqt-Var key="PASSWORD" hostname="shell" ]]`

You'll land on the "Channels" page for your app, which will show
the release channels we discussed in the previous step. Notice that
each of the default channels shows the current version `16.8.0`,
each of the default channels shows the current version `19.3.0`,
while the channel LTS, which we haven't released to, reflects
that.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ app_slug=$(curl --header 'Accept: application/json' --header "Authorization: ${a
customer_email="${INSTRUQT_PARTICIPANT_ID}@geeglo.io"

# create the new customer and keep track of the ID
customer_id=$(replicated customer create --name "Geeglo" --email ${customer_email} --channel Stable --expires-in 720h --output json --app ${app_slug} --token ${api_token} | jq -r .id)
customer_id=$(replicated customer create --name "Geeglo" --email ${customer_email} --channel Stable --expires-in 720h --kots-install=false --output json --app ${app_slug} --token ${api_token} | jq -r .id)

# make sure the customer has a trial license
updated_customer=$(curl --header 'Accept: application/json' --header "Authorization: ${api_token}" "https://api.replicated.com/vendor/v3/app/${app_id}/customer/${customer_id}" | \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
slug: completing-the-install
id: aeywtcz1jfwc
id: 3fqiqvosmf7i
type: challenge
title: Completing the Install
teaser: Finishing the install once the cluster passes its preflights
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ result=0

# check for release to Unstable
installed_chart=$(helm list -o yaml --kubeconfig /home/replicant/.kube/config | yq '.[0].chart')
if [[ ! "${installed_chart}" == "harbor-16.8.0" ]] ; then
if [[ ! "${installed_chart}" == "harbor-19.3.0" ]] ; then
fail-message 'Please be sure to install the Harbor Helm chart'
let "result = result + 1"
fi
Expand Down
2 changes: 1 addition & 1 deletion instruqt/avoiding-installation-pitfalls/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
containers:
- name: shell
image: gcr.io/kots-field-labs/shell:feature-helm-preflights
image: gcr.io/kots-field-labs/shell:main
shell: tmux new-session -A -s shell su - replicant
virtualmachines:
- name: cluster
Expand Down
10 changes: 5 additions & 5 deletions instruqt/avoiding-installation-pitfalls/track.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
slug: avoiding-installation-pitfalls
id:
id: amjfqroa5bfk
title: Avoiding Installation Pitfalls
teaser: |-
Use Preflight checks to avoid common installation pitfalls
Expand All @@ -19,16 +19,16 @@ description: |-
installing
icon: https://storage.googleapis.com/shared-lab-assets/icons/red/checklist.png
tags:
- prod
- builders-plan
- helm
- troubleshoot
- prod
- helm
owner: replicated
developers:
- [email protected]
maintenance: false
lab_config:
overlay: false
width: 33
position: right
checksum: "18363644782998677466"
enableLoadingMessages: true
checksum: "15041863163879828350"
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ export REPLICATED_API_TOKEN=${api_token}
export REPLICATED_APP=${app_slug}

cd /home/replicant
mkdir release
helm pull --version 16.6.8 oci://registry-1.docker.io/bitnamicharts/harbor --untar
yq -i '.version = "16.7.0"' harbor/Chart.yaml
mkdir /home/replicant/release

helm pull --version 19.1.0 oci://registry-1.docker.io/bitnamicharts/harbor --untar
yq -i '.version = "19.2.0"' harbor/Chart.yaml
replicated_sdk_version=$(curl -qsfL https://api.github.com/repos/replicatedhq/replicated-sdk/tags | jq -r '.[0] | .name')
yq -i ".dependencies += { \"name\": \"replicated\", \"repository\": \"oci://registry.replicated.com/library\", \"version\": \"${replicated_sdk_version#?}\"}" harbor/Chart.yaml

Expand All @@ -45,20 +46,20 @@ helm package harbor --destination release
# release and promote the app

# release to the `Unstable` channel
replicated release create --promote Unstable --yaml-dir /home/replicant/release --version 16.7.0 \
replicated release create --promote Unstable --chart /home/replicant/release/harbor-19.2.0.tgz --version 19.2.0 \
--release-notes "Prepares for distribution with Replicated by incorporating the Replicated SDK" \
--app ${app_slug} --token ${api_token}

# get the sequence number for the release to promote
release_sequence=$(curl --header "Accept: application/json" --header "Authorization: ${api_token}" https://api.replicated.com/vendor/v3/apps | jq -r '.apps[0].channels[] | select( .name == "Unstable" ) | .releaseSequence')

# promote to the `Beta` channel
replicated release promote ${release_sequence} Beta --version 16.7.0 \
replicated release promote ${release_sequence} Beta --version 19.2.0 \
--release-notes "Prepares for distribution with Replicated by incorporating the Replicated SDK" \
--app ${app_slug} --token ${api_token}

# promote to the `Stable` channel
replicated release promote ${release_sequence} Stable --version 16.7.0 \
replicated release promote ${release_sequence} Stable --version 19.2.0 \
--release-notes "Prepares for distribution with Replicated by incorporating the Replicated SDK" \
--app ${app_slug} --token ${api_token}

Expand All @@ -67,7 +68,7 @@ replicated channel create --name LTS --description "Releases with long-term supp
--app ${app_slug} --token ${api_token}

# remove the helm chart we used to create the release
rm /home/replicant/release/harbor-16.7.0.tgz
rm /home/replicant/release/harbor-19.2.0.tgz

# make sure permissions are good
chown -R replicant /home/replicant/harbor /home/replicant/release
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
slug: viewing-instance-info
id: u7arnjksadrw
id: jukpqxmfyyww
type: challenge
title: Getting a Picture of a Customer Instance
teaser: Using the Replicated Platform to understand details of a customer instance
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

# This set line ensures that all failures will cause the script to error and exit
set -euxo pipefail
exit 0
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
slug: working-with-support-bundles
id: y9cpyp05iq1k
id: toucvosxrmfv
type: challenge
title: Working with Support Bundles
teaser: |-
Expand All @@ -16,7 +16,7 @@ tabs:
- title: Manifest Editor
type: code
hostname: shell
path: /home/replicant
path: /home
difficulty: basic
timelimit: 420
---
Expand Down Expand Up @@ -58,7 +58,7 @@ spec:
```

You can view the file in the Manifest Editor tab or from the command line.
Let's try colelcting a support bunglde with it..
Let's try collecting a support bunglde with it.

```
kubectl support-bundle ./simplest-support-bundle.yaml
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
slug: additional-information
id: sxl90k6n2bmz
id: 9nq6zzdmcawq
type: challenge
title: Collecting and Analyzing Additional Information
teaser: |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
slug: adding-to-the-chart
id: vvxrunt3e7zu
id: 5gjk0ex2xofz
type: challenge
title: Adding the Support Bundle to the Harbor Helm Chart
teaser: Learn how to incorporate your support bundle into your chart
Expand Down Expand Up @@ -129,12 +129,12 @@ Repackaging Your Chart
======================

To distribute your support bundle, you should bump the version number in
`harbor/Chart.yaml` (from `16.8.0` to `16.9.0`) adn then repackage it. You can edit
`harbor/Chart.yaml` (from `19.3.0` to `19.4.0`) adn then repackage it. You can edit
the version in the Manifest Editor or run the following command to do it from
the shell.

```
yq -i '.version = "16.9.0"' harbor/Chart.yaml
yq -i '.version = "19.4.0"' harbor/Chart.yaml
```

and run the `helm package` command to package the updated version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ if [[ ! -f /home/replicant/harbor/templates/troubleshoot/support-bundle.yaml ]]
let "result = result + 1"
fi

if [[ "$(helm template /home/replicant/harbor | yq 'select( .kind == "Secret" ) | select( .metadata.labels."troubleshoot.sh/kind" == "support-bundle" ) | .stringData | has("support-bundle-spec")')" == "true" ]] ; then
if [[ "$(helm template /home/replicant/harbor | yq 'select( .kind == "Secret" ) | select( .metadata.labels."troubleshoot.sh/kind" == "support-bundle" ) | .stringData | has("support-bundle-spec")' | head -1)" == "true" ]] ; then
set +e pipefail
analyzer_results="$(helm template /home/replicant/harbor | kubectl support-bundle --interactive=false --kubeconfig /home/replicant/.kube/config -)"
set -e pipefail
else
fail-message 'Please add your preflight checks to the preflights template file'
fail-message 'Please add your support bundle definition to the support bundle template file'
let "result = result + 1"
fi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This set line ensures that all failures will cause the script to error and exit
set -euxo pipefail

cat <<HARBOR_SUPPORT_BUNDLE > /home/replicant/harbor/templates/support-bundle.yaml
cat <<HARBOR_SUPPORT_BUNDLE > /home/replicant/harbor/templates/troubelshoot/support-bundle.yaml
apiVersion: v1
kind: Secret
metadata:
Expand Down Expand Up @@ -221,6 +221,6 @@ stringData:
The Trivy image scanner is running on this cluster and ready for use.
HARBOR_SUPPORT_BUNDLE

yq -i '.version = "16.9.0"' /home/replicant/harbor/Chart.yaml
yq -i '.version = "19.4.0"' /home/replicant/harbor/Chart.yaml
helm package /home/replicant/harbor --destination /home/replicant/release
chown -R replicant /home/replicant/harbor /home/replicant/release
Loading

0 comments on commit 646fad0

Please sign in to comment.