cluster: cleanup CephObjectStoreUser creation, add codehosting bucket

Change-Id: I6f41ef3d4775b52c43953f1133e56e69c4c462b8
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1683
Reviewed-by: informatic <informatic@hackerspace.pl>
diff --git a/cluster/kube/k0.libsonnet b/cluster/kube/k0.libsonnet
index f8405dc..b4fc738 100644
--- a/cluster/kube/k0.libsonnet
+++ b/cluster/kube/k0.libsonnet
@@ -236,139 +236,53 @@
 
             // Clients for S3/radosgw storage.
             clients: {
+                local ObjectStoreUser(name) = kube.CephObjectStoreUser(name) {
+                    metadata+: {
+                        namespace: "ceph-waw3",
+                    },
+                    spec: {
+                        store: "waw-hdd-redundant-3-object",
+                        displayName: name,
+                    },
+                },
+
                 # Used for owncloud.hackerspace.pl, which for now lives on boston-packets.hackerspace.pl.
-                nextcloudWaw3: kube.CephObjectStoreUser("nextcloud") {
-                    metadata+: {
-                        namespace: "ceph-waw3",
-                    },
-                    spec: {
-                        store: "waw-hdd-redundant-3-object",
-                        displayName: "nextcloud",
-                    },
-                },
+                nextcloudWaw3: ObjectStoreUser("nextcloud"),
                 # issues.hackerspace.pl (redmine) attachments bucket
-                issuesWaw3: kube.CephObjectStoreUser("issues") {
-                    metadata+: {
-                        namespace: "ceph-waw3",
-                    },
-                    spec: {
-                        store: "waw-hdd-redundant-3-object",
-                        displayName: "issues",
-                    },
-                },
+                issuesWaw3: ObjectStoreUser("issues"),
                 # matrix.hackerspace.pl media storage bucket
-                matrixWaw3: kube.CephObjectStoreUser("matrix") {
-                    metadata+: {
-                        namespace: "ceph-waw3",
-                    },
-                    spec: {
-                        store: "waw-hdd-redundant-3-object",
-                        displayName: "matrix",
-                    },
-                },
+                matrixWaw3: ObjectStoreUser("matrix"),
                 # tape staging temporary storage
-                tapeStaging: kube.CephObjectStoreUser("tape-staging") {
-                    metadata+: {
-                        namespace: "ceph-waw3",
-                    },
-                    spec: {
-                        store: "waw-hdd-redundant-3-object",
-                        displayName: "tape-staging",
-                    },
-                },
+                tapeStaging: ObjectStoreUser("tape-staging"),
 
                 # nuke@hackerspace.pl's personal storage.
-                nukePersonalWaw3: kube.CephObjectStoreUser("nuke-personal") {
-                    metadata+: {
-                        namespace: "ceph-waw3",
-                    },
-                    spec: {
-                        store: "waw-hdd-redundant-3-object",
-                        displayName: "nuke-personal",
-                    },
-                },
+                nukePersonalWaw3: ObjectStoreUser("nuke-personal"),
 
                 # patryk@hackerspace.pl's ArmA3 mod bucket.
-                cz2ArmaModsWaw3: kube.CephObjectStoreUser("cz2-arma3mods") {
-                    metadata+: {
-                        namespace: "ceph-waw3",
-                    },
-                    spec: {
-                        store: "waw-hdd-redundant-3-object",
-                        displayName: "cz2-arma3mods",
-                    },
-                },
+                cz2ArmaModsWaw3: ObjectStoreUser("cz2-arma3mods"),
+
                 # implr's personal user
-                implrSparkWaw3: kube.CephObjectStoreUser("implr") {
-                    metadata+: {
-                        namespace: "ceph-waw3",
-                    },
-                    spec: {
-                        store: "waw-hdd-redundant-3-object",
-                        displayName: "implr",
-                    },
-                },
+                implrSparkWaw3: ObjectStoreUser("implr"),
+
                 # q3k's personal user
-                q3kWaw3: kube.CephObjectStoreUser("q3k") {
-                    metadata+: {
-                        namespace: "ceph-waw3",
-                    },
-                    spec: {
-                        store: "waw-hdd-redundant-3-object",
-                        displayName: "q3k",
-                    },
-                },
+                q3kWaw3: ObjectStoreUser("q3k"),
+
                 # woju's personal user
-                wojuWaw3: kube.CephObjectStoreUser("woju") {
-                    metadata+: {
-                        namespace: "ceph-waw3",
-                    },
-                    spec: {
-                        store: "waw-hdd-redundant-3-object",
-                        displayName: "woju",
-                    },
-                },
+                wojuWaw3: ObjectStoreUser("woju"),
+
                 # cz3's (patryk@hackerspace.pl) personal user
-                cz3Waw3: kube.CephObjectStoreUser("cz3") {
-                    metadata+: {
-                        namespace: "ceph-waw3",
-                    },
-                    spec: {
-                        store: "waw-hdd-redundant-3-object",
-                        displayName: "cz3",
-                    },
-                },
+                cz3Waw3: ObjectStoreUser("cz3"),
+
                 # informatic's personal user
-                informaticWaw3: kube.CephObjectStoreUser("informatic") {
-                    metadata+: {
-                        namespace: "ceph-waw3",
-                    },
-                    spec: {
-                        store: "waw-hdd-redundant-3-object",
-                        displayName: "informatic",
-                    },
-                },
+                informaticWaw3: ObjectStoreUser("informatic"),
+
                 # mastodon qa and prod
                 mastodonWaw3: {
-                    qa: kube.CephObjectStoreUser("mastodon-qa") {
-                        metadata+: {
-                            namespace: "ceph-waw3",
-                        },
-                        spec: {
-                            store: "waw-hdd-redundant-3-object",
-                            displayName: "mastodon-qa",
-                        },
-                    },
-                    prod: kube.CephObjectStoreUser("mastodon-prod") {
-                        metadata+: {
-                            namespace: "ceph-waw3",
-                        },
-                        spec: {
-                            store: "waw-hdd-redundant-3-object",
-                            displayName: "mastodon-prod",
-                        },
-                    },
+                    qa: ObjectStoreUser("mastodon-qa"),
+                    prod: ObjectStoreUser("mastodon-prod"),
                 },
+
+                codehostingWaw3: ObjectStoreUser("codehosting"),
             },
         },