Skip to content

Commit

Permalink
Merge branch 'develop' into explicit_config
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam-D-Lewis committed Jun 4, 2024
2 parents e904428 + 2bac8aa commit 7c90e58
Show file tree
Hide file tree
Showing 44 changed files with 941 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_aws_integration.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test-aws-integration
name: AWS Deployment

on:
schedule:
Expand Down
91 changes: 91 additions & 0 deletions .github/workflows/test_azure_integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Azure Delpoyment

on:
schedule:
- cron: "0 0 * * MON"
workflow_dispatch:
inputs:
branch:
description: 'Nebari branch to deploy, test, destroy'
required: true
default: develop
type: string
image-tag:
description: 'Nebari image tag created by the nebari-docker-images repo'
required: true
default: main
type: string
tf-log-level:
description: 'Change Terraform log levels'
required: false
default: info
type: choice
options:
- info
- warn
- debug
- trace
- error

env:
NEBARI_GH_BRANCH: ${{ github.event.inputs.branch || 'develop' }}
NEBARI_IMAGE_TAG: ${{ github.event.inputs.image-tag || 'main' }}
TF_LOG: ${{ github.event.inputs.tf-log-level || 'info' }}

jobs:
test-azure-integration:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ env.NEBARI_GH_BRANCH }}
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install Nebari
run: |
pip install .[dev]
conda install --quiet --yes conda-build
playwright install
- name: Retrieve secret from Vault
uses: hashicorp/[email protected]
with:
method: jwt
url: "https://quansight-vault-public-vault-b2379fa7.d415e30e.z1.hashicorp.cloud:8200"
namespace: "admin/quansight"
role: "repository-nebari-dev-nebari-role"
secrets: |
kv/data/repository/nebari-dev/nebari/azure/nebari-dev-ci/github-nebari-dev-repo-ci client_id | ARM_CLIENT_ID;
kv/data/repository/nebari-dev/nebari/azure/nebari-dev-ci/github-nebari-dev-repo-ci tenant_id | ARM_TENANT_ID;
kv/data/repository/nebari-dev/nebari/azure/nebari-dev-ci/github-nebari-dev-repo-ci subscription_id | ARM_SUBSCRIPTION_ID;
kv/data/repository/nebari-dev/nebari/cloudflare/[email protected]/nebari-dev-ci token | CLOUDFLARE_TOKEN;
- name: 'Azure login'
uses: azure/login@v2
with:
client-id: ${{ env.ARM_CLIENT_ID }}
tenant-id: ${{ env.ARM_TENANT_ID }}
subscription-id: ${{ env.ARM_SUBSCRIPTION_ID }}

- name: Integration Tests
run: |
pytest --version
pytest tests/tests_integration/ -vvv -s --cloud azure
env:
NEBARI_SECRET__default_images__jupyterhub: "quay.io/nebari/nebari-jupyterhub:${{ env.NEBARI_IMAGE_TAG }}"
NEBARI_SECRET__default_images__jupyterlab: "quay.io/nebari/nebari-jupyterlab:${{ env.NEBARI_IMAGE_TAG }}"
NEBARI_SECRET__default_images__dask_worker: "quay.io/nebari/nebari-dask-worker:${{ env.NEBARI_IMAGE_TAG }}"
ARM_CLIENT_ID: ${{ env.ARM_CLIENT_ID }}
ARM_TENANT_ID: ${{ env.ARM_TENANT_ID }}
ARM_SUBSCRIPTION_ID: ${{ env.ARM_SUBSCRIPTION_ID }}
ARM_USE_OIDC: "true"
CLOUDFLARE_TOKEN: ${{ env.CLOUDFLARE_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/test_do_integration.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test-gcp-integration
name: Digital Ocean Deployment

on:
schedule:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_gcp_integration.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test-gcp-integration
name: GCP Deployment

on:
schedule:
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Code Scanning

on:
push:
branches: [ "develop", "release/*" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "develop" ]
schedule:
- cron: '19 23 * * 6'

permissions:
contents: read

jobs:
SAST:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
name: Trivy config Scan
runs-on: "ubuntu-20.04"
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Run Trivy vulnerability scanner in fs mode
uses: aquasecurity/trivy-action@master
with:
scan-type: 'config'
hide-progress: true
format: 'sarif'
output: 'trivy-results.sarif'
ignore-unfixed: true
severity: 'CRITICAL,HIGH'

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: 'trivy-results.sarif'
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ci:
repos:
# general
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: end-of-file-fixer
exclude: "^docs-sphinx/cli.html"
Expand Down Expand Up @@ -51,13 +51,13 @@ repos:

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

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.5
rev: v0.4.3
hooks:
- id: ruff
args: ["--fix"]
Expand All @@ -73,7 +73,7 @@ repos:

# terraform
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.88.4
rev: v1.89.1
hooks:
- id: terraform_fmt
args:
Expand Down
10 changes: 10 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- name: "Nebari Development Team"
type: software
title: "Nebari"
version: 2024.4.1
date-released: 2024-04-20
url: "https://www.nebari.dev"
repository-code: "https://github.com/nebari-dev/nebari"
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
| :---------- | :-----|
| Project | [![License](https://img.shields.io/badge/License-BSD%203--Clause-gray.svg?colorA=2D2A56&colorB=5936D9&style=flat.svg)](https://opensource.org/licenses/BSD-3-Clause) [![Nebari documentation](https://img.shields.io/badge/%F0%9F%93%96%20Read-the%20docs-gray.svg?colorA=2D2A56&colorB=5936D9&style=flat.svg)](https://www.nebari.dev/docs/welcome) [![PyPI](https://img.shields.io/pypi/v/nebari)](https://badge.fury.io/py/nebari) [![conda version](https://img.shields.io/conda/vn/conda-forge/nebari)]((https://anaconda.org/conda-forge/nebari)) |
| Community | [![GH discussions](https://img.shields.io/badge/%F0%9F%92%AC%20-Participate%20in%20discussions-gray.svg?colorA=2D2A56&colorB=5936D9&style=flat.svg)](https://github.com/nebari-dev/nebari/discussions) [![Open an issue](https://img.shields.io/badge/%F0%9F%93%9D%20Open-an%20issue-gray.svg?colorA=2D2A56&colorB=5936D9&style=flat.svg)](https://github.com/nebari-dev/nebari/issues/new/choose) [![Community guidelines](https://img.shields.io/badge/🤝%20Community-guidelines-gray.svg?colorA=2D2A56&colorB=5936D9&style=flat.svg)](https://www.nebari.dev/docs/community/) |
| CI | [![Kubernetes Tests](https://github.com/nebari-dev/nebari/actions/workflows/test_local_integration.yaml/badge.svg)](https://github.com/nebari-dev/nebari/actions/workflows/kubernetes_test.yaml) [![Tests](https://github.com/nebari-dev/nebari/actions/workflows/test.yaml/badge.svg)](https://github.com/nebari-dev/nebari/actions/workflows/test.yaml) [![Test Nebari Provider](https://github.com/nebari-dev/nebari/actions/workflows/test-provider.yaml/badge.svg)](https://github.com/nebari-dev/nebari/actions/workflows/test-provider.yaml) |
| CI | [![Kubernetes Tests](https://github.com/nebari-dev/nebari/actions/workflows/test_local_integration.yaml/badge.svg)](https://github.com/nebari-dev/nebari/actions/workflows/kubernetes_test.yaml) [![Tests](https://github.com/nebari-dev/nebari/actions/workflows/test.yaml/badge.svg)](https://github.com/nebari-dev/nebari/actions/workflows/test.yaml) [![Test Nebari Provider](https://github.com/nebari-dev/nebari/actions/workflows/test-provider.yaml/badge.svg)](https://github.com/nebari-dev/nebari/actions/workflows/test-provider.yaml)|
| Cloud Providers | [![AWS Deployment Status](https://github.com/nebari-dev/nebari/actions/workflows/test_aws_integration.yaml/badge.svg)](https://github.com/nebari-dev/nebari/actions/workflows/test_aws_integration.yaml) [![Azure Deployment Status](https://github.com/nebari-dev/nebari/actions/workflows/test_azure_integration.yaml/badge.svg)](https://github.com/nebari-dev/nebari/actions/workflows/test_azure_integration.yaml) [![GCP Deployment Status](https://github.com/nebari-dev/nebari/actions/workflows/test_gcp_integration.yaml/badge.svg)](https://github.com/nebari-dev/nebari/actions/workflows/test_gcp_integration.yaml) [![Digital Ocean Deployment Status](https://github.com/nebari-dev/nebari/actions/workflows/test_do_integration.yaml/badge.svg)](https://github.com/nebari-dev/nebari/actions/workflows/test_do_integration.yaml)|

## Table of contents

Expand Down
15 changes: 15 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@ This file is copied to nebari-dev/nebari-docs using a GitHub Action. -->

---

### Release 2024.5.1 - May 13, 2024

## What's Changed

* make userscheduler run on general node group by @Adam-D-Lewis in <https://github.com/nebari-dev/nebari/pull/2415>
* Upgrade to Pydantic V2 by @Adam-D-Lewis in <https://github.com/nebari-dev/nebari/pull/2348>
* Pydantic2 PR fix by @Adam-D-Lewis in <https://github.com/nebari-dev/nebari/pull/2421>
* remove redundant pydantic class, fix bug by @Adam-D-Lewis in <https://github.com/nebari-dev/nebari/pull/2426>
* Update `python-keycloak` version pins constraints by @viniciusdc in <https://github.com/nebari-dev/nebari/pull/2435>
* add HERA_TOKEN env var to user pods by @Adam-D-Lewis in <https://github.com/nebari-dev/nebari/pull/2438>
* fix docs link by @Adam-D-Lewis in <https://github.com/nebari-dev/nebari/pull/2443>
* Update allowed admin groups by @aktech in <https://github.com/nebari-dev/nebari/pull/2429>

**Full Changelog**: <https://github.com/nebari-dev/nebari/compare/2024.4.1...2024.5.1>

## Release 2024.4.1 - April 20, 2024

### What's Changed
Expand Down
2 changes: 1 addition & 1 deletion src/_nebari/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CURRENT_RELEASE = "2024.4.1"
CURRENT_RELEASE = "2024.5.1"

# NOTE: Terraform cannot be upgraded further due to Hashicorp licensing changes
# implemented in August 2023.
Expand Down
9 changes: 6 additions & 3 deletions src/_nebari/stages/infrastructure/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ class AzureInputVars(schema.Base):
tags: Dict[str, str] = {}
max_pods: Optional[int] = None
network_profile: Optional[Dict[str, str]] = None
workload_identity_enabled: bool = False


class AWSNodeGroupInputVars(schema.Base):
Expand Down Expand Up @@ -314,9 +315,9 @@ class GCPNodeGroup(schema.Base):


DEFAULT_GCP_NODE_GROUPS = {
"general": GCPNodeGroup(instance="n1-standard-8", min_nodes=1, max_nodes=1),
"user": GCPNodeGroup(instance="n1-standard-4", min_nodes=0, max_nodes=5),
"worker": GCPNodeGroup(instance="n1-standard-4", min_nodes=0, max_nodes=5),
"general": GCPNodeGroup(instance="e2-highmem-4", min_nodes=1, max_nodes=1),
"user": GCPNodeGroup(instance="e2-standard-4", min_nodes=0, max_nodes=5),
"worker": GCPNodeGroup(instance="e2-standard-4", min_nodes=0, max_nodes=5),
}


Expand Down Expand Up @@ -380,6 +381,7 @@ class AzureProvider(schema.Base):
tags: Optional[Dict[str, str]] = {}
network_profile: Optional[Dict[str, str]] = None
max_pods: Optional[int] = None
workload_identity_enabled: bool = False

@model_validator(mode="before")
@classmethod
Expand Down Expand Up @@ -788,6 +790,7 @@ def input_vars(self, stage_outputs: Dict[str, Dict[str, Any]]):
tags=self.config.azure.tags,
network_profile=self.config.azure.network_profile,
max_pods=self.config.azure.max_pods,
workload_identity_enabled=self.config.azure.workload_identity_enabled,
).model_dump()
elif self.config.provider == schema.ProviderEnum.aws:
return AWSInputVars(
Expand Down
5 changes: 3 additions & 2 deletions src/_nebari/stages/infrastructure/template/azure/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module "kubernetes" {
max_size = config.max_nodes
}
]
vnet_subnet_id = var.vnet_subnet_id
private_cluster_enabled = var.private_cluster_enabled
vnet_subnet_id = var.vnet_subnet_id
private_cluster_enabled = var.private_cluster_enabled
workload_identity_enabled = var.workload_identity_enabled
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ resource "azurerm_kubernetes_cluster" "main" {
resource_group_name = var.resource_group_name
tags = var.tags

# To enable Azure AD Workload Identity oidc_issuer_enabled must be set to true.
oidc_issuer_enabled = var.workload_identity_enabled
workload_identity_enabled = var.workload_identity_enabled

# DNS prefix specified when creating the managed cluster. Changing this forces a new resource to be created.
dns_prefix = "Nebari" # required

Expand Down Expand Up @@ -39,6 +43,9 @@ resource "azurerm_kubernetes_cluster" "main" {
"azure-node-pool" = var.node_groups[0].name
}
tags = var.tags

# temparory_name_for_rotation must be <= 12 characters
temporary_name_for_rotation = "${substr(var.node_groups[0].name, 0, 9)}tmp"
}

sku_tier = "Free" # "Free" [Default] or "Paid"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,13 @@ output "kubeconfig" {
sensitive = true
value = azurerm_kubernetes_cluster.main.kube_config_raw
}

output "cluster_oidc_issuer_url" {
description = "The OpenID Connect issuer URL that is associated with the AKS cluster"
value = azurerm_kubernetes_cluster.main.oidc_issuer_url
}

output "resource_group_name" {
description = "The name of the resource group in which the AKS cluster is created"
value = azurerm_kubernetes_cluster.main.resource_group_name
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,9 @@ variable "max_pods" {
type = number
default = 60
}

variable "workload_identity_enabled" {
description = "Enable Workload Identity"
type = bool
default = false
}
10 changes: 10 additions & 0 deletions src/_nebari/stages/infrastructure/template/azure/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,13 @@ output "kubeconfig_filename" {
description = "filename for nebari kubeconfig"
value = var.kubeconfig_filename
}

output "cluster_oidc_issuer_url" {
description = "The OpenID Connect issuer URL that is associated with the AKS cluster"
value = module.kubernetes.cluster_oidc_issuer_url
}

output "resource_group_name" {
description = "The name of the resource group in which the AKS cluster is created"
value = module.kubernetes.resource_group_name
}
6 changes: 6 additions & 0 deletions src/_nebari/stages/infrastructure/template/azure/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,9 @@ variable "max_pods" {
type = number
default = 60
}

variable "workload_identity_enabled" {
description = "Enable Workload Identity"
type = bool
default = false
}
11 changes: 11 additions & 0 deletions src/_nebari/stages/kubernetes_services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
TIMEOUT = 10 # seconds


_forwardauth_middleware_name = "traefik-forward-auth"


@schema.yaml_object(schema.yaml)
class AccessEnum(str, enum.Enum):
all = "all"
Expand Down Expand Up @@ -327,6 +330,8 @@ class KubernetesServicesInputVars(schema.Base):
realm_id: str
node_groups: Dict[str, Dict[str, str]]
jupyterhub_logout_redirect_url: str = Field(alias="jupyterhub-logout-redirect-url")
forwardauth_middleware_name: str = _forwardauth_middleware_name
cert_secret_name: Optional[str] = None


def _split_docker_image_name(image_name):
Expand Down Expand Up @@ -383,6 +388,7 @@ class DaskGatewayInputVars(schema.Base):
dask_worker_image: ImageNameTag = Field(alias="dask-worker-image")
dask_gateway_profiles: Dict[str, Any] = Field(alias="dask-gateway-profiles")
cloud_provider: str = Field(alias="cloud-provider")
forwardauth_middleware_name: str = _forwardauth_middleware_name


class MonitoringInputVars(schema.Base):
Expand Down Expand Up @@ -486,6 +492,11 @@ def input_vars(self, stage_outputs: Dict[str, Dict[str, Any]]):
realm_id=realm_id,
node_groups=stage_outputs["stages/02-infrastructure"]["node_selectors"],
jupyterhub_logout_redirect_url=final_logout_uri,
cert_secret_name=(
self.config.certificate.secret_name
if self.config.certificate.type == "existing"
else None
),
)

conda_store_vars = CondaStoreInputVars(
Expand Down
Loading

0 comments on commit 7c90e58

Please sign in to comment.