Unverified Commit 2d860319 authored by Matt Pryor's avatar Matt Pryor Committed by GitHub
Browse files

Merge pull request #128 from ESGF/issue/121/hpa

Add HPA resources and make them configurable
parents da00d03b 7dbc78e8
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -6,7 +6,9 @@ metadata:
  name: {{ include "esgf.component.fullname" (list . "fileServer") }}
  labels: {{ include "esgf.component.labels" (list . "fileServer") | nindent 4 }}
spec:
  {{- if not $fileServer.hpa }}
  replicas: {{ $fileServer.replicaCount }}
  {{- end }}
  selector:
    matchLabels: {{ include "esgf.component.selectorLabels" (list . "fileServer") | nindent 6 }}
  template:
@@ -80,6 +82,7 @@ spec:
            # Just cat the access log
            - cat
            - /var/log/nginx/access.log
          resources: {{ toYaml .Values.data.logTailResources | nindent 12 }}
          {{- with .Values.data.securityContext }}
          securityContext: {{ toYaml . | nindent 12 }}
          {{- end }}
+14 −0
Original line number Diff line number Diff line
{{- $fileServer := .Values.data.fileServer -}}
{{- if (and $fileServer.enabled $fileServer.hpa) -}}
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
  name: {{ include "esgf.component.fullname" (list . "fileServer") }}
  labels: {{ include "esgf.component.labels" (list . "fileServer") | nindent 4 }}
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: {{ include "esgf.component.fullname" (list . "fileServer") }}
{{ toYaml $fileServer.hpa | indent 2 }}
{{- end -}}
+3 −0
Original line number Diff line number Diff line
@@ -6,7 +6,9 @@ metadata:
  name: {{ include "esgf.component.fullname" (list . "thredds") }}
  labels: {{ include "esgf.component.labels" (list . "thredds") | nindent 4 }}
spec:
  {{- if not $thredds.hpa }}
  replicas: {{ $thredds.replicaCount }}
  {{- end }}
  selector:
    matchLabels: {{ include "esgf.component.selectorLabels" (list . "thredds") | nindent 6 }}
  template:
@@ -139,6 +141,7 @@ spec:
            # Just cat the log file
            - cat
            - /thredds/logs/{{ . }}
          resources: {{ toYaml $topContext.Values.data.logTailResources | nindent 12 }}
          {{- with $topContext.Values.data.securityContext }}
          securityContext: {{ toYaml . | nindent 12 }}
          {{- end }}
+14 −0
Original line number Diff line number Diff line
{{- $thredds := .Values.data.thredds -}}
{{- if (and $thredds.enabled $thredds.hpa) -}}
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
  name: {{ include "esgf.component.fullname" (list . "thredds") }}
  labels: {{ include "esgf.component.labels" (list . "thredds") | nindent 4 }}
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: {{ include "esgf.component.fullname" (list . "thredds") }}
{{ toYaml $thredds.hpa | indent 2 }}
{{- end -}}
+30 −0
Original line number Diff line number Diff line
@@ -85,6 +85,12 @@ data:
  podSecurityContext: {}
  securityContext: {}

  # The resources for log-tailing containers
  logTailResources:
    requests:
      cpu: 5m
      memory: 10Mi

  # Configuration for the THREDDS pod
  thredds:
    # Indicates if THREDDS should be deployed or not
@@ -107,7 +113,26 @@ data:
      # A folder will be created within this directory using the namespace and release name
      pathPrefix: /var/cache/esgf
    # The number of replicas for the THREDDS pod
    # If an hpa is configured, this is ignored - the hpa has full control over the number of replicas
    replicaCount: 1
    # The horizontal pod autoscaler configuration for THREDDS pods
    # See https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/
    hpa: {}
      # minReplicas: 1
      # maxReplicas: 20
      # metrics:
      #   - type: Resource
      #     resource:
      #       name: cpu
      #       target:
      #         type: Utilization
      #         averageUtilization: 80
      #   - type: Resource
      #     resource:
      #       name: memory
      #       target:
      #         type: Utilization
      #         averageUtilization: 70
    # The startup time for the THREDDS container
    # For large pre-existing catalogs, this maybe need to be large (default 5 mins)
    startTimeout: 300
@@ -135,7 +160,12 @@ data:
    image:
      repository: nginx
    # The number of replicas for the file server pod
    # If an hpa is configured, this is ignored - the hpa has full control over the number of replicas
    replicaCount: 1
    # The horizontal pod autoscaler configuration for file server pods
    # See https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/
    # Configuration is the same as for the thredds pod
    hpa: {}
    # The resource allocations for the file server container
    # See https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
    resources: {}
Loading