@@ -267,13 +267,9 @@ fv-agentless: $(KUBECTL) $(GINKGO) ## Run Sveltos Controller tests using existin
267267 $(KUBECTL ) wait --for=condition=Available deployment/addon-controller -n projectsveltos --timeout=$(TIMEOUT )
268268 cd test/fv; $(GINKGO ) -nodes $(NUM_NODES ) --label-filter=' FV' --v --trace --randomize-all
269269
270- .PHONY : create-cluster
271- create-cluster : $(KIND ) $(CLUSTERCTL ) $(KUBECTL ) $( ENVSUBST ) # # Create a new kind cluster designed for development
270+ .PHONY : create-cluster-infra
271+ create-cluster-infra : $(KIND ) $(CLUSTERCTL ) $(KUBECTL ) # # Create cluster infrastructure without deploying Sveltos
272272 $(MAKE ) create-control-cluster
273-
274- @echo "Start projectsveltos"
275- $(MAKE) deploy-projectsveltos
276-
277273 $(MAKE ) create-workload-cluster
278274
279275 @echo "prepare configMap with kustomize files"
@@ -282,9 +278,36 @@ create-cluster: $(KIND) $(CLUSTERCTL) $(KUBECTL) $(ENVSUBST) ## Create a new kin
282278 @echo "prepare configMap with flux resources"
283279 $(KUBECTL) create configmap install-flux --from-file=test/flux-install.yaml
284280
285- @echo apply reloader CRD to managed cluster
281+ @echo " apply reloader CRD to managed cluster"
286282 $(KUBECTL) --kubeconfig=./test/fv/workload_kubeconfig apply -f https://raw.githubusercontent.com/projectsveltos/libsveltos/$(TAG)/manifests/apiextensions.k8s.io_v1_customresourcedefinition_reloaders.lib.projectsveltos.io.yaml
287283
284+ .PHONY : fv-namespace
285+ fv-namespace : $(GINKGO ) $(KUBECTL ) $(KUSTOMIZE ) $(ENVSUBST ) # # Run FV tests with addon-controller deployed in a random namespace
286+ $(MAKE ) load-image
287+ $(MAKE ) deploy-crds
288+ cd config/manager && $(KUSTOMIZE ) edit set image controller=${IMG}
289+ SVELTOS_NS=" sveltos-$$ (openssl rand -hex 4)" ; \
290+ echo " Deploying addon-controller in namespace: $$ SVELTOS_NS" ; \
291+ $(KUSTOMIZE ) build config/default | $(ENVSUBST ) | \
292+ sed -E ' s/^([[:space:]]+)(name|namespace): projectsveltos$$/\1\2: ' " $$ SVELTOS_NS" ' /' | \
293+ $(KUBECTL ) apply -f-; \
294+ $(KUBECTL ) apply -f https://raw.githubusercontent.com/projectsveltos/libsveltos/$(TAG ) /configuration/default-debuggingconfiguration.yaml; \
295+ $(KUBECTL ) apply -f https://raw.githubusercontent.com/projectsveltos/sveltoscluster-manager/$(TAG ) /manifest/manifest.yaml; \
296+ $(KUBECTL ) apply -f https://raw.githubusercontent.com/projectsveltos/register-mgmt-cluster/$(TAG ) /manifest/manifest.yaml; \
297+ echo " Waiting for addon-controller to be available in namespace $$ SVELTOS_NS..." ; \
298+ $(KUBECTL ) wait --for=condition=Available deployment/addon-controller -n " $$ SVELTOS_NS" --timeout=$(TIMEOUT ) ; \
299+ cd test/fv && SVELTOS_NAMESPACE=" $$ SVELTOS_NS" $(GINKGO ) -nodes $(NUM_NODES ) --label-filter=' FV' --v --trace --randomize-all
300+
301+ .PHONY : kind-test-namespace
302+ kind-test-namespace : test create-cluster-infra fv-namespace # # Build docker image; start kind cluster; run fv in a random namespace
303+
304+ .PHONY : create-cluster
305+ create-cluster : $(KIND ) $(CLUSTERCTL ) $(KUBECTL ) $(ENVSUBST ) # # Create a new kind cluster designed for development
306+ $(MAKE ) create-cluster-infra
307+
308+ @echo "Start projectsveltos"
309+ $(MAKE) deploy-projectsveltos
310+
288311.PHONY : delete-cluster
289312delete-cluster : $(KIND ) # # Deletes the kind cluster $(CONTROL_CLUSTER_NAME)
290313 $(KIND ) delete cluster --name $(CONTROL_CLUSTER_NAME )
@@ -419,11 +442,8 @@ create-cluster-pullmode: $(KIND) $(KUBECTL) $(ENVSUBST) $(KUSTOMIZE)
419442 @echo "Switching to cluster1..."
420443 $(KUBECTL) config use-context kind-$(CONTROL_CLUSTER_NAME)
421444
422- deploy-projectsveltos : $(KUSTOMIZE ) $(ENVSUBST ) $(KUBECTL )
423- # Load projectsveltos image into cluster
424- @echo ' Load projectsveltos image into cluster'
425- $(MAKE ) load-image
426-
445+ .PHONY : deploy-crds
446+ deploy-crds : $(KUBECTL ) # # Install libsveltos CRDs
427447 @echo ' Install libsveltos CRDs'
428448 $(KUBECTL ) apply -f https://raw.githubusercontent.com/projectsveltos/libsveltos/$(TAG ) /manifests/apiextensions.k8s.io_v1_customresourcedefinition_debuggingconfigurations.lib.projectsveltos.io.yaml
429449 $(KUBECTL ) apply -f https://raw.githubusercontent.com/projectsveltos/libsveltos/$(TAG ) /manifests/apiextensions.k8s.io_v1_customresourcedefinition_classifiers.lib.projectsveltos.io.yaml
@@ -436,6 +456,13 @@ deploy-projectsveltos: $(KUSTOMIZE) $(ENVSUBST) $(KUBECTL)
436456 $(KUBECTL ) apply -f https://raw.githubusercontent.com/projectsveltos/libsveltos/$(TAG ) /manifests/apiextensions.k8s.io_v1_customresourcedefinition_configurationbundles.lib.projectsveltos.io.yaml
437457 $(KUBECTL ) apply -f https://raw.githubusercontent.com/projectsveltos/libsveltos/$(TAG ) /manifests/apiextensions.k8s.io_v1_customresourcedefinition_sveltoslicenses.lib.projectsveltos.io.yaml
438458
459+ deploy-projectsveltos : $(KUSTOMIZE ) $(ENVSUBST ) $(KUBECTL )
460+ # Load projectsveltos image into cluster
461+ @echo ' Load projectsveltos image into cluster'
462+ $(MAKE ) load-image
463+
464+ $(MAKE) deploy-crds
465+
439466 # Install projectsveltos addon-controller components
440467 @echo 'Install projectsveltos addon-controller components'
441468 cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
0 commit comments