Skip to content

Instantly share code, notes, and snippets.

@evankanderson
Last active August 5, 2022 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evankanderson/cbfb3c0bb630297b2e86783c1e983f99 to your computer and use it in GitHub Desktop.
Save evankanderson/cbfb3c0bb630297b2e86783c1e983f99 to your computer and use it in GitHub Desktop.
...
- name: config-provider
templateRef:
kind: ClusterConfigTemplate
name: convention-template
params:
- name: serviceAccount
value: default
images:
- resource: image-provider
name: image
- name: app-config
templateRef:
kind: ClusterConfigTemplate
name: appconfig-template
configs:
- resource: config-provider
name: config
- name: service-bindings
templateRef:
kind: ClusterConfigTemplate
name: apply-bindings
configs:
- resource: app-config
name: app_def
...
---
apiVersion: carto.run/v1alpha1
kind: ClusterConfigTemplate
metadata:
name: appconfig-template
spec:
configPath: '.status.resources[?(@.name="appconfig")].outputs'
healthRule:
alwaysHealthy: {}
template:
apiVersion: carto.run/v1alpha1
kind: Workload
metadata:
name: $(workload.metadata.name)$-appconfig
labels:
tanzu-workload-type: $(workload.metadata.labels["apps.tanzu.vmware.com/workload-type"])$
spec:
params:
- name: podIntent
value: $(config)$
- name: workloadName
value: $(workload.metadata.name)$
apiVersion: carto.run/v1alpha1
kind: ClusterConfigTemplate
metadata:
name: knative-template
spec:
configPath: .data
healthRule:
alwaysHealthy: {}
ytt: |
#@ load("@ytt:data", "data")
#@ def delivery():
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: #@ data.values.workloadName
spec:
template: #@ data.values.config
#@ end
---
apiVersion: v1
kind: ConfigMap
metadata:
name: #@ data.values.workloadName
data:
delivery.yml: #@ yaml.encode(delivery())
---
apiVersion: carto.run/v1alpha1
kind: ClusterSupplyChain
metadata:
name: web-app-config
spec:
selector:
tanzu-workload-type: web
params:
- name: podIntent
- name: workloadName
resources:
- name: appconfig # Note: name must match supplychain.yml, line 43 in the templated Workload
templateRef:
kind: ClusterConfigTemplate
name: knative-template
# Params are carried through
apiVersion: carto.run/v1alpha1
kind: ClusterConfigTemplate
metadata:
name: worker-template
spec:
configPath: .data
healthRule:
alwaysHealthy: {}
ytt: |
#@ load("@ytt:data", "data")
#@ def delivery():
apiVersion: apps/v1
kind: Deployment
metadata:
name: #@ data.values.workloadName
spec:
selector:
matchLabels: #@ data.values.config.metadata.labels
template: #@ data.values.config
#@ end
---
apiVersion: v1
kind: ConfigMap
metadata:
name: #@ data.values.workloadName
data:
delivery.yml: #@ yaml.encode(delivery())
---
apiVersion: carto.run/v1alpha1
kind: ClusterSupplyChain
metadata:
name: worker-app-config
spec:
selector:
tanzu-workload-type: worker
params:
- name: podIntent
- name: workloadName
resources:
- name: appconfig # Note: name must match supplychain.yml, line 43 in the templated Workload
templateRef:
kind: ClusterConfigTemplate
name: worker-template
# Params are carried through
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment