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