-
Notifications
You must be signed in to change notification settings - Fork 6
/
kubernetes.jsonnet
31 lines (29 loc) · 975 Bytes
/
kubernetes.jsonnet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
local k = import 'github.com/ksonnet/ksonnet-lib/ksonnet.beta.4/k.libsonnet';
local service = k.core.v1.service;
local servicePort = service.mixin.spec.portsType;
local deployment = k.apps.v1.deployment;
local container = deployment.mixin.spec.template.spec.containersType;
local containerPort = container.portsType;
local name = 'slo-libsonnet-web';
local image = 'quay.io/metalmatze/slo-libsonnet-web:%s' % std.extVar('tag');
local labels = { 'app.kubernetes.io/name': name };
k.core.v1.list.new([
service.new(
name,
labels,
[servicePort.newNamed('http', 9099, 9099)]
),
deployment.new(
name,
1,
container.new(
name,
image,
) +
container.withPorts(containerPort.newNamed(9099, 'http')) +
container.mixin.resources.withRequests({ cpu: '100m', memory: '64Mi' }) +
container.mixin.resources.withLimits({ cpu: '250m', memory: '256Mi' }),
labels,
) +
deployment.mixin.spec.selector.withMatchLabels(labels),
])