Skip to content

Instantly share code, notes, and snippets.

@x95castle1
Last active May 23, 2024 17:59
Show Gist options
  • Save x95castle1/92454a86975d3431baf8ec997bbc977d to your computer and use it in GitHub Desktop.
Save x95castle1/92454a86975d3431baf8ec997bbc977d to your computer and use it in GitHub Desktop.
This gist shows how you can upgrade a single tap package. This example shows how to upgrade only tap-gui to a future version.

In order to upgrade only the tap-gui package to a different version of Tap you can do the following:

  1. Relocate the images for the target version of TAP you plan on using for tap-gui. Most likely 1.9.1 that contains the tap-gui performance fixes.
  2. Apply '02-tap-gui-version-overlay.yaml' onto your cluster. This will create a new package repository with the latest versions.
  3. If you are using GitOps RI then add the annotation from the example in 03-tap-pkgi.yaml to overlay the updated version to the tap-gui package. Example pathing:
  • clusters//cluster-config/config/tap-install/.tanzu-managed/pkgi.yaml

You can also just annotate the tap package imperatively:

k annotate packageinstall tap -n tap-install ext.packaging.carvel.dev/ytt-paths-from-secret-name.99=tap-gui-version-overlay
---
apiVersion: packaging.carvel.dev/v1alpha1
kind: PackageRepository
metadata:
name: tap-repository-1-9-1
namespace: tap-install
spec:
fetch:
imgpkgBundle:
image: registry.tanzu.vmware.com/vmware-tap-packages/tap-packages:1.9.1
---
apiVersion: v1
kind: Secret
metadata:
name: tap-gui-version-overlay
namespace: tap-install
stringData:
overlay-tap-pkgi.yml: |
#@ load("@ytt:overlay", "overlay")
#@overlay/match by=overlay.subset({"kind": "PackageInstall", "metadata": {"name": "tap-gui"}}), expects="0+"
---
spec:
packageRef:
versionSelection:
constraints: 1.9.2
# This only applies if you are doing TAP GitOps RI.
apiVersion: packaging.carvel.dev/v1alpha1
kind: PackageInstall
metadata:
name: tap
namespace: tap-install
annotations:
ext.packaging.carvel.dev/ytt-paths-from-secret-name.99: tap-gui-version-overlay # Annotation to apply overlay to tap-gui package
kapp.k14s.io/change-group: pkgi
kapp.k14s.io/change-rule.0: "upsert after upserting pkgr"
kapp.k14s.io/change-rule.1: "delete before deleting pkgr"
spec:
serviceAccountName: tap-installer-sa
packageRef:
refName: tap.tanzu.vmware.com
versionSelection:
constraints: #@ data.values.tap_install.version.package_version
values:
- secretRef:
name: tap-values
- secretRef:
name: tap-sensitive-values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment