Sergiusz Bazanski | dbfa988 | 2020-06-06 01:21:45 +0200 | [diff] [blame] | 1 | // k0.hswaw.net kubernetes cluster |
| 2 | // This defines the cluster as a single object. |
| 3 | // Use the sibling k0*.jsonnet 'view' files to actually apply the configuration. |
| 4 | |
| 5 | local kube = import "../../kube/kube.libsonnet"; |
| 6 | local policies = import "../../kube/policies.libsonnet"; |
| 7 | |
| 8 | local cluster = import "cluster.libsonnet"; |
| 9 | |
| 10 | local cockroachdb = import "lib/cockroachdb.libsonnet"; |
| 11 | local registry = import "lib/registry.libsonnet"; |
| 12 | local rook = import "lib/rook.libsonnet"; |
| 13 | |
| 14 | { |
| 15 | k0: { |
| 16 | local k0 = self, |
| 17 | cluster: cluster.Cluster("k0", "hswaw.net") { |
| 18 | cfg+: { |
Serge Bazanski | 3d29484 | 2020-08-04 01:34:07 +0200 | [diff] [blame] | 19 | storageClassNameParanoid: k0.ceph.waw3Pools.blockRedundant.name, |
Sergiusz Bazanski | dbfa988 | 2020-06-06 01:21:45 +0200 | [diff] [blame] | 20 | }, |
| 21 | metallb+: { |
| 22 | cfg+: { |
Serge Bazanski | a5ed644 | 2020-09-20 22:52:57 +0000 | [diff] [blame] | 23 | // Peer with calico running on same node. |
Sergiusz Bazanski | dbfa988 | 2020-06-06 01:21:45 +0200 | [diff] [blame] | 24 | peers: [ |
| 25 | { |
Serge Bazanski | a5ed644 | 2020-09-20 22:52:57 +0000 | [diff] [blame] | 26 | "peer-address": "127.0.0.1", |
| 27 | "peer-asn": 65003, |
Sergiusz Bazanski | dbfa988 | 2020-06-06 01:21:45 +0200 | [diff] [blame] | 28 | "my-asn": 65002, |
| 29 | }, |
| 30 | ], |
Serge Bazanski | a5ed644 | 2020-09-20 22:52:57 +0000 | [diff] [blame] | 31 | // Public IP address pools. Keep in sync with k0.calico.yaml. |
Sergiusz Bazanski | dbfa988 | 2020-06-06 01:21:45 +0200 | [diff] [blame] | 32 | addressPools: [ |
| 33 | { |
| 34 | name: "public-v4-1", |
| 35 | protocol: "bgp", |
| 36 | addresses: [ |
| 37 | "185.236.240.48/28", |
| 38 | ], |
| 39 | }, |
| 40 | { |
| 41 | name: "public-v4-2", |
| 42 | protocol: "bgp", |
| 43 | addresses: [ |
| 44 | "185.236.240.112/28" |
| 45 | ], |
| 46 | }, |
| 47 | ], |
| 48 | }, |
| 49 | }, |
| 50 | }, |
| 51 | |
| 52 | // Docker registry |
| 53 | registry: registry.Environment { |
| 54 | cfg+: { |
| 55 | domain: "registry.%s" % [k0.cluster.fqdn], |
| 56 | storageClassName: k0.cluster.cfg.storageClassNameParanoid, |
Serge Bazanski | 3d29484 | 2020-08-04 01:34:07 +0200 | [diff] [blame] | 57 | objectStorageName: "waw-hdd-redundant-3-object", |
Sergiusz Bazanski | dbfa988 | 2020-06-06 01:21:45 +0200 | [diff] [blame] | 58 | }, |
| 59 | }, |
| 60 | |
| 61 | // CockroachDB, running on bc01n{01,02,03}. |
| 62 | cockroach: { |
| 63 | waw2: cockroachdb.Cluster("crdb-waw1") { |
| 64 | cfg+: { |
| 65 | topology: [ |
| 66 | { name: "bc01n01", node: "bc01n01.hswaw.net" }, |
| 67 | { name: "bc01n02", node: "bc01n02.hswaw.net" }, |
Patryk Jakuszew | edf14cc | 2021-01-23 23:00:29 +0100 | [diff] [blame] | 68 | { name: "dcr01s22", node: "dcr01s22.hswaw.net" }, |
Sergiusz Bazanski | dbfa988 | 2020-06-06 01:21:45 +0200 | [diff] [blame] | 69 | ], |
| 70 | // Host path on SSD. |
| 71 | hostPath: "/var/db/crdb-waw1", |
Serge Bazanski | 509ab6e | 2020-07-30 22:43:20 +0200 | [diff] [blame] | 72 | extraDNS: [ |
| 73 | "crdb-waw1.hswaw.net", |
| 74 | ], |
Sergiusz Bazanski | dbfa988 | 2020-06-06 01:21:45 +0200 | [diff] [blame] | 75 | }, |
| 76 | }, |
| 77 | clients: { |
| 78 | cccampix: k0.cockroach.waw2.Client("cccampix"), |
| 79 | cccampixDev: k0.cockroach.waw2.Client("cccampix-dev"), |
| 80 | buglessDev: k0.cockroach.waw2.Client("bugless-dev"), |
| 81 | sso: k0.cockroach.waw2.Client("sso"), |
Serge Bazanski | 509ab6e | 2020-07-30 22:43:20 +0200 | [diff] [blame] | 82 | herpDev: k0.cockroach.waw2.Client("herp-dev"), |
Patryk Jakuszew | f315388 | 2021-01-23 15:38:50 +0100 | [diff] [blame] | 83 | gitea: k0.cockroach.waw2.Client("gitea"), |
Sergiusz Bazanski | dbfa988 | 2020-06-06 01:21:45 +0200 | [diff] [blame] | 84 | }, |
| 85 | }, |
| 86 | |
| 87 | ceph: { |
| 88 | // waw1 cluster - dead as of 2019/08/06, data corruption |
Serge Bazanski | 61f978a | 2021-01-22 16:26:07 +0100 | [diff] [blame] | 89 | // waw2 cluster - dead as of 2021/01/22, torn down (horrible M610 RAID controllers are horrible) |
Sergiusz Bazanski | dbfa988 | 2020-06-06 01:21:45 +0200 | [diff] [blame] | 90 | |
| 91 | // waw3: 6TB SAS 3.5" HDDs |
| 92 | waw3: rook.Cluster(k0.cluster.rook, "ceph-waw3") { |
| 93 | spec: { |
| 94 | mon: { |
Serge Bazanski | cf842b0 | 2021-01-19 20:08:23 +0100 | [diff] [blame] | 95 | count: 1, |
Sergiusz Bazanski | dbfa988 | 2020-06-06 01:21:45 +0200 | [diff] [blame] | 96 | allowMultiplePerNode: false, |
| 97 | }, |
| 98 | storage: { |
| 99 | useAllNodes: false, |
| 100 | useAllDevices: false, |
| 101 | config: { |
| 102 | databaseSizeMB: "1024", |
| 103 | journalSizeMB: "1024", |
| 104 | }, |
| 105 | nodes: [ |
| 106 | { |
| 107 | name: "dcr01s22.hswaw.net", |
| 108 | location: "rack=dcr01 host=dcr01s22", |
| 109 | devices: [ |
| 110 | // https://github.com/rook/rook/issues/1228 |
| 111 | //{ name: "disk/by-id/wwan-0x" + wwan } |
| 112 | //for wwan in [ |
| 113 | // "5000c5008508c433", |
| 114 | // "5000c500850989cf", |
| 115 | // "5000c5008508f843", |
| 116 | // "5000c5008508baf7", |
| 117 | //] |
| 118 | { name: "sdn" }, |
| 119 | { name: "sda" }, |
| 120 | { name: "sdb" }, |
| 121 | { name: "sdc" }, |
| 122 | ], |
| 123 | }, |
| 124 | { |
| 125 | name: "dcr01s24.hswaw.net", |
| 126 | location: "rack=dcr01 host=dcr01s22", |
| 127 | devices: [ |
| 128 | // https://github.com/rook/rook/issues/1228 |
| 129 | //{ name: "disk/by-id/wwan-0x" + wwan } |
| 130 | //for wwan in [ |
| 131 | // "5000c5008508ee03", |
| 132 | // "5000c5008508c9ef", |
| 133 | // "5000c5008508df33", |
| 134 | // "5000c5008508dd3b", |
| 135 | //] |
| 136 | { name: "sdm" }, |
| 137 | { name: "sda" }, |
| 138 | { name: "sdb" }, |
| 139 | { name: "sdc" }, |
| 140 | ], |
| 141 | }, |
| 142 | ], |
| 143 | }, |
| 144 | benji:: { |
| 145 | metadataStorageClass: "waw-hdd-redundant-3", |
| 146 | encryptionPassword: std.split((importstr "../secrets/plain/k0-benji-encryption-password"), '\n')[0], |
| 147 | pools: [ |
| 148 | "waw-hdd-redundant-3", |
| 149 | "waw-hdd-redundant-3-metadata", |
| 150 | "waw-hdd-yolo-3", |
| 151 | ], |
| 152 | s3Configuration: { |
| 153 | awsAccessKeyId: "RPYZIROFXNLQVU2WJ4R3", |
| 154 | awsSecretAccessKey: std.split((importstr "../secrets/plain/k0-benji-secret-access-key"), '\n')[0], |
| 155 | bucketName: "benji-k0-backups-waw3", |
| 156 | endpointUrl: "https://s3.eu-central-1.wasabisys.com/", |
| 157 | }, |
| 158 | } |
| 159 | }, |
| 160 | }, |
| 161 | waw3Pools: { |
| 162 | // redundant block storage |
| 163 | blockRedundant: rook.ECBlockPool(k0.ceph.waw3, "waw-hdd-redundant-3") { |
| 164 | metadataReplicas: 2, |
| 165 | spec: { |
| 166 | failureDomain: "host", |
| 167 | replicated: { |
| 168 | size: 2, |
| 169 | }, |
| 170 | }, |
| 171 | }, |
| 172 | // yolo block storage (low usage, no host redundancy) |
| 173 | blockYolo: rook.ReplicatedBlockPool(k0.ceph.waw3, "waw-hdd-yolo-3") { |
| 174 | spec: { |
| 175 | failureDomain: "osd", |
| 176 | erasureCoded: { |
Serge Bazanski | cf842b0 | 2021-01-19 20:08:23 +0100 | [diff] [blame] | 177 | dataChunks: 2, |
| 178 | codingChunks: 1, |
Sergiusz Bazanski | dbfa988 | 2020-06-06 01:21:45 +0200 | [diff] [blame] | 179 | }, |
| 180 | }, |
| 181 | }, |
Serge Bazanski | 242ec58 | 2020-09-20 15:36:11 +0000 | [diff] [blame] | 182 | // q3k's personal pool, used externally from k8s. |
| 183 | q3kRedundant: rook.ECBlockPool(k0.ceph.waw3, "waw-hdd-redundant-q3k-3") { |
| 184 | metadataReplicas: 2, |
| 185 | spec: { |
| 186 | failureDomain: "host", |
| 187 | replicated: { |
| 188 | size: 2, |
| 189 | }, |
| 190 | }, |
| 191 | }, |
Sergiusz Bazanski | dbfa988 | 2020-06-06 01:21:45 +0200 | [diff] [blame] | 192 | objectRedundant: rook.S3ObjectStore(k0.ceph.waw3, "waw-hdd-redundant-3-object") { |
| 193 | spec: { |
| 194 | metadataPool: { |
| 195 | failureDomain: "host", |
| 196 | replicated: { size: 2 }, |
| 197 | }, |
| 198 | dataPool: { |
| 199 | failureDomain: "host", |
| 200 | replicated: { size: 2 }, |
| 201 | }, |
| 202 | }, |
| 203 | }, |
| 204 | }, |
| 205 | |
| 206 | // Clients for S3/radosgw storage. |
| 207 | clients: { |
| 208 | # Used for owncloud.hackerspace.pl, which for now lives on boston-packets.hackerspace.pl. |
| 209 | nextcloudWaw3: kube.CephObjectStoreUser("nextcloud") { |
| 210 | metadata+: { |
| 211 | namespace: "ceph-waw3", |
| 212 | }, |
| 213 | spec: { |
| 214 | store: "waw-hdd-redundant-3-object", |
| 215 | displayName: "nextcloud", |
| 216 | }, |
| 217 | }, |
| 218 | |
| 219 | # nuke@hackerspace.pl's personal storage. |
| 220 | nukePersonalWaw3: kube.CephObjectStoreUser("nuke-personal") { |
| 221 | metadata+: { |
| 222 | namespace: "ceph-waw3", |
| 223 | }, |
| 224 | spec: { |
| 225 | store: "waw-hdd-redundant-3-object", |
| 226 | displayName: "nuke-personal", |
| 227 | }, |
| 228 | }, |
| 229 | |
| 230 | # patryk@hackerspace.pl's ArmA3 mod bucket. |
| 231 | cz2ArmaModsWaw3: kube.CephObjectStoreUser("cz2-arma3mods") { |
| 232 | metadata+: { |
| 233 | namespace: "ceph-waw3", |
| 234 | }, |
| 235 | spec: { |
| 236 | store: "waw-hdd-redundant-3-object", |
| 237 | displayName: "cz2-arma3mods", |
| 238 | }, |
| 239 | }, |
Bartosz Stebel | d9df587 | 2020-06-13 21:19:40 +0200 | [diff] [blame] | 240 | # Buckets for spark pipelines |
| 241 | # TODO(implr): consider a second yolo-backed one for temp data |
| 242 | implrSparkWaw3: kube.CephObjectStoreUser("implr-spark") { |
| 243 | metadata+: { |
| 244 | namespace: "ceph-waw3", |
| 245 | }, |
| 246 | spec: { |
| 247 | store: "waw-hdd-redundant-3-object", |
| 248 | displayName: "implr-spark", |
| 249 | }, |
| 250 | }, |
Sergiusz Bazanski | b1aadd8 | 2020-06-24 19:06:17 +0200 | [diff] [blame] | 251 | # q3k's personal user |
| 252 | q3kWaw3: kube.CephObjectStoreUser("q3k") { |
| 253 | metadata+: { |
| 254 | namespace: "ceph-waw3", |
| 255 | }, |
| 256 | spec: { |
| 257 | store: "waw-hdd-redundant-3-object", |
| 258 | displayName: "q3k", |
| 259 | }, |
| 260 | }, |
Serge Bazanski | bfe9bb0 | 2020-10-27 20:50:50 +0100 | [diff] [blame] | 261 | # woju's personal user |
| 262 | wojuWaw3: kube.CephObjectStoreUser("woju") { |
| 263 | metadata+: { |
| 264 | namespace: "ceph-waw3", |
| 265 | }, |
| 266 | spec: { |
| 267 | store: "waw-hdd-redundant-3-object", |
| 268 | displayName: "woju", |
| 269 | }, |
Patryk Jakuszew | cae7cf7 | 2020-11-28 14:36:48 +0100 | [diff] [blame] | 270 | }, |
Patryk Jakuszew | 34668a5 | 2020-11-28 13:45:25 +0100 | [diff] [blame] | 271 | # cz3's (patryk@hackerspace.pl) personal user |
| 272 | cz3Waw3: kube.CephObjectStoreUser("cz3") { |
| 273 | metadata+: { |
| 274 | namespace: "ceph-waw3", |
| 275 | }, |
| 276 | spec: { |
| 277 | store: "waw-hdd-redundant-3-object", |
| 278 | displayName: "cz3", |
| 279 | }, |
Serge Bazanski | bfe9bb0 | 2020-10-27 20:50:50 +0100 | [diff] [blame] | 280 | }, |
Sergiusz Bazanski | dbfa988 | 2020-06-06 01:21:45 +0200 | [diff] [blame] | 281 | }, |
| 282 | }, |
| 283 | |
| 284 | |
| 285 | # These are policies allowing for Insecure pods in some namespaces. |
| 286 | # A lot of them are spurious and come from the fact that we deployed |
| 287 | # these namespaces before we deployed the draconian PodSecurityPolicy |
| 288 | # we have now. This should be fixed by setting up some more granular |
| 289 | # policies, or fixing the workloads to not need some of the permission |
| 290 | # bits they use, whatever those might be. |
| 291 | # TODO(q3k): fix this? |
| 292 | unnecessarilyInsecureNamespaces: [ |
Sergiusz Bazanski | dbfa988 | 2020-06-06 01:21:45 +0200 | [diff] [blame] | 293 | policies.AllowNamespaceInsecure("ceph-waw3"), |
| 294 | policies.AllowNamespaceInsecure("matrix"), |
| 295 | policies.AllowNamespaceInsecure("registry"), |
| 296 | policies.AllowNamespaceInsecure("internet"), |
| 297 | # TODO(implr): restricted policy with CAP_NET_ADMIN and tuntap, but no full root |
| 298 | policies.AllowNamespaceInsecure("implr-vpn"), |
| 299 | ], |
| 300 | }, |
| 301 | } |