AETHER-621 Sync subscriber state from ROC when SPGWC restarts
Change-Id: I2dd133b89f34497209e8120a2e2e541ed544fee8
diff --git a/omec/omec-control-plane/Chart.yaml b/omec/omec-control-plane/Chart.yaml
index f328456..2096d75 100644
--- a/omec/omec-control-plane/Chart.yaml
+++ b/omec/omec-control-plane/Chart.yaml
@@ -10,4 +10,4 @@
name: omec-control-plane
icon: https://guide.opencord.org/logos/cord.svg
-version: 0.6.14
+version: 0.6.15
diff --git a/omec/omec-control-plane/templates/bin/_spgwc-init.sh.tpl b/omec/omec-control-plane/templates/bin/_spgwc-init.sh.tpl
new file mode 100644
index 0000000..d752dbb
--- /dev/null
+++ b/omec/omec-control-plane/templates/bin/_spgwc-init.sh.tpl
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# Copyright 2021-present Open Networking Foundation
+#
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+while ! curl -f http://spgwc:8080/startup
+do
+ echo Waiting for SPGWC to be ready
+ sleep 5
+done
+echo SPGWC is ready
+
+echo Posting to sync URL {{ .Values.config.spgwc.managedByRoc.syncUrl }}
+while ! curl -f -X POST {{ .Values.config.spgwc.managedByRoc.syncUrl }}
+do
+ echo Failed posting to sync URL
+ sleep 5
+done
+echo
+
+echo Sleeping forever
+while true
+do
+ sleep 86400
+done
\ No newline at end of file
diff --git a/omec/omec-control-plane/templates/configmap-spgwc.yaml b/omec/omec-control-plane/templates/configmap-spgwc.yaml
index 8d5d61c..6616998 100644
--- a/omec/omec-control-plane/templates/configmap-spgwc.yaml
+++ b/omec/omec-control-plane/templates/configmap-spgwc.yaml
@@ -107,4 +107,6 @@
data:
spgwc-run.sh: |
{{ tuple "bin/_spgwc-run.sh.tpl" . | include "omec-control-plane.template" | indent 4 }}
+ spgwc-init.sh: |
+{{ tuple "bin/_spgwc-init.sh.tpl" . | include "omec-control-plane.template" | indent 4 }}
{{- end }}
diff --git a/omec/omec-control-plane/templates/statefulset-spgwc.yaml b/omec/omec-control-plane/templates/statefulset-spgwc.yaml
index cab92d0..438b794 100644
--- a/omec/omec-control-plane/templates/statefulset-spgwc.yaml
+++ b/omec/omec-control-plane/templates/statefulset-spgwc.yaml
@@ -87,7 +87,7 @@
valueFrom:
fieldRef:
fieldPath: status.podIP
- {{- if .Values.config.spgwc.managedByRoc }}
+ {{- if .Values.config.spgwc.managedByRoc.enabled }}
- name: DISABLE_CONFIG_WATCHER # If the variable has a value then changes
value: "true" # to subscriber_mapping.json are ignored
{{- end }}
@@ -134,6 +134,24 @@
- name: coredump
mountPath: /tmp/coredump
{{- end }}
+ {{- if .Values.config.spgwc.managedByRoc.enabled }}
+ - name: init-sync
+ image: curlimages/curl:7.77.0
+ imagePullPolicy: IfNotPresent
+ stdin: true
+ tty: true
+ command: ["sh", "-c"]
+ args:
+ - /opt/cp/scripts/spgwc-init.sh
+ volumeMounts:
+ - name: scripts
+ mountPath: /opt/cp/scripts
+ volumes:
+ - name: scripts
+ configMap:
+ name: spgwc-scripts
+ defaultMode: 493
+ {{- end }}
volumes:
- name: scripts
configMap:
diff --git a/omec/omec-control-plane/values.yaml b/omec/omec-control-plane/values.yaml
index 41f3482..2f9cb0c 100644
--- a/omec/omec-control-plane/values.yaml
+++ b/omec/omec-control-plane/values.yaml
@@ -407,7 +407,9 @@
#realm:
spgwc:
deploy: true
- managedByRoc: false
+ managedByRoc:
+ enabled: false
+ syncUrl: ""
podAnnotations:
fluentbit.io/parser: spgwc
field.cattle.io/workloadMetrics: '[{"path":"/metrics","port":9089,"schema":"HTTP"}]'