diff --git a/deploy/base/deploy-solar-toolkit-gateway.yaml b/deploy/base/deploy-solar-toolkit-gateway.yaml new file mode 100644 index 0000000..a522694 --- /dev/null +++ b/deploy/base/deploy-solar-toolkit-gateway.yaml @@ -0,0 +1,53 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: solar-toolkit-gateway + labels: + app: solar-toolkit-gateway + component: web + app.kubernetes.io/name: solar-toolkit-gateway + app.kubernetes.io/instance: solar-toolkit-gateway +spec: + selector: + matchLabels: + app: solar-toolkit-gateway + component: web + template: + metadata: + labels: + app: solar-toolkit-gateway + component: web + app.kubernetes.io/name: solar-toolkit-gateway + app.kubernetes.io/instance: solar-toolkit-gateway + spec: + containers: + - image: netfluxio/solar-toolkit:latest + imagePullPolicy: Always + name: solar-toolkit + ports: + - name: http + protocol: TCP + containerPort: 8888 + env: + - name: DATABASE_URL + valueFrom: + secretKeyRef: + name: solar-toolkit-gateway + key: database-url + resources: + requests: + memory: "16Mi" + cpu: "50m" + limits: + memory: "64Mi" + cpu: "100m" + livenessProbe: + failureThreshold: 10 + httpGet: + path: /healthz + port: 8888 + scheme: HTTP + initialDelaySeconds: 10 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 3 diff --git a/deploy/base/ingress.yaml b/deploy/base/ingress.yaml index ba83e2c..8b0896c 100644 --- a/deploy/base/ingress.yaml +++ b/deploy/base/ingress.yaml @@ -94,3 +94,13 @@ spec: name: radicale port: name: caldav + - host: solar-gateway.internal + http: + paths: + - pathType: Prefix + path: "/" + backend: + service: + name: solar-toolkit-gateway + port: + name: http diff --git a/deploy/base/kustomization.yaml b/deploy/base/kustomization.yaml index 19f3368..1e83361 100644 --- a/deploy/base/kustomization.yaml +++ b/deploy/base/kustomization.yaml @@ -96,6 +96,9 @@ resources: - statefulset-radicale.yaml - svc-radicale.yaml +- deploy-solar-toolkit-gateway.yaml +- svc-solar-toolkit-gateway.yaml + configMapGenerator: - name: gitea-scripts files: diff --git a/deploy/base/svc-solar-toolkit-gateway.yaml b/deploy/base/svc-solar-toolkit-gateway.yaml new file mode 100644 index 0000000..c3e25c3 --- /dev/null +++ b/deploy/base/svc-solar-toolkit-gateway.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: solar-toolkit-gateway + component: web + app.kubernetes.io/instance: solar-toolkit-gateway + app.kubernetes.io/name: solar-toolkit-gateway + name: solar-toolkit-gateway +spec: + ports: + - name: http + port: 80 + protocol: TCP + targetPort: 8888 + selector: + app: solar-toolkit-gateway + component: web + type: ClusterIP diff --git a/deploy/dev/kustomization.yaml b/deploy/dev/kustomization.yaml index 8993a16..472dbe6 100644 --- a/deploy/dev/kustomization.yaml +++ b/deploy/dev/kustomization.yaml @@ -103,6 +103,12 @@ secretGenerator: options: labels: app: synapse +- name: solar-toolkit-gateway + literals: + - database-url=postgres://postgres:postgres@dev-db:5432/solar_toolkit_dev?sslmode=disable + options: + labels: + app: solar-toolkit-gateway patches: # Patch the metrics-server to not require TLS in dev cluster. diff --git a/deploy/prod/ingress.yaml b/deploy/prod/ingress.yaml index 37ce4da..c36d0fb 100644 --- a/deploy/prod/ingress.yaml +++ b/deploy/prod/ingress.yaml @@ -17,6 +17,7 @@ - synapse.netflux.io - netflux.io - caldav.netflux.io + - solar-gateway.netflux.io secretName: prod-ingress-tls - op: replace path: /spec/rules/0/host @@ -42,3 +43,6 @@ - op: replace path: /spec/rules/7/host value: caldav.netflux.io +- op: replace + path: /spec/rules/8/host + value: solar-gateway.netflux.io diff --git a/deploy/prod/kustomization.yaml b/deploy/prod/kustomization.yaml index 4c91670..ae41b9c 100644 --- a/deploy/prod/kustomization.yaml +++ b/deploy/prod/kustomization.yaml @@ -92,6 +92,12 @@ secretGenerator: options: labels: app: synapse +- name: solar-toolkit-gateway + files: + - database-url=secrets/solar-toolkit-gateway-database-url + options: + labels: + app: solar-toolkit-gateway patches: # Patch the ingress-nginx deployment to allow it to use a service with a diff --git a/kind/bin/setup-dev-db.sql b/kind/bin/setup-dev-db.sql index 0d7c510..d5857cd 100644 --- a/kind/bin/setup-dev-db.sql +++ b/kind/bin/setup-dev-db.sql @@ -7,3 +7,4 @@ CREATE DATABASE grafana; CREATE DATABASE drone; CREATE DATABASE gitea; CREATE DATABASE synapse ENCODING UTF8 LC_COLLATE 'C' LC_CTYPE 'C' TEMPLATE template0; +CREATE DATABASE solar_toolkit_dev;