Skip to content

Commit 997ca97

Browse files
docs: fix k-lib usage (#1524)
1 parent df800a9 commit 997ca97

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/src/content/docs/tutorial/k-lib.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,24 +125,24 @@ local k = import "github.com/grafana/jsonnet-libs/ksonnet-util/kausal.libsonnet"
125125
// use locals to extract the parts we need
126126
local deployment = k.apps.v1.deployment,
127127
local container = k.core.v1.container,
128-
local port = k.core.v1.containerPort,
128+
local containerPort = k.core.v1.containerPort,
129129
local service = k.core.v1.service,
130130
// defining the objects:
131131
new(name, port):: {
132132
// deployment constructor: name, replicas, containers
133133
deployment: deployment.new(name, replicas=1, containers=[
134134
// container constructor
135-
container.new(, "grafana/grafana")
136-
+ container.withPorts( // add ports to the container
137-
[port.new("ui", 3000)] // port constructor
138-
),
135+
container.new('grafana', 'grafana/grafana')
136+
+ container.withPorts([ // add ports to the container
137+
containerPort.newNamed(name='ui', containerPort=3000),
138+
]),
139139
]),
140140
141141
// instead of using a service constructor, our wrapper provides
142142
// a handy helper to automatically generate a service for a Deployment
143-
service: k.util.serv.util.serviceFor(self.deployment)
144-
+ service.mixin.spec.withType("NodePort"),
145-
}
143+
service: k.util.serviceFor(self.deployment)
144+
+ service.mixin.spec.withType('NodePort'),
145+
},
146146
}
147147
```
148148

0 commit comments

Comments
 (0)