Created
June 1, 2020 16:18
-
-
Save lawrencejones/a504f88e764e992bc3ffecc7f6f165a4 to your computer and use it in GitHub Desktop.
Theatre auto-generated CRDs
This file contains hidden or 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
local k8s = (import 'k8s.libsonnet'); | |
local fn = { | |
mapContainers(f):: { | |
local podContainers = super.spec.template.spec.containers, | |
spec+: { | |
template+: { | |
spec+: { | |
containers: std.map(f, podContainers), | |
}, | |
}, | |
}, | |
}, | |
mapContainersWithName(names, f):: | |
local nameSet = if std.type(names) == 'array' then std.set(names) else std.set([names]); | |
local inNameSet(name) = std.length(std.setInter(nameSet, std.set([name]))) > 0; | |
self.mapContainers(function(c) if std.objectHas(c, 'name') && inNameSet(c.name) then f(c) else c), | |
}; | |
k8s + { | |
core:: k8s.core + { | |
v1:: k8s.core.v1 + { | |
list:: { | |
new(items):: { | |
apiVersion: 'v1', | |
} + { | |
kind: 'List', | |
} + self.items(items), | |
items(items):: if std.type(items) == 'array' then { items+: items } else { items+: [items] }, | |
}, | |
}, | |
}, | |
} |
This file contains hidden or 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
{ | |
__ksonnet: { | |
"k8s.io": { | |
checksum: 'a7ae228407e3ecbb29d27de07282b3ace4f9dc7c4126dcab739bee39fb208d29', | |
generator: { | |
vendor: 'github.com/kube-jsonnet/k', | |
version: 'dev', | |
}, | |
maintainer: 'kube-jsonnet', | |
version: '1.0.0', | |
}, | |
}, | |
_hidden:: (import '_hidden.libsonnet'), | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment