EDGEPOD-114 Enhance CDN-local to better support of hostNetwork
Also renamed resouce names from nginx to cdn-local.
Change-Id: Ib77f18b8e8ea2efcb73c0d36a621bdee5eea2f33
diff --git a/ott-services/cdn-local/templates/statefulset-cdn-local.yaml b/ott-services/cdn-local/templates/statefulset-cdn-local.yaml
new file mode 100644
index 0000000..3937078
--- /dev/null
+++ b/ott-services/cdn-local/templates/statefulset-cdn-local.yaml
@@ -0,0 +1,110 @@
+{{/*
+Copyright 2019-present Open Networking Foundation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/}}
+
+{{ 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: {}