revise namespaces and ingress in docs

This commit is contained in:
Clemens 2024-02-27 11:09:51 +01:00
parent 231002017f
commit 26ca2acb6b

112
README.md
View file

@ -175,11 +175,24 @@ Have you recognized the `defn-spec` macro above? We use allover validation, e.g.
We support namespaces for ingress & postgres (monitoring lives in it's own namespace `monitoring`). We support namespaces for ingress & postgres (monitoring lives in it's own namespace `monitoring`).
```clojure ```clojure
(deftest should-generate-simple-ingress (dda.c4k-common.namespace/generate {:namespace "myapp"})
(is (= [{:apiVersion "v1" ```
:kind "Namespace"
:metadata {:name "myapp"}}] yields:
(cut/generate {:namespace "myapp"}))))
```clojure
[{:apiVersion "v1"
:kind "Namespace"
:metadata {:name "myapp"}}]
```
which can be rendered to:
```yaml
apiVersion: v1
kind: Namespace
metadata:
name: myapp
``` ```
#### Ingress #### Ingress
@ -187,24 +200,77 @@ We support namespaces for ingress & postgres (monitoring lives in it's own names
In most cases we use `generate-ingress-and-cert` which generates an ingress in combination with letsencrypt cert for a named service. In most cases we use `generate-ingress-and-cert` which generates an ingress in combination with letsencrypt cert for a named service.
```clojure ```clojure
(deftest should-generate-ingress-and-cert (dda.c4k-common.ingress/generate-ingress-and-cert
(is (= [{:apiVersion "cert-manager.io/v1", {:fqdns ["test.jit.si"]
...} :service-name "web"
{:apiVersion "networking.k8s.io/v1", :service-port 80})
:kind "Ingress", ```
...
:spec yields:
{:tls [{:hosts ["test.jit.si"], :secretName "web"}],
:rules ```clojure
[{:host "test.jit.si", [{:apiVersion "cert-manager.io/v1",
:http {:paths [{:path "/", :kind "Certificate",
:pathType "Prefix", ...
:backend :spec
{:service {:name "web", {:secretName "web",
:port {:number 80}}}}]}}]}}] :commonName "test.jit.si",
(cut/generate-ingress-and-cert {:fqdns ["test.jit.si"] :duration "2160h",
:service-name "web" :renewBefore "720h",
:service-port 80})))) :dnsNames ["test.jit.si"],
:issuerRef {:name "staging", :kind "ClusterIssuer"}}}
{:apiVersion "networking.k8s.io/v1",
:kind "Ingress",
...
:spec
{:tls [{:hosts ["test.jit.si"], :secretName "web"}],
:rules
[{:host "test.jit.si",
:http {:paths [{:path "/",
:pathType "Prefix",
:backend
{:service {:name "web",
:port {:number 80}}}}]}}]}}]
```
which can be rendered to:
```yaml
apiVersion: cert-manager.io/v1
kind: Certificate
...
spec:
secretName: web
commonName: test.jit.si
duration: 2160h
renewBefore: 720h
dnsNames:
- test.jit.si
issuerRef:
name: staging
kind: ClusterIssuer
---
apiVersion: networking.k8s.io/v1
kind: Ingress
...
spec:
tls:
- hosts:
- test.jit.si
secretName: web
rules:
- host: test.jit.si
http:
paths:
- pathType: Prefix
path: /
backend:
service:
name: web
port:
number: 80
``` ```
#### Postgres Database #### Postgres Database