Skip to content

Commit

Permalink
ENG-196: Create new Kubernetes operator
Browse files Browse the repository at this point in the history
  • Loading branch information
Emma Doyle committed Jun 12, 2023
1 parent 4052eaa commit e6d5ce7
Show file tree
Hide file tree
Showing 36 changed files with 1,867 additions and 234 deletions.
12 changes: 6 additions & 6 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
_extends: .github
_extends: .github-private

repository:
name: base
description: Base repository with default settings and configs
homepage: https://github.com/premiscale/base-python
name: password-store-operator
description: A kubernetes operator that syncs and decrypts secrets from pass git repositories
homepage: https://github.com/premiscale/pass-operator

# A comma-separated list of topics to set on the repository
topics: python, pypi
private: true
topics: python,kubernetes,secrets,operator,pass
private: true
180 changes: 180 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
# Created by https://www.toptal.com/developers/gitignore/api/python,helm
# Edit at https://www.toptal.com/developers/gitignore?templates=python,helm

### Helm ###
# Chart dependencies
**/charts/*.tgz

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

### Python Patch ###
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
poetry.toml

# ruff
.ruff_cache/

# LSP config files
pyrightconfig.json

# End of https://www.toptal.com/developers/gitignore/api/python,helm
4 changes: 0 additions & 4 deletions .mypy.ini

This file was deleted.

52 changes: 15 additions & 37 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
fail_fast: true
repos:
# Requires hadolint binary on local machine.
- repo: https://github.com/hadolint/hadolint
Expand All @@ -18,24 +19,15 @@ repos:
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.0.1
rev: v1.3.0
hooks:
- id: mypy
args:
- --install-types
- --non-interactive
- --config-file=.mypy.ini

# - repo: https://github.com/mgedmin/check-manifest
# rev: "0.48"
# hooks:
# - id: check-manifest
# args:
# - --ignore
# - "*.json,*.txt,*.yaml,.mypy.ini,config/*.md,docker/*.sh,,examples/*,helm/*,package/*,scripts/*,service/*,tests/*,.circleci/*,.pylintrc,.tool-versions,docker/**/*,helm/**/*,examples/**/*"
- --config-file=pyproject.toml

- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 3.0.0
Expand All @@ -44,52 +36,38 @@ repos:
args:
- -x

- repo: https://github.com/bjd2385/circleci-config-pre-commit-hook
rev: v1.1.2
- repo: https://github.com/bjd2385/dynamic-continuation-orb
rev: v3.6.10
hooks:
- id: circleci-config-validate

# - repo: https://github.com/k-ogawa-1988/yamale-pre-commit
# rev: v0.0.2
# hooks:
# - id: yamale-validate
# args:
# - conf/schema.yaml

# - repo: https://github.com/gruntwork-io/pre-commit
# rev: v0.1.18
# hooks:
# - id: helmlint
- repo: https://github.com/gruntwork-io/pre-commit
rev: v0.1.22
hooks:
- id: helmlint

- repo: https://github.com/python-poetry/poetry
rev: 1.3.0
rev: 1.5.0
hooks:
- id: poetry-check
- id: poetry-lock
- id: poetry-export
args: ["-f", "requirements.txt", "-o", "requirements.txt"]

- repo: https://github.com/PyCQA/pylint
rev: v2.16.2
rev: v3.0.0a6
hooks:
- id: pylint
args:
- --rcfile=.pylintrc
- base_python/
- src/

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.12.1
rev: v0.13
hooks:
- id: validate-pyproject

# - repo: https://github.com/charliermarsh/ruff-pre-commit
# rev: v0.0.237
# hooks:
# - id: ruff
# args: [--fix]
# exclude: ^resources

- repo: https://github.com/premiscale/pre-commit-hooks
rev: v0.0.1
rev: v0.0.9
hooks:
- id: msg-issue-prefix
- id: msg-issue-prefix
3 changes: 1 addition & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[MESSAGES CONTROL]

disable=invalid-name,superfluous-parens,line-too-long,missing-final-newline,logging-fstring-interpolation,too-many-instance-attributes
disable=invalid-name,superfluous-parens,line-too-long,missing-final-newline,logging-fstring-interpolation,too-many-instance-attributes,unused-argument,unused-import
fail-under=6

[MASTER]
Expand Down
12 changes: 4 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,13 @@ RUN chmod +x /tini
RUN curl -Ls --tlsv1.2 --proto "=https" --retry 3 https://cli.doppler.com/install.sh | sh

RUN apt update && \
rm -rf /var/apt/lists/* && \
python -m venv /opt/premiscale
rm -rf /var/apt/lists/*

RUN useradd -rm -d /opt/premiscale -s /bin/bash -g root -G sudo -u 1001 premiscale

COPY ./cmd.sh /opt/premiscale/

WORKDIR /opt/premiscale

RUN chmod +x cmd.sh && chown -R premiscale:root .
RUN chown -R premiscale:root .
USER premiscale

ARG PYTHON_USERNAME
Expand All @@ -44,9 +41,8 @@ ENV PATH=${PATH}:/opt/premiscale/.local/bin

# Install and initialize PremiScale.
RUN mkdir -p "$HOME"/.local/bin && \
. bin/activate && \
pip install --upgrade pip && \
pip install --no-cache-dir --no-input --extra-index-url="${PYTHON_INDEX}" base_python=="${PYTHON_PACKAGE_VERSION}"

ENTRYPOINT [ "/tini", "--", "doppler", "run", "--" ]
CMD [ "./cmd.sh" ]
ENTRYPOINT [ "/tini", "--" ]
CMD [ "passop" ]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# base-python
# Pass kubernetes operator

Base Python repo for getting started with a new Python package with default configuration files for PremiScale, Inc.
This Kubernetes operator can be used to sync and decrypt secrets from a [password store (pass)](https://www.passwordstore.org/) Git repository.
Binary file removed base_python/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
13 changes: 0 additions & 13 deletions base_python/alternate/importable.py

This file was deleted.

Binary file not shown.
Binary file not shown.
21 changes: 0 additions & 21 deletions base_python/base_python/test.py

This file was deleted.

7 changes: 0 additions & 7 deletions cmd.sh

This file was deleted.

Loading

0 comments on commit e6d5ce7

Please sign in to comment.