-
-
Save cppforlife/11970157e82b2fc37989d8ed3098dc27 to your computer and use it in GitHub Desktop.
ytt example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ytt -f rebase.yml -f input.yml -f cluster.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type: | |
kind: Cluster | |
package: vmware.tanzu.manage.v1alpha1.cluster | |
version: v1alpha1 | |
fullName: | |
managementClusterName: "seti-labs" | |
name: cluster-cli | |
provisionerName: "lab" | |
meta: | |
labels: null | |
spec: | |
clusterGroupName: seti-labs | |
tkgServiceVsphere: | |
distribution: | |
version: v1.18.10+vmware.1-tkg.1.3a6cd48 | |
settings: | |
network: | |
pods: | |
cidrBlocks: | |
- 192.0.2.0/16 | |
services: | |
cidrBlocks: | |
- 198.51.100.0/12 | |
storage: | |
classes: | |
- k8s-storage-policy | |
defaultClass: "k8s-storage-policy" | |
topology: | |
controlPlane: | |
class: best-effort-medium | |
highAvailability: false | |
storageClass: k8s-storage-policy | |
nodePools: | |
- info: | |
description: default description for the nodepool | |
name: default-node-pool | |
spec: | |
tkgServiceVsphere: | |
class: best-effort-medium | |
storageClass: k8s-storage-policy | |
workerNodeCount: "1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fullName: | |
managementClusterName: seti-labs | |
name: cluster-cli | |
orgId: d8bdaf07-6e61-4310-92f3-8c52e24a2d54 | |
provisionerName: lab | |
meta: | |
annotations: | |
authoritativeRID: rid:c:d8bdaf07-6e61-4310-92f3-8c52e24a2d54:seti-labs:lab:cluster-cli | |
creationTime: "2021-07-29T15:58:55.248931Z" | |
labels: | |
tmc.cloud.vmware.com/creator: warroyo | |
parentReferences: | |
- rid: rid:cg:d8bdaf07-6e61-4310-92f3-8c52e24a2d54:seti-labs | |
uid: cg:01F1NCANC0FMN0SW6XBE4XZZ8H | |
- rid: rid:prvn:d8bdaf07-6e61-4310-92f3-8c52e24a2d54:seti-labs:lab | |
uid: prvn:01FAG4ZRWPB44MBJKPWAAREYXB | |
resourceVersion: 81730:31255308 | |
uid: c:01FBSFTXRJTG4QE97M4W2SNX2X | |
updateTime: "2021-07-29T19:30:43Z" | |
spec: | |
clusterGroupName: seti-labs | |
tkgServiceVsphere: | |
distribution: | |
version: v1.18.10+vmware.1-tkg.1.3a6cd48 | |
settings: | |
network: | |
pods: | |
cidrBlocks: | |
- 192.0.2.0/16 | |
services: | |
cidrBlocks: | |
- 198.51.100.0/12 | |
storage: | |
classes: | |
- k8s-storage-policy | |
defaultClass: k8s-storage-policy | |
topology: | |
controlPlane: | |
class: best-effort-medium | |
storageClass: k8s-storage-policy | |
status: | |
allocatedCpu: | |
allocatable: 4000 | |
allocatedPercentage: 79 | |
requested: 3180 | |
units: millicores | |
allocatedMemory: | |
allocatable: 15747 | |
allocatedPercentage: 19 | |
requested: 3066 | |
units: mb | |
conditions: | |
Agent-READY: | |
message: cluster is connected to TMC and healthy | |
reason: 'phase: COMPLETE, health: HEALTHY' | |
severity: INFO | |
status: "TRUE" | |
type: READY | |
WCM-Ready: | |
severity: INFO | |
status: "TRUE" | |
type: Ready | |
WCM-VersionIsLatest: | |
message: Version v1.20.7+vmware.1-tkg.1.7fb9067 is available for upgrade | |
severity: INFO | |
status: "FALSE" | |
type: VersionIsLatest | |
health: HEALTHY | |
healthDetails: | |
controllerManagerHealth: | |
message: Health status is unsupported for kube server version [v1.18.10+vmware.1]. | |
name: controller-manager | |
etcdHealth: | |
- health: HEALTHY | |
message: Healthy | |
name: etcd-0 | |
message: Cluster is healthy | |
schedulerHealth: | |
message: Health status is unsupported for kube server version [v1.18.10+vmware.1]. | |
name: scheduler | |
timestamp: "2021-07-29T19:21:54.366891Z" | |
infrastructureProvider: VMWARE_VSPHERE | |
kubeServerVersion: v1.18.10+vmware.1 | |
kubernetesProvider: | |
type: VMWARE_TANZU_KUBERNETES_GRID_SERVICE | |
nodeCount: "2" | |
phase: READY | |
type: TANZU_KUBERNETES_GRID_SERVICE | |
type: | |
kind: Cluster | |
package: vmware.tanzu.manage.v1alpha1.cluster | |
version: v1alpha1 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#@ load("@ytt:overlay", "overlay") | |
#@ load("@ytt:template", "template") | |
#@ load("@ytt:data", "data") | |
#@ load("@ytt:yaml", "yaml") | |
#! remove current state from the output | |
#@overlay/match by=lambda i,l,r: "uid" in l["meta"] | |
#@overlay/remove | |
--- | |
#! load current state into a variable | |
#@ current = yaml.decode(data.read("input.yml")) | |
#! combine desired state with current state | |
#@overlay/match by=overlay.all | |
--- | |
fullName: | |
#@overlay/match missing_ok=True | |
orgId: #@ current["fullName"]["orgId"] | |
#@yaml/text-templated-strings | |
meta: | |
#@ meta = current["meta"] | |
#@overlay/match missing_ok=True | |
annotations: | |
#@ for/end k in meta["annotations"]: | |
#@overlay/match when=0 | |
(@= k @): #@ meta["annotations"][k] | |
#@overlay/match missing_ok=True | |
labels: | |
#@ for/end k in meta["labels"]: | |
#@overlay/match when=0 | |
(@= k @): #@ meta["labels"][k] | |
#@ meta.pop("labels") | |
#@ meta.pop("annotations") | |
#@ for/end k in meta: | |
#@overlay/match missing_ok=True | |
(@= k @): #@ meta[k] | |
#@overlay/match missing_ok=True | |
status: #@ current["status"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment