mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-01 17:06:28 +00:00
tests: k8s: k8s-scale-nginx auto-generated policy
Auto-generate policy for k8s-scale-nginx.bats. Fixes: #9096 Signed-off-by: Dan Mihai <dmihai@microsoft.com>
This commit is contained in:
@@ -14,14 +14,20 @@ setup() {
|
||||
replicas="3"
|
||||
deployment="nginx-deployment"
|
||||
get_pod_config_dir
|
||||
|
||||
# Create the yaml file
|
||||
test_yaml="${pod_config_dir}/test-${deployment}.yaml"
|
||||
sed -e "s/\${nginx_version}/${nginx_image}/" \
|
||||
"${pod_config_dir}/${deployment}.yaml" > "${test_yaml}"
|
||||
|
||||
# Add policy to the yaml file
|
||||
policy_settings_dir="$(create_tmp_policy_settings_dir "${pod_config_dir}")"
|
||||
add_requests_to_policy_settings "${policy_settings_dir}" "ReadStreamRequest"
|
||||
auto_generate_policy "${policy_settings_dir}" "${test_yaml}"
|
||||
}
|
||||
|
||||
@test "Scale nginx deployment" {
|
||||
|
||||
sed -e "s/\${nginx_version}/${nginx_image}/" \
|
||||
"${pod_config_dir}/${deployment}.yaml" > "${pod_config_dir}/test-${deployment}.yaml"
|
||||
|
||||
kubectl create -f "${pod_config_dir}/test-${deployment}.yaml"
|
||||
kubectl create -f "${test_yaml}"
|
||||
kubectl wait --for=condition=Available --timeout=$timeout deployment/${deployment}
|
||||
kubectl expose deployment/${deployment}
|
||||
kubectl scale deployment/${deployment} --replicas=${replicas}
|
||||
@@ -30,7 +36,8 @@ setup() {
|
||||
}
|
||||
|
||||
teardown() {
|
||||
rm -f "${pod_config_dir}/test-${deployment}.yaml"
|
||||
rm -f "${test_yaml}"
|
||||
kubectl delete deployment "$deployment"
|
||||
kubectl delete service "$deployment"
|
||||
delete_tmp_policy_settings_dir "${policy_settings_dir}"
|
||||
}
|
||||
|
Reference in New Issue
Block a user