Skip to main content

A Kubernetes operator that syncs and decrypts secrets from pass store git repositories

Project description

pass secrets operator

GitHub Release PyPI - License PyPI - Python Version Docker Pulls CircleCI

A Kubernetes operator to sync and decrypt secrets from a password store (pass) Git repository. This operator is proposed as a proof-of-concept and shouldn't be used in any production capacity.

While this approach to secrets management on Kubernetes is more technically challenging, the advantage is that we don't have to rely on a 3rd party SaaS platform, such as Vault or Doppler, to hold our secrets (the obvious benefits these platforms do provide, however, are better user and access management). We may also use this operator in an airgapped environment with a self-hosted git repository.

How it works

The following flowchart outlines how this operator reacts to PassSecret-related events and pass store updates.

pass operator flow diagram

From a high level, this operator runs git pull on an interval to grab updates from a git repository populated with encrypted secrets by pass. It maps secrets' paths to data values through the application of a PassSecret, a custom resource, such as the following.

apiVersion: secrets.premiscale.com/v1alpha1
kind: PassSecret
metadata:
  name: mysecret
  namespace: pass-operator-test
spec:
  encryptedData:
    mykey: premiscale/mydata
  managedSecret:
    metadata:
      name: mysecret
      namespace: pass-operator-test
    type: Opaque
    immutable: false

The above PassSecret manifest translates to the following Secret.

apiVersion: v1
kind: Secret
metadata:
  name: mysecret
  namespace: pass-operator-test
stringData:
  mykey: <decrypted contents of premiscale/mydata>
immutable: false
type: Opaque

Installation

See the chart README for an overview of operator installation and configuration options.

Development

Unit tests

Run unit tests with

yarn test:unit

End-to-end tests

Run e2e tests against a live (local) environment with

yarn test:e2e

This command will

  1. Stand up a local 1-node minikube cluster with 4 cores, 4GiB memory and 30GiB storage. (Modify ./scripts/minikube.sh if these resources are unsuitable for your local development environment.)
  2. Create a localhost docker registry redirect container.
  3. Build both e2e (hosts a git repository with encrypted pass secrets that match paths found in ./src/test/data/crd) and operator container images, as well as push these images to the local redirect for minikube to access.
  4. Installs both e2e and pass-operator Helm charts.
  5. Run e2e tests.
  6. Tear down the cluster and local registry, as well as cleans up locally-built artifacts.

Coverage

Test coverage against the codebase with

poetry run coverage run -m pytest
poetry run coverage report -m pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pass_operator-0.4.4.tar.gz (24.8 kB view details)

Uploaded Source

Built Distribution

pass_operator-0.4.4-py3-none-any.whl (38.0 kB view details)

Uploaded Python 3

File details

Details for the file pass_operator-0.4.4.tar.gz.

File metadata

  • Download URL: pass_operator-0.4.4.tar.gz
  • Upload date:
  • Size: 24.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.6

File hashes

Hashes for pass_operator-0.4.4.tar.gz
Algorithm Hash digest
SHA256 1c0d18f68c18551ba68fa0f01dd11b2c44e6e8d1f4903e6ce81abcbdc147b20c
MD5 11a6f1b9c406f00bec764e21f1889149
BLAKE2b-256 5c6a264403c175883edfbdfcd88b058ae4015a576fed0d98ba44a93a53c4b638

See more details on using hashes here.

File details

Details for the file pass_operator-0.4.4-py3-none-any.whl.

File metadata

File hashes

Hashes for pass_operator-0.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 494827b044eeb857fe23523fd49279eba9918cc8873cf8248f9b1a54be951ea6
MD5 139ea774b85185e4cf384d7f2bd0d4ad
BLAKE2b-256 79d2e14664837738876606b0d28eb893a4632d3056b06d99a10659f81ad880d4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page