Skip to content

Instantly share code, notes, and snippets.

piVersion: packaging.carvel.dev/v1alpha1
kind: PackageRepository
metadata:
name: tanzu-standard-repo-tmc
namespace: tap-install
spec:
fetch:
imgpkgBundle:
image: extensions.aws-usw2.tmc.cloud.vmware.com/packages/standard/repo:v2024.4.19
@x95castle1
x95castle1 / 01-overlay.yaml
Created September 11, 2024 13:43
Add Dangerous Flags to Carvel to only focus on the Namespace the App is running
#@ load("@ytt:overlay", "overlay")
#@ def deploy_template():
kind: ClusterDeploymentTemplate
metadata:
name: app-deploy
#@ end
#@overlay/match by=overlay.subset(deploy_template())
---
@x95castle1
x95castle1 / 01-workload.yaml
Last active August 19, 2024 18:54
Example GIST that demonstrates how to add a custom param for tolerations onto a Pod Intent
#@data/values
---
workload:
metadata:
name: test
labels:
test: test
spec:
params:
ports: 8080
@x95castle1
x95castle1 / 01-overlay.yaml
Last active August 16, 2024 13:16
Increase TAP GUI HTTPProxy Timeout
apiVersion: v1
kind: Secret
metadata:
name: tap-gui-timeout-overlay
namespace: tap-install
stringData:
tap-gui-timeout-overlay.yaml: |
#@ load("@ytt:overlay", "overlay")
#@overlay/match by=overlay.subset({"kind": "HTTPProxy", "metadata": {"name": "tap-gui"}})
---
@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 / delete-service-account-tokens.sh
Created July 9, 2024 13:23
Cleanup Service Account Tokens
#!/bin/bash
# Function to find the index of the secret to be removed
find_secret_index() {
local secret_name=$1
local sa_secrets=("${@:2}")
local index=0
for secret in "${sa_secrets[@]}"; do
if [[ "$secret" == *"$secret_name"* ]]; then
@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: