[COMAC-174] CDN-Local code refactoring - only possible to use SRIOV
- remove unnecessary values in values.yaml
- use camel case
- rename nginx-rtmp to nginx
- allow CDN-Local to use multiple CDN-Remotes
- pull all videos from all CDN-Remotes
- define Roles, RoleBinding, ServiceAccount
- split each POD yaml file into Service, ConfigMap, and StatefulSet
- Remove hard coded values in Service, ConfigMap, and StatefulSet and
then locate them to values.yaml
Change-Id: Ib7c0d674f5aa4118274f1aad6888e373ef5c97be
diff --git a/cdn-services/cdn-local/templates/statefulset-nginx.yaml b/cdn-services/cdn-local/templates/statefulset-nginx.yaml
new file mode 100644
index 0000000..93b1f13
--- /dev/null
+++ b/cdn-services/cdn-local/templates/statefulset-nginx.yaml
@@ -0,0 +1,107 @@
+{{/*
+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 "nginx" . | include "cdn-local.service_account" }}
+
+---
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+ name: nginx
+ labels:
+{{ tuple "nginx" . | include "cdn-local.metadata_labels" | indent 4 }}
+spec:
+ replicas: {{ .Values.config.nginx.replicas }}
+ selector:
+ matchLabels:
+{{ tuple "nginx" . | include "cdn-local.metadata_labels" | indent 6 }}
+ serviceName: "nginx"
+ template:
+ metadata:
+ labels:
+{{ tuple "nginx" . | include "cdn-local.metadata_labels" | indent 8 }}
+ annotations:
+ k8s.v1.cni.cncf.io/networks: '[
+ {
+ "name": "sgi-net-cdn",
+ "interface": {{ .Values.config.nginx.sgi.device | quote }},
+ "ips": {{ .Values.config.nginx.sgi.ip | quote }}
+ }
+ ]'
+ spec:
+ {{- if .Values.nodeSelectors.enabled }}
+ nodeSelector:
+ {{ .Values.nodeSelectors.antMedia.label }}: {{ .Values.nodeSelectors.antMedia.value }}
+ {{- end }}
+ serviceAccountName: nginx
+ initContainers:
+ - name: nginx-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/route-gen.sh; /config/network-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: {}
\ No newline at end of file