COMAC-170 Use common patterns in values and manifests in mcord-services
This patchset is a part of mcord-services refactoring.
1. Group values by images, nodeSelectors, resources, configs and networks.
2. Make StatefulSets have common patterns for label, resources, and nodeSelectors
3. Use fixed resource name to reduce complexities
4. Don't set namespace as a value, use the one passed with helm install
5. Use common cniPlugin and ipam for SGI and S1U networks
6. Use camel case for value names
7. Do not support old mme anymore
8. Use official omecproject repo for default images
Change-Id: I9654993c8885f12cebb1a93517119556a90127d6
diff --git a/mcord-release/mcord-services/templates/statefulset-spgwu.yaml b/mcord-release/mcord-services/templates/statefulset-spgwu.yaml
index 40bf94a..6b4f845 100644
--- a/mcord-release/mcord-services/templates/statefulset-spgwu.yaml
+++ b/mcord-release/mcord-services/templates/statefulset-spgwu.yaml
@@ -1,50 +1,51 @@
----
-# Copyright 2018-present Open Networking Foundation
-# Copyright 2018 Intel Corporation
-#
-# 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.
+{{/*
+Copyright 2018-present Open Networking Foundation
+Copyright 2018 Intel Corporation
+
+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.
+*/}}
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
- name: {{ .Values.spgwu.name }}
+ name: spgwu
labels:
- app: {{ .Values.spgwu.name }}
+{{ tuple "spgwu" . | include "mcord-services.metadata_labels" | indent 4 }}
spec:
replicas: 1
selector:
matchLabels:
- app: {{ .Values.spgwu.name }}
- serviceName: {{ .Values.spgwu.name | quote }}
+{{ tuple "spgwu" . | include "mcord-services.metadata_labels" | indent 6 }}
+ serviceName: spgwu
template:
metadata:
labels:
- app: {{ .Values.spgwu.name }}
+{{ tuple "spgwu" . | include "mcord-services.metadata_labels" | indent 8 }}
annotations:
k8s.v1.cni.cncf.io/networks: '[
- { "name": "s1u-net", "interface": "s1u-net", "interfaceRequest": "s1u-net" },
- { "name": "sgi-net", "interface": "sgi-net", "interfaceRequest": "sgi-net" }
+ { "name": "s1u-net", "interface": "s1u-net" },
+ { "name": "sgi-net", "interface": "sgi-net" }
]'
spec:
-{{- if .Values.network.sriov.enabled }}
+ {{- if .Values.nodeSelectors.enabled }}
nodeSelector:
-{{ toYaml .Values.spgwu.nodeselector | indent 8 }}
-{{- end }}
-{{- if not .Values.network.sriov.enabled }}
+ {{ .Values.nodeSelectors.spgwu.label }}: {{ .Values.nodeSelectors.spgwu.value }}
+ {{- end }}
+ {{- if not .Values.networks.sriov.enabled }}
initContainers:
- name: spgwu-iptables-init
- image: {{ .Values.spgwu.images.tags.init | quote }}
- imagePullPolicy: {{ .Values.spgwu.images.pullPolicy | quote }}
+ image: {{ .Values.images.tags.init | quote }}
+ imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
command: [ "sh", "-xec"]
securityContext:
capabilities:
@@ -53,8 +54,8 @@
args:
- iptables -I OUTPUT -p icmp --icmp-type destination-unreachable -j DROP;
- name: spgwu-af-iface-init
- image: {{ .Values.spgwu.images.tags.spgwu | quote }}
- imagePullPolicy: {{ .Values.spgwu.images.pullPolicy | quote }}
+ image: {{ .Values.images.tags.init | quote }}
+ imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
securityContext:
capabilities:
add:
@@ -65,64 +66,69 @@
- name: dp-script
mountPath: /opt/dp/scripts/setup-af-iface.sh
subPath: setup-af-iface.sh
-{{- end }}
+ {{- end }}
containers:
- - name: {{ .Values.spgwu.name }}
- image: {{ .Values.spgwu.images.tags.spgwu | quote }}
- imagePullPolicy: {{ .Values.spgwu.images.pullPolicy | quote }}
+ - name: spgwu
+ image: {{ .Values.images.tags.spgwu | quote }}
+ imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
stdin: true
tty: true
env:
- name: MEM_LIMIT
valueFrom:
resourceFieldRef:
- containerName: {{ .Values.spgwu.name }}
+ containerName: spgwu
resource: limits.memory
divisor: 1Mi
- name: S1U_DEVNAME
- {{- if .Values.network.sriov.enabled }}
+ {{- if .Values.networks.sriov.enabled }}
value: s1u-net
- {{- else }}
- value: {{ .Values.spgwu.conf.dp.s1u_af_dev | quote }}
- {{- end }}
+ {{- else }}
+ value: {{ .Values.config.spgwu.dp.s1uAfDev | quote }}
+ {{- end }}
- name: SGI_DEVNAME
- {{- if .Values.network.sriov.enabled }}
+ {{- if .Values.networks.sriov.enabled }}
value: sgi-net
- {{- else }}
- value: {{ .Values.spgwu.conf.dp.sgi_af_dev | quote }}
- {{- end }}
+ {{- else }}
+ value: {{ .Values.config.spgwu.dp.sgiAfDev | quote }}
+ {{- end }}
- name: DEVICES
- value: {{ .Values.spgwu.conf.dp.devices | quote }}
+ value: {{ .Values.config.spgwu.dp.devices | quote }}
- name: CP_ADDR
- value: spgwc-0.{{ .Values.spgwc.name }}
+ value: spgwc-0.spgwc
- name: DP_ADDR
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: RTR_SGI_IP
- value: {{ .Values.spgwu.conf.dp.rtr_sgi_ip | quote }}
+ value: {{ .Values.config.spgwu.dp.rtrSgiIp | quote }}
- name: SGI_MASK
- value: {{ .Values.spgwu.conf.dp.sgi_mask | quote }}
+ value: {{ .Values.config.spgwu.dp.sgiMask | quote }}
command: ["bash", "-xc"]
args:
- ip a;
- /opt/dp/scripts/launch.sh;
+ /opt/dp/scripts/run.sh;
volumeMounts:
- name: dp-script
- mountPath: /opt/dp/scripts/launch.sh
- subPath: launch.sh
+ mountPath: /opt/dp/scripts/run.sh
+ subPath: run.sh
- name: dp-config
mountPath: /etc/dp/config
- #- name: hugepage
- # mountPath: /dev/hugepages
resources:
- limits:
- #hugepages-1Gi: 8Gi
- cpu: {{ .Values.spgwu.resources.cpu | quote }}
- memory: {{ .Values.spgwu.resources.memory }}
- {{- if .Values.network.sriov.enabled }}
+ requests:
+ {{- if .Values.resources.enabled }}
+{{ toYaml .Values.resources.spgwu.requests | indent 12 }}
+ {{- end }}
+ {{- if .Values.networks.sriov.enabled }}
intel.com/sriov_vfio: 2
- {{- end }}
+ {{- end }}
+ limits:
+ {{- if .Values.resources.enabled }}
+{{ toYaml .Values.resources.spgwu.limits | indent 12 }}
+ {{- end }}
+ {{- if .Values.networks.sriov.enabled }}
+ intel.com/sriov_vfio: 2
+ {{- end }}
securityContext:
capabilities:
add:
@@ -130,12 +136,9 @@
volumes:
- name: dp-script
configMap:
- name: {{ .Values.spgwu.name }}
+ name: spgwu
defaultMode: 493
- name: dp-config
configMap:
- name: {{ .Values.spgwu.name }}
+ name: spgwu
defaultMode: 420
- #- name: hugepage
- # emptyDir:
- # medium: HugePages