-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update: source github.com/jsonnet-libs/k8s@c69bea2f
- Loading branch information
1 parent
44a9f3d
commit 3e32f80
Showing
1,077 changed files
with
111,866 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
local d = import 'doc-util/main.libsonnet'; | ||
local gen = import '../gen.libsonnet'; | ||
|
||
local patch = { | ||
daemonSet+: { | ||
'#new'+: d.func.withArgs([ | ||
d.arg('name', d.T.string), | ||
d.arg('containers', d.T.array), | ||
d.arg('podLabels', d.T.object, {}), | ||
]), | ||
new( | ||
name, | ||
containers=[], | ||
podLabels={} | ||
):: | ||
local labels = { name: name } + podLabels; | ||
super.new(name) | ||
+ super.spec.template.spec.withContainers(containers) | ||
+ super.spec.template.metadata.withLabels(labels) | ||
+ super.spec.selector.withMatchLabels(labels), | ||
}, | ||
deployment+: { | ||
'#new'+: d.func.withArgs([ | ||
d.arg('name', d.T.string), | ||
d.arg('replicas', d.T.int, 1), | ||
d.arg('containers', d.T.array), | ||
d.arg('podLabels', d.T.object, {}), | ||
]), | ||
new( | ||
name, | ||
replicas=1, | ||
containers=error 'containers unset', | ||
podLabels={}, | ||
):: | ||
local labels = { name: name } + podLabels; | ||
super.new(name) | ||
+ (if replicas == null then {} else super.spec.withReplicas(replicas)) | ||
+ super.spec.template.spec.withContainers(containers) | ||
+ super.spec.template.metadata.withLabels(labels) | ||
+ super.spec.selector.withMatchLabels(labels), | ||
}, | ||
|
||
statefulSet+: { | ||
'#new'+: d.func.withArgs([ | ||
d.arg('name', d.T.string), | ||
d.arg('replicas', d.T.int, 1), | ||
d.arg('containers', d.T.array), | ||
d.arg('volumeClaims', d.T.array, []), | ||
d.arg('podLabels', d.T.object, {}), | ||
]), | ||
new( | ||
name, | ||
replicas=1, | ||
containers=error 'containers unset', | ||
volumeClaims=[], | ||
podLabels={}, | ||
):: | ||
local labels = { name: name } + podLabels; | ||
super.new(name) | ||
+ super.spec.withReplicas(replicas) | ||
+ super.spec.template.spec.withContainers(containers) | ||
+ super.spec.template.metadata.withLabels(labels) | ||
+ super.spec.selector.withMatchLabels(labels) | ||
|
||
// remove volumeClaimTemplates if empty | ||
// (otherwise it will create a diff all the time) | ||
+ ( | ||
if std.length(volumeClaims) > 0 | ||
then super.spec.withVolumeClaimTemplates(volumeClaims) | ||
else {} | ||
), | ||
}, | ||
}; | ||
|
||
{ | ||
[if std.objectHas(gen, 'extensions') then 'extensions']+: { // This was removed in v1.22 | ||
[if std.objectHas(gen.extensions, 'v1beta1') then 'v1beta1']+: patch, | ||
}, | ||
apps+: { | ||
v1+: patch, | ||
v1beta1+: patch, | ||
v1beta2+: patch, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
local d = import 'doc-util/main.libsonnet'; | ||
|
||
local withApiVersion = { | ||
'#withApiVersion':: d.fn(help='API version of the referent', args=[d.arg(name='apiversion', type=d.T.string)]), | ||
withApiVersion(apiversion): { apiVersion: apiversion }, | ||
}; | ||
|
||
|
||
local withScaleTargetRef = { | ||
'#withScaleTargetRef':: d.fn(help='Set spec.ScaleTargetRef to `object`', args=[d.arg(name='object', type=d.T.object)]), | ||
withScaleTargetRef(object): | ||
{ spec+: { scaleTargetRef+: { | ||
apiVersion: object.apiVersion, | ||
kind: object.kind, | ||
name: object.metadata.name, | ||
} } }, | ||
}; | ||
|
||
local patch = { | ||
crossVersionObjectReference+: withApiVersion, | ||
horizontalPodAutoscaler+: { | ||
spec+: withScaleTargetRef, | ||
}, | ||
}; | ||
|
||
{ | ||
autoscaling+: { | ||
v1+: patch, | ||
v2+: patch, | ||
v2beta1+: patch, | ||
v2beta2+: patch, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
local d = import 'doc-util/main.libsonnet'; | ||
|
||
local patch = { | ||
cronJob+: { | ||
'#new'+: d.func.withArgs([ | ||
d.arg('name', d.T.string), | ||
d.arg('schedule', d.T.string), | ||
d.arg('containers', d.T.array), | ||
]), | ||
new( | ||
name, | ||
schedule='', | ||
containers=[] | ||
):: | ||
super.new(name) | ||
+ super.spec.withSchedule(schedule) | ||
+ super.spec.jobTemplate.spec.template.spec.withContainers(containers) | ||
+ super.spec.jobTemplate.spec.template.metadata.withLabels({ name: name }), | ||
}, | ||
}; | ||
|
||
{ | ||
batch+: { | ||
v1+: patch, | ||
v1beta1+: patch, | ||
v2alpha1+: patch, | ||
}, | ||
} |
Oops, something went wrong.