2222set -e
2323set -o pipefail
2424
25+ usage () {
26+ echo " Usage: $0 [--no-argocd] <CMD>"
27+ echo
28+ echo " Options:"
29+ echo " --no-argocd Deploy without ArgoCD using the legacy overlay."
30+ echo " Installs cert-manager, mpi-operator, and lustre"
31+ echo " operators directly instead of via ArgoCD."
32+ echo
33+ echo " Commands:"
34+ echo " create Create a new KIND cluster."
35+ echo " destroy Destroy the existing KIND cluster."
36+ echo " reset Destroy the existing KIND cluster and create"
37+ echo " a new cluster. Note: locally-built images are"
38+ echo " not automatically reloaded -- re-run 'push' or"
39+ echo " './nnf-deploy make kind-push' after a reset."
40+ echo " push Execute 'make kind-push' in each submodule dir."
41+ echo " argocd_attach <new_password>"
42+ echo " Login to the argocd instance and set the new"
43+ echo " password. Then add the Git repo to the instance."
44+ echo " argocd_login <new_password>"
45+ echo " Only do the login to the argocd instance and set"
46+ echo " the password."
47+ echo " argocd_add_git_repo Only add the git repo to the argocd instance."
48+ echo " help Show this help message."
49+ }
50+
51+ NO_ARGOCD=
52+ while [[ " $1 " == --* ]]; do
53+ case " $1 " in
54+ --no-argocd) NO_ARGOCD=1 ;;
55+ --help) usage; exit 0 ;;
56+ * ) echo " Unknown option: $1 " ; exit 1 ;;
57+ esac
58+ shift
59+ done
60+
2561CMD=" $1 "
2662shift
2763
@@ -77,6 +113,22 @@ function inject_ca_certs {
77113 [[ -n " $tmp_certs " ]] && rm -f " $tmp_certs "
78114}
79115
116+ # Create the integration test user on KIND Rabbit worker nodes.
117+ # The nnf-integration-test suite verifies that UID/GID exist on Rabbit nodes
118+ # (defaults: UID=1051 GID=1052, the flux user). Without this, the BeforeSuite
119+ # check fails and no tests run.
120+ function create_test_user {
121+ local uid=${NNF_USER_ID:- 1051}
122+ local gid=${NNF_GROUP_ID:- 1052}
123+
124+ echo " Creating test user (UID=$uid , GID=$gid ) on KIND Rabbit worker nodes..."
125+ for node in $( kind get nodes | grep -v control-plane) ; do
126+ # Create group and user if they don't already exist
127+ docker exec " $node " sh -c " getent group $gid >/dev/null 2>&1 || groupadd -g $gid testgroup"
128+ docker exec " $node " sh -c " getent passwd $uid >/dev/null 2>&1 || useradd -u $uid -g $gid -M -s /bin/bash testuser"
129+ done
130+ }
131+
80132function create_cluster {
81133 CONFIG=kind-config.yaml
82134
146198 # Use the same init routines that we use on real hardware.
147199 # This applies taints and labels to rabbit nodes, and installs other
148200 # services that rabbit software requires.
201+ if [[ -n $NO_ARGOCD ]]; then
202+ echo " Deploying without ArgoCD (legacy overlay mode)..."
203+ cp config/overlay-legacy.yaml-template overlay-legacy.yaml
204+ fi
149205 ./nnf-deploy init
206+
207+ # Create the test user on Rabbit nodes for integration tests
208+ create_test_user
150209}
151210
152211function have_argocd {
@@ -231,23 +290,7 @@ function push_submodules {
231290 done
232291}
233292
234- usage () {
235- echo " Usage: $0 <CMD>"
236- echo
237- echo " create Create a new KIND cluster."
238- echo " destroy Destroy the existing KIND cluster."
239- echo " reset Destroy the existing KIND cluster and create"
240- echo " a new cluster."
241- echo " push Execute 'make kind-push' in each submodule dir."
242- echo " argocd_attach <new_password>"
243- echo " Login to the argocd instance and set the new"
244- echo " password. Then add the Git repo to the instance."
245- echo " argocd_login <new_password>"
246- echo " Only do the login to the argocd instance and set"
247- echo " the password."
248- echo " argocd_add_git_repo Only add the git repo to the argocd instance."
249293
250- }
251294
252295if [[ " $CMD " == " create" ]]; then
253296 create_cluster
@@ -264,6 +307,8 @@ elif [[ "$CMD" == "argocd_login" ]]; then
264307 argocd_login " $* "
265308elif [[ " $CMD " == " argocd_add_git_repo" ]]; then
266309 argocd_add_git_repo
310+ elif [[ " $CMD " == " help" || " $CMD " == " --help" ]]; then
311+ usage
267312else
268313 usage
269314 exit 1
0 commit comments