Skip to content

Commit

Permalink
Remove the unnecessary cat commands, the logic remains unchanged (#421)
Browse files Browse the repository at this point in the history
  • Loading branch information
rdavid authored Apr 16, 2024
1 parent d17ecbe commit 583109d
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 48 deletions.
4 changes: 1 addition & 3 deletions scripts/delete-network-policies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ oc delete --filename ./test-target/egress-deny-all-np.yaml --namespace "$TNF_EXA

# Render the script with vars
mkdir -p ./temp

# shellcheck disable=SC2002 # Useless cat.
cat ./test-target/pod-to-pod-np.yaml | TNF_EXAMPLE_CNF_NAMESPACE=$TNF_EXAMPLE_CNF_NAMESPACE "$SCRIPT_DIR"/mo >./temp/rendered-pod-to-pod-np.yaml
TNF_EXAMPLE_CNF_NAMESPACE=$TNF_EXAMPLE_CNF_NAMESPACE "$SCRIPT_DIR"/mo ./test-target/pod-to-pod-np.yaml >./temp/rendered-pod-to-pod-np.yaml
oc delete --filename ./temp/rendered-pod-to-pod-np.yaml --namespace "$TNF_EXAMPLE_CNF_NAMESPACE" --ignore-not-found
oc delete --filename ./temp/rendered-pod-to-pod-np.yaml --namespace default --ignore-not-found
rm ./temp/rendered-pod-to-pod-np.yaml
4 changes: 1 addition & 3 deletions scripts/delete-pod-disruption-budget.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ source "$SCRIPT_DIR"/init-env.sh

# Delete test PDB
mkdir -p ./temp

# shellcheck disable=SC2002 # Useless cat.
cat ./test-target/pod-disruption-budget.yaml | APP_1="testdp" APP_2="testss" "$SCRIPT_DIR"/mo >./temp/rendered-pod-disruption-budget-template.yaml
APP_1="testdp" APP_2="testss" "$SCRIPT_DIR"/mo ./test-target/pod-disruption-budget.yaml >./temp/rendered-pod-disruption-budget-template.yaml
oc delete --filename ./temp/rendered-pod-disruption-budget-template.yaml --namespace "$TNF_EXAMPLE_CNF_NAMESPACE" --ignore-not-found=true
rm ./temp/rendered-pod-disruption-budget-template.yaml
3 changes: 1 addition & 2 deletions scripts/delete-storage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ source "$SCRIPT_DIR"/init-env.sh

mkdir -p ./temp

# shellcheck disable=SC2002 # Useless cat.
cat ./test-target/storage.yaml | "$SCRIPT_DIR"/mo >./temp/rendered-test-storage.yaml
"$SCRIPT_DIR"/mo ./test-target/storage.yaml >./temp/rendered-test-storage.yaml
oc delete --filename ./temp/rendered-test-storage.yaml -n "$TNF_EXAMPLE_CNF_NAMESPACE" --ignore-not-found=true
rm ./temp/rendered-test-storage.yaml
19 changes: 7 additions & 12 deletions scripts/deploy-community-operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,19 @@ fi

# Create the operator group
mkdir -p ./temp

# shellcheck disable=SC2002 # Useless cat.
cat ./test-target/community-operator-group.yaml | TNF_EXAMPLE_CNF_NAMESPACE=$TNF_EXAMPLE_CNF_NAMESPACE "$SCRIPT_DIR"/mo >./temp/rendered-local-community-operator-group.yaml
TNF_EXAMPLE_CNF_NAMESPACE=$TNF_EXAMPLE_CNF_NAMESPACE "$SCRIPT_DIR"/mo ./test-target/community-operator-group.yaml >./temp/rendered-local-community-operator-group.yaml
oc apply --filename ./temp/rendered-local-community-operator-group.yaml
cat ./temp/rendered-local-community-operator-group.yaml
rm ./temp/rendered-local-community-operator-group.yaml

# Create the Subscription
mkdir -p ./temp

# shellcheck disable=SC2002 # Useless cat.
cat ./test-target/community-operator-subscription.yaml |
OPERATOR_BASE=$COMMUNITY_OPERATOR_BASE \
OPERATOR_NAME=$COMMUNITY_OPERATOR_NAME \
CATALOG_SOURCE=$CATALOG_SOURCE \
CATALOG_NAMESPACE=$CATALOG_NAMESPACE \
TNF_EXAMPLE_CNF_NAMESPACE=$TNF_EXAMPLE_CNF_NAMESPACE \
"$SCRIPT_DIR"/mo >./temp/rendered-local-community-operator-subscription.yaml
OPERATOR_BASE=$COMMUNITY_OPERATOR_BASE \
OPERATOR_NAME=$COMMUNITY_OPERATOR_NAME \
CATALOG_SOURCE=$CATALOG_SOURCE \
CATALOG_NAMESPACE=$CATALOG_NAMESPACE \
TNF_EXAMPLE_CNF_NAMESPACE=$TNF_EXAMPLE_CNF_NAMESPACE \
"$SCRIPT_DIR"/mo ./test-target/community-operator-subscription.yaml >./temp/rendered-local-community-operator-subscription.yaml
oc apply --filename ./temp/rendered-local-community-operator-subscription.yaml
cat ./temp/rendered-local-community-operator-subscription.yaml
rm ./temp/rendered-local-community-operator-subscription.yaml
Expand Down
8 changes: 2 additions & 6 deletions scripts/deploy-cpu-scheduling-test-pods.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@ SCRIPT_DIR=$(dirname "$0")
# shellcheck disable=SC1091 # Not following.
source "$SCRIPT_DIR"/init-env.sh
mkdir -p ./temp

# shellcheck disable=SC2002 # Useless cat.
cat ./test-target/cpu-exclusive-pool-rt-sched-policy-pod.yaml | "$SCRIPT_DIR"/mo >./temp/rendered-cpu-exclusive-pool-rt-sched-policy-pod.yaml

# shellcheck disable=SC2002 # Useless cat.
cat ./test-target/cpu-shared-pool-non-rt-sched-policy-pod.yaml | "$SCRIPT_DIR"/mo >./temp/rendered-cpu-shared-pool-non-rt-sched-policy-pod.yaml
"$SCRIPT_DIR"/mo ./test-target/cpu-exclusive-pool-rt-sched-policy-pod.yaml >./temp/rendered-cpu-exclusive-pool-rt-sched-policy-pod.yaml
"$SCRIPT_DIR"/mo ./test-target/cpu-shared-pool-non-rt-sched-policy-pod.yaml >./temp/rendered-cpu-shared-pool-non-rt-sched-policy-pod.yaml
oc apply --filename ./temp/rendered-cpu-exclusive-pool-rt-sched-policy-pod.yaml
oc apply --filename ./temp/rendered-cpu-shared-pool-non-rt-sched-policy-pod.yaml
rm ./temp/rendered-cpu-exclusive-pool-rt-sched-policy-pod.yaml
Expand Down
4 changes: 2 additions & 2 deletions scripts/deploy-multus-network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ if $TNF_NON_OCP_CLUSTER; then
# Creates the network attachment with ptp plugin on partner namespace
mkdir -p ./temp

# shellcheck disable=SC2002,SC2001 # Useless cat, echo.
cat ./config/k8s-cluster/multus.yaml | IP_NUM=$(echo "$2" | sed 's/NUM/'"${NUM}"'/g') NET_NAME_NUM="$NET_NAME-$1-$NUM" "$SCRIPT_DIR"/mo >./temp/rendered-multus.yaml
# shellcheck disable=SC2001 # Useless echo.
IP_NUM=$(echo "$2" | sed 's/NUM/'"${NUM}"'/g') NET_NAME_NUM="$NET_NAME-$1-$NUM" "$SCRIPT_DIR"/mo ./config/k8s-cluster/multus.yaml >./temp/rendered-multus.yaml
oc apply --filename ./temp/rendered-multus.yaml
rm ./temp/rendered-multus.yaml
done
Expand Down
4 changes: 1 addition & 3 deletions scripts/deploy-network-policies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ oc apply --filename ./test-target/egress-deny-all-np.yaml --namespace "$TNF_EXAM

# Render the script with vars
mkdir -p ./temp

# shellcheck disable=SC2002 # Useless cat.
cat ./test-target/pod-to-pod-np.yaml | TNF_EXAMPLE_CNF_NAMESPACE=$TNF_EXAMPLE_CNF_NAMESPACE "$SCRIPT_DIR"/mo >./temp/rendered-pod-to-pod-np.yaml
TNF_EXAMPLE_CNF_NAMESPACE=$TNF_EXAMPLE_CNF_NAMESPACE "$SCRIPT_DIR"/mo ./test-target/pod-to-pod-np.yaml >./temp/rendered-pod-to-pod-np.yaml

# Apply policies to allow pod-to-pod communication (aka make the ping test work)
oc apply --filename ./temp/rendered-pod-to-pod-np.yaml --namespace "$TNF_EXAMPLE_CNF_NAMESPACE"
Expand Down
3 changes: 1 addition & 2 deletions scripts/deploy-pod-disruption-budget.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ SCRIPT_DIR=$(dirname "$0")
source "$SCRIPT_DIR"/init-env.sh
mkdir -p ./temp

# shellcheck disable=SC2002 # Useless cat.
cat ./test-target/pod-disruption-budget.yaml | APP_1="testdp" APP_2="testss" "$SCRIPT_DIR"/mo >./temp/rendered-pod-disruption-budget-template.yaml
APP_1="testdp" APP_2="testss" "$SCRIPT_DIR"/mo ./test-target/pod-disruption-budget.yaml >./temp/rendered-pod-disruption-budget-template.yaml
oc apply --filename ./temp/rendered-pod-disruption-budget-template.yaml --namespace "$TNF_EXAMPLE_CNF_NAMESPACE"
rm ./temp/rendered-pod-disruption-budget-template.yaml
4 changes: 1 addition & 3 deletions scripts/deploy-statefulset-test-pods.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ NUM_NODES="${NUM_NODES%"${NUM_NODES##*[![:space:]]}"}"
if [[ $NUM_NODES == 1 ]]; then
REPLICAS=1
fi

# shellcheck disable=SC2002 # Useless cat.
cat ./test-target/local-pod-under-test.yaml | APP="testss" RESOURCE_TYPE="StatefulSet" MULTUS_ANNOTATION=$MULTUS_ANNOTATION REPLICAS=$REPLICAS "$SCRIPT_DIR"/mo >./temp/rendered-local-statefulset-pod-under-test-template.yaml
APP="testss" RESOURCE_TYPE="StatefulSet" MULTUS_ANNOTATION=$MULTUS_ANNOTATION REPLICAS=$REPLICAS "$SCRIPT_DIR"/mo ./test-target/local-pod-under-test.yaml >./temp/rendered-local-statefulset-pod-under-test-template.yaml
oc apply --filename ./temp/rendered-local-statefulset-pod-under-test-template.yaml
rm ./temp/rendered-local-statefulset-pod-under-test-template.yaml
sleep 3
Expand Down
3 changes: 1 addition & 2 deletions scripts/deploy-storage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ source "$SCRIPT_DIR"/init-env.sh

mkdir -p ./temp

# shellcheck disable=SC2002 # Useless cat.
cat ./test-target/storage.yaml | "$SCRIPT_DIR"/mo >./temp/rendered-test-storage.yaml
"$SCRIPT_DIR"/mo ./test-target/storage.yaml >./temp/rendered-test-storage.yaml
oc apply --filename ./temp/rendered-test-storage.yaml --namespace "$TNF_EXAMPLE_CNF_NAMESPACE"
rm ./temp/rendered-test-storage.yaml
7 changes: 2 additions & 5 deletions scripts/deploy-test-pods.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ NUM_NODES="${NUM_NODES%"${NUM_NODES##*[![:space:]]}"}"
if [[ $NUM_NODES == 1 ]]; then
REPLICAS=1
fi

# shellcheck disable=SC2002 # Useless cat.
cat ./test-target/test-service-account.yaml | "$SCRIPT_DIR"/mo >./temp/rendered-test-service-account-template.yaml
# shellcheck disable=SC2002 # Useless cat.
cat ./test-target/local-pod-under-test.yaml | APP="testdp" RESOURCE_TYPE="Deployment" MULTUS_ANNOTATION=$MULTUS_ANNOTATION REPLICAS=$REPLICAS "$SCRIPT_DIR"/mo >./temp/rendered-local-pod-under-test-template.yaml
"$SCRIPT_DIR"/mo ./test-target/test-service-account.yaml >./temp/rendered-test-service-account-template.yaml
APP="testdp" RESOURCE_TYPE="Deployment" MULTUS_ANNOTATION=$MULTUS_ANNOTATION REPLICAS=$REPLICAS "$SCRIPT_DIR"/mo ./test-target/local-pod-under-test.yaml >./temp/rendered-local-pod-under-test-template.yaml
oc apply --filename ./temp/rendered-test-service-account-template.yaml
oc apply --filename ./temp/rendered-local-pod-under-test-template.yaml
rm ./temp/rendered-test-service-account-template.yaml ./temp/rendered-local-pod-under-test-template.yaml
Expand Down
7 changes: 2 additions & 5 deletions scripts/manage-service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,11 @@ fi

# ipv6 service
mkdir -p ./temp

# shellcheck disable=SC2002 # Useless cat.
cat ./test-target/service.yaml | SERVICE_NAME="test-service-dualstack" APP="testdp" IP_FAMILY_POLICY="PreferDualStack" IP_FAMILIES='["IPv4","IPv6"]' "$SCRIPT_DIR"/mo >./temp/rendered-local-service-under-test-template.yaml
SERVICE_NAME="test-service-dualstack" APP="testdp" IP_FAMILY_POLICY="PreferDualStack" IP_FAMILIES='["IPv4","IPv6"]' "$SCRIPT_DIR"/mo ./test-target/service.yaml >./temp/rendered-local-service-under-test-template.yaml
oc $ACTION --filename ./temp/rendered-local-service-under-test-template.yaml
rm ./temp/rendered-local-service-under-test-template.yaml

# dual stack service
# shellcheck disable=SC2002 # Useless cat.
cat ./test-target/service.yaml | SERVICE_NAME="test-service-ipv6" APP="testdp" IP_FAMILY_POLICY="SingleStack" IP_FAMILIES='["IPv6"]' "$SCRIPT_DIR"/mo >./temp/rendered-local-service-under-test-template.yaml
SERVICE_NAME="test-service-ipv6" APP="testdp" IP_FAMILY_POLICY="SingleStack" IP_FAMILIES='["IPv6"]' "$SCRIPT_DIR"/mo ./test-target/service.yaml >./temp/rendered-local-service-under-test-template.yaml
oc $ACTION --filename ./temp/rendered-local-service-under-test-template.yaml
rm ./temp/rendered-local-service-under-test-template.yaml

0 comments on commit 583109d

Please sign in to comment.