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: ...@@ -6,3 +6,10 @@ data:
{{- range $key, $val := .Values.config }} {{- range $key, $val := .Values.config }}
{{ $key }}: {{ $val | quote }} {{ $key }}: {{ $val | quote }}
{{- end }} {{- 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: ...@@ -57,6 +57,27 @@ spec:
{{- end}} {{- end}}
securityContext: securityContext:
{{- toYaml .Values.securityContext | nindent 12 }} {{- 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: ports:
- containerPort: {{ .Values.service.sctpPort }} - containerPort: {{ .Values.service.sctpPort }}
name: oai-amf name: oai-amf
...@@ -304,12 +325,15 @@ spec: ...@@ -304,12 +325,15 @@ spec:
configMapKeyRef: configMapKeyRef:
name: {{ .Chart.Name }}-configmap name: {{ .Chart.Name }}-configmap
key: operatorKey key: operatorKey
{{- if .Values.persistence.sharedvolume}}
volumes: volumes:
{{- if .Values.persistence.sharedvolume}}
- name: cn5g-pv - name: cn5g-pv
persistenceVolumeClaim: persistenceVolumeClaim:
claimName: cn5g-pvc claimName: cn5g-pvc
{{- end }} {{- end }}
- name: scripts
configMap:
name: health-cm
dnsPolicy: ClusterFirst dnsPolicy: ClusterFirst
restartPolicy: Always restartPolicy: Always
serviceAccountName: {{ .Values.serviceAccount.name }} serviceAccountName: {{ .Values.serviceAccount.name }}
......
...@@ -117,6 +117,10 @@ resources: ...@@ -117,6 +117,10 @@ resources:
cpu: 100m cpu: 100m
memory: 256Mi memory: 256Mi
readinessProbe: true
livenessProbe: true
terminationGracePeriodSeconds: 30 terminationGracePeriodSeconds: 30
nodeSelector: {} 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: ...@@ -6,3 +6,10 @@ data:
{{- range $key, $val := .Values.config }} {{- range $key, $val := .Values.config }}
{{ $key }}: {{ $val | quote }} {{ $key }}: {{ $val | quote }}
{{- end }} {{- 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: ...@@ -53,6 +53,27 @@ spec:
{{- end}} {{- end}}
securityContext: securityContext:
{{- toYaml .Values.securityContext | nindent 12 }} {{- 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: ports:
- containerPort: {{ .Values.service.http1Port }} - containerPort: {{ .Values.service.http1Port }}
name: http1 name: http1
...@@ -91,12 +112,15 @@ spec: ...@@ -91,12 +112,15 @@ spec:
configMapKeyRef: configMapKeyRef:
name: {{ .Chart.Name }}-configmap name: {{ .Chart.Name }}-configmap
key: nrfApiVersion key: nrfApiVersion
{{- if .Values.persistence.sharedvolume}}
volumes: volumes:
{{- if .Values.persistence.sharedvolume}}
- name: cn5g-pv - name: cn5g-pv
persistentVolumeClaim: persistenceVolumeClaim:
claimName: cn5g-pvc claimName: cn5g-pvc
{{- end }} {{- end }}
- name: scripts
configMap:
name: health-cm
dnsPolicy: ClusterFirst dnsPolicy: ClusterFirst
restartPolicy: Always restartPolicy: Always
serviceAccountName: {{ .Values.serviceAccount.name }} serviceAccountName: {{ .Values.serviceAccount.name }}
......
...@@ -76,6 +76,10 @@ resources: ...@@ -76,6 +76,10 @@ resources:
terminationGracePeriodSeconds: 30 terminationGracePeriodSeconds: 30
readinessProbe: true
livenessProbe: true
nodeSelector: {} nodeSelector: {}
nodeName: 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: ...@@ -6,4 +6,10 @@ data:
{{- range $key, $val := .Values.config }} {{- range $key, $val := .Values.config }}
{{ $key }}: {{ $val | quote }} {{ $key }}: {{ $val | quote }}
{{- end }} {{- 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: ...@@ -44,6 +44,27 @@ spec:
image: "{{ .Values.nfimage.repository }}:{{ .Values.nfimage.version }}" image: "{{ .Values.nfimage.repository }}:{{ .Values.nfimage.version }}"
securityContext: securityContext:
{{- toYaml .Values.securityContext | nindent 12 }} {{- 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: ports:
- containerPort: {{ .Values.service.n4Port }} - containerPort: {{ .Values.service.n4Port }}
name: oai-smf name: oai-smf
...@@ -197,12 +218,15 @@ spec: ...@@ -197,12 +218,15 @@ spec:
- /bin/sleep - /bin/sleep
- infinity - infinity
{{- end}} {{- end}}
{{- if .Values.persistence.sharedvolume}}
volumes: volumes:
{{- if .Values.persistence.sharedvolume}}
- name: cn5g-pv - name: cn5g-pv
persistentVolumeClaim: persistenceVolumeClaim:
claimName: cn5g-pvc claimName: cn5g-pvc
{{- end }} {{- end }}
- name: scripts
configMap:
name: health-cm
dnsPolicy: ClusterFirst dnsPolicy: ClusterFirst
restartPolicy: Always restartPolicy: Always
serviceAccountName: {{ .Values.serviceAccount.name }} serviceAccountName: {{ .Values.serviceAccount.name }}
......
...@@ -97,8 +97,12 @@ resources: ...@@ -97,8 +97,12 @@ resources:
cpu: 100m cpu: 100m
memory: 256Mi memory: 256Mi
readinessProbe: true
livenessProbe: true
terminationGracePeriodSeconds: 30 terminationGracePeriodSeconds: 30
nodeSelector: {} 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
...@@ -5,4 +5,11 @@ metadata: ...@@ -5,4 +5,11 @@ metadata:
data: data:
{{- range $key, $val := .Values.config }} {{- range $key, $val := .Values.config }}
{{ $key }}: {{ $val | quote }} {{ $key }}: {{ $val | quote }}
{{- end }} {{- end }}
\ No newline at end of file ---
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: ...@@ -48,6 +48,27 @@ spec:
image: "{{ .Values.nfimage.repository }}:{{ .Values.nfimage.version }}" image: "{{ .Values.nfimage.repository }}:{{ .Values.nfimage.version }}"
securityContext: securityContext:
{{- toYaml .Values.securityContext | nindent 12 }} {{- 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: ports:
- containerPort: {{ .Values.service.pfcpPort }} - containerPort: {{ .Values.service.pfcpPort }}
name: oai-spgwu name: oai-spgwu
...@@ -221,12 +242,15 @@ spec: ...@@ -221,12 +242,15 @@ spec:
memory: {{ .Values.resources.limits.memory | quote }} memory: {{ .Values.resources.limits.memory | quote }}
cpu: {{ .Values.resources.limits.cpu | quote }} cpu: {{ .Values.resources.limits.cpu | quote }}
{{- end}} {{- end}}
{{- if .Values.persistence.sharedvolume}}
volumes: volumes:
{{- if .Values.persistence.sharedvolume}}
- name: cn5g-pv - name: cn5g-pv
persistentVolumeClaim: persistenceVolumeClaim:
claimName: cn5g-pvc claimName: cn5g-pvc
{{- end }} {{- end }}
- name: scripts
configMap:
name: health-cm
dnsPolicy: ClusterFirst dnsPolicy: ClusterFirst
restartPolicy: Always restartPolicy: Always
schedulerName: default-scheduler schedulerName: default-scheduler
......
...@@ -98,6 +98,10 @@ resources: ...@@ -98,6 +98,10 @@ resources:
cpu: 100m cpu: 100m
memory: 256Mi memory: 256Mi
readinessProbe: true
livenessProbe: true
terminationGracePeriodSeconds: 30 terminationGracePeriodSeconds: 30
nodeSelector: {} nodeSelector: {}
......
...@@ -145,6 +145,9 @@ The mysql database is pre-configured with some subscriber information. If there ...@@ -145,6 +145,9 @@ The mysql database is pre-configured with some subscriber information. If there
operatorKey: "63bfa50ee6523365ff14c1f45f88737d" (should be the same in mysql) 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. 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 ### 3.3 Configuring SMF
...@@ -165,6 +168,8 @@ config: ...@@ -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. 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. 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 ### 3.4 Configuring UPF
...@@ -186,12 +191,16 @@ config: ...@@ -186,12 +191,16 @@ config:
pidDirectory: "/var/run" 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. 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 ### 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) 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 ### 3.6 Configuring subscriber data in MYSQL
Currently the MYSQL is configured with below subscriber data, 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 ...@@ -225,15 +234,15 @@ Once the configuration is finished the charts can be deployed with a user who ha
``` ```
$ helm install mysql mysql/ $ helm install mysql mysql/
# wait for the pod to come up # wait for the pod to be ready
$ helm install amf oai-amf/ $ helm install amf oai-amf/
# wait for the pod to come up # wait for the pod to be ready
$ helm install nrf oai-nrf/ $ helm install nrf oai-nrf/
# wait for the pod to come up # wait for the pod to be ready
$ helm install smf oai-smf/ $ 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/ $ helm install upf oai-spgwu-tiny/
# wait for the pod to come up # wait for the pod to be ready
$ helm list $ helm list
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION 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 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