Skip to content

Commit 85b305c

Browse files
Merge pull request #433 from cncf/feature/#397-helm
#397 helm prerequisite checker
2 parents a324300 + c9db06d commit 85b305c

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

spec/configuration_lifecycle_spec.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ describe CnfConformance do
131131
begin
132132
`./cnf-conformance cnf_setup cnf-path=sample-cnfs/sample_coredns_hardcoded_ips deploy_with_chart=false`
133133
$?.success?.should be_true
134-
response_s = `./cnf-conformance hardcoded_ip_addresses_in_k8s_runtime_configuration verbose`
134+
response_s = `LOG_LEVEL=info ./cnf-conformance hardcoded_ip_addresses_in_k8s_runtime_configuration verbose`
135135
LOGGING.info response_s
136136
$?.success?.should be_true
137137
(/FAILURE: Hard-coded IP addresses found in the runtime K8s configuration/ =~ response_s).should_not be_nil

src/tasks/configuration_lifecycle.cr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,19 +230,19 @@ task "hardcoded_ip_addresses_in_k8s_runtime_configuration" do |_, args|
230230
current_dir = FileUtils.pwd
231231
#helm = "#{current_dir}/#{TOOLS_DIR}/helm/linux-amd64/helm"
232232
helm = CNFSingleton.helm
233-
VERBOSE_LOGGING.debug "Helm Path: #{helm}" if check_verbose(args)
233+
VERBOSE_LOGGING.info "Helm Path: #{helm}" if check_verbose(args)
234234

235235
create_namespace = `kubectl create namespace hardcoded-ip-test`
236236
unless helm_chart.empty?
237237
helm_install = `#{helm} install --namespace hardcoded-ip-test hardcoded-ip-test #{helm_chart} --dry-run --debug > #{destination_cnf_dir}/helm_chart.yml`
238-
VERBOSE_LOGGING.debug "helm_chart: #{helm_chart}" if check_verbose(args)
238+
VERBOSE_LOGGING.info "helm_chart: #{helm_chart}" if check_verbose(args)
239239
else
240240
helm_install = `#{helm} install --namespace hardcoded-ip-test hardcoded-ip-test #{destination_cnf_dir}/#{helm_directory} --dry-run --debug > #{destination_cnf_dir}/helm_chart.yml`
241-
VERBOSE_LOGGING.debug "helm_directory: #{helm_directory}" if check_verbose(args)
241+
VERBOSE_LOGGING.info "helm_directory: #{helm_directory}" if check_verbose(args)
242242
end
243243

244244
ip_search = File.read_lines("#{destination_cnf_dir}/helm_chart.yml").take_while{|x| x.match(/NOTES:/) == nil}.reduce([] of String){|acc, x| x.match(/([0-9]{1,3}[\.]){3}[0-9]{1,3}/) && x.match(/([0-9]{1,3}[\.]){3}[0-9]{1,3}/).try &.[0] != "0.0.0.0" ? acc << x : acc}
245-
VERBOSE_LOGGING.debug "IPs: #{ip_search}" if check_verbose(args)
245+
VERBOSE_LOGGING.info "IPs: #{ip_search}" if check_verbose(args)
246246

247247
if ip_search.empty?
248248
upsert_passed_task("hardcoded_ip_addresses_in_k8s_runtime_configuration", "✔️ PASSED: No hard-coded IP addresses found in the runtime K8s configuration")

src/tasks/prereqs.cr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ require "./utils/system_information/clusterctl.cr"
1111

1212
task "prereqs" do |_, args|
1313

14-
if helm_installation.includes?("helm found") &&
15-
!CNFManager.helm_gives_k8s_warning?(true) &&
16-
wget_installation.includes?("wget found") &&
17-
curl_installation.includes?("curl found") &&
18-
kubectl_installation.includes?("kubectl found") &&
14+
if (helm_installation.includes?("helm found") &&
15+
!CNFManager.helm_gives_k8s_warning?(true)) &
16+
wget_installation.includes?("wget found") &
17+
curl_installation.includes?("curl found") &
18+
kubectl_installation.includes?("kubectl found") &
1919
git_installation.includes?("git found")
2020

2121
verbose = check_verbose(args)

src/tasks/utils/system_information/helm.cr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def helm_installation(verbose=false)
1111

1212
global_helm_version = helm_version(ghelm, verbose)
1313

14-
if global_helm_version
14+
if global_helm_version && !global_helm_version.empty?
1515
gmsg = "Global helm found. Version: #{global_helm_version}"
1616
stdout_success gmsg
1717
else
@@ -23,7 +23,7 @@ def helm_installation(verbose=false)
2323

2424
local_helm_version = helm_version(lhelm, verbose)
2525

26-
if local_helm_version
26+
if local_helm_version && !local_helm_version.empty?
2727
lmsg = "Local helm found. Version: #{local_helm_version}"
2828
stdout_success lmsg
2929

0 commit comments

Comments
 (0)