local kube = import "k8s/configs/base.libsonnet"; local linuxserver = import "k8s/configs/templates/core/linuxserver.libsonnet"; local images = import "k8s/configs/images.libsonnet"; local probe(delaySeconds) = { initialDelaySeconds: delaySeconds, periodSeconds: 30, tcpSocket: { port: "http", }, }; local WebPort = 80; local Params = kube.simpleFieldStruct([ "namespace", "name", "filePath", "dataClaimName", "ingressHost", ]) { labels: {}, gatekeeperSidecar: null, lsParams: linuxserver.AppParams { name: $.name, namespace: $.namespace, filePath: $.filePath, templatePath: std.thisFile, baseAppName: "grocy", imageName: "linuxserver/grocy", labels+: $.labels, gatekeeperSidecar: $.gatekeeperSidecar, services: [ linuxserver.Service { suffix: "ui", spec: kube.SvcUtil.BasicHttpClusterIpSpec(WebPort) }, ], ports: [ kube.DeployUtil.ContainerPort("http", WebPort), ], pvcs: [ linuxserver.Pvc{ name: "data", mountPath: "/config", bindName: $.dataClaimName, }, ], resources: { requests: { cpu: "50m", memory: "128Mi", }, limits: { cpu: "100m", memory: "256Mi", }, }, livenessProbe: probe(/*delaySeconds=*/20), readinessProbe: probe(/*delaySeconds=*/20), }, }; local App(params) = linuxserver.App(params.lsParams) { ingress: kube.Ingress(params.namespace, "grocy") { metadata+: { annotations+: { "cert-manager.io/cluster-issuer": "letsencrypt-production", }, }, spec+: { ingressClassName: "nginx", tls: [ { hosts: [ params.ingressHost, ], secretName: "grocy-cert", }, ], rules: [ { host: params.ingressHost, http: { paths: [ { path: "/", pathType: "Prefix", backend: { service: { name: 'grocy-ui', port: { number: 80}, }, }, }, ], }, }, ], }, }, }; { Params: Params, WebPort: WebPort, App(params): App(params), }