tests: k8s: k8s-qos-pods auto-generated policy

Auto-generate policy for k8s-qos-pods.bats.

Fixes: #9096

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
This commit is contained in:
Dan Mihai 2024-02-14 21:09:20 +00:00
parent 0179f53469
commit 56689c6800

View File

@ -16,9 +16,15 @@ setup() {
@test "Guaranteed QoS" {
pod_name="qos-test"
yaml_file="${pod_config_dir}/pod-guaranteed.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}" "${yaml_file}"
# Create pod
kubectl create -f "${pod_config_dir}/pod-guaranteed.yaml"
kubectl create -f "${yaml_file}"
# Check pod creation
kubectl wait --for=condition=Ready --timeout=$timeout pod "$pod_name"
@ -29,9 +35,15 @@ setup() {
@test "Burstable QoS" {
pod_name="burstable-test"
yaml_file="${pod_config_dir}/pod-burstable.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}" "${yaml_file}"
# Create pod
kubectl create -f "${pod_config_dir}/pod-burstable.yaml"
kubectl create -f "${yaml_file}"
# Check pod creation
kubectl wait --for=condition=Ready --timeout=$timeout pod "$pod_name"
@ -42,9 +54,15 @@ setup() {
@test "BestEffort QoS" {
pod_name="besteffort-test"
yaml_file="${pod_config_dir}/pod-besteffort.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}" "${yaml_file}"
# Create pod
kubectl create -f "${pod_config_dir}/pod-besteffort.yaml"
kubectl create -f "${yaml_file}"
# Check pod creation
kubectl wait --for=condition=Ready --timeout=$timeout pod "$pod_name"
@ -55,4 +73,5 @@ setup() {
teardown() {
kubectl delete pod "$pod_name"
delete_tmp_policy_settings_dir "${policy_settings_dir}"
}