blob: 1e67e1c117e4f65883158509304a06500cd88827 [file] [log] [blame]
Woojoong Kim9bcff462019-09-19 12:59:01 -07001{{/*
2Copyright 2019-present Open Networking Foundation
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/}}
16
17{{ tuple "nginx" . | include "cdn-local.service_account" }}
18
19---
20apiVersion: apps/v1
21kind: StatefulSet
22metadata:
23 name: nginx
24 labels:
25{{ tuple "nginx" . | include "cdn-local.metadata_labels" | indent 4 }}
26spec:
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 Kim231956c2019-10-14 18:25:51 -070036{{ if .Values.config.sriov.enabled }}
Woojoong Kim9bcff462019-09-19 12:59:01 -070037 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 Kim231956c2019-10-14 18:25:51 -070045{{ end }}
Woojoong Kim9bcff462019-09-19 12:59:01 -070046 spec:
47 {{- if .Values.nodeSelectors.enabled }}
48 nodeSelector:
49 {{ .Values.nodeSelectors.antMedia.label }}: {{ .Values.nodeSelectors.antMedia.value }}
50 {{- end }}
Woojoong Kim231956c2019-10-14 18:25:51 -070051 hostNetwork: {{ not .Values.config.sriov.enabled }}
Woojoong Kim9bcff462019-09-19 12:59:01 -070052 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: {}