Skip to content

Commit

Permalink
Refactor into a package
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam-D-Lewis committed Apr 18, 2023
1 parent ce8f4dd commit fe3a78a
Show file tree
Hide file tree
Showing 23 changed files with 1,379 additions and 183 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
_version.py

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
94 changes: 94 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# pre-commit is a tool to perform a predefined set of tasks manually and/or
# automatically before git commits are made.
#
# Config reference: https://pre-commit.com/#pre-commit-configyaml---top-level
#
# Common tasks
#
# - Register git hooks: pre-commit install --install-hooks
# - Run on all files: pre-commit run --all-files
#
# These pre-commit hooks are run as CI.
#
# NOTE: if it can be avoided, add configs/args in pyproject.toml, setup.cfg or below instead of creating a new `.config.file`.
# https://pre-commit.ci/#configuration
ci:
autoupdate_schedule: monthly
autofix_commit_msg: |
[pre-commit.ci] Apply automatic pre-commit fixes
# this does not work on pre-commit ci
skip: [terraform_fmt]

repos:
# general
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-json
- id: check-yaml
# jinja2 templates for helm charts
exclude: "nebari/template/stages/07-kubernetes-services/modules/kubernetes/services/(clearml/chart/templates/.*|prefect/chart/templates/.*)"
args: [--allow-multiple-documents]
- id: check-toml
# Lint: Checks that non-binary executables have a proper shebang.
- id: check-executables-have-shebangs
exclude: "^nebari/template/"

- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
hooks:
- id: codespell
args:
[
"--builtin=rare,clear,informal,names",
"--skip=_build,*/build/*,*/node_modules/*,nebari.egg-info,.nox,*.git,*.js,*.json,*.yaml,*.yml",
"--ignore-words-list=AKS,aks",
"--write",
]
language: python

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

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.254
hooks:
- id: ruff
args: ["--fix"]

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort
additional_dependencies: [toml]
files: \.py$
args: ["--profile", "black"]

# terraform
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.77.1
hooks:
- id: terraform_fmt
args:
- --args=-write=true

# markdown
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
hooks:
- id: mdformat
files: ^docs/
name: mdformat
entry: mdformat --wrap=120 --number --end-of-line=lf
language: python
types: [markdown]
minimum_pre_commit_version: "2.0.0"
additional_dependencies:
- mdformat-tables
29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2020-2022, Nebari development team
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
18 changes: 5 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
Argo Workflows Admission Controller
===================================
# Run project
- `pip install .`
- `python main.py`

This repo holds some proof of concept work for an Argo Workflows Admission Controller to limit the volumes that a workflow can mount. It is mostly a storage of some WIP code, and will not run without some modification.

Steps to use
============
- You need to build the argowf_admission_controller/Dockerfile and push it to a registry that your kubernetes cluster can access.
- You need to kubectl apply the files in the manifests directory.

Other Notes
===========
- The argowf_admission_controller folder contains the source code for the Fastapi admission controller.
- argowf_admission_controller/example_admission_requests contains some example admission requests that can be used to test the admission controller.
# Developing on this project
Run `pip install -e .[dev]`
12 changes: 0 additions & 12 deletions argowf_admission_controller/Dockerfile

This file was deleted.

56 changes: 0 additions & 56 deletions argowf_admission_controller/app.py

This file was deleted.

3 changes: 0 additions & 3 deletions argowf_admission_controller/requirements.txt

This file was deleted.

1 change: 0 additions & 1 deletion commands.txt

This file was deleted.

20 changes: 0 additions & 20 deletions manifests/example-hello-world-workflow.yaml

This file was deleted.

29 changes: 0 additions & 29 deletions manifests/ingressroute.yaml

This file was deleted.

47 changes: 0 additions & 47 deletions manifests/validating-webhook-config.yaml

This file was deleted.

Empty file.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging

import uvicorn

logger = logging.getLogger(__name__)
Expand All @@ -12,5 +13,6 @@ def main():
reload=True,
)


if __name__ == "__main__":
main()
Loading

0 comments on commit fe3a78a

Please sign in to comment.