Skip to content

Commit

Permalink
Merge branch 'main' into KF-771-renovate-configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
misohu committed Dec 9, 2022
2 parents 9535c04 + 2cfb3ba commit 1545060
Show file tree
Hide file tree
Showing 30 changed files with 262 additions and 106 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/get-charm-paths.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash -x

# Finds the charms in this repo, outputing them as JSON
# Finds the charms in this repo, outputting them as JSON
# Will return one of:
# * the relative paths of the directories listed in `./charms`, if that directory exists
# * "./", if the root directory has a "metadata.yaml" file
# * otherwise, error
#
# Modifed from: https://stackoverflow.com/questions/63517732/github-actions-build-matrix-for-lambda-functions/63736071#63736071
# Modified from: https://stackoverflow.com/questions/63517732/github-actions-build-matrix-for-lambda-functions/63736071#63736071
CHARMS_DIR="./charms"
if [ -d "$CHARMS_DIR" ];
then
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ jobs:
- name: Run test
run: |
sg microk8s -c "microk8s enable ingress metallb:10.64.140.43-10.64.140.49"
sudo apt install -y firefox-geckodriver
sudo apt install tar wget
# Install firefox-geckodriver from source to avoid issues
wget https://github.com/mozilla/geckodriver/releases/download/v0.28.0/geckodriver-v0.28.0-linux64.tar.gz
tar xf geckodriver-v0.28.0-linux64.tar.gz
sudo mv geckodriver /usr/local/bin
sudo snap install juju-bundle --classic
sudo snap install juju-wait --classic
sudo snap refresh charmcraft --channel=latest/candidate
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ providing lifecycle management for each application, handling events (install, u
This Jupyter bundle requires some other components of Kubeflow to be deployed,
including istio and the kubeflow dashboard. It also currently requires some
manual configuration of the Kubernetes cluster. As these requirements are
subject to change at this time, the most reliable set-up instuctions are
subject to change at this time, the most reliable set-up instructions are
contained in the `Deploy charm dependencies` section of the
[integration workflow][integrate].

Expand Down
2 changes: 1 addition & 1 deletion charms/jupyter-controller/metadata.yaml
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ resources:
oci-image:
type: oci-image
description: 'Backing OCI image'
upstream-source: docker.io/kubeflownotebookswg/notebook-controller:v1.6.0-rc.1
upstream-source: docker.io/kubeflownotebookswg/notebook-controller:v1.6.1
deployment:
type: stateless
service: omit
Expand Down
8 changes: 4 additions & 4 deletions charms/jupyter-controller/requirements-fmt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile --resolver=backtracking ./charms/jupyter-controller/requirements-fmt.in
# pip-compile --resolver=backtracking ./requirements-fmt.in
#
black==22.10.0
# via -r ./charms/jupyter-controller/requirements-fmt.in
# via -r ./requirements-fmt.in
click==8.1.3
# via black
isort==5.10.1
# via -r ./charms/jupyter-controller/requirements-fmt.in
# via -r ./requirements-fmt.in
mypy-extensions==0.4.3
# via black
pathspec==0.10.2
# via black
platformdirs==2.5.4
platformdirs==2.6.0
# via black
tomli==2.0.1
# via black
Expand Down
24 changes: 11 additions & 13 deletions charms/jupyter-controller/requirements-integration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile --resolver=backtracking ./charms/jupyter-controller/requirements-integration.in
# pip-compile --resolver=backtracking ./requirements-integration.in
#
asttokens==2.2.1
# via stack-data
Expand All @@ -14,7 +14,7 @@ bcrypt==4.0.1
# via paramiko
cachetools==5.2.0
# via google-auth
certifi==2022.9.24
certifi==2022.12.7
# via
# kubernetes
# requests
Expand Down Expand Up @@ -50,7 +50,7 @@ jinja2==3.1.2
# via pytest-operator
juju==3.0.4
# via
# -r ./charms/jupyter-controller/requirements-integration.in
# -r ./requirements-integration.in
# pytest-operator
jujubundlelib==0.5.7
# via theblues
Expand All @@ -69,10 +69,10 @@ mypy-extensions==0.4.3
oauthlib==3.2.2
# via requests-oauthlib
oci-image==1.0.0
# via -r ./charms/jupyter-controller/requirements.txt
# via -r ./requirements.txt
ops==1.5.4
# via -r ./charms/jupyter-controller/requirements.txt
packaging==21.3
# via -r ./requirements.txt
packaging==22.0
# via pytest
paramiko==2.12.0
# via juju
Expand All @@ -84,7 +84,7 @@ pickleshare==0.7.5
# via ipython
pluggy==1.0.0
# via pytest
prompt-toolkit==3.0.33
prompt-toolkit==3.0.36
# via ipython
protobuf==3.20.3
# via macaroonbakery
Expand All @@ -110,8 +110,6 @@ pynacl==1.5.0
# macaroonbakery
# paramiko
# pymacaroons
pyparsing==3.0.9
# via packaging
pyrfc3339==1.1
# via
# juju
Expand All @@ -120,17 +118,17 @@ pytest==7.2.0
# via
# pytest-asyncio
# pytest-operator
pytest-asyncio==0.20.2
pytest-asyncio==0.20.3
# via pytest-operator
pytest-operator==0.22.0
# via -r ./charms/jupyter-controller/requirements-integration.in
# via -r ./requirements-integration.in
python-dateutil==2.8.2
# via kubernetes
pytz==2022.6
# via pyrfc3339
pyyaml==6.0
# via
# -r ./charms/jupyter-controller/requirements.txt
# -r ./requirements.txt
# juju
# jujubundlelib
# kubernetes
Expand Down Expand Up @@ -165,7 +163,7 @@ tomli==2.0.1
# via pytest
toposort==1.7
# via juju
traitlets==5.6.0
traitlets==5.7.0
# via
# ipython
# matplotlib-inline
Expand Down
32 changes: 16 additions & 16 deletions charms/jupyter-controller/requirements-lint.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,58 @@
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile --resolver=backtracking ./charms/jupyter-controller/requirements-lint.in
# pip-compile --resolver=backtracking ./requirements-lint.in
#
black==22.10.0
# via -r ./charms/jupyter-controller/requirements-fmt.txt
# via -r ./requirements-fmt.txt
click==8.1.3
# via
# -r ./charms/jupyter-controller/requirements-fmt.txt
# -r ./requirements-fmt.txt
# black
codespell==2.2.2
# via -r ./charms/jupyter-controller/requirements-lint.in
# via -r ./requirements-lint.in
flake8==5.0.4
# via
# -r ./charms/jupyter-controller/requirements-lint.in
# -r ./requirements-lint.in
# flake8-builtins
# pep8-naming
# pyproject-flake8
flake8-builtins==2.0.1
# via -r ./charms/jupyter-controller/requirements-lint.in
# via -r ./requirements-lint.in
flake8-copyright==0.2.3
# via -r ./charms/jupyter-controller/requirements-lint.in
# via -r ./requirements-lint.in
isort==5.10.1
# via -r ./charms/jupyter-controller/requirements-fmt.txt
# via -r ./requirements-fmt.txt
mccabe==0.7.0
# via flake8
mypy-extensions==0.4.3
# via
# -r ./charms/jupyter-controller/requirements-fmt.txt
# -r ./requirements-fmt.txt
# black
pathspec==0.10.2
# via
# -r ./charms/jupyter-controller/requirements-fmt.txt
# -r ./requirements-fmt.txt
# black
pep8-naming==0.13.2
# via -r ./charms/jupyter-controller/requirements-lint.in
platformdirs==2.5.4
# via -r ./requirements-lint.in
platformdirs==2.6.0
# via
# -r ./charms/jupyter-controller/requirements-fmt.txt
# -r ./requirements-fmt.txt
# black
pycodestyle==2.9.1
# via flake8
pyflakes==2.5.0
# via flake8
pyproject-flake8==5.0.4.post1
# via -r ./charms/jupyter-controller/requirements-lint.in
# via -r ./requirements-lint.in
tomli==2.0.1
# via
# -r ./charms/jupyter-controller/requirements-fmt.txt
# -r ./requirements-fmt.txt
# black
# pyproject-flake8
typing-extensions==4.4.0
# via
# -r ./charms/jupyter-controller/requirements-fmt.txt
# -r ./requirements-fmt.txt
# black

# The following packages are considered to be unsafe in a requirements file:
Expand Down
16 changes: 7 additions & 9 deletions charms/jupyter-controller/requirements-unit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,29 @@
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile --resolver=backtracking ./charms/jupyter-controller/requirements-unit.in
# pip-compile --resolver=backtracking ./requirements-unit.in
#
attrs==22.1.0
# via pytest
coverage==6.5.0
# via -r ./charms/jupyter-controller/requirements-unit.in
# via -r ./requirements-unit.in
exceptiongroup==1.0.4
# via pytest
iniconfig==1.1.1
# via pytest
oci-image==1.0.0
# via -r ./charms/jupyter-controller/requirements.txt
# via -r ./requirements.txt
ops==1.5.4
# via -r ./charms/jupyter-controller/requirements.txt
packaging==21.3
# via -r ./requirements.txt
packaging==22.0
# via pytest
pluggy==1.0.0
# via pytest
pyparsing==3.0.9
# via packaging
pytest==7.2.0
# via -r ./charms/jupyter-controller/requirements-unit.in
# via -r ./requirements-unit.in
pyyaml==6.0
# via
# -r ./charms/jupyter-controller/requirements.txt
# -r ./requirements.txt
# ops
tomli==2.0.1
# via pytest
6 changes: 3 additions & 3 deletions charms/jupyter-controller/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile --resolver=backtracking ./charms/jupyter-controller/requirements.in
# pip-compile --resolver=backtracking ./requirements.in
#
oci-image==1.0.0
# via -r ./charms/jupyter-controller/requirements.in
# via -r ./requirements.in
ops==1.5.4
# via -r ./charms/jupyter-controller/requirements.in
# via -r ./requirements.in
pyyaml==6.0
# via ops
4 changes: 3 additions & 1 deletion charms/jupyter-controller/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class CheckFailedError(Exception):
"""Raise this exception if one of the checks in main fails."""

def __init__(self, msg, status_type=None):
"""Raise this exception if one of the checks in main fails."""
super().__init__()

self.msg = str(msg)
Expand All @@ -38,6 +39,7 @@ class Operator(CharmBase):
"""

def __init__(self, *args):
"""Charm for the jupyter notebook server."""
super().__init__(*args)

self.log = logging.getLogger(__name__)
Expand Down Expand Up @@ -66,7 +68,7 @@ def __init__(self, *args):
self.framework.observe(event, self.main)

def main(self, event):
"""Main function of the charm.
"""Run main operations of the charm.
Runs at install, update, config change and relation change.
"""
Expand Down
3 changes: 2 additions & 1 deletion charms/jupyter-controller/tests/integration/test_charm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright 2022 Canonical Ltd.
# See LICENSE file for licensing details.

"""Tests for Jupyter controller."""
import logging
from pathlib import Path

Expand All @@ -16,6 +16,7 @@

@pytest.mark.abort_on_fail
async def test_build_and_deploy(ops_test: OpsTest):
"""Test build and deploy."""
await ops_test.model.deploy("istio-pilot", channel="1.5/beta")
await ops_test.model.deploy("jupyter-ui")
await ops_test.model.add_relation("jupyter-ui", "istio-pilot")
Expand Down
5 changes: 5 additions & 0 deletions charms/jupyter-controller/tests/unit/test_operator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright 2022 Canonical Ltd.
# See LICENSE file for licensing details.
"""Test for Jupyter controller."""
import pytest
from ops.model import ActiveStatus, BlockedStatus, WaitingStatus
from ops.testing import Harness
Expand All @@ -9,21 +10,25 @@

@pytest.fixture
def harness():
"""Instantiate a test harness."""
return Harness(Operator)


def test_not_leader(harness):
"""Test that charm waits if not leader."""
harness.begin_with_initial_hooks()
assert harness.charm.model.unit.status == WaitingStatus("Waiting for leadership")


def test_missing_image(harness):
"""Test if charm is blocked if missing oci-image."""
harness.set_leader(True)
harness.begin_with_initial_hooks()
assert harness.charm.model.unit.status == BlockedStatus("Missing resource: oci-image")


def test_no_relation(harness):
"""Test charm goes to active if no additional relations exist."""
harness.set_leader(True)
harness.add_oci_resource(
"oci-image",
Expand Down
12 changes: 7 additions & 5 deletions charms/jupyter-controller/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ allowlist_externals =
xargs
commands =
; uses 'bash -c' because piping didn't work in regular tox commands
bash -c \'find . -type f -name "requirements*.in" | xargs --replace=\{\} pip-compile --resolver=backtracking \{\}'
pip-compile requirements.in
pip-compile requirements-fmt.in
bash -c 'find . -type f -name "requirements*.in" | xargs --replace=\{\} pip-compile --resolver=backtracking \{\}'
deps =
pip-tools
description = Update requirements files by executing pip-compile on all requirements*.in files, including those in subdirs.
Expand All @@ -50,10 +52,10 @@ description = Apply coding style standards to code
commands =
# uncomment the following line if this charm owns a lib
# codespell {[vars]lib_path}
codespell {toxinidir}/. --skip {toxinidir}/.git --skip {toxinidir}/.tox \
--skip {toxinidir}/build --skip {toxinidir}/lib --skip {toxinidir}/venv \
--skip {toxinidir}/.mypy_cache \
--skip {toxinidir}/icon.svg --skip *.json.tmpl
codespell {toxinidir}/. --skip {toxinidir}/./.git --skip {toxinidir}/./.tox \
--skip {toxinidir}/./build --skip {toxinidir}/./lib --skip {toxinidir}/./venv \
--skip {toxinidir}/./.mypy_cache \
--skip {toxinidir}/./icon.svg --skip *.json.tmpl
# pflake8 wrapper supports config from pyproject.toml
pflake8 {[vars]all_path}
isort --check-only --diff {[vars]all_path}
Expand Down
2 changes: 1 addition & 1 deletion charms/jupyter-ui/metadata.yaml
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ resources:
oci-image:
type: oci-image
description: 'Backing OCI image'
upstream-source: docker.io/kubeflownotebookswg/jupyter-web-app:v1.6.0-rc.1
upstream-source: docker.io/kubeflownotebookswg/jupyter-web-app:v1.6.1
requires:
ingress:
interface: ingress
Expand Down
Loading

0 comments on commit 1545060

Please sign in to comment.