Skip to content

Instantly share code, notes, and snippets.

@x95castle1
Last active February 10, 2025 17:06
Show Gist options
  • Select an option

  • Save x95castle1/600a7a843859f21324763719e1f04158 to your computer and use it in GitHub Desktop.

Select an option

Save x95castle1/600a7a843859f21324763719e1f04158 to your computer and use it in GitHub Desktop.
#@ load("@ytt:overlay", "overlay")
#@ def with_name():
volumeClaimTemplate:
spec:
#@overlay/replace
accessModes:
- ReadWriteMany
#@overlay/match missing_ok=True
storageClassName: sc-tekton
#@ end
#@overlay/match by=overlay.subset({"kind": "Component"})
---
spec:
pipelineRun:
workspaces:
#@overlay/match by=lambda idx, left, right: "volumeClaimTemplate" in left, expects="1+"
#@overlay/replace via=lambda left, right: overlay.apply(left, with_name())
-
apiVersion: supply-chain.apps.tanzu.vmware.com/v1alpha1
kind: Component
metadata:
labels:
supply-chain.apps.tanzu.vmware.com/catalog: tanzu
name: git-writer-1.0.0
namespace: git-writer-catalog
resourceVersion: "26749"
uid: 5de5567e-c876-4d4e-8c6e-ee9066a5ffa9
spec:
config:
- path: spec.gitOps
schema:
properties:
branch:
default: main
description: the branch to commit changes to
type: string
subPath:
default: ""
description: the relative path within the gitops repository to add the package
configuration to.
example: my-project/spaces/my-app-staging
type: string
url:
description: the repository to push the pull request to
example: https://github.com/my-org/my-gitops-repo
type: string
required:
- url
type: object
description: Writes carvel package config directly to a gitops repository
inputs:
- name: package
type: package
pipelineRun:
params:
- name: package-url
value: $(inputs.package.url)
- name: workload-name
value: $(workload.metadata.name)
- name: gitops-url
value: $(workload.spec.gitOps.url)
- name: commit-branch
value: $(workload.spec.gitOps.branch)
- name: base-branch
value: $(workload.spec.gitOps.branch)
- name: git-user
value: Cartographer v2
- name: git-email
value: [email protected]
- name: git-commit-message
value: New Commit
- name: sub-path
value: $(workload.spec.gitOps.subPath)
- name: git-files
value: ""
pipelineRef:
name: git-writer
taskRunSpecs:
- pipelineTaskName: fetch
podTemplate:
securityContext:
fsGroup: 1000
runAsGroup: 1000
runAsUser: 1001
- pipelineTaskName: clone-gitops-repo
podTemplate:
securityContext:
fsGroup: 1000
runAsGroup: 1000
runAsUser: 1001
- pipelineTaskName: write
podTemplate:
securityContext:
fsGroup: 1000
runAsGroup: 1000
runAsUser: 1001
workspaces:
- name: package-config
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
- name: gitops-repo
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: sc-tekton
parameters:
type: pd-balanced
provisioner: pd.csi.storage.gke.io
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer
allowedTopologies:
- matchLabelExpressions:
- key: topology.kubernetes.io/zone
values:
- us-west2-a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment