Skip to content
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

Add initial uptime metrics #2609

Merged
merged 26 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2dfc367
initial commit
dcmcand Jun 25, 2024
3f5dde9
add hello world
dcmcand Jun 27, 2024
53eb391
Merge branch 'add-k8s-manifests-directly' into add-uptime-monitoring
dcmcand Aug 1, 2024
d65b223
intial implementation of kuberhealthy
dcmcand Aug 5, 2024
f65b202
Merge branch 'develop' into add-uptime-monitoring
dcmcand Aug 5, 2024
13195f4
Merge branch 'develop' into add-uptime-monitoring
dcmcand Aug 9, 2024
8bd372c
add NebariKustomizeStage class
dcmcand Aug 13, 2024
0ffe096
Merge branch 'develop' into add-uptime-monitoring
dcmcand Aug 20, 2024
208187c
update render method for kustomize stage class
dcmcand Aug 23, 2024
7974da7
ignore downloaded helm charts
dcmcand Aug 23, 2024
5b98741
add initial uptime test
dcmcand Aug 25, 2024
4b34588
add helm download
dcmcand Aug 26, 2024
36aed37
Merge branch 'develop' into add-uptime-monitoring
dcmcand Aug 26, 2024
b4fefe6
update conda-store check
dcmcand Aug 26, 2024
354b768
update conda-store check
dcmcand Aug 27, 2024
d7a2daa
add jupyterhub and keycloak checks
dcmcand Aug 27, 2024
417893d
Merge branch 'develop' into add-uptime-monitoring
dcmcand Aug 27, 2024
5dbc20f
update check names
dcmcand Aug 27, 2024
13fae57
add jupyterhub and keycloak checks
dcmcand Aug 27, 2024
c2b1d36
Merge branch 'develop' into add-uptime-monitoring
dcmcand Aug 29, 2024
1dca20d
update helm install script to pass script checks
dcmcand Aug 29, 2024
449eae3
fix destroy and move config to monitoring
dcmcand Aug 30, 2024
f98e0fb
Merge branch 'develop' into add-uptime-monitoring
dcmcand Aug 30, 2024
496416d
Merge branch 'develop' into add-uptime-monitoring
dcmcand Aug 30, 2024
bfdcd21
cleanup downloaded helm charts
dcmcand Aug 30, 2024
5aea0c5
Merge branch 'develop' into add-uptime-monitoring
dcmcand Aug 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,6 @@ nebari-config.yaml

# Integration tests deployments
_test_deploy

# ignore downloaded helm charts
**/template/charts
2 changes: 2 additions & 0 deletions src/_nebari/constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
CURRENT_RELEASE = "2024.7.1"

HELM_VERSION = "v3.15.3"
KUSTOMIZE_VERSION = "5.4.3"
# NOTE: Terraform cannot be upgraded further due to Hashicorp licensing changes
# implemented in August 2023.
# https://www.hashicorp.com/license-faq
Expand Down
71 changes: 71 additions & 0 deletions src/_nebari/provider/helm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import logging
import os
import subprocess
import tempfile
from pathlib import Path

from _nebari import constants
from _nebari.utils import run_subprocess_cmd

logger = logging.getLogger(__name__)


class HelmException(Exception):
pass


def download_helm_binary(version=constants.HELM_VERSION) -> Path:
filename_directory = Path(tempfile.gettempdir()) / "helm" / version
filename_path = filename_directory / "helm"

if not filename_directory.is_dir():
filename_directory.mkdir(parents=True)

if not filename_path.is_file():
logger.info(
"downloading and extracting Helm binary version %s to path=%s",
constants.HELM_VERSION,
filename_path,
)
old_path = os.environ.get("PATH")
new_path = f"{filename_directory}:{old_path}"
install_script = subprocess.run(
[
"curl",
"-s",
"https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3",
],
stdout=subprocess.PIPE,
check=True,
)
subprocess.run(
[
"bash",
"-s",
"--",
"-v",
constants.HELM_VERSION,
"--no-sudo",
],
input=install_script.stdout,
check=True,
env={"HELM_INSTALL_DIR": str(filename_directory), "PATH": new_path},
)

filename_path.chmod(0o555)
return filename_path


def run_helm_subprocess(processargs, **kwargs) -> None:
helm_path = download_helm_binary()
logger.info("helm at %s", helm_path)
if run_subprocess_cmd([helm_path] + processargs, **kwargs):
raise HelmException("Helm returned an error")


def version() -> str:
helm_path = download_helm_binary()
logger.info("checking helm=%s version", helm_path)

version_output = subprocess.check_output([helm_path, "version"]).decode("utf-8")
return version_output
Loading
Loading