Commit e4275d67 authored by arora's avatar arora 🎤
Browse files

added readinessProbe and livenessProbe

parent 49efcfdb
#!/bin/bash
set -eo pipefail
STATUS=0
AMF_PORT_FOR_NGAP=38412
AMF_PORT_FOR_N11_HTTP=80
AMF_IP_NGAP_INTERFACE=$(ifconfig $AMF_INTERFACE_NAME_FOR_NGAP | grep inet | awk {'print $2'})
AMF_IP_N11_INTERFACE=$(ifconfig $AMF_INTERFACE_NAME_FOR_N11 | grep inet | awk {'print $2'})
N2_PORT_STATUS=$(netstat -Snpl | grep -o "$AMF_IP_NGAP_INTERFACE:$AMF_PORT_FOR_NGAP")
N11_PORT_STATUS=$(netstat -tnpl | grep -o "$AMF_IP_N11_INTERFACE:$AMF_PORT_FOR_N11_HTTP")
#Check if entrypoint properly configured the conf file and no parameter is unset (optional)
NB_UNREPLACED_AT=`cat /openair-amf/etc/*.conf | grep -v contact@openairinterface.org | grep -c @ || true`
if [ $NB_UNREPLACED_AT -ne 0 ]; then
STATUS=1
echo "Healthcheck error: configuration file is not configured properly"
fi
if [[ -z $N2_PORT_STATUS ]]; then
STATUS=1
echo "Healthcheck error: N2 SCTP port $AMF_PORT_FOR_NGAP is not listening"
fi
if [[ -z $N11_PORT_STATUS ]]; then
STATUS=1
echo "Healthcheck error: N11/SBI TCP/HTTP port $AMF_PORT_FOR_N11_HTTP is not listening"
fi
exit $STATUS
......@@ -6,3 +6,10 @@ data:
{{- range $key, $val := .Values.config }}
{{ $key }}: {{ $val | quote }}
{{- end }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: health-cm
data:
{{ (.Files.Glob "scripts/live-ready.sh").AsConfig | indent 2 }}
\ No newline at end of file
......@@ -57,6 +57,27 @@ spec:
{{- end}}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
volumeMounts:
- mountPath: /scripts
name: scripts
{{- if .Values.readinessProbe}}
readinessProbe:
exec:
command:
- sh
- /scripts/live-ready.sh
initialDelaySeconds: 5
periodSeconds: 5
{{- end}}
{{- if .Values.livenessProbe}}
livenessProbe:
exec:
command:
- sh
- /scripts/live-ready.sh
initialDelaySeconds: 5
periodSeconds: 5
{{- end}}
ports:
- containerPort: {{ .Values.service.sctpPort }}
name: oai-amf
......@@ -304,12 +325,15 @@ spec:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: operatorKey
{{- if .Values.persistence.sharedvolume}}
volumes:
{{- if .Values.persistence.sharedvolume}}
- name: cn5g-pv
persistenceVolumeClaim:
claimName: cn5g-pvc
{{- end }}
- name: scripts
configMap:
name: health-cm
dnsPolicy: ClusterFirst
restartPolicy: Always
serviceAccountName: {{ .Values.serviceAccount.name }}
......
......@@ -117,6 +117,10 @@ resources:
cpu: 100m
memory: 256Mi
readinessProbe: true
livenessProbe: true
terminationGracePeriodSeconds: 30
nodeSelector: {}
......
#!/bin/bash
set -eo pipefail
STATUS=0
NRF_IP_SBI_INTERFACE=$(ifconfig $NRF_INTERFACE_NAME_FOR_SBI | grep inet | awk {'print $2'})
NRF_SBI_PORT_STATUS=$(netstat -tnpl | grep -o "$NRF_IP_SBI_INTERFACE:$NRF_INTERFACE_PORT_FOR_SBI")
#Check if entrypoint properly configured the conf file and no parameter is unset(optional)
NB_UNREPLACED_AT=`cat /openair-nrf/etc/*.conf | grep -v contact@openairinterface.org | grep -c @ || true`
if [ $NB_UNREPLACED_AT -ne 0 ]; then
STATUS=1
echo "Healthcheck error: UNHEALTHY configuration file is not configured properly"
fi
if [[ -z $NRF_SBI_PORT_STATUS ]]; then
STATUS=1
echo "Healthcheck error: UNHEALTHY SBI TCP/HTTP port $NRF_INTERFACE_PORT_FOR_SBI is not listening."
fi
exit $STATUS
\ No newline at end of file
......@@ -6,3 +6,10 @@ data:
{{- range $key, $val := .Values.config }}
{{ $key }}: {{ $val | quote }}
{{- end }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: health-cm
data:
{{ (.Files.Glob "scripts/live-ready.sh").AsConfig | indent 2 }}
\ No newline at end of file
......@@ -53,6 +53,27 @@ spec:
{{- end}}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
volumeMounts:
- mountPath: /scripts
name: scripts
{{- if .Values.readinessProbe}}
readinessProbe:
exec:
command:
- sh
- /scripts/live-ready.sh
initialDelaySeconds: 5
periodSeconds: 5
{{- end}}
{{- if .Values.livenessProbe}}
livenessProbe:
exec:
command:
- sh
- /scripts/live-ready.sh
initialDelaySeconds: 5
periodSeconds: 5
{{- end}}
ports:
- containerPort: {{ .Values.service.http1Port }}
name: http1
......@@ -91,12 +112,15 @@ spec:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: nrfApiVersion
{{- if .Values.persistence.sharedvolume}}
volumes:
{{- if .Values.persistence.sharedvolume}}
- name: cn5g-pv
persistentVolumeClaim:
persistenceVolumeClaim:
claimName: cn5g-pvc
{{- end }}
- name: scripts
configMap:
name: health-cm
dnsPolicy: ClusterFirst
restartPolicy: Always
serviceAccountName: {{ .Values.serviceAccount.name }}
......
......@@ -76,6 +76,10 @@ resources:
terminationGracePeriodSeconds: 30
readinessProbe: true
livenessProbe: true
nodeSelector: {}
nodeName:
......
#!/bin/bash
set -eo pipefail
STATUS=0
SMF_IP_SBI_INTERFACE=$(ifconfig $SMF_INTERFACE_NAME_FOR_SBI | grep inet | awk {'print $2'})
#Check if entrypoint properly configured the conf file and no parameter is unset(optional)
SMF_SBI_PORT_STATUS=$(netstat -tnpl | grep -o "$SMF_IP_SBI_INTERFACE:$SMF_INTERFACE_PORT_FOR_SBI")
NB_UNREPLACED_AT=`cat /openair-smf/etc/*.conf | grep -v contact@openairinterface.org | grep -c @ || true`
if [ $NB_UNREPLACED_AT -ne 0 ]; then
STATUS=-1
echo "Healthcheck error: UNHEALTHY configuration file is not configured properly"
fi
if [[ -z $SMF_SBI_PORT_STATUS ]]; then
STATUS=-1
echo "Healthcheck error: UNHEALTHY SBI TCP/HTTP port $SMF_INTERFACE_PORT_FOR_SBI is not listening."
fi
exit $STATUS
\ No newline at end of file
......@@ -6,4 +6,10 @@ data:
{{- range $key, $val := .Values.config }}
{{ $key }}: {{ $val | quote }}
{{- end }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: health-cm
data:
{{ (.Files.Glob "scripts/live-ready.sh").AsConfig | indent 2 }}
\ No newline at end of file
......@@ -44,6 +44,27 @@ spec:
image: "{{ .Values.nfimage.repository }}:{{ .Values.nfimage.version }}"
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
volumeMounts:
- mountPath: /scripts
name: scripts
{{- if .Values.readinessProbe}}
readinessProbe:
exec:
command:
- sh
- /scripts/live-ready.sh
initialDelaySeconds: 5
periodSeconds: 5
{{- end}}
{{- if .Values.livenessProbe}}
livenessProbe:
exec:
command:
- sh
- /scripts/live-ready.sh
initialDelaySeconds: 5
periodSeconds: 5
{{- end}}
ports:
- containerPort: {{ .Values.service.n4Port }}
name: oai-smf
......@@ -197,12 +218,15 @@ spec:
- /bin/sleep
- infinity
{{- end}}
{{- if .Values.persistence.sharedvolume}}
volumes:
{{- if .Values.persistence.sharedvolume}}
- name: cn5g-pv
persistentVolumeClaim:
persistenceVolumeClaim:
claimName: cn5g-pvc
{{- end }}
- name: scripts
configMap:
name: health-cm
dnsPolicy: ClusterFirst
restartPolicy: Always
serviceAccountName: {{ .Values.serviceAccount.name }}
......
......@@ -97,8 +97,12 @@ resources:
cpu: 100m
memory: 256Mi
readinessProbe: true
livenessProbe: true
terminationGracePeriodSeconds: 30
nodeSelector: {}
#nodeName:
nodeName:
#!/bin/bash
set -eo pipefail
STATUS=0
SGW_PORT_FOR_S1U_S12_S4_UP=2152
SGW_PORT_FOR_SX=8805
SGW_IP_S1U_INTERFACE=$(ifconfig $SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP | grep inet | awk {'print $2'})
SGW_IP_SX_INTERFACE=$(ifconfig $SGW_INTERFACE_NAME_FOR_SX | grep inet | awk {'print $2'})
S1U_S12_S4_UP_PORT_STATUS=$(netstat -unpl | grep -o "$SGW_IP_S1U_INTERFACE:$SGW_PORT_FOR_S1U_S12_S4_UP")
SX_PORT_STATUS=$(netstat -unpl | grep -o "$SGW_IP_SX_INTERFACE:$SGW_PORT_FOR_SX")
#Check if entrypoint properly configured the conf file and no parameter is unset (optional)
NB_UNREPLACED_AT=`cat /openair-spgwu/etc/*.conf | grep -v contact@openairinterface.org | grep -c @ || true`
if [ $NB_UNREPLACED_AT -ne 0 ]; then
STATUS=1
echo "Healthcheck error: UNHEALTHY configuration file is not configured properly"
fi
if [[ -z $S1U_S12_S4_UP_PORT_STATUS ]]; then
STATUS=1
echo "Healthcheck error: UNHEALTHY S1U port $SGW_PORT_FOR_S1U_S12_S4_UP is not listening."
fi
if [[ -z $SX_PORT_STATUS ]]; then
STATUS=1
echo "Healthcheck error: UNHEALTHY SX port $SGW_PORT_FOR_SX is not listening."
fi
exit $STATUS
\ No newline at end of file
......@@ -6,3 +6,10 @@ data:
{{- range $key, $val := .Values.config }}
{{ $key }}: {{ $val | quote }}
{{- end }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: health-cm
data:
{{ (.Files.Glob "scripts/live-ready.sh").AsConfig | indent 2 }}
\ No newline at end of file
......@@ -48,6 +48,27 @@ spec:
image: "{{ .Values.nfimage.repository }}:{{ .Values.nfimage.version }}"
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
volumeMounts:
- mountPath: /scripts
name: scripts
{{- if .Values.readinessProbe}}
readinessProbe:
exec:
command:
- sh
- /scripts/live-ready.sh
initialDelaySeconds: 5
periodSeconds: 5
{{- end}}
{{- if .Values.livenessProbe}}
livenessProbe:
exec:
command:
- sh
- /scripts/live-ready.sh
initialDelaySeconds: 5
periodSeconds: 5
{{- end}}
ports:
- containerPort: {{ .Values.service.pfcpPort }}
name: oai-spgwu
......@@ -221,12 +242,15 @@ spec:
memory: {{ .Values.resources.limits.memory | quote }}
cpu: {{ .Values.resources.limits.cpu | quote }}
{{- end}}
{{- if .Values.persistence.sharedvolume}}
volumes:
{{- if .Values.persistence.sharedvolume}}
- name: cn5g-pv
persistentVolumeClaim:
persistenceVolumeClaim:
claimName: cn5g-pvc
{{- end }}
- name: scripts
configMap:
name: health-cm
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
......
......@@ -98,6 +98,10 @@ resources:
cpu: 100m
memory: 256Mi
readinessProbe: true
livenessProbe: true
terminationGracePeriodSeconds: 30
nodeSelector: {}
......
......@@ -145,6 +145,9 @@ The mysql database is pre-configured with some subscriber information. If there
operatorKey: "63bfa50ee6523365ff14c1f45f88737d" (should be the same in mysql)
```
Configure `readinessProbe` and `livenessProbe` by default they are `true` to switch them off change the value with `false`
There are more parametes which can be configured like extra interfaces and resource usage by network function, please refer [values.yaml](../charts/oai-amf/values.yaml). Infront of every parameter there is a comment.
### 3.3 Configuring SMF
......@@ -165,6 +168,8 @@ config:
Currenly DNN related information and UE network related information can only be changed at the time of building the SMF network function. Refer [Configure the Containers](./CONFIGURE_CONTAINERS.md) to understand how it can be done.
Configure `readinessProbe` and `livenessProbe` by default they are `true` to switch them off change the value with `false`
There are more parametes which can be configured like extra interfaces and resource usage by network function, please refer [values.yaml](../charts/oai-smf/values.yaml). Infront of every parameter there is a comment.
### 3.4 Configuring UPF
......@@ -186,12 +191,16 @@ config:
pidDirectory: "/var/run"
```
Configure `readinessProbe` and `livenessProbe` by default they are `true` to switch them off change the value with `false`
There are more parametes which can be configured like extra interfaces and resource usage by network function, please refer [values.yaml](../charts/oai-spgwu-tiny/values.yaml). Infront of every parameter there is a comment.
### 3.5 Configuring NRF
NRF configuration is straight forward, most of configurable parameters have comment infront of it for explaination. Refer the [values.yaml](../charts/oai-nrf/values.yaml)
Configure `readinessProbe` and `livenessProbe` by default they are `true` to switch them off change the value with `false`
### 3.6 Configuring subscriber data in MYSQL
Currently the MYSQL is configured with below subscriber data,
......@@ -225,15 +234,15 @@ Once the configuration is finished the charts can be deployed with a user who ha
```
$ helm install mysql mysql/
# wait for the pod to come up
# wait for the pod to be ready
$ helm install amf oai-amf/
# wait for the pod to come up
# wait for the pod to be ready
$ helm install nrf oai-nrf/
# wait for the pod to come up
# wait for the pod to be ready
$ helm install smf oai-smf/
# wait for the pod to come up
# wait for the pod to be ready
$ helm install upf oai-spgwu-tiny/
# wait for the pod to come up
# wait for the pod to be ready
$ helm list
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
mysql oai-5g-develop 1 2021-07-29 14:20:34.010881045 +0200 CEST deployed mysql-1.6.9 5.7.30
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment