-
Notifications
You must be signed in to change notification settings - Fork 105
Add extra services checks to kuberhealthy #2978
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
Conversation
@viniciusdc I haven't reviewed this PR but we probably want to update the Summary of available healthchecks in our docs. |
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.
Looks good, thanks @viniciusdc 🚀
I'm wondering whether we should still have
nebari/src/_nebari/stages/kubernetes_services/__init__.py
Lines 744 to 775 in 8c9a680
def check( | |
self, stage_outputs: Dict[str, Dict[str, Any]], disable_prompt: bool = False | |
): | |
directory = "stages/07-kubernetes-services" | |
import requests | |
# suppress insecure warnings | |
import urllib3 | |
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | |
def _attempt_connect_url( | |
url, verify=False, num_attempts=NUM_ATTEMPTS, timeout=TIMEOUT | |
): | |
for i in range(num_attempts): | |
response = requests.get(url, verify=verify, timeout=timeout) | |
if response.status_code < 400: | |
print(f"Attempt {i+1} health check succeeded for url={url}") | |
return True | |
else: | |
print(f"Attempt {i+1} health check failed for url={url}") | |
time.sleep(timeout) | |
return False | |
services = stage_outputs[directory]["service_urls"]["value"] | |
for service_name, service in services.items(): | |
service_url = service["health_url"] | |
if service_url and not _attempt_connect_url(service_url): | |
print( | |
f"ERROR: Service {service_name} DOWN when checking url={service_url}" | |
) | |
sys.exit(1) |
Reference Issues or PRs
closes #2976
What does this implement/fix?
Put a
x
in the boxes that applyTesting
How to test this PR?
Any other comments?