From 9340a3933d56d3ee675cc2851c785c7bf19bd06b Mon Sep 17 00:00:00 2001 From: viq Date: Sun, 28 Jan 2024 23:29:52 +0100 Subject: [PATCH] Playing around with gethomepage Change-Id: I96e69f31eb90c017500ee5450b06e30bb9e068da Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1882 --- personal/viq/gethomepage/prod.jsonnet | 129 ++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 personal/viq/gethomepage/prod.jsonnet diff --git a/personal/viq/gethomepage/prod.jsonnet b/personal/viq/gethomepage/prod.jsonnet new file mode 100644 index 00000000..d69f4e1c --- /dev/null +++ b/personal/viq/gethomepage/prod.jsonnet @@ -0,0 +1,129 @@ +local kube = import "../../../kube/hscloud.libsonnet"; + +{ + local top = self, + local cfg = self.cfg, + + cfg:: { + name: "gethomepage", + namespace: "personal-viq", + }, + + local ns = kube.Namespace(cfg.namespace), + + configMap: kube.ConfigMap("config") { + local cm = self, + metadata+: { + namespace: cfg.namespace, + }, + data: { + "settings.yaml": std.manifestJson({ + logpath: "/logs", + }), + "custom.css": "", + "custom.js": "", + "docker.yaml": "", + "kubernetes.yaml": std.manifestYamlDoc({ + mode: "cluster", + }), + "bookmarks.yaml": "", +// "bookmarks.yaml": std.manifestYamlDoc({ +// bookmarks: [ +// { +// Documentation: [ +// { +// hswiki: { abbr: "wiki", href: "https://wiki.hackerspace.pl" }, +// sourcegraph: { abbr: "CS", href: "https://cs.hackerspace.pl" }, +// } +// ], +// } +// ], +// }), + "services.yaml": std.manifestJson([ + { + Documentation: [ + { + Wiki: { href: "https://wiki.hackerspace.pl", siteMonitor: "https://wiki.hackerspace.pl" }, + }, + { + SourceGraph: { href: "https://cs.hackerspace.pl", siteMonitor: "https://cs.hackerspace.pl" }, + }, + ], + }, + ]), + "widgets.yaml": std.manifestJson([ + { + kubernetes: { + cluster: { + show: "true", + cpu: "true", + memory: "true", + showLabel: "true", + label: "hscloud k0", + }, + nodes: { + show: "true", + cpu: true, + memory: true, + showLabel: true, + }, + }, + }, + { + datetime: { + text_size: "xl", + locale: "en-DK", + format: { + hourCycle: "h23", + timeStyle: "long", + dateStyle: "long", + }, + }, + }, + { + openmeteo: { + label: "Warsaw", + timezone: "Europe/Warsaw", + units: "metric", + cache: "5", + latitude: "52.24160", + longitude: "20.98485", + }, + }, + ]), + }, + }, + + deployment: ns.Contain(kube.Deployment(cfg.name)) { + spec+: { + replicas: 1, + template+: { + spec+: { + volumes_: { + config: top.configMap.volume, + logs: { + emptyDir: {}, + }, + }, + containers_: { + default: kube.Container("default") { + image: "ghcr.io/gethomepage/homepage:latest", + resources: { + requests: { cpu: "50m", memory: "128M" }, + limits: { cpu: "750m", memory: "256M" }, + }, + ports_: { + http: { containerPort: 3000 }, + }, + volumeMounts_: { + //config: { mountPath: "/app/config/services.yaml", subPath: "services.yaml"}, + config: { mountPath: "/app/config", }, + logs: { mountPath: "/logs", }, + }, + }, + }, + }, + }, + }, + } +}