Skip to content

Commit

Permalink
Merge branch 'develop' into typing-hookspecs
Browse files Browse the repository at this point in the history
  • Loading branch information
dcmcand authored Mar 13, 2024
2 parents 5a8ec42 + ff38679 commit 9dd60a9
Show file tree
Hide file tree
Showing 55 changed files with 1,610 additions and 169 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
36 changes: 19 additions & 17 deletions .github/workflows/test_local_integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,24 @@ 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:
default_settings:
"@jupyterlab/apputils-extension:themes":
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 @@ -106,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 Expand Up @@ -167,22 +185,6 @@ jobs:
run: |
pytest tests/tests_deployment/ -v -s
- name: JupyterHub Notebook Tests
timeout-minutes: 2
# run jhub-client after pytest since jhubctl can cleanup
# the running server
env:
JUPYTERHUB_USERNAME: ${{ env.TEST_USERNAME }}
JUPYTERHUB_PASSWORD: ${{ env.TEST_PASSWORD }}
run: |
sleep 60
jhubctl --verbose run --hub=https://github-actions.nebari.dev\
--auth-type=keycloak \
--validate --no-verify-ssl \
--kernel python3 \
--stop-server \
--notebook tests/tests_deployment/assets/notebook/simple.ipynb \
### CLEANUP AFTER TESTS
- name: Cleanup nebari deployment
if: always()
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ repos:

# python
- repo: https://github.com/psf/black
rev: 23.11.0
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.6
rev: v0.2.0
hooks:
- id: ruff
args: ["--fix"]

- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
name: isort
Expand All @@ -73,7 +73,7 @@ repos:

# terraform
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.83.6
rev: v1.86.0
hooks:
- id: terraform_fmt
args:
Expand Down
92 changes: 92 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,98 @@ 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

* Upgrade conda-store to latest version 2024.1.1
* Add Jhub-Apps
* Add Jupyterlab-pioneer
* Minor improvements and bug fixes

### Breaking Changes

> WARNING: jupyterlab-videochat, retrolab, jupyter-tensorboard, jupyterlab-conda-store and jupyter-nvdashboard are no longer supported in Nebari version and will be uninstalled."
### What's Changed

* [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/nebari-dev/nebari/pull/2176
* Fix logic for dns lookup. by @pt247 in https://github.com/nebari-dev/nebari/pull/2166
* Integrate JupyterHub App Launcher into Nebari by @aktech in https://github.com/nebari-dev/nebari/pull/2185
* Pass in permissions boundary to k8s module by @aktech in https://github.com/nebari-dev/nebari/pull/2153
* Add jupyterlab-pioneer by @aktech in https://github.com/nebari-dev/nebari/pull/2127
* JHub Apps: Filter conda envs by user by @aktech in https://github.com/nebari-dev/nebari/pull/2187
* update upgrade command by @dcmcand in https://github.com/nebari-dev/nebari/pull/2198
* Remove JupyterLab from services list by @aktech in https://github.com/nebari-dev/nebari/pull/2189
* Adding fields to ignore within keycloak_realm by @costrouc in https://github.com/nebari-dev/nebari/pull/2200
* Add Nebari menu item configuration. by @marcelovilla in https://github.com/nebari-dev/nebari/pull/2196
* Disable "Newer update available" popup as default setting by @viniciusdc in https://github.com/nebari-dev/nebari/pull/2192
* Block usage of pip inside jupyterlab by @viniciusdc in https://github.com/nebari-dev/nebari/pull/2191
* Return all environments instead of just those under the user's namespace for jhub-apps by @marcelovilla in https://github.com/nebari-dev/nebari/pull/2206
* Adding a temporary writable directory for conda-store server /home/conda by @costrouc in https://github.com/nebari-dev/nebari/pull/2209
* Add demo repositories mechanism to populate user's space by @viniciusdc in https://github.com/nebari-dev/nebari/pull/2207
* update nebari_workflow_controller and conda_store tags to test rc by @dcmcand in https://github.com/nebari-dev/nebari/pull/2210
* 2023.12.1 release notes by @dcmcand in https://github.com/nebari-dev/nebari/pull/2211
* Make it so that jhub-apps default theme doesn't override by @costrouc in https://github.com/nebari-dev/nebari/pull/2213
* Adding additional theme variables to jupyterhub theme config by @costrouc in https://github.com/nebari-dev/nebari/pull/2215
* updates Current Release to 2024.1.1 by @dcmcand in https://github.com/nebari-dev/nebari/pull/2227


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

## Release 2023.12.1 - December 15, 2023

### Feature changes and enhancements

* Upgrade conda-store to latest version 2023.10.1
* Minor improvements and bug fixes

### Breaking Changes

> WARNING: Prefect, ClearML and kbatch were removed in this release and upgrading to this version will result in all of them being uninstalled.
### What's Changed
* BUG: fix incorrect config override #2086 by @fangchenli in https://github.com/nebari-dev/nebari/pull/2087
* ENH: add AWS IAM permissions_boundary option #2078 by @fangchenli in https://github.com/nebari-dev/nebari/pull/2082
* CI: cleanup local integration workflow by @fangchenli in https://github.com/nebari-dev/nebari/pull/2079
* ENH: check missing GCP services by @fangchenli in https://github.com/nebari-dev/nebari/pull/2036
* ENH: use packaging for version parsing, add unit tests by @fangchenli in https://github.com/nebari-dev/nebari/pull/2048
* ENH: specify required field when retrieving available gcp regions by @fangchenli in https://github.com/nebari-dev/nebari/pull/2033
* Upgrade conda-store to 2023.10.1 by @iameskild in https://github.com/nebari-dev/nebari/pull/2092
* Add upgrade command for 2023.11.1 by @iameskild in https://github.com/nebari-dev/nebari/pull/2103
* CLN: cleanup typing and typing import in init by @fangchenli in https://github.com/nebari-dev/nebari/pull/2107
* Remove kbatch, prefect and clearml by @iameskild in https://github.com/nebari-dev/nebari/pull/2101
* Fix integration tests, helm-validate script by @iameskild in https://github.com/nebari-dev/nebari/pull/2102
* Re-enable AWS tags support by @iameskild in https://github.com/nebari-dev/nebari/pull/2096
* Update upgrade instructions for 2023.11.1 by @iameskild in https://github.com/nebari-dev/nebari/pull/2112
* Update nebari-git env pins by by @iameskild in https://github.com/nebari-dev/nebari/pull/2113
* Update release notes for 2023.11.1 by @iameskild in https://github.com/nebari-dev/nebari/pull/2114


**Full Changelog**: https://github.com/nebari-dev/nebari/compare/2023.11.1...2023.12.1

## Release 2023.11.1 - November 15, 2023

Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ dev = [
"diagrams",
"escapism",
"importlib-metadata<5.0",
"jhub-client",
"jinja2",
"mypy==1.6.1",
"paramiko",
Expand Down
8 changes: 4 additions & 4 deletions src/_nebari/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CURRENT_RELEASE = "2023.12.1"
CURRENT_RELEASE = "2024.3.1"

# NOTE: Terraform cannot be upgraded further due to Hashicorp licensing changes
# implemented in August 2023.
Expand All @@ -8,14 +8,14 @@
# 04-kubernetes-ingress
DEFAULT_TRAEFIK_IMAGE_TAG = "2.9.1"

HIGHEST_SUPPORTED_K8S_VERSION = ("1", "26", "9")
HIGHEST_SUPPORTED_K8S_VERSION = ("1", "29", "2")
DEFAULT_GKE_RELEASE_CHANNEL = "UNSPECIFIED"

DEFAULT_NEBARI_DASK_VERSION = CURRENT_RELEASE
DEFAULT_NEBARI_IMAGE_TAG = CURRENT_RELEASE
DEFAULT_NEBARI_WORKFLOW_CONTROLLER_IMAGE_TAG = "2023.7.2"
DEFAULT_NEBARI_WORKFLOW_CONTROLLER_IMAGE_TAG = CURRENT_RELEASE

DEFAULT_CONDA_STORE_IMAGE_TAG = "2023.10.1"
DEFAULT_CONDA_STORE_IMAGE_TAG = "2024.1.1"

LATEST_SUPPORTED_PYTHON_VERSION = "3.10"

Expand Down
40 changes: 40 additions & 0 deletions src/_nebari/provider/cloud/amazon_web_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,46 @@ def aws_get_vpc_id(name: str, namespace: str, region: str) -> Optional[str]:
return None


def set_asg_tags(asg_node_group_map: Dict[str, str], region: str) -> None:
"""Set tags for AWS node scaling from zero to work."""
session = aws_session(region=region)
autoscaling_client = session.client("autoscaling")
tags = []
for asg_name, node_group in asg_node_group_map.items():
tags.append(
{
"Key": "k8s.io/cluster-autoscaler/node-template/label/dedicated",
"Value": node_group,
"ResourceId": asg_name,
"ResourceType": "auto-scaling-group",
"PropagateAtLaunch": True,
}
)
autoscaling_client.create_or_update_tags(Tags=tags)


def aws_get_asg_node_group_mapping(
name: str, namespace: str, region: str
) -> Dict[str, str]:
"""Return a dictionary of autoscaling groups and their associated node groups."""
asg_node_group_mapping = {}
session = aws_session(region=region)
eks = session.client("eks")
node_groups_response = eks.list_nodegroups(
clusterName=f"{name}-{namespace}",
)
node_groups = node_groups_response.get("nodegroups", [])
for nodegroup in node_groups:
response = eks.describe_nodegroup(
clusterName=f"{name}-{namespace}", nodegroupName=nodegroup
)
node_group_name = response["nodegroup"]["nodegroupName"]
auto_scaling_groups = response["nodegroup"]["resources"]["autoScalingGroups"]
for auto_scaling_group in auto_scaling_groups:
asg_node_group_mapping[auto_scaling_group["name"]] = node_group_name
return asg_node_group_mapping


def aws_get_subnet_ids(name: str, namespace: str, region: str) -> List[str]:
"""Return list of subnet IDs for the EKS cluster named `{name}-{namespace}`."""
session = aws_session(region=region)
Expand Down
25 changes: 23 additions & 2 deletions src/_nebari/stages/infrastructure/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,17 @@ class AWSInputVars(schema.Base):
tags: Dict[str, str] = {}


def _calculate_asg_node_group_map(config: schema.Main):
if config.provider == schema.ProviderEnum.aws:
return amazon_web_services.aws_get_asg_node_group_mapping(
config.project_name,
config.namespace,
config.amazon_web_services.region,
)
else:
return {}


def _calculate_node_groups(config: schema.Main):
if config.provider == schema.ProviderEnum.aws:
return {
Expand Down Expand Up @@ -437,10 +448,10 @@ class AmazonWebServicesProvider(schema.Base):
node_groups: Dict[str, AWSNodeGroup] = {
"general": AWSNodeGroup(instance="m5.2xlarge", min_nodes=1, max_nodes=1),
"user": AWSNodeGroup(
instance="m5.xlarge", min_nodes=1, max_nodes=5, single_subnet=False
instance="m5.xlarge", min_nodes=0, max_nodes=5, single_subnet=False
),
"worker": AWSNodeGroup(
instance="m5.xlarge", min_nodes=1, max_nodes=5, single_subnet=False
instance="m5.xlarge", min_nodes=0, max_nodes=5, single_subnet=False
),
}
existing_subnet_ids: List[str] = None
Expand Down Expand Up @@ -810,6 +821,16 @@ def set_outputs(
outputs["node_selectors"] = _calculate_node_groups(self.config)
super().set_outputs(stage_outputs, outputs)

@contextlib.contextmanager
def post_deploy(
self, stage_outputs: Dict[str, Dict[str, Any]], disable_prompt: bool = False
):
asg_node_group_map = _calculate_asg_node_group_map(self.config)
if asg_node_group_map:
amazon_web_services.set_asg_tags(
asg_node_group_map, self.config.amazon_web_services.region
)

@contextlib.contextmanager
def deploy(
self, stage_outputs: Dict[str, Dict[str, Any]], disable_prompt: bool = False
Expand Down
1 change: 1 addition & 0 deletions src/_nebari/stages/infrastructure/template/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,5 @@ module "kubernetes" {

endpoint_private_access = var.eks_endpoint_private_access
public_access_cidrs = var.eks_public_access_cidrs
permissions_boundary = var.permissions_boundary
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ resource "aws_eks_node_group" "main" {
max_size = var.node_groups[count.index].max_size
}

labels = {
"dedicated" = var.node_groups[count.index].name
}

lifecycle {
ignore_changes = [
scaling_config[0].desired_size,
Expand All @@ -53,7 +57,9 @@ resource "aws_eks_node_group" "main" {
]

tags = merge({
"kubernetes.io/cluster/${var.name}" = "shared"
# "kubernetes.io/cluster/${var.name}" = "shared"
"k8s.io/cluster-autoscaler/node-template/label/dedicated" = var.node_groups[count.index].name
propagate_at_launch = true
}, var.tags)
}

Expand Down
6 changes: 3 additions & 3 deletions src/_nebari/stages/infrastructure/template/local/main.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
terraform {
required_providers {
kind = {
source = "kyma-incubator/kind"
version = "0.0.11"
source = "tehcyx/kind"
version = "0.4.0"
}
docker = {
source = "kreuzwerker/docker"
Expand Down Expand Up @@ -48,7 +48,7 @@ resource "kind_cluster" "default" {

node {
role = "general"
image = "kindest/node:v1.21.10"
image = "kindest/node:v1.29.2"
}
}
}
Expand Down
Loading

0 comments on commit 9dd60a9

Please sign in to comment.