Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
kuberbetes: Renaming kubernetes prefix
Browse files Browse the repository at this point in the history
Renaming kubernetes_* functions to k8s_* to match the
rest of the functions.

Fixes: #5593

Signed-Off-By: Unmesh Deodhar <[email protected]>
  • Loading branch information
UnmeshDeodhar committed Jul 7, 2023
1 parent 1bab0a2 commit d7d223b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions integration/kubernetes/confidential/agent_image.bats
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ create_test_pod() {

echo "Create the test sandbox"
echo "Pod config is: $pod_config"
kubernetes_create_cc_pod $pod_config
k8s_create_cc_pods $pod_config
}

# Create a pod configuration out of a template file.
Expand Down Expand Up @@ -80,7 +80,7 @@ setup() {
pod_config="$(new_pod_config "$image_simple_signed")"
pod_id=""

kubernetes_delete_all_cc_pods_if_any_exists || true
k8s_delete_all_cc_pods_if_any_exists || true

echo "Prepare containerd for Confidential Container"
SAVED_CONTAINERD_CONF_FILE="/etc/containerd/config.toml.$$"
Expand Down Expand Up @@ -235,7 +235,7 @@ teardown() {
return
fi

kubernetes_delete_all_cc_pods_if_any_exists || true
k8s_delete_all_cc_pods_if_any_exists || true
clear_kernel_params
add_kernel_params "${original_kernel_params}"
switch_image_service_offload off
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ setup() {

pod_id=$(kubectl get pods -l app=ccv0-ssh -o jsonpath='{.items..metadata.name}')
if [ -n ${pod_id} ]; then
kubernetes_delete_ssh_demo_pod_if_exists "$pod_id"
k8s_delete_ssh_demo_pod_if_exists "$pod_id"
fi

echo "Prepare containerd for Confidential Container"
Expand All @@ -44,7 +44,7 @@ setup() {
CC_KBS_PORT=${CC_KBS_PORT:-"60000"}
add_kernel_params "agent.aa_kbc_params=cc_kbc::http://${CC_KBS_IP}:${CC_KBS_PORT}/"
fi
kubernetes_create_ssh_demo_pod
k8s_create_ssh_demo_pod

sleep 1
local pod_ip_address=$(kubectl get service ccv0-ssh -o jsonpath="{.spec.clusterIP}")
Expand Down Expand Up @@ -72,7 +72,7 @@ teardown() {
fi

pod_id=$(kubectl get pods -l app=ccv0-ssh -o jsonpath='{.items..metadata.name}')
kubernetes_delete_ssh_demo_pod_if_exists "$pod_id" || true
k8s_delete_ssh_demo_pod_if_exists "$pod_id" || true

clear_kernel_params
add_kernel_params "${original_kernel_params}"
Expand Down
18 changes: 9 additions & 9 deletions integration/kubernetes/confidential/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ source "${BATS_TEST_DIRNAME}/../../../.ci/lib.sh"
FIXTURES_DIR="${BATS_TEST_DIRNAME}/fixtures"

# Delete all pods if any exist, otherwise just return
kubernetes_delete_all_cc_pods_if_any_exists() {
k8s_delete_all_cc_pods_if_any_exists() {
[ -z "$(kubectl get pods)" ] || \
kubectl delete --all pods
}
Expand All @@ -24,7 +24,7 @@ kubernetes_delete_all_cc_pods_if_any_exists() {
# $1 - the sandbox ID
# $2 - wait time in seconds. Defaults to 120. (optional)
#
kubernetes_wait_cc_pod_be_ready() {
k8s_wait_cc_pod_be_ready() {
local pod_name="$1"
local wait_time="${2:-120}"

Expand All @@ -36,7 +36,7 @@ kubernetes_wait_cc_pod_be_ready() {
# Parameters:
# $1 - the pod configuration file.
#
kubernetes_create_cc_pod() {
k8s_create_cc_pod() {
local config_file="$1"
local pod_name=""

Expand All @@ -51,7 +51,7 @@ kubernetes_create_cc_pod() {
return 1
fi

if ! kubernetes_wait_cc_pod_be_ready "$pod_name"; then
if ! k8s_wait_cc_pod_be_ready "$pod_name"; then
# TODO: run this command for debugging. Maybe it should be
# guarded by DEBUG=true?
kubectl get pods "$pod_name"
Expand All @@ -78,7 +78,7 @@ checkout_doc_repo_dir() {
fi
}

kubernetes_create_ssh_demo_pod() {
k8s_create_ssh_demo_pod() {
checkout_doc_repo_dir
kubectl apply -f "${doc_repo_dir}/demos/ssh-demo/k8s-cc-ssh.yaml" && pod=$(kubectl get pods -o jsonpath='{.items..metadata.name}') && kubectl wait --timeout=120s --for=condition=ready pods/$pod
kubectl get pod $pod
Expand All @@ -92,14 +92,14 @@ connect_to_ssh_demo_pod() {
${ssh_command}
}

kubernetes_delete_ssh_demo_pod_if_exists() {
k8s_delete_ssh_demo_pod_if_exists() {
local sandbox_name="$1"
if [ -n "$(kubectl get pods $sandbox_name)" ]; then
kubernetes_delete_ssh_demo_pod ${sandbox_name}
k8s_delete_ssh_demo_pod ${sandbox_name}
fi
}

kubernetes_delete_ssh_demo_pod() {
k8s_delete_ssh_demo_pod() {
checkout_doc_repo_dir
kubectl delete -f "${doc_repo_dir}/demos/ssh-demo/k8s-cc-ssh.yaml"
kubectl wait pod/$1 --for=delete --timeout=-30s
Expand All @@ -110,7 +110,7 @@ assert_pod_fail() {
echo "In assert_pod_fail: "$container_config

echo "Attempt to create the container but it should fail"
! kubernetes_create_cc_pod "$container_config" || /bin/false
! k8s_create_cc_pod "$container_config" || /bin/false
}

setup_decryption_files_in_guest() {
Expand Down

0 comments on commit d7d223b

Please sign in to comment.