Skip to content

Commit 6ecbb77

Browse files
grafanalfjsonnet-libs-bot
authored andcommitted
update: source github.com/jsonnet-libs/k8s@ee35f1fc
1 parent bf9a62c commit 6ecbb77

File tree

1,179 files changed

+118737
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,179 files changed

+118737
-2
lines changed

1.30/_custom/apps.libsonnet

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
local gen = import '../gen.libsonnet';
2+
local d = import 'doc-util/main.libsonnet';
3+
4+
local patch = {
5+
daemonSet+: {
6+
'#new'+: d.func.withArgs([
7+
d.arg('name', d.T.string),
8+
d.arg('containers', d.T.array),
9+
d.arg('podLabels', d.T.object, {}),
10+
]),
11+
new(
12+
name,
13+
containers=[],
14+
podLabels={}
15+
)::
16+
local labels = { name: name } + podLabels;
17+
super.new(name)
18+
+ super.spec.template.spec.withContainers(containers)
19+
+ super.spec.template.metadata.withLabels(labels)
20+
+ super.spec.selector.withMatchLabels(labels),
21+
},
22+
deployment+: {
23+
'#new'+: d.func.withArgs([
24+
d.arg('name', d.T.string),
25+
d.arg('replicas', d.T.int, 1),
26+
d.arg('containers', d.T.array),
27+
d.arg('podLabels', d.T.object, {}),
28+
]),
29+
new(
30+
name,
31+
replicas=1,
32+
containers=error 'containers unset',
33+
podLabels={},
34+
)::
35+
local labels = { name: name } + podLabels;
36+
super.new(name)
37+
+ (if replicas == null then {} else super.spec.withReplicas(replicas))
38+
+ super.spec.template.spec.withContainers(containers)
39+
+ super.spec.template.metadata.withLabels(labels)
40+
+ super.spec.selector.withMatchLabels(labels),
41+
},
42+
43+
statefulSet+: {
44+
'#new'+: d.func.withArgs([
45+
d.arg('name', d.T.string),
46+
d.arg('replicas', d.T.int, 1),
47+
d.arg('containers', d.T.array),
48+
d.arg('volumeClaims', d.T.array, []),
49+
d.arg('podLabels', d.T.object, {}),
50+
]),
51+
new(
52+
name,
53+
replicas=1,
54+
containers=error 'containers unset',
55+
volumeClaims=[],
56+
podLabels={},
57+
)::
58+
local labels = { name: name } + podLabels;
59+
super.new(name)
60+
+ super.spec.withReplicas(replicas)
61+
+ super.spec.template.spec.withContainers(containers)
62+
+ super.spec.template.metadata.withLabels(labels)
63+
+ super.spec.selector.withMatchLabels(labels)
64+
65+
// remove volumeClaimTemplates if empty
66+
// (otherwise it will create a diff all the time)
67+
+ (
68+
if std.length(volumeClaims) > 0
69+
then super.spec.withVolumeClaimTemplates(volumeClaims)
70+
else {}
71+
),
72+
},
73+
};
74+
75+
{
76+
apps+: {
77+
v1+: patch,
78+
},
79+
}

1.30/_custom/autoscaling.libsonnet

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
local d = import 'doc-util/main.libsonnet';
2+
3+
local withApiVersion = {
4+
'#withApiVersion':: d.fn(help='API version of the referent', args=[d.arg(name='apiversion', type=d.T.string)]),
5+
withApiVersion(apiversion): { apiVersion: apiversion },
6+
};
7+
8+
9+
local withScaleTargetRef = {
10+
'#withScaleTargetRef':: d.fn(help='Set spec.ScaleTargetRef to `object`', args=[d.arg(name='object', type=d.T.object)]),
11+
withScaleTargetRef(object):
12+
{ spec+: { scaleTargetRef+: {
13+
apiVersion: object.apiVersion,
14+
kind: object.kind,
15+
name: object.metadata.name,
16+
} } },
17+
};
18+
19+
local patch = {
20+
crossVersionObjectReference+: withApiVersion,
21+
horizontalPodAutoscaler+: {
22+
spec+: withScaleTargetRef,
23+
},
24+
};
25+
26+
{
27+
autoscaling+: {
28+
v1+: patch,
29+
v2+: patch,
30+
},
31+
}

1.30/_custom/batch.libsonnet

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
local d = import 'doc-util/main.libsonnet';
2+
3+
local patch = {
4+
cronJob+: {
5+
'#new'+: d.func.withArgs([
6+
d.arg('name', d.T.string),
7+
d.arg('schedule', d.T.string),
8+
d.arg('containers', d.T.array),
9+
]),
10+
new(
11+
name,
12+
schedule='',
13+
containers=[]
14+
)::
15+
super.new(name)
16+
+ super.spec.withSchedule(schedule)
17+
+ super.spec.jobTemplate.spec.template.spec.withContainers(containers)
18+
+ super.spec.jobTemplate.spec.template.metadata.withLabels({ name: name }),
19+
},
20+
};
21+
22+
{
23+
batch+: {
24+
v1+: patch,
25+
},
26+
}

0 commit comments

Comments
 (0)