From a26a4a521b0fa14aa8f1c9311e0de11e0b1cf7ff Mon Sep 17 00:00:00 2001 From: Graham Dumpleton Date: Wed, 20 Jul 2022 16:03:34 +1000 Subject: [PATCH] Install Contour to virtual cluster using App instead of Package/PackageInstall. --- .../training-platform/config/images.yaml | 1 + .../handlers/application_vcluster.py | 52 ++++++------------- 2 files changed, 17 insertions(+), 36 deletions(-) diff --git a/carvel-packages/training-platform/config/images.yaml b/carvel-packages/training-platform/config/images.yaml index d9749e9f..7a897efa 100644 --- a/carvel-packages/training-platform/config/images.yaml +++ b/carvel-packages/training-platform/config/images.yaml @@ -40,4 +40,5 @@ imageVersions: - name: loftsh-vcluster image: "loftsh/vcluster:0.7.1" - name: contour-bundle + #! contour.community.tanzu.vmware.com.1.20.1 image: projects.registry.vmware.com/tce/contour@sha256:0128c3458d57cd637c198b3a6377bb1eca6e23301f27710ac29d9d0ee1c5bd09 diff --git a/session-manager/handlers/application_vcluster.py b/session-manager/handlers/application_vcluster.py index 4a61f3f6..4d023955 100644 --- a/session-manager/handlers/application_vcluster.py +++ b/session-manager/handlers/application_vcluster.py @@ -435,34 +435,6 @@ def vcluster_session_objects_list(workshop_spec, application_properties): if ingress_enabled: objects.extend( [ - { - "apiVersion": "data.packaging.carvel.dev/v1alpha1", - "kind": "Package", - "metadata": { - "name": "contour.community.tanzu.vmware.com.1.20.1", - "namespace": "$(session_namespace)-vc", - }, - "spec": { - "refName": "contour.community.tanzu.vmware.com", - "version": "1.20.1", - "releaseNotes": "contour 1.20.1 https://github.com/projectcontour/contour/releases/tag/v1.20.1", - "releasedAt": "2022-02-24T00:00:00Z", - "licenses": ["Apache 2.0"], - "template": { - "spec": { - "fetch": [ - {"imgpkgBundle": {"image": CONTOUR_BUNDLE_IMAGE}} - ], - "template": [ - {"ytt": {"paths": ["config/"]}}, - {"kbld": {"paths": ["-", ".imgpkg/images.yml"]}}, - ], - "deploy": [{"kapp": {}}], - } - }, - "capacityRequirementsDescription": "Varies significantly based on number of Services, Ingresses/HTTPProxies, etc. A starting point is 128MB RAM and 0.5 CPU for each Contour and Envoy pod, but this can and should be tuned based on observed usage.", - }, - }, { "apiVersion": "v1", "kind": "Secret", @@ -475,18 +447,13 @@ def vcluster_session_objects_list(workshop_spec, application_properties): }, }, { - "apiVersion": "packaging.carvel.dev/v1alpha1", - "kind": "PackageInstall", + "apiVersion": "kappctrl.k14s.io/v1alpha1", + "kind": "App", "metadata": { - "name": "contour", + "name": "contour.community.tanzu.vmware.com.1.20.1", "namespace": "$(session_namespace)-vc", }, "spec": { - "packageRef": { - "refName": "contour.community.tanzu.vmware.com", - "versionSelection": {"constraints": "1.20.1"}, - }, - "values": [{"secretRef": {"name": "contour-values"}}], "cluster": { "namespace": "default", "kubeconfigSecretRef": { @@ -494,6 +461,19 @@ def vcluster_session_objects_list(workshop_spec, application_properties): "key": "config", }, }, + "fetch": [{"imgpkgBundle": {"image": CONTOUR_BUNDLE_IMAGE}}], + "template": [ + { + "ytt": { + "paths": ["config/"], + "valuesFrom": [ + {"secretRef": {"name": "contour-values"}} + ], + } + }, + {"kbld": {"paths": ["-", ".imgpkg/images.yml"]}}, + ], + "deploy": [{"kapp": {}}], "noopDelete": True, "syncPeriod": "24h", },