Skip to content

Commit 1b9c975

Browse files
committed
Move cnf_install and cnf_uninstall from setup namespace
Signed-off-by: Rafal Lal <rafal.lal@tietoevry.com>
1 parent 5eb887c commit 1b9c975

5 files changed

Lines changed: 32 additions & 33 deletions

File tree

.github/workflows/actions.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ jobs:
525525
cd /shared/$DIR
526526
./cnf-testsuite setup
527527
wget -O cnf-testsuite.yml https://raw.githubusercontent.com/lfn-cnti/testsuite/${GITHUB_SHA}/example-cnfs/coredns/cnf-testsuite.yml
528-
./cnf-testsuite setup:cnf_install cnf-config=./cnf-testsuite.yml
528+
./cnf-testsuite cnf_install cnf-config=./cnf-testsuite.yml
529529
LOG_LEVEL=info ./cnf-testsuite all ~compatibility ~resilience ~reasonable_startup_time ~reasonable_image_size ~platform ~increase_capacity ~decrease_capacity ~install_script_helm ~helm_chart_valid ~helm_chart_published
530530
echo get ratelimit anonymously
531531
TOKEN=$(curl "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token)
@@ -618,7 +618,7 @@ jobs:
618618
cd /shared/$DIR
619619
./cnf-testsuite setup
620620
wget -O cnf-testsuite.yml https://raw.githubusercontent.com/lfn-cnti/testsuite/${GITHUB_SHA}/example-cnfs/coredns/cnf-testsuite.yml
621-
./cnf-testsuite setup:cnf_install cnf-config=./cnf-testsuite.yml
621+
./cnf-testsuite cnf_install cnf-config=./cnf-testsuite.yml
622622
LOG_LEVEL=info ./cnf-testsuite all ~resilience ~compatibility ~pod_network_latency ~platform ~increase_capacity ~decrease_capacity ~liveness ~readiness ~rolling_update ~rolling_downgrade ~rolling_version_change ~nodeport_not_used ~hostport_not_used ~hardcoded_ip_addresses_in_k8s_runtime_configuration ~install_script_helm ~helm_chart_valid ~helm_chart_published ~rollback ~secrets_used ~immutable_configmap
623623
echo get ratelimit anonymously
624624
TOKEN=$(curl "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token)
@@ -711,7 +711,7 @@ jobs:
711711
cd /shared/$DIR
712712
./cnf-testsuite setup
713713
wget -O cnf-testsuite.yml https://raw.githubusercontent.com/lfn-cnti/testsuite/${GITHUB_SHA}/example-cnfs/coredns/cnf-testsuite.yml
714-
./cnf-testsuite setup:cnf_install cnf-config=./cnf-testsuite.yml
714+
./cnf-testsuite cnf_install cnf-config=./cnf-testsuite.yml
715715
LOG_LEVEL=info ./cnf-testsuite all ~resilience ~platform ~liveness ~readiness ~rolling_update ~rolling_downgrade ~rolling_version_change ~nodeport_not_used ~hostport_not_used ~hardcoded_ip_addresses_in_k8s_runtime_configuration ~rollback ~secrets_used ~immutable_configmap ~reasonable_startup_time ~reasonable_image_size
716716
echo get ratelimit anonymously
717717
TOKEN=$(curl "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token)

spec/spec_helper.cr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module ShellCmd
3333

3434
def self.cnf_install(install_params, cmd_prefix="", expect_failure=false)
3535
timeout_parameter = install_params.includes?("timeout") ? "" : "timeout=300"
36-
result = run_testsuite("setup:cnf_install #{install_params} #{timeout_parameter}", cmd_prefix)
36+
result = run_testsuite("cnf_install #{install_params} #{timeout_parameter}", cmd_prefix)
3737
if !expect_failure
3838
result[:status].success?.should be_true
3939
else
@@ -44,7 +44,7 @@ module ShellCmd
4444

4545
def self.cnf_uninstall(uninstall_params="", cmd_prefix="", expect_failure=false)
4646
timeout_parameter = uninstall_params.includes?("timeout") ? "" : "timeout=300"
47-
result = run_testsuite("setup:cnf_uninstall #{uninstall_params} #{timeout_parameter}", cmd_prefix)
47+
result = run_testsuite("cnf_uninstall #{uninstall_params} #{timeout_parameter}", cmd_prefix)
4848
if !expect_failure
4949
result[:status].success?.should be_true
5050
else

src/tasks/cleanup.cr

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ task "tools_uninstall", [
2020
"setup:uninstall_kubescape",
2121
"setup:uninstall_cluster_tools",
2222
"setup:uninstall_opa",
23+
# (rafal-lal) Temporary solution that will be replaced soon
24+
Dockerd.uninstall
2325

2426
# Helm needs to be uninstalled last to allow other uninstalls to use helm if necessary.
2527
# Check this issue for details - https://github.com/cncf/cnf-testsuite/issues/1586
@@ -29,7 +31,7 @@ task "tools_uninstall", [
2931
end
3032

3133
desc "Cleans up the CNF Test Suite sample projects, helper tools, and containers"
32-
task "uninstall_all", ["setup:cnf_uninstall", "tools_uninstall"] do |_, args|
34+
task "uninstall_all", ["cnf_uninstall", "tools_uninstall"] do |_, args|
3335
end
3436

3537
task "delete_results" do |_, args|

src/tasks/constants.cr

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ SPECIALIZED_INIT_SYSTEMS = ["tini", "dumb-init", "s6-svscan"]
2626
ROLLING_VERSION_CHANGE_TEST_NAMES = ["rolling_update", "rolling_downgrade", "rolling_version_change"]
2727
WORKLOAD_RESOURCE_KIND_NAMES = ["replicaset", "deployment", "statefulset", "pod", "daemonset"]
2828

29-
# (rafal-lal)T TODO: why do we need 2 namespaces, trim that to 1
3029
TESTSUITE_NAMESPACE = "cnf-testsuite"
3130
DEFAULT_CNF_NAMESPACE = "cnf-default"
3231
# (kosstennbl) Needed only for manifest deployments, where we don't have control over installation namespace

src/tasks/setup/cnf_setup.cr

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,32 @@
11
require "sam"
22
require "../utils/utils.cr"
33

4-
namespace "setup" do
5-
task "cnf_install", ["setup:helm_local_install", "setup:create_namespace"] do |_, args|
6-
logger = SLOG.for("cnf_install")
7-
logger.info { "Installing CNF to cluster" }
4+
task "cnf_install", ["setup:helm_local_install", "setup:create_namespace"] do |_, args|
5+
logger = SLOG.for("cnf_install")
6+
logger.info { "Installing CNF to cluster" }
87

9-
if CNFManager.cnf_installed?
10-
stdout_warning "A CNF is already installed. Installation of multiple CNFs is not allowed."
11-
stdout_warning "To install a new CNF, uninstall the existing one by running: cnf_uninstall"
12-
exit 0
13-
end
14-
15-
if ClusterTools.install
16-
stdout_success "ClusterTools installed"
17-
else
18-
stdout_failure "The ClusterTools installation timed out. Please check the status of the cluster-tools pods."
19-
exit 1
20-
end
21-
22-
stdout_success "CNF installation start."
23-
CNFInstall.install_cnf(args)
24-
logger.info { "CNF installed successfuly" }
25-
stdout_success "CNF installation complete."
8+
if CNFManager.cnf_installed?
9+
stdout_warning "A CNF is already installed. Installation of multiple CNFs is not allowed."
10+
stdout_warning "To install a new CNF, uninstall the existing one by running: cnf_uninstall"
11+
exit 0
2612
end
2713

28-
task "cnf_uninstall" do |_, args|
29-
logger = SLOG.for("cnf_uninstall")
30-
logger.info { "Uninstalling CNF from cluster" }
31-
CNFInstall.uninstall_cnf
32-
logger.info { "CNF uninstallation ended" }
14+
if ClusterTools.install
15+
stdout_success "ClusterTools installed"
16+
else
17+
stdout_failure "The ClusterTools installation timed out. Please check the status of the cluster-tools pods."
18+
exit 1
3319
end
20+
21+
stdout_success "CNF installation start."
22+
CNFInstall.install_cnf(args)
23+
logger.info { "CNF installed successfuly" }
24+
stdout_success "CNF installation complete."
25+
end
26+
27+
task "cnf_uninstall" do |_, args|
28+
logger = SLOG.for("cnf_uninstall")
29+
logger.info { "Uninstalling CNF from cluster" }
30+
CNFInstall.uninstall_cnf
31+
logger.info { "CNF uninstallation ended" }
3432
end

0 commit comments

Comments
 (0)