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" }, |
| 68 | { name: "bc01n03", node: "bc01n03.hswaw.net" }, |
| 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"), |
Sergiusz Bazanski | dbfa988 | 2020-06-06 01:21:45 +0200 | [diff] [blame] | 83 | }, |
| 84 | }, |
| 85 | |
| 86 | ceph: { |
| 87 | // waw1 cluster - dead as of 2019/08/06, data corruption |
Serge Bazanski | 61f978a | 2021-01-22 16:26:07 +0100 | [diff] [blame] | 88 | // 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] | 89 | |
| 90 | // waw3: 6TB SAS 3.5" HDDs |
| 91 | waw3: rook.Cluster(k0.cluster.rook, "ceph-waw3") { |
| 92 | spec: { |
| 93 | mon: { |
Serge Bazanski | cf842b0 | 2021-01-19 20:08:23 +0100 | [diff] [blame] | 94 | count: 1, |
Sergiusz Bazanski | dbfa988 | 2020-06-06 01:21:45 +0200 | [diff] [blame] | 95 | allowMultiplePerNode: false, |
| 96 | }, |
| 97 | storage: { |
| 98 | useAllNodes: false, |
| 99 | useAllDevices: false, |
| 100 | config: { |
| 101 | databaseSizeMB: "1024", |
| 102 | journalSizeMB: "1024", |
| 103 | }, |
| 104 | nodes: [ |
| 105 | { |
| 106 | name: "dcr01s22.hswaw.net", |
| 107 | location: "rack=dcr01 host=dcr01s22", |
| 108 | devices: [ |
| 109 | // https://github.com/rook/rook/issues/1228 |
| 110 | //{ name: "disk/by-id/wwan-0x" + wwan } |
| 111 | //for wwan in [ |
| 112 | // "5000c5008508c433", |
| 113 | // "5000c500850989cf", |
| 114 | // "5000c5008508f843", |
| 115 | // "5000c5008508baf7", |
| 116 | //] |
| 117 | { name: "sdn" }, |
| 118 | { name: "sda" }, |
| 119 | { name: "sdb" }, |
| 120 | { name: "sdc" }, |
| 121 | ], |
| 122 | }, |
| 123 | { |
| 124 | name: "dcr01s24.hswaw.net", |
| 125 | location: "rack=dcr01 host=dcr01s22", |
| 126 | devices: [ |
| 127 | // https://github.com/rook/rook/issues/1228 |
| 128 | //{ name: "disk/by-id/wwan-0x" + wwan } |
| 129 | //for wwan in [ |
| 130 | // "5000c5008508ee03", |
| 131 | // "5000c5008508c9ef", |
| 132 | // "5000c5008508df33", |
| 133 | // "5000c5008508dd3b", |
| 134 | //] |
| 135 | { name: "sdm" }, |
| 136 | { name: "sda" }, |
| 137 | { name: "sdb" }, |
| 138 | { name: "sdc" }, |
| 139 | ], |
| 140 | }, |
| 141 | ], |
| 142 | }, |
| 143 | benji:: { |
| 144 | metadataStorageClass: "waw-hdd-redundant-3", |
| 145 | encryptionPassword: std.split((importstr "../secrets/plain/k0-benji-encryption-password"), '\n')[0], |
| 146 | pools: [ |
| 147 | "waw-hdd-redundant-3", |
| 148 | "waw-hdd-redundant-3-metadata", |
| 149 | "waw-hdd-yolo-3", |
| 150 | ], |
| 151 | s3Configuration: { |
| 152 | awsAccessKeyId: "RPYZIROFXNLQVU2WJ4R3", |
| 153 | awsSecretAccessKey: std.split((importstr "../secrets/plain/k0-benji-secret-access-key"), '\n')[0], |
| 154 | bucketName: "benji-k0-backups-waw3", |
| 155 | endpointUrl: "https://s3.eu-central-1.wasabisys.com/", |
| 156 | }, |
| 157 | } |
| 158 | }, |
| 159 | }, |
| 160 | waw3Pools: { |
| 161 | // redundant block storage |
| 162 | blockRedundant: rook.ECBlockPool(k0.ceph.waw3, "waw-hdd-redundant-3") { |
| 163 | metadataReplicas: 2, |
| 164 | spec: { |
| 165 | failureDomain: "host", |
| 166 | replicated: { |
| 167 | size: 2, |
| 168 | }, |
| 169 | }, |
| 170 | }, |
| 171 | // yolo block storage (low usage, no host redundancy) |
| 172 | blockYolo: rook.ReplicatedBlockPool(k0.ceph.waw3, "waw-hdd-yolo-3") { |
| 173 | spec: { |
| 174 | failureDomain: "osd", |
| 175 | erasureCoded: { |
Serge Bazanski | cf842b0 | 2021-01-19 20:08:23 +0100 | [diff] [blame] | 176 | dataChunks: 2, |
| 177 | codingChunks: 1, |
Sergiusz Bazanski | dbfa988 | 2020-06-06 01:21:45 +0200 | [diff] [blame] | 178 | }, |
| 179 | }, |
| 180 | }, |
Serge Bazanski | 242ec58 | 2020-09-20 15:36:11 +0000 | [diff] [blame] | 181 | // q3k's personal pool, used externally from k8s. |
| 182 | q3kRedundant: rook.ECBlockPool(k0.ceph.waw3, "waw-hdd-redundant-q3k-3") { |
| 183 | metadataReplicas: 2, |
| 184 | spec: { |
| 185 | failureDomain: "host", |
| 186 | replicated: { |
| 187 | size: 2, |
| 188 | }, |
| 189 | }, |
| 190 | }, |
Sergiusz Bazanski | dbfa988 | 2020-06-06 01:21:45 +0200 | [diff] [blame] | 191 | objectRedundant: rook.S3ObjectStore(k0.ceph.waw3, "waw-hdd-redundant-3-object") { |
| 192 | spec: { |
| 193 | metadataPool: { |
| 194 | failureDomain: "host", |
| 195 | replicated: { size: 2 }, |
| 196 | }, |
| 197 | dataPool: { |
| 198 | failureDomain: "host", |
| 199 | replicated: { size: 2 }, |
| 200 | }, |
| 201 | }, |
| 202 | }, |
| 203 | }, |
| 204 | |
| 205 | // Clients for S3/radosgw storage. |
| 206 | clients: { |
| 207 | # Used for owncloud.hackerspace.pl, which for now lives on boston-packets.hackerspace.pl. |
| 208 | nextcloudWaw3: kube.CephObjectStoreUser("nextcloud") { |
| 209 | metadata+: { |
| 210 | namespace: "ceph-waw3", |
| 211 | }, |
| 212 | spec: { |
| 213 | store: "waw-hdd-redundant-3-object", |
| 214 | displayName: "nextcloud", |
| 215 | }, |
| 216 | }, |
| 217 | |
| 218 | # nuke@hackerspace.pl's personal storage. |
| 219 | nukePersonalWaw3: kube.CephObjectStoreUser("nuke-personal") { |
| 220 | metadata+: { |
| 221 | namespace: "ceph-waw3", |
| 222 | }, |
| 223 | spec: { |
| 224 | store: "waw-hdd-redundant-3-object", |
| 225 | displayName: "nuke-personal", |
| 226 | }, |
| 227 | }, |
| 228 | |
| 229 | # patryk@hackerspace.pl's ArmA3 mod bucket. |
| 230 | cz2ArmaModsWaw3: kube.CephObjectStoreUser("cz2-arma3mods") { |
| 231 | metadata+: { |
| 232 | namespace: "ceph-waw3", |
| 233 | }, |
| 234 | spec: { |
| 235 | store: "waw-hdd-redundant-3-object", |
| 236 | displayName: "cz2-arma3mods", |
| 237 | }, |
| 238 | }, |
Bartosz Stebel | d9df587 | 2020-06-13 21:19:40 +0200 | [diff] [blame] | 239 | # Buckets for spark pipelines |
| 240 | # TODO(implr): consider a second yolo-backed one for temp data |
| 241 | implrSparkWaw3: kube.CephObjectStoreUser("implr-spark") { |
| 242 | metadata+: { |
| 243 | namespace: "ceph-waw3", |
| 244 | }, |
| 245 | spec: { |
| 246 | store: "waw-hdd-redundant-3-object", |
| 247 | displayName: "implr-spark", |
| 248 | }, |
| 249 | }, |
Sergiusz Bazanski | b1aadd8 | 2020-06-24 19:06:17 +0200 | [diff] [blame] | 250 | # q3k's personal user |
| 251 | q3kWaw3: kube.CephObjectStoreUser("q3k") { |
| 252 | metadata+: { |
| 253 | namespace: "ceph-waw3", |
| 254 | }, |
| 255 | spec: { |
| 256 | store: "waw-hdd-redundant-3-object", |
| 257 | displayName: "q3k", |
| 258 | }, |
| 259 | }, |
Serge Bazanski | bfe9bb0 | 2020-10-27 20:50:50 +0100 | [diff] [blame] | 260 | # woju's personal user |
| 261 | wojuWaw3: kube.CephObjectStoreUser("woju") { |
| 262 | metadata+: { |
| 263 | namespace: "ceph-waw3", |
| 264 | }, |
| 265 | spec: { |
| 266 | store: "waw-hdd-redundant-3-object", |
| 267 | displayName: "woju", |
| 268 | }, |
Patryk Jakuszew | cae7cf7 | 2020-11-28 14:36:48 +0100 | [diff] [blame] | 269 | }, |
Patryk Jakuszew | 34668a5 | 2020-11-28 13:45:25 +0100 | [diff] [blame] | 270 | # cz3's (patryk@hackerspace.pl) personal user |
| 271 | cz3Waw3: kube.CephObjectStoreUser("cz3") { |
| 272 | metadata+: { |
| 273 | namespace: "ceph-waw3", |
| 274 | }, |
| 275 | spec: { |
| 276 | store: "waw-hdd-redundant-3-object", |
| 277 | displayName: "cz3", |
| 278 | }, |
Serge Bazanski | bfe9bb0 | 2020-10-27 20:50:50 +0100 | [diff] [blame] | 279 | }, |
Sergiusz Bazanski | dbfa988 | 2020-06-06 01:21:45 +0200 | [diff] [blame] | 280 | }, |
| 281 | }, |
| 282 | |
| 283 | |
| 284 | # These are policies allowing for Insecure pods in some namespaces. |
| 285 | # A lot of them are spurious and come from the fact that we deployed |
| 286 | # these namespaces before we deployed the draconian PodSecurityPolicy |
| 287 | # we have now. This should be fixed by setting up some more granular |
| 288 | # policies, or fixing the workloads to not need some of the permission |
| 289 | # bits they use, whatever those might be. |
| 290 | # TODO(q3k): fix this? |
| 291 | unnecessarilyInsecureNamespaces: [ |
Sergiusz Bazanski | dbfa988 | 2020-06-06 01:21:45 +0200 | [diff] [blame] | 292 | policies.AllowNamespaceInsecure("ceph-waw3"), |
| 293 | policies.AllowNamespaceInsecure("matrix"), |
| 294 | policies.AllowNamespaceInsecure("registry"), |
| 295 | policies.AllowNamespaceInsecure("internet"), |
| 296 | # TODO(implr): restricted policy with CAP_NET_ADMIN and tuntap, but no full root |
| 297 | policies.AllowNamespaceInsecure("implr-vpn"), |
| 298 | ], |
| 299 | }, |
| 300 | } |