Skip to content

Instantly share code, notes, and snippets.

@sh0rez
Created January 15, 2020 19:36
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sh0rez/a78de9f807eef5e9e29faa302489dc45 to your computer and use it in GitHub Desktop.
Save sh0rez/a78de9f807eef5e9e29faa302489dc45 to your computer and use it in GitHub Desktop.
Creating ConfigMaps with Grafana Tanka
(import "ksonnet-util/kausal.libsonnet") + {
local configMap = $.core.v1.configMap,
local deploy = $.apps.v1.deployment,
local container = $.core.v1.container,
// the data for the configMap
myConfigData:: {
"foo.yml": std.manifestYamlDoc({
foo: "bar",
list: [1,2,3],
object: {
"my key": "contains a space!",
}
}),
},
// create a new configMap using the above data
configMap: configMap.new("my-cool-config") +
configMap.withData($.myConfigData),
// create a deployment that mounts the configMap
deployment: deploy.new(
name="myapp",
replicas=1,
containers=[container.new("app", "alpine:edge")],
) + $.util.configMapVolumeMount($.configMap, "/path/to/mountpoint"),
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment