Unverified Commit 57997690 authored by William Tucker's avatar William Tucker Committed by GitHub
Browse files

Merge pull request #261 from bstrdsmkr/chart-hpa-version

More flexible nginx configuration in helm chart
parents 5f5d6b7c 189dfc68
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -18,6 +18,12 @@ server {
        return 200;
    }

    # Basic metrics export, compatible with nginx exporter
    # https://github.com/nginx/nginx-prometheus-exporter
    location = /stub_status {
        stub_status;
    }

    # Create a location block for each dataset
    {{- range .Values.data.datasets }}
    location /thredds/fileServer/{{ .path }}/ {
@@ -26,6 +32,10 @@ server {
        proxy_pass https://{{ $s3.host }}:{{ $s3.port }}/{{ $s3.bucket }}/{{ trimAll "/" $s3.dataPath }}/;
        {{- else }}
        alias {{ trimSuffix "/" .location }}/;
        autoindex on;
        expires max;
        sendfile on;
        tcp_nopush on;
        try_files $uri =404;
        {{- end }}
    }
+10 −0
Original line number Diff line number Diff line
{{- $fileServer := .Values.data.fileServer -}}
{{- if (and .Values.data.enabled $fileServer.enabled (index $fileServer "nginx.conf")) -}}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "esgf.component.fullname" (list . "fileServer") }}-nginx-conf
  labels: {{ include "esgf.component.labels" (list . "fileServer" $fileServer.labels) | nindent 4 }}
data:
  nginx.conf: {{ tpl (index $fileServer "nginx.conf") . | quote }}
{{- end -}}
+1 −1
Original line number Diff line number Diff line
@@ -8,6 +8,6 @@ metadata:
data:
  datasets.conf: {{ tpl (.Files.Get "files/fileServer/datasets.conf") . | quote }}
{{ range $file, $content := $fileServer.extraNginxConf }}
  {{ $file }}: {{ tpl $content . | quote }}
  {{ $file }}: {{ tpl $content $ | quote }}
{{- end }}
{{- end -}}
+15 −2
Original line number Diff line number Diff line
@@ -19,6 +19,9 @@ spec:
      # https://helm.sh/docs/howto/charts_tips_and_tricks/#automatically-roll-deployments
      annotations:
        checksum/configmap: {{ include (print $.Template.BasePath "/fileServer/configmap.yaml") . | sha256sum }}
        {{- if (index $fileServer "nginx.conf") }}
        checksum/configmap-nginx: {{ include (print $.Template.BasePath "/fileServer/configmap-nginx.yaml") . | sha256sum }}
        {{- end }}
        {{- if $accessLogSidecar.enabled }}
        # When the access log sidecar is enabled, roll the deployment if the logstash pipelines or certificates change
        checksum/logstash-pipelines: {{ include (print $.Template.BasePath "/logstash/pipelines.yaml") . | sha256sum }}
@@ -82,7 +85,7 @@ spec:
          securityContext: {{ toYaml . | nindent 12 }}
          {{- end }}
          volumeMounts:
            - name: nginx-conf
            - name: nginx-extra
              mountPath: /etc/nginx/conf.d
              readOnly: true
            - name: static-content
@@ -99,6 +102,11 @@ spec:
              mountPath: /var/lib/nginx/tmp
            - name: nginx-run
              mountPath: /run/nginx
            {{- if (index $fileServer "nginx.conf") }}
            - name: nginx-conf
              mountPath: /etc/nginx/nginx.conf
              subPath: nginx.conf
            {{- end }}
            {{- include "esgf.data.volumeMounts" . | nindent 12 }}
            {{- with $fileServer.extraVolumeMounts }}
            {{- toYaml . | nindent 12 }}
@@ -166,7 +174,7 @@ spec:
      tolerations: {{ toYaml . | nindent 8 }}
      {{- end }}
      volumes:
        - name: nginx-conf
        - name: nginx-extra
          configMap:
            name: {{ include "esgf.component.fullname" (list . "fileServer") }}
        - name: static-content
@@ -178,6 +186,11 @@ spec:
          emptyDir: {}
        - name: nginx-run
          emptyDir: {}
        {{- if (index $fileServer "nginx.conf") }}
        - name: nginx-conf
          configMap:
            name: {{ include "esgf.component.fullname" (list . "fileServer") }}-nginx
        {{- end }}
        # These volumes are only required if the access log sidecar is enabled
        {{- if $accessLogSidecar.enabled }}
        # Each pod gets a directory to hold the named pipes for the logs
+1 −1
Original line number Diff line number Diff line
{{- $fileServer := .Values.data.fileServer -}}
{{- if (and .Values.data.enabled $fileServer.enabled $fileServer.hpa) -}}
apiVersion: autoscaling/v2beta2
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: {{ include "esgf.component.fullname" (list . "fileServer") }}
Loading