Installer: introduce namespacePrefix, fix certificates, split matrix installation using pre-install hook
diff --git a/charts/matrix/templates/matrix.yaml b/charts/matrix/templates/matrix.yaml
index d9bd47f..e03223f 100644
--- a/charts/matrix/templates/matrix.yaml
+++ b/charts/matrix/templates/matrix.yaml
@@ -4,6 +4,9 @@
 metadata:
   name: CreateConfigMaps
   namespace: {{ .Release.Namespace }}
+  annotations:
+    helm.sh/hook: pre-install
+    helm.sh/hook-weight: "-10"
 rules:
 - apiGroups:
   - ""
@@ -18,6 +21,9 @@
 metadata:
   name: default-CreateConfigMaps
   namespace: {{ .Release.Namespace }}
+  annotations:
+    helm.sh/hook: pre-install
+    helm.sh/hook-weight: "-10"
 roleRef:
   apiGroup: rbac.authorization.k8s.io
   kind: Role
@@ -42,21 +48,32 @@
     targetPort: http
     protocol: TCP
 ---
+apiVersion: cert-manager.io/v1
+kind: Certificate
+metadata:
+  name: matrix.{{ .Values.domain }}
+  namespace: {{ .Release.Namespace }}
+  annotations:
+    helm.sh/resource-policy: keep
+spec:
+  dnsNames:
+  - 'matrix.{{ .Values.domain }}'
+  issuerRef:
+    name: {{ .Values.certificateIssuer }}
+    kind: ClusterIssuer
+  secretName: cert-matrix.{{ .Values.domain }}
+---
 apiVersion: networking.k8s.io/v1
 kind: Ingress
 metadata:
   name: ingress
   namespace: {{ .Release.Namespace }}
-  annotations:
-    cert-manager.io/cluster-issuer: {{ .Values.certificateIssuer }}
-    acme.cert-manager.io/http01-edit-in-place: "true"
 spec:
   ingressClassName: {{ .Values.ingressClassName }}
   tls:
   - hosts:
     - matrix.{{ .Values.domain }}
     secretName: cert-matrix.{{ .Values.domain }}
-    # secretName: cert-wildcard.{{ .Values.domain }}
   rules:
   - host: matrix.{{ .Values.domain }}
     http:
@@ -74,6 +91,9 @@
 metadata:
   name: generate-config
   namespace: {{ .Release.Namespace }}
+  annotations:
+    helm.sh/hook: pre-install
+    helm.sh/hook-weight: "-5"
 spec:
   template:
     metadata:
@@ -179,6 +199,9 @@
 metadata:
   name: data
   namespace: {{ .Release.Namespace }}
+  annotations:
+    helm.sh/hook: pre-install
+    helm.sh/hook-weight: "-10"
 spec:
   accessModes:
     - ReadWriteOnce