From 58e3feaacf376de2be3e105e3203db2208a982ba Mon Sep 17 00:00:00 2001 From: Blaine Gardner Date: Wed, 21 Aug 2024 13:50:19 -0600 Subject: [PATCH] multus: fix default service account handling The default service account isn't passed to the multus validation test when no config file is used. Fix this. Signed-off-by: Blaine Gardner --- cmd/rook/userfacing/multus/validation/validation.go | 2 ++ tests/scripts/multus/test-110-cli.sh | 4 ++++ tests/scripts/multus/test-210-stretch-overlap.sh | 4 ++++ tests/scripts/multus/test-220-stretch-pub-and-cluster.sh | 4 ++++ tests/scripts/multus/test-230-stretch-pub-only.sh | 4 ++++ tests/scripts/multus/test-240-stretch-cluster-only.sh | 4 ++++ 6 files changed, 22 insertions(+) diff --git a/cmd/rook/userfacing/multus/validation/validation.go b/cmd/rook/userfacing/multus/validation/validation.go index e5f1c4321..7a654938b 100644 --- a/cmd/rook/userfacing/multus/validation/validation.go +++ b/cmd/rook/userfacing/multus/validation/validation.go @@ -134,6 +134,8 @@ func init() { "The default value is set to the worst-case value for a Rook Ceph cluster with 3 portable OSDs, 3 portable monitors, "+ "and where all optional child resources have been created with 1 daemon such that they all might run on a single node in a failure scenario. "+ "If you aren't sure what to choose for this value, add 1 for each additional OSD beyond 3.") + runCmd.Flags().StringVar(&validationConfig.ServiceAccountName, "service-account", defaultConfig.ServiceAccountName, + "The name of the service account that will be used for test resources.") runCmd.Flags().BoolVar(&flagHostCheckOnly, "host-check-only", defaultConfig.HostCheckOnly, "Only check that hosts can connect to the server via the public network. Do not start clients. "+ "This mode is recommended when a Rook cluster is already running and consuming the public network specified.") diff --git a/tests/scripts/multus/test-110-cli.sh b/tests/scripts/multus/test-110-cli.sh index 79ad0289c..5b69e29b8 100755 --- a/tests/scripts/multus/test-110-cli.sh +++ b/tests/scripts/multus/test-110-cli.sh @@ -6,6 +6,10 @@ OUTFILE="cli-test.log" kubectl create namespace "$NAMESPACE" +# create the expected serviceaccount in the namespace +# in Minikube/KinD, the tool needs no special permissions, so just the SA is fine +kubectl create serviceaccount rook-ceph-system --namespace "$NAMESPACE" + ./rook --log-level DEBUG multus validation run \ --namespace "$NAMESPACE" \ --public-network default/public-net \ diff --git a/tests/scripts/multus/test-210-stretch-overlap.sh b/tests/scripts/multus/test-210-stretch-overlap.sh index 273c7b6f1..dfb809e8a 100755 --- a/tests/scripts/multus/test-210-stretch-overlap.sh +++ b/tests/scripts/multus/test-210-stretch-overlap.sh @@ -7,6 +7,10 @@ OUTFILE="overlap-test.log" kubectl create namespace "$NAMESPACE" +# create the expected serviceaccount in the namespace +# in Minikube/KinD, the tool needs no special permissions, so just the SA is fine +kubectl create serviceaccount rook-ceph-system --namespace "$NAMESPACE" + sed \ -e "s|namespace:.*|namespace: $NAMESPACE|" \ -e 's|publicNetwork:.*|publicNetwork: "default/public-net"|' \ diff --git a/tests/scripts/multus/test-220-stretch-pub-and-cluster.sh b/tests/scripts/multus/test-220-stretch-pub-and-cluster.sh index 5f5d39760..72aea979c 100755 --- a/tests/scripts/multus/test-220-stretch-pub-and-cluster.sh +++ b/tests/scripts/multus/test-220-stretch-pub-and-cluster.sh @@ -7,6 +7,10 @@ OUTFILE="stretch-pub-and-cluster-test.log" kubectl create namespace "$NAMESPACE" +# create the expected serviceaccount in the namespace +# in Minikube/KinD, the tool needs no special permissions, so just the SA is fine +kubectl create serviceaccount rook-ceph-system --namespace "$NAMESPACE" + sed \ -e "s|namespace:.*|namespace: $NAMESPACE|" \ -e 's|publicNetwork:.*|publicNetwork: "default/public-net"|' \ diff --git a/tests/scripts/multus/test-230-stretch-pub-only.sh b/tests/scripts/multus/test-230-stretch-pub-only.sh index b4dd1c5c2..791c75d43 100755 --- a/tests/scripts/multus/test-230-stretch-pub-only.sh +++ b/tests/scripts/multus/test-230-stretch-pub-only.sh @@ -7,6 +7,10 @@ OUTFILE="stretch-pub-test.log" kubectl create namespace "$NAMESPACE" +# create the expected serviceaccount in the namespace +# in Minikube/KinD, the tool needs no special permissions, so just the SA is fine +kubectl create serviceaccount rook-ceph-system --namespace "$NAMESPACE" + # all daemons get public network, so all should get started sed \ diff --git a/tests/scripts/multus/test-240-stretch-cluster-only.sh b/tests/scripts/multus/test-240-stretch-cluster-only.sh index a2f1f2ddd..6f28c0710 100755 --- a/tests/scripts/multus/test-240-stretch-cluster-only.sh +++ b/tests/scripts/multus/test-240-stretch-cluster-only.sh @@ -7,6 +7,10 @@ OUTFILE="stretch-cluster-test.log" kubectl create namespace "$NAMESPACE" +# create the expected serviceaccount in the namespace +# in Minikube/KinD, the tool needs no special permissions, so just the SA is fine +kubectl create serviceaccount rook-ceph-system --namespace "$NAMESPACE" + sed \ -e "s|namespace:.*|namespace: $NAMESPACE|" \ -e 's|publicNetwork:.*|publicNetwork: ""|' \