TBeijen / klutch

Putting your HPAs into overdrive

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Klutch

Putting your HPAs into overdrive

Resources

Kubernetes Python SDK

JSON patch

Running sample

Pick or create a namespace.

examples/redeploy.sh --namespace=<demo-namespace>

python -m klutch --namespace=<demo-namespace>

Development setup

# When on OSX, might be needed to install python version first, e.g. using pyenv
pyenv install 3.8.2
poetry env use -vvvv ~/.pyenv/versions/3.8.2/bin/python3.8

poetry install
poetry shell
pre-commit install

python -m klutch --dry-run

Debugging in VScode

.vscode/launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Module",
            "type": "python",
            "request": "launch",
            "module": "klutch",
            "args" : ["--config-path=dev.yaml"]
        }
    ]
}

.vscode/settings.json (note the path when starting poetry shell):

{
    "python.defaultInterpreterPath": "/Users/<user-name>/Library/Caches/pypoetry/virtualenvs/klutch-abcabc-py3.9",
    "python.testing.pytestArgs": [
        "tests"
    ],
    "python.testing.unittestEnabled": false,
    "python.testing.nosetestsEnabled": false,
    "python.testing.pytestEnabled": true
}

Running and debugging tests in VScode

Via cmd + shift + p: 'Python: Discover Tests`.

Test option (lab flask icon) should appear in left bar.

.vscode/settings.json now includes:

{
    "python.pythonPath": "/Users/<user-name>/Library/Caches/pypoetry/virtualenvs/klutch-abcabc-py3.8",
    "python.testing.pytestArgs": [
        "tests"
    ],
    "python.testing.unittestEnabled": false,
    "python.testing.nosetestsEnabled": false,
    "python.testing.pytestEnabled": true
}

Be sure to open the output panel 'Python Test Log'.

Enabling debugging of library code:

Reference:

Add to .vscode/launch.json (under configurations):

        {
            "name": "Python: Unit Tests",
            "type": "python",
            "request": "test",
            "justMyCode": false,
        }

Github workflow

Workflow using Github actions

  • Job test: Runs on all commits
  • Job publish: Runs on tags only

About

Putting your HPAs into overdrive

License:Apache License 2.0


Languages

Language:Python 93.1%Language:Mustache 6.0%Language:Dockerfile 0.9%