blob: 393707866d3504aa6b2e94e7c4f9c2936a43815c [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
Hyunsun Moon7f23b2d2020-02-02 14:23:28 -080017{{ tuple "cdn-local" . | include "cdn-local.service_account" }}
Woojoong Kim9bcff462019-09-19 12:59:01 -070018
19---
20apiVersion: apps/v1
21kind: StatefulSet
22metadata:
Hyunsun Moon7f23b2d2020-02-02 14:23:28 -080023 name: cdn-local
Woojoong Kim9bcff462019-09-19 12:59:01 -070024 labels:
Hyunsun Moon7f23b2d2020-02-02 14:23:28 -080025{{ tuple "cdn-local" . | include "cdn-local.metadata_labels" | indent 4 }}
Woojoong Kim9bcff462019-09-19 12:59:01 -070026spec:
27 replicas: {{ .Values.config.nginx.replicas }}
28 selector:
29 matchLabels:
Hyunsun Moon7f23b2d2020-02-02 14:23:28 -080030{{ tuple "cdn-local" . | include "cdn-local.metadata_labels" | indent 6 }}
31 serviceName: "cdn-local"
Woojoong Kim9bcff462019-09-19 12:59:01 -070032 template:
33 metadata:
34 labels:
Hyunsun Moon7f23b2d2020-02-02 14:23:28 -080035{{ tuple "cdn-local" . | 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",
Hyunsun Moon7f23b2d2020-02-02 14:23:28 -080041 "interface": {{ .Values.config.nginx.sgiInterface.name | quote }},
42 "ips": {{ .Values.config.nginx.sgiInterface.ip | quote }}
Woojoong Kim9bcff462019-09-19 12:59:01 -070043 }
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:
Woojoong Kimcbc98202019-10-21 11:38:19 -070049 {{ .Values.nodeSelectors.nginx.label }}: {{ .Values.nodeSelectors.nginx.value }}
Woojoong Kim9bcff462019-09-19 12:59:01 -070050 {{- end }}
Woojoong Kim231956c2019-10-14 18:25:51 -070051 hostNetwork: {{ not .Values.config.sriov.enabled }}
Hyunsun Moon7f23b2d2020-02-02 14:23:28 -080052 serviceAccountName: cdn-local
Woojoong Kim9bcff462019-09-19 12:59:01 -070053 initContainers:
Hyunsun Moon7f23b2d2020-02-02 14:23:28 -080054 - name: cdn-local-init
Woojoong Kim9bcff462019-09-19 12:59:01 -070055 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:
Hyunsun Moon7f23b2d2020-02-02 14:23:28 -080077 - chmod a+x /config/*.sh; /config/run-nginx.sh
Woojoong Kim9bcff462019-09-19 12:59:01 -070078 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
Hyunsun Moon7f23b2d2020-02-02 14:23:28 -0800110 emptyDir: {}