chilly-waitress-62592
01/09/2023, 4:27 PMquaint-dress-831
01/09/2023, 4:58 PMquaint-dress-831
01/09/2023, 4:58 PMmammoth-flag-56137
01/10/2023, 2:19 AMmammoth-flag-56137
01/10/2023, 2:19 AMgarden.yaml
kind: Module
type: kubernetes
name: one-server
disabled: ${!var.one.enabled}
include:
- "*"
files:
- deployment.yaml
- service.yaml
- hpa.yaml
- ingress.yaml
- pdb.yaml
variables:
tls-suffix: "${var.acme.production ? 'prod' : 'staging'}"
issuer: "${var.acme.production ? 'letsencrypt-issuer-prod' : 'letsencrypt-issuer-staging'}"
external-image: "${var.one.server.container.image}:${var.one.server.container.tag}"
serviceResource:
kind: Deployment
name: one-servermammoth-flag-56137
01/10/2023, 2:20 AMhpa.yaml
${if var.one.server.autoscaling.enabled}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: one-server
labels:
app.kubernetes.io/name: one-server
app.kubernetes.io/instance: ${environment.fullName}
app.kubernetes.io/service: server
app.kubernetes.io/version: ${var.one.server.container.tag}
app.kubernetes.io/managed-by: Garden
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: one-server
minReplicas: ${var.one.server.autoscaling.min}
maxReplicas: ${var.one.server.autoscaling.max}
metrics:
${if var.one.server.autoscaling.cpu}
- type: Resource
resource:
name: cpu
targetAverageUtilization: ${var.one.server.autoscaling.cpu}
${endif}
${if var.one.server.autoscaling.memory}
- type: Resource
resource:
name: memory
targetAverageUtilization: ${var.one.server.autoscaling.memory}
${endif}
${endif}chilly-waitress-62592
01/10/2023, 2:44 PMcontainer module) over the k8s primitives. For instance, I'm using tlsCertificates with my own cert-manager installation. It's nice that the built in container module is probably templating in the correct hostnames and everything for ingress based on the environment.
So to add some autoscaling, I now have a lot of surface area to replicate and make sure it's working correctly. I will likely be scanning the garden source to copy/paste the existing templates to the best of my ability.
Are the existing templates for container easily accessible in the garden repo? Or are they built more programmatically in the JS?mammoth-flag-56137
01/13/2023, 1:28 AMquaint-dress-831
01/16/2023, 7:31 PMcontainer modules because they are so simple to reason through. As your needs grow we generally advise relegating use of the container module to the role of image-builder then leaning on the kubernetes or helm modules for the heavy-lifting. After all, Kubernetes is the underlying substrate.chilly-waitress-62592
01/22/2023, 6:35 PMmammoth-flag-56137
01/23/2023, 1:23 AM