Woojoong Kim | 9bcff46 | 2019-09-19 12:59:01 -0700 | [diff] [blame] | 1 | {{/* |
| 2 | Copyright 2019-present Open Networking Foundation |
| 3 | |
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | */}} |
| 16 | |
| 17 | {{ tuple "nginx" . | include "cdn-local.service_account" }} |
| 18 | |
| 19 | --- |
| 20 | apiVersion: apps/v1 |
| 21 | kind: StatefulSet |
| 22 | metadata: |
| 23 | name: nginx |
| 24 | labels: |
| 25 | {{ tuple "nginx" . | include "cdn-local.metadata_labels" | indent 4 }} |
| 26 | spec: |
| 27 | replicas: {{ .Values.config.nginx.replicas }} |
| 28 | selector: |
| 29 | matchLabels: |
| 30 | {{ tuple "nginx" . | include "cdn-local.metadata_labels" | indent 6 }} |
| 31 | serviceName: "nginx" |
| 32 | template: |
| 33 | metadata: |
| 34 | labels: |
| 35 | {{ tuple "nginx" . | include "cdn-local.metadata_labels" | indent 8 }} |
Woojoong Kim | 231956c | 2019-10-14 18:25:51 -0700 | [diff] [blame^] | 36 | {{ if .Values.config.sriov.enabled }} |
Woojoong Kim | 9bcff46 | 2019-09-19 12:59:01 -0700 | [diff] [blame] | 37 | annotations: |
| 38 | k8s.v1.cni.cncf.io/networks: '[ |
| 39 | { |
| 40 | "name": "sgi-net-cdn", |
| 41 | "interface": {{ .Values.config.nginx.sgi.device | quote }}, |
| 42 | "ips": {{ .Values.config.nginx.sgi.ip | quote }} |
| 43 | } |
| 44 | ]' |
Woojoong Kim | 231956c | 2019-10-14 18:25:51 -0700 | [diff] [blame^] | 45 | {{ end }} |
Woojoong Kim | 9bcff46 | 2019-09-19 12:59:01 -0700 | [diff] [blame] | 46 | spec: |
| 47 | {{- if .Values.nodeSelectors.enabled }} |
| 48 | nodeSelector: |
| 49 | {{ .Values.nodeSelectors.antMedia.label }}: {{ .Values.nodeSelectors.antMedia.value }} |
| 50 | {{- end }} |
Woojoong Kim | 231956c | 2019-10-14 18:25:51 -0700 | [diff] [blame^] | 51 | hostNetwork: {{ not .Values.config.sriov.enabled }} |
Woojoong Kim | 9bcff46 | 2019-09-19 12:59:01 -0700 | [diff] [blame] | 52 | serviceAccountName: nginx |
| 53 | initContainers: |
| 54 | - name: nginx-init |
| 55 | image: {{ .Values.images.tags.nginx }} |
| 56 | imagePullPolicy: {{ .Values.images.pullPolicy }} |
| 57 | securityContext: |
| 58 | allowPrivilegeEscalation: false |
| 59 | readOnlyRootFilesystem: false |
| 60 | runAsUser: 0 |
| 61 | command: [ "bash", "-xc"] |
| 62 | args: |
| 63 | - cp /config/*.sh /shared-vol;cp /conf/* /shared-vol |
| 64 | volumeMounts: |
| 65 | - name: shared-volume |
| 66 | mountPath: /shared-vol |
| 67 | - name: nginx-net-config |
| 68 | mountPath: /config |
| 69 | - name: nginx-rtmp-config |
| 70 | mountPath: /conf |
| 71 | containers: |
| 72 | - name: nginx |
| 73 | image: {{ .Values.images.tags.nginx }} |
| 74 | imagePullPolicy: {{ .Values.images.pullPolicy }} |
| 75 | command: [ "bash", "-xc"] |
| 76 | args: |
| 77 | - chmod a+x /config/*.sh; /config/route-gen.sh; /config/network-config.sh; /config/run-nginx.sh |
| 78 | securityContext: |
| 79 | privileged: true |
| 80 | volumeMounts: |
| 81 | - name: shared-volume |
| 82 | mountPath: /config |
| 83 | - name: shared-volume |
| 84 | mountPath: /conf |
| 85 | resources: |
| 86 | requests: |
| 87 | {{- if .Values.resources.enabled }} |
| 88 | {{ toYaml .Values.resources.nginx.requests | indent 12 }} |
| 89 | {{- end }} |
| 90 | {{- if .Values.config.sriov.enabled }} |
| 91 | intel.com/sriov_netdevice: 2 |
| 92 | {{- end }} |
| 93 | limits: |
| 94 | {{- if .Values.resources.enabled }} |
| 95 | {{ toYaml .Values.resources.nginx.limits | indent 12 }} |
| 96 | {{- end }} |
| 97 | {{- if .Values.config.sriov.enabled }} |
| 98 | intel.com/sriov_netdevice: 2 |
| 99 | {{- end }} |
| 100 | volumes: |
| 101 | - name: nginx-net-config |
| 102 | configMap: |
| 103 | name: nginx-net-config |
| 104 | defaultMode: 493 |
| 105 | - name: nginx-rtmp-config |
| 106 | configMap: |
| 107 | name: nginx-rtmp-config |
| 108 | defaultMode: 420 |
| 109 | - name: shared-volume |
| 110 | emptyDir: {} |