blob: 5275f661a101db084cfc8516eb777b36efb9aef6 [file] [log] [blame]
Sergiusz Bazanski4d9e72c2019-01-13 22:06:33 +01001# Top level cluster configuration.
2
3local kube = import "../../kube/kube.libsonnet";
Sergiusz Bazanski49b9a132019-01-14 00:02:59 +01004local coredns = import "lib/coredns.libsonnet";
Sergiusz Bazanskiaf3be422019-01-17 18:57:19 +01005local metrics = import "lib/metrics.libsonnet";
6local calico = import "lib/calico.libsonnet";
Sergiusz Bazanski1e565dc2019-01-18 09:40:59 +01007local metallb = import "lib/metallb.libsonnet";
Sergiusz Bazanskia9c7e862019-04-01 17:56:28 +02008local nginx = import "lib/nginx.libsonnet";
Sergiusz Bazanskib7fcc672019-04-01 18:40:50 +02009local rook = import "lib/rook.libsonnet";
Sergiusz Bazanski4d9e72c2019-01-13 22:06:33 +010010
11local Cluster(fqdn) = {
12 local cluster = self,
13
14 // These are required to let the API Server contact kubelets.
15 crAPIServerToKubelet: kube.ClusterRole("system:kube-apiserver-to-kubelet") {
16 metadata+: {
17 annotations+: {
18 "rbac.authorization.kubernetes.io/autoupdate": "true",
19 },
20 labels+: {
21 "kubernets.io/bootstrapping": "rbac-defaults",
22 },
23 },
24 rules: [
25 {
26 apiGroups: [""],
27 resources: ["nodes/%s" % r for r in [ "proxy", "stats", "log", "spec", "metrics" ]],
28 verbs: ["*"],
29 },
30 ],
31 },
Sergiusz Bazanski5bebbeb2019-01-13 22:08:05 +010032 crbAPIServer: kube.ClusterRoleBinding("system:kube-apiserver") {
Sergiusz Bazanski4d9e72c2019-01-13 22:06:33 +010033 roleRef: {
34 apiGroup: "rbac.authorization.k8s.io",
35 kind: "ClusterRole",
36 name: cluster.crAPIServerToKubelet.metadata.name,
37 },
38 subjects: [
39 {
40 apiGroup: "rbac.authorization.k8s.io",
41 kind: "User",
42 # A cluster API Server authenticates with a certificate whose CN is == to the FQDN of the cluster.
43 name: fqdn,
44 },
45 ],
Sergiusz Bazanski49b9a132019-01-14 00:02:59 +010046 },
47
Sergiusz Bazanskiaf3be422019-01-17 18:57:19 +010048 // Calico network fabric
49 calico: calico.Environment {},
Sergiusz Bazanski49b9a132019-01-14 00:02:59 +010050 // CoreDNS for this cluster.
Sergiusz Bazanskiaf3be422019-01-17 18:57:19 +010051 dns: coredns.Environment {},
52 // Metrics Server
53 metrics: metrics.Environment {},
Sergiusz Bazanski1e565dc2019-01-18 09:40:59 +010054 // Metal Load Balancer
Sergiusz Bazanski14cbacb2019-04-01 18:00:44 +020055 metallb: metallb.Environment {
56 cfg+: {
57 addressPools: [
58 { name: "public-v4-1", protocol: "layer2", addresses: ["185.236.240.50-185.236.240.63"] },
59 ],
60 },
61 },
Sergiusz Bazanskia9c7e862019-04-01 17:56:28 +020062 // Main nginx Ingress Controller
63 nginx: nginx.Environment {},
Sergiusz Bazanskib7fcc672019-04-01 18:40:50 +020064 // Rook Ceph storage
65 rook: rook.Environment {},
Sergiusz Bazanski4d9e72c2019-01-13 22:06:33 +010066};
67
Sergiusz Bazanski49b9a132019-01-14 00:02:59 +010068
Sergiusz Bazanski4d9e72c2019-01-13 22:06:33 +010069{
70 k0: Cluster("k0.hswaw.net"),
71}