Debian Codegraph @

case_studies/kubernetes/kube.libsonnet

raw
1 # Copyright 2015 Google Inc. All rights reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 /** A collection of templates and utility functions to make it easier to configure Kubernetes
16 * workloads.
17 */
18 {
19 v1:: {
20
21 local ApiVersion = { apiVersion: "v1" },
22
23 local Metadata(name) = {
24 metadata: {
25 name: name,
26 labels: {
27 name: name,
28 },
29 },
30 },
31
32 ReplicationController(name): ApiVersion + Metadata(name) {
33 kind: "ReplicationController",
34 },
35
36 Service(name): ApiVersion + Metadata(name) {
37 kind: "Service",
38 },
39 },
40
41 pair_list_ex(tab, kfield, vfield)::
42 [{ [kfield]: k, [vfield]: tab[k] } for k in std.objectFields(tab)],
43
44 pair_list(tab)::
45 self.pair_list_ex(tab, "name", "value"),
46 }