blob: 8471f7f05ccacd44ddca6d201fff9910bf43ca58 [file] [log] [blame]
{{/*
# Copyright 2019-present Open Networking Foundation
# SPDX-License-Identifier: Apache-2.0
*/}}
{{ tuple "cdn-local" . | include "cdn-local.service_account" }}
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: cdn-local
labels:
{{ tuple "cdn-local" . | include "cdn-local.metadata_labels" | indent 4 }}
spec:
replicas: {{ .Values.config.nginx.replicas }}
selector:
matchLabels:
{{ tuple "cdn-local" . | include "cdn-local.metadata_labels" | indent 6 }}
serviceName: "cdn-local"
template:
metadata:
labels:
{{ tuple "cdn-local" . | include "cdn-local.metadata_labels" | indent 8 }}
{{ if .Values.config.sriov.enabled }}
annotations:
k8s.v1.cni.cncf.io/networks: '[
{
"name": "sgi-net-cdn",
"interface": {{ .Values.config.nginx.sgiInterface.name | quote }},
"ips": {{ .Values.config.nginx.sgiInterface.ip | quote }}
}
]'
{{ end }}
spec:
{{- if .Values.nodeSelectors.enabled }}
nodeSelector:
{{ .Values.nodeSelectors.nginx.label }}: {{ .Values.nodeSelectors.nginx.value }}
{{- end }}
hostNetwork: {{ not .Values.config.sriov.enabled }}
serviceAccountName: cdn-local
initContainers:
- name: cdn-local-init
image: {{ .Values.images.tags.nginx }}
imagePullPolicy: {{ .Values.images.pullPolicy }}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: false
runAsUser: 0
command: [ "bash", "-xc"]
args:
- cp /config/*.sh /shared-vol;cp /conf/* /shared-vol
volumeMounts:
- name: shared-volume
mountPath: /shared-vol
- name: nginx-net-config
mountPath: /config
- name: nginx-rtmp-config
mountPath: /conf
containers:
- name: nginx
image: {{ .Values.images.tags.nginx }}
imagePullPolicy: {{ .Values.images.pullPolicy }}
command: [ "bash", "-xc"]
args:
- chmod a+x /config/*.sh; /config/run-nginx.sh
securityContext:
privileged: true
volumeMounts:
- name: shared-volume
mountPath: /config
- name: shared-volume
mountPath: /conf
resources:
requests:
{{- if .Values.resources.enabled }}
{{ toYaml .Values.resources.nginx.requests | indent 12 }}
{{- end }}
{{- if .Values.config.sriov.enabled }}
intel.com/sriov_netdevice: 2
{{- end }}
limits:
{{- if .Values.resources.enabled }}
{{ toYaml .Values.resources.nginx.limits | indent 12 }}
{{- end }}
{{- if .Values.config.sriov.enabled }}
intel.com/sriov_netdevice: 2
{{- end }}
volumes:
- name: nginx-net-config
configMap:
name: nginx-net-config
defaultMode: 493
- name: nginx-rtmp-config
configMap:
name: nginx-rtmp-config
defaultMode: 420
- name: shared-volume
emptyDir: {}