From 1f9fb4ca5bd22335389fefa352c916bb0e1fc185 Mon Sep 17 00:00:00 2001 From: Sebastian Pietras Date: Tue, 26 Mar 2024 13:28:23 +0100 Subject: [PATCH] Added `emipass` (#89) --- src/clusters/main/apps/emipass/emipass.yaml | 25 +++++++++++++++++++ .../kustomize/emipass-helm/emipass-helm.yaml | 13 ++++++++++ .../emipass-helm/kustomize/kustomization.yaml | 7 ++++++ .../kustomize/resources/release.yaml | 16 ++++++++++++ .../kustomize/resources/repository.yaml | 8 ++++++ .../emipass-namespace/emipass-namespace.yaml | 10 ++++++++ .../kustomize/kustomization.yaml | 6 +++++ .../kustomize/resources/namespace.yaml | 5 ++++ .../emipass-traefik/emipass-traefik.yaml | 13 ++++++++++ .../kustomize/kustomization.yaml | 8 ++++++ .../kustomize/resources/routes/http.yaml | 18 +++++++++++++ .../kustomize/resources/routes/rtp.yaml | 15 +++++++++++ .../kustomize/resources/routes/whip.yaml | 18 +++++++++++++ .../apps/emipass/kustomize/kustomization.yaml | 8 ++++++ src/clusters/main/apps/kustomization.yaml | 1 + .../kustomize/resources/release.yaml | 10 ++++++++ .../resources/certificates/wildcard.yaml | 1 + .../ci/main/apps/emipass/emipass.yaml | 25 +++++++++++++++++++ .../kustomize/emipass-helm/emipass-helm.yaml | 13 ++++++++++ .../emipass-helm/kustomize/kustomization.yaml | 5 ++++ .../emipass-namespace/emipass-namespace.yaml | 10 ++++++++ .../kustomize/kustomization.yaml | 5 ++++ .../emipass-traefik/emipass-traefik.yaml | 13 ++++++++++ .../kustomize/kustomization.yaml | 5 ++++ .../apps/emipass/kustomize/kustomization.yaml | 8 ++++++ .../clusters/ci/main/apps/kustomization.yaml | 1 + 26 files changed, 267 insertions(+) create mode 100644 src/clusters/main/apps/emipass/emipass.yaml create mode 100644 src/clusters/main/apps/emipass/kustomize/emipass-helm/emipass-helm.yaml create mode 100644 src/clusters/main/apps/emipass/kustomize/emipass-helm/kustomize/kustomization.yaml create mode 100644 src/clusters/main/apps/emipass/kustomize/emipass-helm/kustomize/resources/release.yaml create mode 100644 src/clusters/main/apps/emipass/kustomize/emipass-helm/kustomize/resources/repository.yaml create mode 100644 src/clusters/main/apps/emipass/kustomize/emipass-namespace/emipass-namespace.yaml create mode 100644 src/clusters/main/apps/emipass/kustomize/emipass-namespace/kustomize/kustomization.yaml create mode 100644 src/clusters/main/apps/emipass/kustomize/emipass-namespace/kustomize/resources/namespace.yaml create mode 100644 src/clusters/main/apps/emipass/kustomize/emipass-traefik/emipass-traefik.yaml create mode 100644 src/clusters/main/apps/emipass/kustomize/emipass-traefik/kustomize/kustomization.yaml create mode 100644 src/clusters/main/apps/emipass/kustomize/emipass-traefik/kustomize/resources/routes/http.yaml create mode 100644 src/clusters/main/apps/emipass/kustomize/emipass-traefik/kustomize/resources/routes/rtp.yaml create mode 100644 src/clusters/main/apps/emipass/kustomize/emipass-traefik/kustomize/resources/routes/whip.yaml create mode 100644 src/clusters/main/apps/emipass/kustomize/kustomization.yaml create mode 100644 tests/clusters/ci/main/apps/emipass/emipass.yaml create mode 100644 tests/clusters/ci/main/apps/emipass/kustomize/emipass-helm/emipass-helm.yaml create mode 100644 tests/clusters/ci/main/apps/emipass/kustomize/emipass-helm/kustomize/kustomization.yaml create mode 100644 tests/clusters/ci/main/apps/emipass/kustomize/emipass-namespace/emipass-namespace.yaml create mode 100644 tests/clusters/ci/main/apps/emipass/kustomize/emipass-namespace/kustomize/kustomization.yaml create mode 100644 tests/clusters/ci/main/apps/emipass/kustomize/emipass-traefik/emipass-traefik.yaml create mode 100644 tests/clusters/ci/main/apps/emipass/kustomize/emipass-traefik/kustomize/kustomization.yaml create mode 100644 tests/clusters/ci/main/apps/emipass/kustomize/kustomization.yaml diff --git a/src/clusters/main/apps/emipass/emipass.yaml b/src/clusters/main/apps/emipass/emipass.yaml new file mode 100644 index 0000000..01e5fb9 --- /dev/null +++ b/src/clusters/main/apps/emipass/emipass.yaml @@ -0,0 +1,25 @@ +# Create emipass Kustomization +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: emipass +spec: + # Path inside repository to a directory containing Kustomization files + path: src/clusters/main/apps/emipass/kustomize + dependsOn: + # Deploy Traefik first + - name: traefik + # Apply patches for common configurations + # This key always needs to be here for patching to work + patches: + # Set target namespace + - target: + group: kustomize.toolkit.fluxcd.io + kind: Kustomization + name: .* + patch: | + kind: . + metadata: + name: . + spec: + targetNamespace: emipass diff --git a/src/clusters/main/apps/emipass/kustomize/emipass-helm/emipass-helm.yaml b/src/clusters/main/apps/emipass/kustomize/emipass-helm/emipass-helm.yaml new file mode 100644 index 0000000..e1c798d --- /dev/null +++ b/src/clusters/main/apps/emipass/kustomize/emipass-helm/emipass-helm.yaml @@ -0,0 +1,13 @@ +# Create emipass-helm Kustomization +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: emipass-helm +spec: + # Path inside repository to a directory containing Kustomization files + path: src/clusters/main/apps/emipass/kustomize/emipass-helm/kustomize + dependsOn: + # Deploy namespace first + - name: emipass-namespace + # This key always needs to be here for patching to work + patches: [] diff --git a/src/clusters/main/apps/emipass/kustomize/emipass-helm/kustomize/kustomization.yaml b/src/clusters/main/apps/emipass/kustomize/emipass-helm/kustomize/kustomization.yaml new file mode 100644 index 0000000..2858a7b --- /dev/null +++ b/src/clusters/main/apps/emipass/kustomize/emipass-helm/kustomize/kustomization.yaml @@ -0,0 +1,7 @@ +# Create emipass-helm Kustomization +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +# Include the following resources +resources: + - resources/release.yaml + - resources/repository.yaml diff --git a/src/clusters/main/apps/emipass/kustomize/emipass-helm/kustomize/resources/release.yaml b/src/clusters/main/apps/emipass/kustomize/emipass-helm/kustomize/resources/release.yaml new file mode 100644 index 0000000..523882c --- /dev/null +++ b/src/clusters/main/apps/emipass/kustomize/emipass-helm/kustomize/resources/release.yaml @@ -0,0 +1,16 @@ +# Create emipass Helm release +apiVersion: helm.toolkit.fluxcd.io/v2beta1 +kind: HelmRelease +metadata: + name: emipass +spec: + chart: + spec: + # Use this chart from the repository + chart: emipass + # Use this Helm repository + sourceRef: + kind: HelmRepository + name: radio-aktywne + # This key always needs to be here for patching to work + postRenderers: [] diff --git a/src/clusters/main/apps/emipass/kustomize/emipass-helm/kustomize/resources/repository.yaml b/src/clusters/main/apps/emipass/kustomize/emipass-helm/kustomize/resources/repository.yaml new file mode 100644 index 0000000..5dac9cd --- /dev/null +++ b/src/clusters/main/apps/emipass/kustomize/emipass-helm/kustomize/resources/repository.yaml @@ -0,0 +1,8 @@ +# Create emipass Helm repository +apiVersion: source.toolkit.fluxcd.io/v1beta2 +kind: HelmRepository +metadata: + name: radio-aktywne +spec: + type: oci + url: oci://ghcr.io/radio-aktywne/charts diff --git a/src/clusters/main/apps/emipass/kustomize/emipass-namespace/emipass-namespace.yaml b/src/clusters/main/apps/emipass/kustomize/emipass-namespace/emipass-namespace.yaml new file mode 100644 index 0000000..788cfb0 --- /dev/null +++ b/src/clusters/main/apps/emipass/kustomize/emipass-namespace/emipass-namespace.yaml @@ -0,0 +1,10 @@ +# Create emipass-namespace Kustomization +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: emipass-namespace +spec: + # Path inside repository to a directory containing Kustomization files + path: src/clusters/main/apps/emipass/kustomize/emipass-namespace/kustomize + # This key always needs to be here for patching to work + patches: [] diff --git a/src/clusters/main/apps/emipass/kustomize/emipass-namespace/kustomize/kustomization.yaml b/src/clusters/main/apps/emipass/kustomize/emipass-namespace/kustomize/kustomization.yaml new file mode 100644 index 0000000..7e27548 --- /dev/null +++ b/src/clusters/main/apps/emipass/kustomize/emipass-namespace/kustomize/kustomization.yaml @@ -0,0 +1,6 @@ +# Create emipass-namespace Kustomization +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +# Include the following resources +resources: + - resources/namespace.yaml diff --git a/src/clusters/main/apps/emipass/kustomize/emipass-namespace/kustomize/resources/namespace.yaml b/src/clusters/main/apps/emipass/kustomize/emipass-namespace/kustomize/resources/namespace.yaml new file mode 100644 index 0000000..45253fc --- /dev/null +++ b/src/clusters/main/apps/emipass/kustomize/emipass-namespace/kustomize/resources/namespace.yaml @@ -0,0 +1,5 @@ +# Create emipass namespace +apiVersion: v1 +kind: Namespace +metadata: + name: emipass diff --git a/src/clusters/main/apps/emipass/kustomize/emipass-traefik/emipass-traefik.yaml b/src/clusters/main/apps/emipass/kustomize/emipass-traefik/emipass-traefik.yaml new file mode 100644 index 0000000..73942e3 --- /dev/null +++ b/src/clusters/main/apps/emipass/kustomize/emipass-traefik/emipass-traefik.yaml @@ -0,0 +1,13 @@ +# Create emipass-traefik Kustomization +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: emipass-traefik +spec: + # Path inside repository to a directory containing Kustomization files + path: src/clusters/main/apps/emipass/kustomize/emipass-traefik/kustomize + dependsOn: + # Deploy Helm release first + - name: emipass-helm + # This key always needs to be here for patching to work + patches: [] diff --git a/src/clusters/main/apps/emipass/kustomize/emipass-traefik/kustomize/kustomization.yaml b/src/clusters/main/apps/emipass/kustomize/emipass-traefik/kustomize/kustomization.yaml new file mode 100644 index 0000000..03cba85 --- /dev/null +++ b/src/clusters/main/apps/emipass/kustomize/emipass-traefik/kustomize/kustomization.yaml @@ -0,0 +1,8 @@ +# Create emipass-traefik Kustomization +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +# Include the following resources +resources: + - resources/routes/http.yaml + - resources/routes/whip.yaml + - resources/routes/rtp.yaml diff --git a/src/clusters/main/apps/emipass/kustomize/emipass-traefik/kustomize/resources/routes/http.yaml b/src/clusters/main/apps/emipass/kustomize/emipass-traefik/kustomize/resources/routes/http.yaml new file mode 100644 index 0000000..799df31 --- /dev/null +++ b/src/clusters/main/apps/emipass/kustomize/emipass-traefik/kustomize/resources/routes/http.yaml @@ -0,0 +1,18 @@ +# Create HTTP ingress route for emipass +apiVersion: traefik.io/v1alpha1 +kind: IngressRoute +metadata: + name: emipass-http +spec: + entryPoints: + # Use entrypoint for HTTPS traffic + - https + routes: + # Match traffic with the Host header + - match: HostRegexp(`emipass\..*`) + kind: Rule + services: + # Route traffic to the emipass service + - name: emipass + # This is the name of the port in the service + port: http diff --git a/src/clusters/main/apps/emipass/kustomize/emipass-traefik/kustomize/resources/routes/rtp.yaml b/src/clusters/main/apps/emipass/kustomize/emipass-traefik/kustomize/resources/routes/rtp.yaml new file mode 100644 index 0000000..d4cc6d3 --- /dev/null +++ b/src/clusters/main/apps/emipass/kustomize/emipass-traefik/kustomize/resources/routes/rtp.yaml @@ -0,0 +1,15 @@ +# Create RTP ingress route for emipass +apiVersion: traefik.io/v1alpha1 +kind: IngressRouteUDP +metadata: + name: emipass-rtp +spec: + entryPoints: + # Use entrypoint for emipass RTP traffic + - emipass-rtp + routes: + - services: + # Route traffic to the emipass service + - name: emipass + # This is the name of the port in the service + port: rtp diff --git a/src/clusters/main/apps/emipass/kustomize/emipass-traefik/kustomize/resources/routes/whip.yaml b/src/clusters/main/apps/emipass/kustomize/emipass-traefik/kustomize/resources/routes/whip.yaml new file mode 100644 index 0000000..c64bb33 --- /dev/null +++ b/src/clusters/main/apps/emipass/kustomize/emipass-traefik/kustomize/resources/routes/whip.yaml @@ -0,0 +1,18 @@ +# Create WHIP ingress route for emipass +apiVersion: traefik.io/v1alpha1 +kind: IngressRoute +metadata: + name: emipass-whip +spec: + entryPoints: + # Use entrypoint for HTTPS traffic + - https + routes: + # Match traffic with the Host header + - match: HostRegexp(`whip.emipass\..*`) + kind: Rule + services: + # Route traffic to the emipass service + - name: emipass + # This is the name of the port in the service + port: whip diff --git a/src/clusters/main/apps/emipass/kustomize/kustomization.yaml b/src/clusters/main/apps/emipass/kustomize/kustomization.yaml new file mode 100644 index 0000000..1b6df7e --- /dev/null +++ b/src/clusters/main/apps/emipass/kustomize/kustomization.yaml @@ -0,0 +1,8 @@ +# Create emipass Kustomization +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +# Include the following resources +resources: + - emipass-helm/emipass-helm.yaml + - emipass-namespace/emipass-namespace.yaml + - emipass-traefik/emipass-traefik.yaml diff --git a/src/clusters/main/apps/kustomization.yaml b/src/clusters/main/apps/kustomization.yaml index c6e44b5..a06787a 100644 --- a/src/clusters/main/apps/kustomization.yaml +++ b/src/clusters/main/apps/kustomization.yaml @@ -3,6 +3,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization # Include the following resources resources: + - emipass/emipass.yaml - emirecorder/emirecorder.yaml - emischeduler/emischeduler.yaml - emishows/emishows.yaml diff --git a/src/clusters/main/infrastructure/traefik/kustomize/traefik-helm/kustomize/resources/release.yaml b/src/clusters/main/infrastructure/traefik/kustomize/traefik-helm/kustomize/resources/release.yaml index 8e0edaf..aa321dc 100644 --- a/src/clusters/main/infrastructure/traefik/kustomize/traefik-helm/kustomize/resources/release.yaml +++ b/src/clusters/main/infrastructure/traefik/kustomize/traefik-helm/kustomize/resources/release.yaml @@ -118,6 +118,16 @@ spec: protocol: UDP # Port to use inside the cluster port: 9996 + # Port for emipass RTP traffic + emipass-rtp: + # Expose it outside the cluster + expose: true + # Expose it on this port + exposedPort: 9995 + # emipass RTP traffic uses UDP + protocol: UDP + # Port to use inside the cluster + port: 9995 service: annotations: # Use custom machine name in Tailscale diff --git a/src/clusters/main/infrastructure/traefik/kustomize/traefik-tls/kustomize/resources/certificates/wildcard.yaml b/src/clusters/main/infrastructure/traefik/kustomize/traefik-tls/kustomize/resources/certificates/wildcard.yaml index 2db57e0..fd3638b 100644 --- a/src/clusters/main/infrastructure/traefik/kustomize/traefik-tls/kustomize/resources/certificates/wildcard.yaml +++ b/src/clusters/main/infrastructure/traefik/kustomize/traefik-tls/kustomize/resources/certificates/wildcard.yaml @@ -8,6 +8,7 @@ spec: dnsNames: - "*.k8s.spietras.dev" - "*.emiarchive.k8s.spietras.dev" + - "*.emipass.k8s.spietras.dev" # Use Let's Encrypt to issue the certificate issuerRef: name: letsencrypt diff --git a/tests/clusters/ci/main/apps/emipass/emipass.yaml b/tests/clusters/ci/main/apps/emipass/emipass.yaml new file mode 100644 index 0000000..feea20b --- /dev/null +++ b/tests/clusters/ci/main/apps/emipass/emipass.yaml @@ -0,0 +1,25 @@ +# Create emipass Kustomization +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: emipass +spec: + # Path inside repository to a directory containing Kustomization files + path: tests/clusters/ci/main/apps/emipass/kustomize + dependsOn: + # Deploy Traefik first + - name: traefik + # Apply patches for common configurations + # This key always needs to be here for patching to work + patches: + # Set target namespace + - target: + group: kustomize.toolkit.fluxcd.io + kind: Kustomization + name: .* + patch: | + kind: . + metadata: + name: . + spec: + targetNamespace: emipass diff --git a/tests/clusters/ci/main/apps/emipass/kustomize/emipass-helm/emipass-helm.yaml b/tests/clusters/ci/main/apps/emipass/kustomize/emipass-helm/emipass-helm.yaml new file mode 100644 index 0000000..0fb2f77 --- /dev/null +++ b/tests/clusters/ci/main/apps/emipass/kustomize/emipass-helm/emipass-helm.yaml @@ -0,0 +1,13 @@ +# Create emipass-helm Kustomization +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: emipass-helm +spec: + # Path inside repository to a directory containing Kustomization files + path: tests/clusters/ci/main/apps/emipass/kustomize/emipass-helm/kustomize + dependsOn: + # Deploy namespace first + - name: emipass-namespace + # This key always needs to be here for patching to work + patches: [] diff --git a/tests/clusters/ci/main/apps/emipass/kustomize/emipass-helm/kustomize/kustomization.yaml b/tests/clusters/ci/main/apps/emipass/kustomize/emipass-helm/kustomize/kustomization.yaml new file mode 100644 index 0000000..c8fa785 --- /dev/null +++ b/tests/clusters/ci/main/apps/emipass/kustomize/emipass-helm/kustomize/kustomization.yaml @@ -0,0 +1,5 @@ +# Overlay emipass-helm Kustomization +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ../../../../../../../../../src/clusters/main/apps/emipass/kustomize/emipass-helm/kustomize diff --git a/tests/clusters/ci/main/apps/emipass/kustomize/emipass-namespace/emipass-namespace.yaml b/tests/clusters/ci/main/apps/emipass/kustomize/emipass-namespace/emipass-namespace.yaml new file mode 100644 index 0000000..5f2660d --- /dev/null +++ b/tests/clusters/ci/main/apps/emipass/kustomize/emipass-namespace/emipass-namespace.yaml @@ -0,0 +1,10 @@ +# Create emipass-namespace Kustomization +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: emipass-namespace +spec: + # Path inside repository to a directory containing Kustomization files + path: tests/clusters/ci/main/apps/emipass/kustomize/emipass-namespace/kustomize + # This key always needs to be here for patching to work + patches: [] diff --git a/tests/clusters/ci/main/apps/emipass/kustomize/emipass-namespace/kustomize/kustomization.yaml b/tests/clusters/ci/main/apps/emipass/kustomize/emipass-namespace/kustomize/kustomization.yaml new file mode 100644 index 0000000..0e0d632 --- /dev/null +++ b/tests/clusters/ci/main/apps/emipass/kustomize/emipass-namespace/kustomize/kustomization.yaml @@ -0,0 +1,5 @@ +# Overlay emipass-namespace Kustomization +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ../../../../../../../../../src/clusters/main/apps/emipass/kustomize/emipass-namespace/kustomize diff --git a/tests/clusters/ci/main/apps/emipass/kustomize/emipass-traefik/emipass-traefik.yaml b/tests/clusters/ci/main/apps/emipass/kustomize/emipass-traefik/emipass-traefik.yaml new file mode 100644 index 0000000..2729a20 --- /dev/null +++ b/tests/clusters/ci/main/apps/emipass/kustomize/emipass-traefik/emipass-traefik.yaml @@ -0,0 +1,13 @@ +# Create emipass-traefik Kustomization +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: emipass-traefik +spec: + # Path inside repository to a directory containing Kustomization files + path: tests/clusters/ci/main/apps/emipass/kustomize/emipass-traefik/kustomize + dependsOn: + # Deploy Helm release first + - name: emipass-helm + # This key always needs to be here for patching to work + patches: [] diff --git a/tests/clusters/ci/main/apps/emipass/kustomize/emipass-traefik/kustomize/kustomization.yaml b/tests/clusters/ci/main/apps/emipass/kustomize/emipass-traefik/kustomize/kustomization.yaml new file mode 100644 index 0000000..b372258 --- /dev/null +++ b/tests/clusters/ci/main/apps/emipass/kustomize/emipass-traefik/kustomize/kustomization.yaml @@ -0,0 +1,5 @@ +# Overlay emipass-traefik Kustomization +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ../../../../../../../../../src/clusters/main/apps/emipass/kustomize/emipass-traefik/kustomize diff --git a/tests/clusters/ci/main/apps/emipass/kustomize/kustomization.yaml b/tests/clusters/ci/main/apps/emipass/kustomize/kustomization.yaml new file mode 100644 index 0000000..1b6df7e --- /dev/null +++ b/tests/clusters/ci/main/apps/emipass/kustomize/kustomization.yaml @@ -0,0 +1,8 @@ +# Create emipass Kustomization +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +# Include the following resources +resources: + - emipass-helm/emipass-helm.yaml + - emipass-namespace/emipass-namespace.yaml + - emipass-traefik/emipass-traefik.yaml diff --git a/tests/clusters/ci/main/apps/kustomization.yaml b/tests/clusters/ci/main/apps/kustomization.yaml index c6e44b5..a06787a 100644 --- a/tests/clusters/ci/main/apps/kustomization.yaml +++ b/tests/clusters/ci/main/apps/kustomization.yaml @@ -3,6 +3,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization # Include the following resources resources: + - emipass/emipass.yaml - emirecorder/emirecorder.yaml - emischeduler/emischeduler.yaml - emishows/emishows.yaml