blob: 93b1f133bad075bce02c15537e79b72d5c54b26c [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 }}
36 annotations:
37 k8s.v1.cni.cncf.io/networks: '[
38 {
39 "name": "sgi-net-cdn",
40 "interface": {{ .Values.config.nginx.sgi.device | quote }},
41 "ips": {{ .Values.config.nginx.sgi.ip | quote }}
42 }
43 ]'
44 spec:
45 {{- if .Values.nodeSelectors.enabled }}
46 nodeSelector:
47 {{ .Values.nodeSelectors.antMedia.label }}: {{ .Values.nodeSelectors.antMedia.value }}
48 {{- end }}
49 serviceAccountName: nginx
50 initContainers:
51 - name: nginx-init
52 image: {{ .Values.images.tags.nginx }}
53 imagePullPolicy: {{ .Values.images.pullPolicy }}
54 securityContext:
55 allowPrivilegeEscalation: false
56 readOnlyRootFilesystem: false
57 runAsUser: 0
58 command: [ "bash", "-xc"]
59 args:
60 - cp /config/*.sh /shared-vol;cp /conf/* /shared-vol
61 volumeMounts:
62 - name: shared-volume
63 mountPath: /shared-vol
64 - name: nginx-net-config
65 mountPath: /config
66 - name: nginx-rtmp-config
67 mountPath: /conf
68 containers:
69 - name: nginx
70 image: {{ .Values.images.tags.nginx }}
71 imagePullPolicy: {{ .Values.images.pullPolicy }}
72 command: [ "bash", "-xc"]
73 args:
74 - chmod a+x /config/*.sh; /config/route-gen.sh; /config/network-config.sh; /config/run-nginx.sh
75 securityContext:
76 privileged: true
77 volumeMounts:
78 - name: shared-volume
79 mountPath: /config
80 - name: shared-volume
81 mountPath: /conf
82 resources:
83 requests:
84 {{- if .Values.resources.enabled }}
85{{ toYaml .Values.resources.nginx.requests | indent 12 }}
86 {{- end }}
87 {{- if .Values.config.sriov.enabled }}
88 intel.com/sriov_netdevice: 2
89 {{- end }}
90 limits:
91 {{- if .Values.resources.enabled }}
92{{ toYaml .Values.resources.nginx.limits | indent 12 }}
93 {{- end }}
94 {{- if .Values.config.sriov.enabled }}
95 intel.com/sriov_netdevice: 2
96 {{- end }}
97 volumes:
98 - name: nginx-net-config
99 configMap:
100 name: nginx-net-config
101 defaultMode: 493
102 - name: nginx-rtmp-config
103 configMap:
104 name: nginx-rtmp-config
105 defaultMode: 420
106 - name: shared-volume
107 emptyDir: {}