Skip to content

Commit

Permalink
Merge branch 'develop' into bugfix/gitlab-setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam-D-Lewis authored Mar 12, 2024
2 parents c16b094 + 5319447 commit 174f443
Show file tree
Hide file tree
Showing 24 changed files with 592 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .cirun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ runners:
- name: run-k8s-tests
# Cloud Provider: AWS
cloud: aws
# Instance Type has 4 vcpu, 16 GiB memory, Up to 5 Gbps Network Performance
instance_type: t3a.xlarge
# Instance Type has 8 vcpu, 32 GiB memory, Up to 5 Gbps Network Performance
instance_type: t3a.2xlarge
# Custom AMI with docker/cypress/hub pre-installed
machine_image: ami-0a388df278199ff52
# Region: Oregon
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/test_local_integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ jobs:
sed -i -E 's/(cpu_guarantee):\s+[0-9\.]+/\1: 0.25/g' "nebari-config.yaml"
sed -i -E 's/(mem_guarantee):\s+[A-Za-z0-9\.]+/\1: 0.25G/g' "nebari-config.yaml"
# Change default JupyterLab theme
cat >> nebari-config.yaml <<- EOM
jupyterlab:
Expand All @@ -105,6 +104,16 @@ jobs:
theme: JupyterLab Dark
EOM
# Change default value for minio persistence size
cat >> nebari-config.yaml <<- EOM
monitoring:
enabled: true
overrides:
minio:
persistence:
size: 1Gi
EOM
cat nebari-config.yaml
- name: Deploy Nebari
Expand All @@ -115,7 +124,7 @@ jobs:
- name: Basic kubectl checks after deployment
if: always()
run: |
kubectl get all,cm,secret,ing -A
kubectl get all,cm,secret,pv,pvc,ing -A
- name: Check github-actions.nebari.dev resolves
run: |
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ repos:

# python
- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black
args: ["--line-length=88", "--exclude=/src/_nebari/template/"]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
rev: v0.2.0
hooks:
- id: ruff
args: ["--fix"]
Expand Down
23 changes: 23 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,29 @@ This file is copied to nebari-dev/nebari-docs using a GitHub Action. -->

## Upcoming Release

## Release 2024.3.1 - March 11, 2024

### What's Changed
* Modify Playwright test to account for changes in JupyterLab UI. by @marcelovilla in https://github.com/nebari-dev/nebari/pull/2232
* Add favicon to jupyterhub theme. by @jbouder in https://github.com/nebari-dev/nebari/pull/2222
* Set min nodes to 0 for worker and user. by @pt247 in https://github.com/nebari-dev/nebari/pull/2168
* Remove `jhub-client` from pyproject.toml by @pavithraes in https://github.com/nebari-dev/nebari/pull/2242
* Include permission validation step to programmatically cloned repos by @viniciusdc in https://github.com/nebari-dev/nebari/pull/2258
* Expose jupyter's preferred dir as a config option by @krassowski in https://github.com/nebari-dev/nebari/pull/2251
* Allow to configure default settings for JupyterLab (`overrides.json`) by @krassowski in https://github.com/nebari-dev/nebari/pull/2249
* Feature/jlab menu customization by @marcelovilla in https://github.com/nebari-dev/nebari/pull/2259
* Add cloud provider to the dask config.json file by @marcelovilla in https://github.com/nebari-dev/nebari/pull/2266
* Fix syntax error in jupyter-server-config Python file by @krassowski in https://github.com/nebari-dev/nebari/pull/2286
* Add "Open VS Code" entry in services by @krassowski in https://github.com/nebari-dev/nebari/pull/2267
* Add Grafana Loki integration by @aktech in https://github.com/nebari-dev/nebari/pull/2156

### New Contributors
* @jbouder made their first contribution in https://github.com/nebari-dev/nebari/pull/2222
* @krassowski made their first contribution in https://github.com/nebari-dev/nebari/pull/2251

**Full Changelog**: https://github.com/nebari-dev/nebari/compare/2024.1.1...2024.3.1


## Release 2024.1.1 - January 17, 2024

### Feature changes and enhancements
Expand Down
4 changes: 2 additions & 2 deletions src/_nebari/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CURRENT_RELEASE = "2024.1.1"
CURRENT_RELEASE = "2024.3.1"

# NOTE: Terraform cannot be upgraded further due to Hashicorp licensing changes
# implemented in August 2023.
Expand All @@ -13,7 +13,7 @@

DEFAULT_NEBARI_DASK_VERSION = CURRENT_RELEASE
DEFAULT_NEBARI_IMAGE_TAG = CURRENT_RELEASE
DEFAULT_NEBARI_WORKFLOW_CONTROLLER_IMAGE_TAG = "2024.1.1"
DEFAULT_NEBARI_WORKFLOW_CONTROLLER_IMAGE_TAG = CURRENT_RELEASE

DEFAULT_CONDA_STORE_IMAGE_TAG = "2024.1.1"

Expand Down
6 changes: 3 additions & 3 deletions src/_nebari/stages/kubernetes_ingress/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ def input_vars(self, stage_outputs: Dict[str, Dict[str, Any]]):
cert_details["acme-email"] = self.config.certificate.acme_email
cert_details["acme-server"] = self.config.certificate.acme_server
elif cert_type == "existing":
cert_details[
"certificate-secret-name"
] = self.config.certificate.secret_name
cert_details["certificate-secret-name"] = (
self.config.certificate.secret_name
)

return {
**{
Expand Down
22 changes: 22 additions & 0 deletions src/_nebari/stages/kubernetes_services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,16 @@ class JHubApps(schema.Base):
enabled: bool = False


class MonitoringOverrides(schema.Base):
loki: typing.Dict = {}
promtail: typing.Dict = {}
minio: typing.Dict = {}


class Monitoring(schema.Base):
enabled: bool = True
overrides: MonitoringOverrides = MonitoringOverrides()
minio_enabled: bool = True


class JupyterLabPioneer(schema.Base):
Expand Down Expand Up @@ -381,6 +389,12 @@ class DaskGatewayInputVars(schema.Base):

class MonitoringInputVars(schema.Base):
monitoring_enabled: bool = Field(alias="monitoring-enabled")
minio_enabled: bool = Field(alias="minio-enabled")
grafana_loki_overrides: List[str] = Field(alias="grafana-loki-overrides")
grafana_promtail_overrides: List[str] = Field(alias="grafana-promtail-overrides")
grafana_loki_minio_overrides: List[str] = Field(
alias="grafana-loki-minio-overrides"
)


class TelemetryInputVars(schema.Base):
Expand Down Expand Up @@ -524,6 +538,14 @@ def input_vars(self, stage_outputs: Dict[str, Dict[str, Any]]):

monitoring_vars = MonitoringInputVars(
monitoring_enabled=self.config.monitoring.enabled,
minio_enabled=self.config.monitoring.minio_enabled,
grafana_loki_overrides=[json.dumps(self.config.monitoring.overrides.loki)],
grafana_promtail_overrides=[
json.dumps(self.config.monitoring.overrides.promtail)
],
grafana_loki_minio_overrides=[
json.dumps(self.config.monitoring.overrides.minio)
],
)

telemetry_vars = TelemetryInputVars(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,21 @@ locals {
resource "local_file" "jupyter_server_config_py" {
content = local.jupyter-notebook-config-py-template
filename = "${path.module}/files/jupyter/jupyter_server_config.py"

provisioner "local-exec" {
# check the syntax of the config file without running it
command = "python -m py_compile ${self.filename}"
}
}

resource "local_file" "jupyter_jupyterlab_pioneer_config_py" {
content = local.jupyter-pioneer-config-py-template
filename = "${path.module}/files/jupyter/jupyter_jupyterlab_pioneer_config.py"

provisioner "local-exec" {
# check the syntax of the config file without running it
command = "python -m py_compile ${self.filename}"
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import json


default_log_format = "%(asctime)s %(levelname)9s %(lineno)4s %(module)s: %(message)s"
log_format = ${log_format}
log_format = "${log_format}"

logging.basicConfig(
level=logging.INFO,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@

# Extra config available at:
# https://zero-to-jupyterhub.readthedocs.io/en/1.x/jupyterhub/customizing/user-management.html#culling-user-pods

# Enable Show Hidden Files menu option in View menu
c.ContentsManager.allow_hidden = True
c.FileContentsManager.allow_hidden = True

# Set the preferred path for the frontend to start in
preferred_dir = ${jupyterlab_preferred_dir}
c.FileContentsManager.preferred_dir = preferred_dir if preferred_dir else None
c.FileContentsManager.preferred_dir = "${jupyterlab_preferred_dir}"

# Timeout (in seconds) in which a terminal has been inactive and ready to
# be culled.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,14 @@ def base_profile_extra_mounts():

extra_pod_config = {
"volumes": [
{
"name": volume["name"],
"persistentVolumeClaim": {"claimName": volume["name"]},
}
if volume["kind"] == "persistentvolumeclaim"
else {"name": volume["name"], "configMap": {"name": volume["name"]}}
(
{
"name": volume["name"],
"persistentVolumeClaim": {"claimName": volume["name"]},
}
if volume["kind"] == "persistentvolumeclaim"
else {"name": volume["name"], "configMap": {"name": volume["name"]}}
)
for mount_path, volume in extra_mounts.items()
]
}
Expand Down Expand Up @@ -367,9 +369,11 @@ def configure_user(username, groups, uid=1000, gid=100):
# mount the shared directories for user only if there are
# shared folders (groups) that the user is a member of
# else ensure that the `shared` folder symlink does not exist
f"ln -sfn /shared /home/{username}/shared"
if groups
else f"rm -f /home/{username}/shared",
(
f"ln -sfn /shared /home/{username}/shared"
if groups
else f"rm -f /home/{username}/shared"
),
# conda-store environment configuration
f"printf '{condarc}' > /home/{username}/.condarc",
# jupyter configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@
"text": "Argo Workflows",
"newBrowserTab": true
}
},
{
"command": "nebari:open-proxy",
"rank": 5,
"args": {
"name": "vscode"
}
}
]
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
resource "random_password" "minio_root_password" {
length = 32
special = false
}

locals {
minio-url = "http://${var.minio-release-name}:${var.minio-port}"
node-selector = {
"${var.node-group.key}" = "${var.node-group.value}"
}
}

resource "helm_release" "loki-minio" {
count = var.minio-enabled ? 1 : 0
name = var.minio-release-name
namespace = var.namespace
repository = "https://raw.githubusercontent.com/bitnami/charts/defb094c658024e4aa8245622dab202874880cbc/bitnami"
chart = "minio"
# last release that was Apache-2.0
version = var.minio-helm-chart-version

set {
name = "accessKey.password"
value = "admin"
}

set {
name = "secretKey.password"
value = random_password.minio_root_password.result
}

set {
name = "defaultBuckets"
value = join(" ", var.buckets)
}

set {
name = "persistence.size"
value = var.minio-storage
}

values = concat([
file("${path.module}/values_minio.yaml"),
jsonencode({
nodeSelector : local.node-selector
})
], var.grafana-loki-minio-overrides)
}


resource "helm_release" "grafana-loki" {
name = "nebari-loki"
namespace = var.namespace
repository = "https://grafana.github.io/helm-charts"
chart = "loki"
version = var.loki-helm-chart-version

values = concat([
file("${path.module}/values_loki.yaml"),
jsonencode({
loki : {
storage : {
s3 : {
endpoint : local.minio-url,
accessKeyId : "admin"
secretAccessKey : random_password.minio_root_password.result,
s3ForcePathStyle : true
}
}
}
storageConfig : {
# We configure MinIO by using the AWS config because MinIO implements the S3 API
aws : {
s3 : local.minio-url
s3ForcePathStyle : true
}
}
write : { nodeSelector : local.node-selector }
read : { nodeSelector : local.node-selector }
backend : { nodeSelector : local.node-selector }
gateway : { nodeSelector : local.node-selector }
})
], var.grafana-loki-overrides)

depends_on = [helm_release.loki-minio]
}

resource "helm_release" "grafana-promtail" {
# Promtail ships the contents of logs to Loki instance
name = "nebari-promtail"
namespace = var.namespace
repository = "https://grafana.github.io/helm-charts"
chart = "promtail"
version = var.promtail-helm-chart-version

values = concat([
file("${path.module}/values_promtail.yaml"),
jsonencode({
})
], var.grafana-promtail-overrides)

depends_on = [helm_release.grafana-loki]
}
Loading

0 comments on commit 174f443

Please sign in to comment.