-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improvement: check if cluster is up and running #1995
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is likely held up by #1964 (review) as the previous message is the output when kubeconfig or connection does not exist:
pair@cnfdev4:~/workspace/drew/testsuite-barmull$ LOG_LEVEL=debug ./cnf-testsuite setup
CNF TestSuite version: HEAD-2024-04-21-010045-2b70ba7b
Successfully created directories for cnf-testsuite
I, [2024-04-21 01:00:45 +00:00 #657279] INFO -- cnf-testsuite: VERSION: HEAD-2024-04-21-010045-2b70ba7b
D, [2024-04-21 01:00:45 +00:00 #657279] DEBUG -- cnf-testsuite: helm_v3?: Regex::MatchData("BuildInfo{Version:\"v3.11.1\", GitCommit:\"293b50c65d4d56187cd4e2f390f0ada46b4c4737\", GitTreeState:\"clean\", GoVersion:\"go1.18.10\"" 1:"v3.11.1" 2:"11.")
I, [2024-04-21 01:00:45 +00:00 #657279] INFO -- cnf-testsuite: Globally installed helm satisfies required version. Skipping local helm install.
Global helm found. Version: v3.11.1
D, [2024-04-21 01:00:45 +00:00 #657279] DEBUG -- cnf-testsuite: helm_v2?:
D, [2024-04-21 01:00:45 +00:00 #657279] DEBUG -- cnf-testsuite: helm_v3?: Regex::MatchData("BuildInfo{Version:\"v3.11.1\", GitCommit:\"293b50c65d4d56187cd4e2f390f0ada46b4c4737\", GitTreeState:\"clean\", GoVersion:\"go1.18.10\"" 1:"v3.11.1" 2:"11.")
I, [2024-04-21 01:00:45 +00:00 #657279] INFO -- cnf-testsuite: helm_local_version command: /home/pair/.cnf-testsuite/tools/helm/linux-amd64/helm version
No Local helm version found
D, [2024-04-21 01:00:45 +00:00 #657279] DEBUG -- cnf-testsuite: helm_local_version output:
I, [2024-04-21 01:00:45 +00:00 #657279] INFO -- cnf-testsuite: helm_local_version stderr: --: 1: /home/pair/.cnf-testsuite/tools/helm/linux-amd64/helm: not found
D, [2024-04-21 01:00:45 +00:00 #657279] DEBUG -- cnf-testsuite: helm_v2?:
D, [2024-04-21 01:00:45 +00:00 #657279] DEBUG -- cnf-testsuite: helm_v3?:
D, [2024-04-21 01:00:45 +00:00 #657279] DEBUG -- cnf-testsuite: helm_v3?: Regex::MatchData("BuildInfo{Version:\"v3.11.1\", GitCommit:\"293b50c65d4d56187cd4e2f390f0ada46b4c4737\", GitTreeState:\"clean\", GoVersion:\"go1.18.10\"" 1:"v3.11.1" 2:"11.")
I, [2024-04-21 01:00:45 +00:00 #657279] INFO -- cnf-testsuite: error: Error: Kubernetes cluster unreachable: Get "http://localhost:8080/version": dial tcp [::1]:8080: connect: connection refused
I, [2024-04-21 01:00:45 +00:00 #657279] INFO -- cnf-testsuite: helm_resp (add):
Global kubectl found. Version: 1.26
Global kubectl client version could not be checked for compatibility with server. (Server not configured?)
No Local kubectl version found
Global git found. Version: 2.34.1
No Local git version found
All prerequisites found.
I, [2024-04-21 01:00:45 +00:00 #657279] INFO -- cnf-testsuite: KubectlClient::Create.namespace command: kubectl create namespace cnf-testsuite
Could not create cnf-testsuite namespace on the Kubernetes cluster
D, [2024-04-21 01:00:45 +00:00 #657279] DEBUG -- cnf-testsuite: KubectlClient::Create.namespace output:
I, [2024-04-21 01:00:45 +00:00 #657279] INFO -- cnf-testsuite: KubectlClient::Create.namespace stderr: The connection to the server localhost:8080 was refused - did you specify the right host or port?
I, [2024-04-21 01:00:45 +00:00 #657279] INFO -- cnf-testsuite-verbose: install_apisnoop
I, [2024-04-21 01:00:45 +00:00 #657279] INFO -- cnf-testsuite: apisnoop already installed. Skipping git clone for apisnoop.
Setup complete
I, [2024-04-21 01:00:45 +00:00 #657279] INFO -- cnf-testsuite: install_kind
In this case is not working as expected. Because the change is only in method ensure_kubeconfig! |
I checked out your fork and both changes were included when tested. |
src/tasks/utils/utils.cr
Outdated
exit_code = KubectlClient::ShellCmd.run(cmd, "", false)[:status].exit_status | ||
error_message = "Exit code: #{exit_code}. Executing this command '#{cmd}' raised an error. For further information run command in CLI." | ||
if exit_code != 0 | ||
puts error_message.colorize(:red) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- use stdout_failure instead of puts
- don't raise
- do exit(1)
- add condition in ensure_kubeconfig! method to check the cluster's health Signed-off-by: barmull <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Description
Add condition in ensure_kubeconfig! method to check the cluster's health.
Issues:
Refs: #1968
How has this been tested:
Types of changes:
Checklist:
Documentation
Code Review
Issue