| local kube = import "../../kube/hscloud.libsonnet"; |
| |
| { |
| local top = self, |
| local cfg = self.cfg, |
| |
| cfg:: { |
| name: 'labelmaker', |
| namespace: 'labelmaker', |
| domain: 'label.hackerspace.pl', |
| images: { |
| app: 'registry.k0.hswaw.net/radex/labelmaker:20240610142603', |
| proxy: "quay.io/oauth2-proxy/oauth2-proxy:v7.2.1", |
| }, |
| }, |
| |
| secretRefs:: { |
| cookie_secret: { secretKeyRef: { name: "labelmaker-proxy", key: "cookie_secret" } }, |
| oidc_secret: { secretKeyRef: { name: "labelmaker-proxy", key: "oidc_secret" } }, |
| }, |
| |
| local ns = kube.Namespace(cfg.namespace), |
| |
| deployment: ns.Contain(kube.Deployment(cfg.name)) { |
| spec+: { |
| replicas: 1, |
| template+: { |
| spec+: { |
| containers_: { |
| default: kube.Container("default") { |
| image: cfg.images.proxy, |
| ports_: { |
| http: { containerPort: 8001 }, |
| }, |
| env_: { |
| OAUTH2_PROXY_UPSTREAMS: "http://127.0.0.1:5000", |
| OAUTH2_PROXY_HTTP_ADDRESS: "0.0.0.0:8001", |
| |
| OAUTH2_PROXY_COOKIE_SECRET: top.secretRefs.cookie_secret, |
| |
| OAUTH2_PROXY_PROVIDER: "oidc", |
| OAUTH2_PROXY_OIDC_ISSUER_URL: "https://sso.hackerspace.pl", |
| OAUTH2_PROXY_SKIP_PROVIDER_BUTTON: "true", |
| |
| OAUTH2_PROXY_CLIENT_ID: "f99bcf63-fb39-4916-baae-7f66aa969115", |
| OAUTH2_PROXY_CLIENT_SECRET: top.secretRefs.oidc_secret, |
| |
| OAUTH2_PROXY_EMAIL_DOMAINS: "*", |
| |
| OAUTH2_PROXY_REVERSE_PROXY: true, |
| OAUTH2_PROXY_TRUSTED_IPS: "185.236.240.5", // customs.hackerspace.pl |
| }, |
| }, |
| |
| app: kube.Container("app") { |
| image: cfg.images.app, |
| ports_: { |
| http: { containerPort: 5000 }, |
| }, |
| env_: { |
| PRINTSERVANT_HOST: 'http://printservant.printservant.svc.cluster.local:3199', |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| |
| service: ns.Contain(kube.Service(cfg.name)) { |
| target:: top.deployment, |
| }, |
| |
| ingress: ns.Contain(kube.SimpleIngress(cfg.name)) { |
| hosts:: [cfg.domain], |
| target:: top.service, |
| }, |
| } |