Skip to content

Instantly share code, notes, and snippets.

@x95castle1
x95castle1 / 01-overlay.yaml
Last active July 24, 2024 20:56
Inject New Document into existing Package
#@ load("@ytt:overlay", "overlay")
#@overlay/match by=overlay.subset({"kind":"Deployment","metadata":{"name":"server"}}), expects="1+"
---
spec:
#@overlay/replace via=lambda left, _: left
replicas:
---
apiVersion: policy/v1
kind: PodDisruptionBudget
@x95castle1
x95castle1 / 01-overlay.yaml
Last active July 22, 2024 19:50
Overlay a PodIntent generated by ClusterConfigTemplate
#@ load("@ytt:overlay", "overlay")
#@ load("@ytt:data", "data")
#@ load("@ytt:yaml", "yaml")
#@ def convention_template():
kind: ClusterConfigTemplate
metadata:
name: convention-template
#@ end
@x95castle1
x95castle1 / 01-values.yaml
Last active July 24, 2024 18:12
Gist to add HPA and PDB to Carvel Packages produced by TAP.
#@data/values
---
workload_name: jeremy
hpa:
enabled: true
minReplicas: 5
maxReplicas: 10
metrics:
- type: Resource
resource:
@x95castle1
x95castle1 / 01-server-with-sso-template.yaml
Last active July 10, 2024 13:31
Custom Workload Type for SSO Workloads with Sticky Sessions
# This should be installed on your build cluster
apiVersion: carto.run/v1alpha1
kind: ClusterConfigTemplate
metadata:
name: server-with-sso-template
annotations:
doc: |
This template consumes an input named config which contains a
PodTemplateSpec and returns a ConfigMap which contains a
"delivery.yml" which contains a manifests for a Kubernetes
@x95castle1
x95castle1 / 01-overlay.yaml
Last active June 12, 2024 23:06
Overlay to update HPA Autoscaler Defaults for Tekton
#@ load("@ytt:overlay", "overlay")
#@overlay/match by=overlay.subset({"kind": "HorizontalPodAutoscaler", "metadata": {"name": "tekton-pipelines-webhook"}}), expects="1+"
---
spec:
#@overlay/match missing_ok=True
maxReplicas: 20
minReplicas: 10
#@overlay/remove
metrics:
@x95castle1
x95castle1 / 01-README.md
Last active May 23, 2024 17:59
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:

@x95castle1
x95castle1 / 01-overlay.yaml
Last active May 3, 2024 14:00
Updated TAP GUI HTTPProxy to handle Session Affinity
#@ load("@ytt:overlay", "overlay")
#@overlay/match by=overlay.subset({"kind":"HTTPProxy","metadata":{"name":"tap-gui"}})
---
spec:
routes:
#@overlay/match by=overlay.subset({"services": [{"name": "server"}]})
- services: []
#@overlay/match missing_ok=True
loadBalancerPolicy:
strategy: Cookie
@x95castle1
x95castle1 / 01-overlay.yaml
Last active May 2, 2024 16:41
Add Downgradable to all Packages
#@ load("@ytt:overlay", "overlay")
#@ def match_packageinstall():
kind: PackageInstall
#@ end
#@overlay/match by=overlay.subset(match_packageinstall()), expects="1+"
---
metadata:
#@overlay/match missing_ok=True
@x95castle1
x95castle1 / 01-overlay.yaml
Created April 25, 2024 12:43
Add Labels to All TAP Namespaces During Installation
#@ load("@ytt:overlay", "overlay")
#@ def match_packageinstall():
kind: PackageInstall
#@ end
---
apiVersion: v1
kind: Secret
metadata:
@x95castle1
x95castle1 / 01-package.yaml
Created April 12, 2024 16:10
Alter a Package to add inline overlay
apiVersion: data.packaging.carvel.dev/v1alpha1
kind: Package
metadata:
name: tap.tanzu.vmware.com.1.8.1
namespace: tap-install
spec:
template:
spec:
deploy:
- kapp: {}