Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add liveness in backend config #767

Merged
merged 3 commits into from
Jul 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add ci
jiangpengcheng committed Jul 2, 2024
commit 0d53e8e874ace69f807323d9b0f4c635e512dd42
12 changes: 12 additions & 0 deletions .ci/helm.sh
Original file line number Diff line number Diff line change
@@ -619,4 +619,16 @@ function ci::verify_pod_log() {
sleep 5
kubectl logs --tail=-1 $pod | grep "$log"
done
}

function ci::verify_liveness_probe() {
pod=$1
expected=$2
result=$(kubectl get pod $pod -o jsonpath='{.spec.containers[*].livenessProbe}')
echo "liveness probe is $result"
if [[ "$result" != "$expected" ]]; then
echo "failed"
return 1
fi
echo "succeeded"
}
Original file line number Diff line number Diff line change
@@ -7,3 +7,6 @@ spec:
env:
namespaced1: namespacedvalue1
shared1: fromnamespace
liveness:
initialDelaySeconds: 50
periodSeconds: 60
Original file line number Diff line number Diff line change
@@ -73,6 +73,15 @@ if [ $? -ne 0 ]; then
exit 1
fi

# verify liveness config
verify_liveness_result=$(ci::verify_liveness_probe function-sample-env-function-0 '{"failureThreshold":3,"httpGet":{"path":"/","port":9094,"scheme":"HTTP"},"initialDelaySeconds":30,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":10}' 2>&1)
if [ $? -ne 0 ]; then
echo "$verify_liveness_result"
kubectl delete -f "${mesh_config_file}" > /dev/null 2>&1
kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true
exit 1
fi

# delete the namespaced config, the function should be reconciled without namespaced env injected
kubectl delete -f "${mesh_config_file}" > /dev/null 2>&1
sleep 30
@@ -105,6 +114,14 @@ if [ $? -ne 0 ]; then
exit 1
fi

# it should use liveness config from global config
verify_liveness_result=$(ci::verify_liveness_probe function-sample-env-function-0 '{"failureThreshold":3,"httpGet":{"path":"/","port":9094,"scheme":"HTTP"},"initialDelaySeconds":10,"periodSeconds":30,"successThreshold":1,"timeoutSeconds":30}' 2>&1)
if [ $? -ne 0 ]; then
echo "$verify_liveness_result"
kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true
exit 1
fi

# delete the global config, the function should be reconciled without global env injected
kubectl delete -f "${global_mesh_config_file}" -n $FUNCTION_MESH_NAMESPACE > /dev/null 2>&1 || true
sleep 30
@@ -123,6 +140,14 @@ if [ $? -ne 0 ]; then
exit 1
fi

# it should has no liveness config
verify_liveness_result=$(ci::verify_liveness_probe function-sample-env-function-0 "" 2>&1)
if [ $? -ne 0 ]; then
echo "$verify_liveness_result"
kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true
exit 1
fi

# config created in an another namespace should not affect functions in other namespaces
kubectl apply -f "${mesh_config_file_in_kube_system}" > /dev/null 2>&1
sleep 30
@@ -134,6 +159,14 @@ if [ $? -ne 0 ]; then
exit 1
fi

# it should has no liveness config
verify_liveness_result=$(ci::verify_liveness_probe function-sample-env-function-0 "" 2>&1)
if [ $? -ne 0 ]; then
echo "$verify_liveness_result"
kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true
exit 1
fi

verify_env_result=$(ci::verify_env "function-sample-env" namespaced1 "" 2>&1)
if [ $? -eq 0 ]; then
echo "e2e-test: ok" | yq eval -
Loading