Skip to content

Commit

Permalink
feat!: add inline environments support
Browse files Browse the repository at this point in the history
Signed-off-by: irizzant <[email protected]>
  • Loading branch information
irizzant committed Jan 4, 2022
1 parent 9ef7fe5 commit 99ca06b
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
26 changes: 26 additions & 0 deletions example/tk/inline/clusters.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[
{
// import the microservices example
local tempo = import '../tempo-microservices/main.jsonnet',

name: 'cluster name',
apiServer: 'https://0.0.0.0:6443',
namespace: 'namespace',

data: tempo,

dataOverride: {
_images+:: {
// images can be overridden here if desired
},

_config+:: {

// config can be overridden here if desired

},

},

},
]
29 changes: 29 additions & 0 deletions example/tk/inline/main.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
local clusters = import 'clusters.libsonnet';
local tanka = import 'github.com/grafana/jsonnet-libs/tanka-util/main.libsonnet';

{
environment(cluster)::
tanka.environment.new(
name='grafana/' + cluster.name,
namespace=cluster.namespace,
apiserver=cluster.apiServer,
)
+ tanka.environment.withLabels({ cluster: cluster.name })
+ tanka.environment.withData( cluster.data {

_config+:: {
namespace: cluster.namespace,
},

} + cluster.dataOverride)
+ {
spec+: {
injectLabels: true,
},
},

envs: {
[cluster.name]: $.environment(cluster)
for cluster in clusters
},
}

0 comments on commit 99ca06b

Please sign in to comment.