Skip to content

Commit

Permalink
airgap: Remove airgap mode
Browse files Browse the repository at this point in the history
Remove all code connected to airgap mode and module,
"offline" parameter, "input_file" and "output_file" arguments.
Related spec tests and documentation is also removed.

Refs: cnti-testcatalog#2104
Signed-off-by: Konstantin Yarovoy <[email protected]>
  • Loading branch information
Konstantin Yarovoy committed Jul 16, 2024
1 parent 7f8c910 commit 1883c95
Show file tree
Hide file tree
Showing 40 changed files with 226 additions and 1,689 deletions.
7 changes: 0 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
/tools/helm
/tools/sonobuoy
/tools/cluster-api
/tools/airgapped_kind/kind_node/node.tar.gz
/tools/dockerd-manifest.yml
admin.conf
cnf-testsuite
Expand All @@ -25,7 +24,6 @@ cnf-testsuite*.tar*
*.tar
reasonable_startup_orig.yml
reasonable_startup_test.yml
cri_tools.yml
ephemeral_env
kubeconfig.conf
linux-amd64/
Expand All @@ -41,13 +39,8 @@ chaos_container_kill.yml
/.idea/
*.log
points.yml
/tools/cri-tools-manifest.yml
cri-tools-manifest.yml
containerd-*-linux-amd64.tar.gz
crictl-*-linux-amd64.tar.gz
tools/LICENSE
airgapped.tar.gz
airgaptest.tar.gz
/cnf-testsuite.yml
/*.tgz
/enforce-image-tag.yml
Expand Down
57 changes: 0 additions & 57 deletions AIRGAP.md

This file was deleted.

35 changes: 0 additions & 35 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,31 +129,6 @@ This should build a cnf-testsuite binary in the root directory of the git repo c
</p>
</details>

#### Air-Gapped

The CNF-TestSuite has the ability to install in an air-gapped environment. A tarball with upstream tools can be created from a source installation, or downloaded from the binaries of the release.

You can read more about the air-gap process by reading the [AIRGAP detailed documentation](AIRGAP.md).

<details><summary> Click here for brief air-gap install details</summary>
<p>

Prerequite: Follow the source install instructions to create a working binary which will generate the air-gapped tarball.

Follow these steps to create an air-gap tarball and to bootstrap the cluster with the tarball:

```
./cnf-testsuite airgapped output-file=./tmp/airgapped.tar.gz
./cnf-testsuite setup offline=./tmp/airgapped.tar.gz
# To run the set suite in air-gapped mode
./cnf-testsuite workload offline=true
```
This should create a bootstrapped cluster with the upstream tools necessary for the cnf-testsuite.

</p>
</details>

### Preparation

Now that you have cnf-testsuite installed, we need to prepare the suite.
Expand Down Expand Up @@ -227,16 +202,6 @@ If you've followed the [CNF_TESTSUITE_YML_USAGE.md](CNF_TESTSUITE_YML_USAGE.md)
```
cnf-testsuite cnf_setup cnf-config=./cnf-testsuite.yml
```
#### Installing a CNF in Airgapped mode

To create a tarball of a cnf that can be copied into the airgapped environment:
```
cnf-testsuite cnf_setup cnf-config=./cnf-testsuite.yml output-file=/tmp/mycnf.tar
```
To install a cnf from a tarball into the airgapped environment:
```
cnf-testsuite cnf_setup cnf-config=./cnf-testsuite.yml input-file=/tmp/mycnf.tar
```

### Running cnf-testsuite for the first time

Expand Down
4 changes: 0 additions & 4 deletions shard.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
version: 2.0
shards:
airgap:
path: utils/airgap
version: 0.1.0

ameba:
git: https://github.com/crystal-ameba/ameba.git
version: 1.3.1
Expand Down
2 changes: 0 additions & 2 deletions shard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ dependencies:
release_manager:
github: cnf-testsuite/release_manager
branch: main
airgap:
path: utils/airgap
retriable:
github: Sija/retriable.cr
protobuf:
Expand Down
8 changes: 0 additions & 8 deletions spec/airgap_task_spec.cr

This file was deleted.

9 changes: 0 additions & 9 deletions spec/prereqs_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,4 @@ describe "Prereq" do
(/kubectl found/ =~ result[:output]).should_not be_nil
(/git found/ =~ result[:output]).should_not be_nil
end

it "'prereq' with offline option should check the system for prerequisites except git", tags: ["points"] do
result = ShellCmd.run_testsuite("prereqs verbose offline=1")
result[:status].success?.should be_true
(/helm found/ =~ result[:output]).should_not be_nil

(/kubectl found/ =~ result[:output]).should_not be_nil
(/git found/ =~ result[:output]).should be_nil
end
end
1 change: 0 additions & 1 deletion spec/setup_spec.cr
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require "./spec_helper"
require "colorize"
require "../src/tasks/utils/utils.cr"
require "airgap"
require "kubectl_client"
require "helm"
require "file_utils"
Expand Down
1 change: 0 additions & 1 deletion spec/utils/k8s_instrumentation_spec.cr
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require "../spec_helper"
require "airgap"
require "kubectl_client"
require "../../src/tasks/utils/k8s_instrumentation.cr"
require "file_utils"
Expand Down
34 changes: 0 additions & 34 deletions src/tasks/airgap_task.cr

This file was deleted.

22 changes: 6 additions & 16 deletions src/tasks/chaos_mesh_setup.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,20 @@ require "file_utils"
require "colorize"
require "totem"
require "./utils/utils.cr"
# require "./utils/tar.cr"
require "tar"

CHAOS_MESH_VERSION = "v0.8.0"
CHAOS_MESH_OFFLINE_DIR = "#{TarClient::TAR_REPOSITORY_DIR}/chaos-mesh_chaos-mesh"

desc "Install Chaos Mesh"
task "install_chaosmesh" do |_, args|
Log.for("verbose").info { "install_chaosmesh" } if check_verbose(args)
current_dir = FileUtils.pwd
helm = Helm::BinarySingleton.helm
# KubectlClient::Apply.file("https://raw.githubusercontent.com/chaos-mesh/chaos-mesh/#{CHAOS_MESH_VERSION}/manifests/crd.yaml")

if args.named["offline"]?
Log.info { "install chaos mesh offline mode" }
helm_chart = Dir.entries(CHAOS_MESH_OFFLINE_DIR).first
Helm.install("my-chaos-mesh #{CHAOS_MESH_OFFLINE_DIR}/#{helm_chart} --version 0.5.1")

else
# `helm repo add chaos-mesh https://charts.chaos-mesh.org`
# `helm install my-chaos-mesh chaos-mesh/chaos-mesh --version 0.5.1`
Helm.helm_repo_add("chaos-mesh","https://charts.chaos-mesh.org")
Helm.install("my-chaos-mesh chaos-mesh/chaos-mesh --version 0.5.1")
end
helm = Helm::BinarySingleton.helm
# KubectlClient::Apply.file("https://raw.githubusercontent.com/chaos-mesh/chaos-mesh/#{CHAOS_MESH_VERSION}/manifests/crd.yaml")
# `helm repo add chaos-mesh https://charts.chaos-mesh.org`
# `helm install my-chaos-mesh chaos-mesh/chaos-mesh --version 0.5.1`
Helm.helm_repo_add("chaos-mesh","https://charts.chaos-mesh.org")
Helm.install("my-chaos-mesh chaos-mesh/chaos-mesh --version 0.5.1")

File.write("chaos_network_loss.yml", CHAOS_NETWORK_LOSS)
File.write("chaos_cpu_hog.yml", CHAOS_CPU_HOG)
Expand Down
1 change: 0 additions & 1 deletion src/tasks/cluster_setup.cr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ require "totem"
require "./utils/utils.cr"

# CHAOS_MESH_VERSION = "v0.8.0"
# CHAOS_MESH_OFFLINE_DIR = "#{TarClient::TAR_REPOSITORY_DIR}/chaos-mesh_chaos-mesh"

desc "Install CNF Test Suite Cluster Tools"
task "install_cluster_tools" do |_, args|
Expand Down
48 changes: 8 additions & 40 deletions src/tasks/cnf_setup.cr
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,15 @@ task "cnf_setup", ["helm_local_install", "create_namespace"] do |_, args|
Log.for("verbose").info { "cnf_setup" } if check_verbose(args)
Log.for("verbose").debug { "args = #{args.inspect}" } if check_verbose(args)
cli_hash = CNFManager.sample_setup_cli_args(args)
output_file = cli_hash[:output_file]
input_file = cli_hash[:input_file]
config_file = cli_hash[:config_file]
if output_file && !output_file.empty?
puts "cnf tarball generation mode".colorize(:green)
tar_info = CNFManager::CNFAirGap.generate_cnf_setup(cli_hash[:config_file], output_file, cli_hash)
puts "cnf tarball generation mode complete".colorize(:green)
elsif input_file && !input_file.empty?
puts "cnf setup airgapped mode".colorize(:green)
AirGap.extract(input_file)
puts "cnf setup caching images on nodes (airgapped mode)".colorize(:green)
install_method = CNFManager::Config.install_method_by_config_file(config_file)
config_src = CNFManager::Config.config_src_by_config_file(config_file)
release_name = CNFManager::Config.release_name_by_config_file(config_file)
if config_file && !AirGap.image_pull_policy_config_file?(install_method, config_src, release_name)
puts "Some containers within the installation manifests do not have an image pull policy defined. Airgap mode will not work until this is fixed.".colorize(:red)
exit 1
end
AirGap.cache_images(cnf_setup: true)
puts "cnf setup finished caching images on nodes (airgapped mode)".colorize(:green)
CNFManager.sample_setup(cli_hash)
puts "cnf setup airgapped mode complete".colorize(:green)
if ClusterTools.install
puts "ClusterTools installed".colorize(:green)
else
Log.info { "Installing ClusterTools"}
if ClusterTools.install
puts "ClusterTools installed".colorize(:green)
else
puts "The ClusterTools installation timed out. Please check the status of the cluster-tools pods.".colorize(:red)
end
puts "cnf setup online mode".colorize(:green)
CNFManager.sample_setup(cli_hash)
puts "cnf setup online mode complete".colorize(:green)
puts "The ClusterTools installation timed out. Please check the status of the cluster-tools pods.".colorize(:red)
end
puts "cnf setup start".colorize(:green)
CNFManager.sample_setup(cli_hash)
puts "cnf setup complete".colorize(:green)
end

task "cnf_cleanup" do |_, args|
Expand Down Expand Up @@ -86,16 +62,8 @@ task "generate_config" do |_, args|
Log.for("verbose").debug { "args = #{args.inspect}" } if check_verbose(args)
if args.named["config-src"]?
config_src = args.named["config-src"].as(String)
output_file = args.named["output-file"].as(String) if args.named["output-file"]?
output_file = args.named["of"].as(String) if args.named["of"]?
#TODO make this work in airgapped mode
if output_file && !output_file.empty?
Log.info { "generating config with an output file" }
CNFManager::GenerateConfig.generate_config(config_src, output_file)
else
Log.info { "generating config without an output file" }
CNFManager::GenerateConfig.generate_config(config_src)
end
Log.info { "generating config without an output file" }
CNFManager::GenerateConfig.generate_config(config_src)
end

end
Expand Down
1 change: 0 additions & 1 deletion src/tasks/constants.cr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ ESSENTIAL_PASSED_THRESHOLD = 15
CNF_DIR = "cnfs"
CONFIG_FILE = "cnf-testsuite.yml"
BASE_CONFIG = "./config.yml"
OFFLINE_MANIFESTS_PATH = "/tmp/manifests"
PASSED = "passed"
FAILED = "failed"
SKIPPED = "skipped"
Expand Down
Loading

0 comments on commit 1883c95

Please sign in to comment.