Skip to main content

Output notes for a Kubernetes deployment

Project description

github latest release pypi latest package docker latest image project license

dok8s CI dok8s CD security scan pre-commit

code coverage code alerts code quality code style

dok8s

dok8s: Output notes for a Kubernetes deployment.

Contents

  1. Use Case
  2. Configuration
  3. Development
  4. Testing
  5. Versioning
  6. Deployment
  7. Production

Use Case

Collect and export information about a Kubernetes deployment (such as components, resources and docker images/tags) in a table format. Input: Deployment files (collection of YAML definitions).
Output: Pretty-print tabular data.

Requirements

  • Parse the following Kubernetes components:
    ConfigMap, Deployment, Ingress, PersistentVolumeClaim, Secret, Service, StatefulSet.
  • Collect relevant information:
    kind, metadata name, data filenames, (init) containers, hosts / rules, storage name / size, ports, cpu/memory requests/limits
  • Production-ready code.

Assumptions

Design

This project is based on a CLI interface.

Example Output

Input

YAML file: Cluster Autoscaler

Output

Components

Component Value Details
ClusterRole cluster-autoscaler --
ClusterRoleBinding cluster-autoscaler --
Deployment cluster-autoscaler cluster-autoscaler
Role cluster-autoscaler --
RoleBinding cluster-autoscaler --
ServiceAccount cluster-autoscaler --

Resources

Platform/Service Name Request Limit Request Notes
cluster-autoscaler cluster-autoscaler CPU:100m Memory:300Mi CPU:100m Memory:300Mi --

Docker images

Platform/Service Name Image Version
cluster-autoscaler cluster-autoscaler k8s.gcr.io/cluster-autoscaler v1.14.7

Configuration

Behaviour of the application can be configured via Environment Variables.

Environment Variable Description Type Default Value
DOK8S_LOG_LEVEL Level of logging - overrides verbose/quiet flag string -
DOK8S_LOG_DIR Directory to save logs string -
DOK8S_BIN_DIR Directory to save any output (bin) string bin

Development

Configure your local development

  • Clone repo on your local machine
  • Install conda or miniconda
  • Create your local project environment (based on conda, poetry, pre-commit):
    $ make env
  • (Optional) Update existing local project environment:
    $ make env-update

Run locally

On a terminal, run the following (execute on project's root directory):

  • Activate project environment:
    $ . ./scripts/helpers/environment.sh
  • Run the CLI using poetry:
    $ dok8s

Contribute

[ Not Available ]

Testing

(part of CI/CD)

[ Work in progress... ]

To run the tests, open a terminal and run the following (execute on project's root directory):

  • Activate project environment:
    $ . ./scripts/helpers/environment.sh
  • To run pytest:
    $ make test
  • To check test coverage:
    $ make test-coverage

Versioning

Increment the version number:
$ poetry version {bump rule}
where valid bump rules are:

  1. patch
  2. minor
  3. major
  4. prepatch
  5. preminor
  6. premajor
  7. prerelease

Changelog

Use CHANGELOG.md to track the evolution of this package.
The [UNRELEASED] tag at the top of the file should always be there to log the work until a release occurs.

Work should be logged under one of the following subtitles:

  • Added
  • Changed
  • Fixed
  • Removed

On a release, a version of the following format should be added to all the current unreleased changes in the file.
## [major.minor.patch] - YYYY-MM-DD

Deployment

Pip package

On a terminal, run the following (execute on project's root directory):

  • Activate project environment:
    $ . ./scripts/helpers/environment.sh
  • To build pip package:
    $ make build-package
  • To publish pip package (requires credentials to PyPi):
    $ make publish-package

Docker image

On a terminal, run the following (execute on project's root directory):

  • Activate project environment:
    $ . ./scripts/helpers/environment.sh
  • To build docker image:
    $ make build-docker

Production

For production, a Docker image is used. This image is published publicly on docker hub.

  • First pull image from docker hub:
    $ docker pull nichelia/dok8s:{version}
  • Execute CLI via docker run:
    $ docker run --rm -it -v ~/dok8s_bin:/tmp/bin nichelia/dok8s:{version} {command} -d /tmp/bin -o {filename}
    This command mounts the application's bin (outcome) to user's root directory under dok8s_bin folder. The Kubernetes YAML files you want to parse, should be included in this directory.

where version is the published application version

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

dok8s-0.0.4.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dok8s-0.0.4-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file dok8s-0.0.4.tar.gz.

File metadata

  • Download URL: dok8s-0.0.4.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.0 CPython/3.8.3 Linux/5.3.0-1028-azure

File hashes

Hashes for dok8s-0.0.4.tar.gz
Algorithm Hash digest
SHA256 afc66ceaaf3ccb48524273e289e54c95b839ce3785f22dce837e0021a2e0c520
MD5 729f650767d9080afa12861654624167
BLAKE2b-256 0f6efb81f88ee35a6f57a842a458a1c58d5b5313ab7aea2e27bdbcee23958e53

See more details on using hashes here.

File details

Details for the file dok8s-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: dok8s-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.0 CPython/3.8.3 Linux/5.3.0-1028-azure

File hashes

Hashes for dok8s-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d90e6cf6f2592f3fa091098df91f848f12677811fd68e866041b7e66be8b9cff
MD5 d32f89baf9406d28a09aea76e2a3d2ef
BLAKE2b-256 8b770bf64bab26975d46786d0a10f00c7a1f6b7fcb8a4fd007dc73a2272394e6

See more details on using hashes here.

Supported by

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