Skip to content

Commit

Permalink
fix: Change Helm library to CNFInstall module (#2127)
Browse files Browse the repository at this point in the history
- affect CNFs that installing method is HelmDirectory
- CNF is correctly installing into cnf-default namespace
  (if helm_install_namespace variable is not set)
- change Helm::InstallMethod::HelmDirectory to
  CNFInstall::InstallMethod::HelmDirectory

Signed-off-by: barmull <[email protected]>
  • Loading branch information
barmull authored Sep 2, 2024
1 parent 900135a commit c0f461e
Show file tree
Hide file tree
Showing 16 changed files with 30 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: foo-pvc
namespace: default
spec:
storageClassName: local-storage
accessModes:
Expand Down
2 changes: 2 additions & 0 deletions sample-cnfs/sample-oran-noric/manifests/ric.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Pod
metadata:
name: flexric
namespace: oran
labels:
app.kubernetes.io/name: flexric
spec:
Expand All @@ -25,6 +26,7 @@ apiVersion: v1
kind: Service
metadata:
name: flexric
namespace: oran
spec:
ports:
- name: ric
Expand Down
1 change: 1 addition & 0 deletions sample-cnfs/sample-oran-noric/manifests/srsran.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Pod
metadata:
name: srsran
namespace: oran
spec:
containers:
- name: srsran
Expand Down
2 changes: 2 additions & 0 deletions sample-cnfs/sample-oran-ric/manifests/ric.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Pod
metadata:
name: flexric
namespace: oran
labels:
app.kubernetes.io/name: flexric
spec:
Expand All @@ -25,6 +26,7 @@ apiVersion: v1
kind: Service
metadata:
name: flexric
namespace: oran
spec:
ports:
- name: ric
Expand Down
1 change: 1 addition & 0 deletions sample-cnfs/sample-oran-ric/manifests/srsran.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Pod
metadata:
name: srsran
namespace: oran
spec:
containers:
- name: srsran
Expand Down
1 change: 1 addition & 0 deletions sample-cnfs/sample-tracing/cnf-testsuite.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
helm_directory: jaeger
release_name: test
helm_install_namespace: jaeger
helm_repository:
name: jaegertracing
repo_url: https://jaegertracing.github.io/helm-charts
1 change: 1 addition & 0 deletions sample-cnfs/sample_open5gs/cnf-testsuite.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
helm_directory: open5gs
release_name: open5gs
helm_install_namespace: testsuite-5g
#optional 5gcore tag
amf_label: app.kubernetes.io/name=amf
smf_label: app.kubernetes.io/name=smf
Expand Down
1 change: 1 addition & 0 deletions sample-cnfs/sample_srsran_ueauth_open5gs/cnf-testsuite.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
helm_directory: open5gs
release_name: open5gs
helm_install_namespace: oran
#optional 5gcore tag
core: app.kubernetes.io/name=amf
amf_service_name: open5gs-amf-ngap
Expand Down
6 changes: 3 additions & 3 deletions spec/5g/ran_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ describe "5g" do
result = ShellCmd.run_testsuite("oran_e2_connection verbose")
(/(PASSED).*(RAN connects to a RIC using the e2 standard interface)/ =~ result[:output]).should_not be_nil
ensure
result = ShellCmd.run_testsuite("cnf_cleanup cnf-config=sample-cnfs/sample-oran-ric/cnf-testsuite.yml")
result = ShellCmd.run_testsuite("cnf_cleanup cnf-config=sample-cnfs/sample_srsran_ueauth_open5gs/cnf-testsuite.yml")
result[:status].success?.should be_true
result = ShellCmd.run_testsuite("cnf_cleanup cnf-config=sample-cnfs/sample_open5gs/cnf-testsuite.yml")
result = ShellCmd.run_testsuite("cnf_cleanup cnf-config=sample-cnfs/sample-oran-ric/cnf-testsuite.yml")
result[:status].success?.should be_true
end
end
Expand All @@ -34,7 +34,7 @@ describe "5g" do
result = ShellCmd.run_testsuite("oran_e2_connection verbose")
(/(FAILED).*(RAN does not connect to a RIC using the e2 standard interface)/ =~ result[:output]).should_not be_nil
ensure
result = ShellCmd.run_testsuite("cnf_cleanup cnf-config=sample-cnfs/sample_open5gs/cnf-testsuite.yml")
result = ShellCmd.run_testsuite("cnf_cleanup cnf-config=sample-cnfs/sample_srsran_ueauth_open5gs/cnf-testsuite.yml")
result[:status].success?.should be_true
result = ShellCmd.run_testsuite("cnf_cleanup cnf-config=sample-cnfs/sample-oran-noric/cnf-testsuite.yml")
result[:status].success?.should be_true
Expand Down
2 changes: 1 addition & 1 deletion spec/utils/cnf_manager_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ describe "SampleUtils" do
begin
# fails because doesn't have a service
ShellCmd.cnf_setup("cnf-path=./sample-cnfs/sample_coredns_values")
deployment_containers = KubectlClient::Get.deployment_containers("coredns-coredns")
deployment_containers = KubectlClient::Get.resource_containers("deployment", "coredns-coredns", "cnf-default")
image_tags = KubectlClient::Get.container_image_tags(deployment_containers)
Log.info { "image_tags: #{image_tags}" }
(/1.6.9/ =~ image_tags[0][:tag]).should_not be_nil
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/utils/cnf_installation/install_common.cr
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module CNFInstall
end

def self.cnf_installation_method(config : CNFManager::Config) : Tuple(CNFInstall::InstallMethod, String)
Log.info { "cnf_installation_method config : CNFManager::Config" }
Log.info { "cnf_installation_method: #{config.cnf_config[:install_method]}" }
Log.info { "config_cnf_config: #{config.cnf_config}" }
yml_file_path = config.cnf_config[:source_cnf_file]
parsed_config_file = CNFManager.parsed_config_file(yml_file_path)
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/utils/cnf_manager.cr
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ module CNFManager
def self.get_deployment_namespace(config)
install_method = CNFInstall.cnf_installation_method(config)
case install_method[0]
when CNFInstall::InstallMethod::HelmChart, Helm::InstallMethod::HelmDirectory
when CNFInstall::InstallMethod::HelmChart, CNFInstall::InstallMethod::HelmDirectory
if !config.cnf_config[:helm_install_namespace].empty?
Log.info { "deployment namespace was set to: #{config.cnf_config[:helm_install_namespace]}" }
config.cnf_config[:helm_install_namespace]
Expand Down
11 changes: 6 additions & 5 deletions src/tasks/utils/jaeger.cr
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@ module JaegerManager
end
def self.uninstall
Log.for("verbose").info { "uninstall_jaeger" }
Helm.delete("jaeger")
Helm.delete("jaeger -n jaeger")
end

def self.install
Log.info {"Installing Jaeger daemonset "}
Helm.helm_repo_add("jaegertracing","https://jaegertracing.github.io/helm-charts")
Helm.install("jaeger --set cassandra.config.cluster_size=1 --set cassandra.config.seed_size=1 jaegertracing/jaeger")
KubectlClient::Get.resource_wait_for_install("Deployment", "jaeger-collector", 300)
KubectlClient::Get.resource_wait_for_install("Deployment", "jaeger-query", 300)
KubectlClient::Get.resource_wait_for_install("Daemonset", "jaeger-agent", 300)
CNFManager.ensure_namespace_exists!("jaeger")
Helm.install("jaeger -n jaeger --set cassandra.config.cluster_size=1 --set cassandra.config.seed_size=1 jaegertracing/jaeger")
KubectlClient::Get.resource_wait_for_install("Deployment", "jaeger-collector", 300, namespace: "jaeger")
KubectlClient::Get.resource_wait_for_install("Deployment", "jaeger-query", 300, namespace: "jaeger")
KubectlClient::Get.resource_wait_for_install("Daemonset", "jaeger-agent", 300, namespace: "jaeger")
end

def self.node_for_cnf(resource_name)
Expand Down
6 changes: 3 additions & 3 deletions src/tasks/utils/srsran.cr
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module SRSRAN
Log.info { "ueran_pods: #{ueran_pods}" }
unless ueran_pods[0]? == nil
Log.info { "Found ueransim ... deleting" }
Helm.delete("ueransim")
Helm.delete("ueransim -n testsuite-5g")
end
Helm.helm_repo_add("openverso","https://gradiant.github.io/openverso-charts/")
Helm.fetch("openverso/ueransim-gnb --version 0.2.5 --untar")
Expand Down Expand Up @@ -89,9 +89,9 @@ module SRSRAN
File.write("gnb-ues-values.yaml", ue_values)
# File.write("gnb-ues-values.yaml", UES_VALUES)
File.write("#{Dir.current}/ueransim-gnb/resources/ue.yaml", UERANSIM_HELMCONFIG)
Helm.install("ueransim #{Dir.current}/ueransim-gnb --values ./gnb-ues-values.yaml")
Helm.install("-n testsuite-5g ueransim #{Dir.current}/ueransim-gnb --values ./gnb-ues-values.yaml")
Log.info { "after helm install" }
KubectlClient::Get.resource_wait_for_install("Pod", "ueransim")
KubectlClient::Get.resource_wait_for_install("Pod", "ueransim", namespace: "testsuite-5g")
true
else
false
Expand Down
9 changes: 5 additions & 4 deletions src/tasks/utils/ueransim.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module UERANSIM

def self.uninstall
Log.for("verbose").info { "uninstall_ueransim" }
Helm.delete("ueransim")
Helm.delete("ueransim -n testsuite-5g")
end


Expand Down Expand Up @@ -38,7 +38,7 @@ module UERANSIM
Log.info { "ueran_pods: #{ueran_pods}" }
unless ueran_pods[0]? == nil
Log.info { "Found ueransim ... deleting" }
Helm.delete("ueransim")
Helm.delete("ueransim -n testsuite-5g")
end
#Helm.helm_repo_add("openverso","https://gradiant.github.io/openverso-charts/")
# Helm.fetch("openverso/ueransim-gnb --version 0.2.5 --untar")
Expand Down Expand Up @@ -85,9 +85,10 @@ module UERANSIM
File.write("gnb-ues-values.yaml", ue_values)
# File.write("gnb-ues-values.yaml", UES_VALUES)
File.write("#{Dir.current}/ueransim-gnb/resources/ue.yaml", UERANSIM_HELMCONFIG)
Helm.install("ueransim #{Dir.current}/ueransim-gnb --values ./gnb-ues-values.yaml")
CNFManager.ensure_namespace_exists!("cnf-default")
Helm.install("-n testsuite-5g ueransim #{Dir.current}/ueransim-gnb --values ./gnb-ues-values.yaml")
Log.info { "after helm install" }
KubectlClient::Get.resource_wait_for_install("Pod", "ueransim")
KubectlClient::Get.resource_wait_for_install("Pod", "ueransim", namespace: "testsuite-5g")
true
else
false
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/workload/5g_validator.cr
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ task "suci_enabled" do |t, args|
CNFManager::TestcaseResult.new(CNFManager::ResultStatus::Failed, "Core does not use SUCI 5g authentication")
end
ensure
Helm.delete("ueransim")
Helm.delete("ueransim -n testsuite-5g")
ClusterTools.install
end

Expand Down

0 comments on commit c0f461e

Please sign in to comment.