app/matrix: split matrix-ng into submodules, use kube.Namespace.Contain
matrix-ng split into multiple submodules causes some changes in keys
that might've been used for homeserver/riot configuration customization.
Migration to kube.Namespace.Contain has also caused change in Deployment
selectors (immutable fields), thus needing manual removal of these
first.
This is, as always, documented in lib/matrix-ng.libsonnet header.
Change-Id: I39a745ee27e3c55ec748818b9cf9b4e8ba1d2df5
diff --git a/app/matrix/lib/wellknown.libsonnet b/app/matrix/lib/wellknown.libsonnet
new file mode 100644
index 0000000..cdc5ceb
--- /dev/null
+++ b/app/matrix/lib/wellknown.libsonnet
@@ -0,0 +1,41 @@
+local kube = import "../../../kube/kube.libsonnet";
+
+{
+ local app = self,
+ local cfg = app.cfg,
+ cfg:: {
+ image: error "cfg.image must be set",
+
+ # webDomain is the domain name of matrix homeserver to be served
+ webDomain: error "cfg.webDomain must be set",
+ },
+
+ ns:: error "ns needs to be a kube.Namespace object",
+
+ deployment: app.ns.Contain(kube.Deployment("wellknown")) {
+ spec+: {
+ replicas: 1,
+ template+: {
+ spec+: {
+ containers_: {
+ web: kube.Container("wellknown") {
+ image: cfg.image,
+ ports_: {
+ http: { containerPort: 8080 },
+ },
+ command: ["/app/matrix/wellknown"],
+ args: ["-hspki_disable", "-domain", cfg.webDomain],
+ },
+ },
+ securityContext: {
+ runAsUser: 101,
+ runAsGroup: 101,
+ },
+ },
+ },
+ },
+ },
+ svc: app.ns.Contain(kube.Service("wellknown")) {
+ target_pod:: app.deployment.spec.template,
+ },
+}