nais / naisd

nais deployment daemon
https://nais.io
MIT License
27 stars 10 forks source link

nais validate improvement #111

Closed mammut89 closed 6 years ago

mammut89 commented 6 years ago

Nais validate does not check for invalid memory resources. A typo in this yaml causes Bad Gateway and is tricky to debug. The typo is : memory: 2048i , should have been memory: 2048Mi but was not picked up by the validator.

name: gjenlevende-selvbetjening-frontend
image: repo.adeo.no:5443/gjenlevende-selvbetjening-frontend
replicas: # set min = max to disable autoscaling
  min: 1 # minimum number of replicas
  max: 1 # maximum number of replicas
  cpuThresholdPercentage: 50 # total cpu percentage threshold on deployment, at which point it will increase number of pods if current < max
port: 8080 # the port number which is exposed by the container and should receive traffic
healthcheck:
  liveness:
    path: api/internal/isAlive
    # wait 30 seconds before trying to check status,
    # and then try 60 times with 1 second intervals before
    # killing the pod: 30 + 1*60 = 90 seconds before pod is killed
    initialDelay: 30
    periodSeconds: 1
    failureThreshold: 60
  readiness:
    path: api/internal/isReady
    initialDelay: 30
    periodSeconds: 1
    failureThreshold: 60
prometheus: #Optional
  enabled: true # if true the pod will be scraped for metrics by prometheus
  path: /metrics # Path to prometheus-metrics
resources: # Optional. See: http://kubernetes.io/docs/user-guide/compute-resources/
  limits:
    cpu: 1000m # app will have its cpu usage throttled if exceeding this limit
    memory: 2048i  # app will be killed if exceeding these limits
  requests: # app will be scheduled on nodes with at least this amount resources available
    cpu: 500m
    memory: 256Mi
ghost commented 6 years ago

I guess we should validate correct cpu unit as well.

ghost commented 6 years ago

Regarding "Bad Gateway". I have asked Roger Bjørnstad to include the the body of a nasid deploy response in addition to the status code.