Jeremy Ronquillo | 11851d3 | 2020-06-08 15:13:08 -0700 | [diff] [blame] | 1 | {{/* |
Jeremy Ronquillo | ec2d3e4 | 2020-06-05 11:33:39 -0700 | [diff] [blame] | 2 | # Copyright 2019-present Open Networking Foundation |
Jeremy Ronquillo | 11851d3 | 2020-06-08 15:13:08 -0700 | [diff] [blame] | 3 | |
Jeremy Ronquillo | 6046ce3 | 2020-06-18 11:06:29 -0700 | [diff] [blame] | 4 | # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0 |
Jeremy Ronquillo | 11851d3 | 2020-06-08 15:13:08 -0700 | [diff] [blame] | 5 | */}} |
| 6 | |
| 7 | {{ tuple "cdn-local" . | include "cdn-local.service_account" }} |
| 8 | |
| 9 | --- |
| 10 | apiVersion: apps/v1 |
| 11 | kind: StatefulSet |
| 12 | metadata: |
| 13 | name: cdn-local |
| 14 | labels: |
| 15 | {{ tuple "cdn-local" . | include "cdn-local.metadata_labels" | indent 4 }} |
| 16 | spec: |
| 17 | replicas: {{ .Values.config.nginx.replicas }} |
| 18 | selector: |
| 19 | matchLabels: |
| 20 | {{ tuple "cdn-local" . | include "cdn-local.metadata_labels" | indent 6 }} |
| 21 | serviceName: "cdn-local" |
| 22 | template: |
| 23 | metadata: |
| 24 | labels: |
| 25 | {{ tuple "cdn-local" . | include "cdn-local.metadata_labels" | indent 8 }} |
| 26 | {{ if .Values.config.sriov.enabled }} |
| 27 | annotations: |
| 28 | k8s.v1.cni.cncf.io/networks: '[ |
| 29 | { |
| 30 | "name": "sgi-net-cdn", |
| 31 | "interface": {{ .Values.config.nginx.sgiInterface.name | quote }}, |
| 32 | "ips": {{ .Values.config.nginx.sgiInterface.ip | quote }} |
| 33 | } |
| 34 | ]' |
| 35 | {{ end }} |
| 36 | spec: |
| 37 | {{- if .Values.nodeSelectors.enabled }} |
| 38 | nodeSelector: |
| 39 | {{ .Values.nodeSelectors.nginx.label }}: {{ .Values.nodeSelectors.nginx.value }} |
| 40 | {{- end }} |
| 41 | hostNetwork: {{ not .Values.config.sriov.enabled }} |
| 42 | serviceAccountName: cdn-local |
| 43 | initContainers: |
| 44 | - name: cdn-local-init |
| 45 | image: {{ .Values.images.tags.nginx }} |
| 46 | imagePullPolicy: {{ .Values.images.pullPolicy }} |
| 47 | securityContext: |
| 48 | allowPrivilegeEscalation: false |
| 49 | readOnlyRootFilesystem: false |
| 50 | runAsUser: 0 |
| 51 | command: [ "bash", "-xc"] |
| 52 | args: |
| 53 | - cp /config/*.sh /shared-vol;cp /conf/* /shared-vol |
| 54 | volumeMounts: |
| 55 | - name: shared-volume |
| 56 | mountPath: /shared-vol |
| 57 | - name: nginx-net-config |
| 58 | mountPath: /config |
| 59 | - name: nginx-rtmp-config |
| 60 | mountPath: /conf |
| 61 | containers: |
| 62 | - name: nginx |
| 63 | image: {{ .Values.images.tags.nginx }} |
| 64 | imagePullPolicy: {{ .Values.images.pullPolicy }} |
| 65 | command: [ "bash", "-xc"] |
| 66 | args: |
| 67 | - chmod a+x /config/*.sh; /config/run-nginx.sh |
| 68 | securityContext: |
| 69 | privileged: true |
| 70 | volumeMounts: |
| 71 | - name: shared-volume |
| 72 | mountPath: /config |
| 73 | - name: shared-volume |
| 74 | mountPath: /conf |
| 75 | resources: |
| 76 | requests: |
| 77 | {{- if .Values.resources.enabled }} |
| 78 | {{ toYaml .Values.resources.nginx.requests | indent 12 }} |
| 79 | {{- end }} |
| 80 | {{- if .Values.config.sriov.enabled }} |
| 81 | intel.com/sriov_netdevice: 2 |
| 82 | {{- end }} |
| 83 | limits: |
| 84 | {{- if .Values.resources.enabled }} |
| 85 | {{ toYaml .Values.resources.nginx.limits | indent 12 }} |
| 86 | {{- end }} |
| 87 | {{- if .Values.config.sriov.enabled }} |
| 88 | intel.com/sriov_netdevice: 2 |
| 89 | {{- end }} |
| 90 | volumes: |
| 91 | - name: nginx-net-config |
| 92 | configMap: |
| 93 | name: nginx-net-config |
| 94 | defaultMode: 493 |
| 95 | - name: nginx-rtmp-config |
| 96 | configMap: |
| 97 | name: nginx-rtmp-config |
| 98 | defaultMode: 420 |
| 99 | - name: shared-volume |
| 100 | emptyDir: {} |