Skip to main content

tools for sending app modules to k8s infrastructure and managing app versions

Project description

Underpinnings

Underpinnings is an experimental utility to explore a two-repo pattern for migrating templated apps from an "applications" repo to a K8s "infrastructure" repo.

Infrastructure repos (IRepos) are managed by Dev Ops people or people that are keen to dive into the management of K8s clusters while applications repos (ARepos) are the realm of application developers who build many applications (on many docker images). Microservices systems lead to a profusion of apps and docker images that need to be managed and deployed into Kubernetes infrastructure. Application developers typically do not care about the details of how things are deployed once they have the resources they need to run their applications. There are of course many engineers who are happy to work in either space and indeed many teams have arrived at good solutions to manage these environments.

Underpinnings takes the perspective that special tooling could be useful sitting between ARepos and IRepos and that some patterns and abstractions are worth thinking about.

  • How to create a separation of concerns between I and A
  • How to create abstract and simple application templates that can be translated into Kubernetes applications
  • How to manage docker and other container builds and their versions when mapping between A and I

Usage

Underpinning creates a target repo for infrastructure. It is useful to think of underpinning running in the context of the source or ARepo, either inline in the repo are as part of builds, building the ARepo. Then the target repo has its own Git Context managed by underpin as a conduit to send transfer manifests. Consider a basic config file

version: underpin.io/alpha1
metadata:
  namespace: default
  source-root: samples
  app-uri: default/deployment
repos:
  source: git@github.com:mr-saoirse/underpinnings.git
  target: git@github.com:mr-saoirse/cloud-stack.git

Underpinnings will initialize the target repo into ~/.underpin/cloned/<target>

underpin init

Then a pipeline can be run to generate all hydrated templates with

underpin run

which will translates applications under source-root: samples and "hydrate" applications for K8s. There are some default templates in underpin or you additional ones can be added to the IRepo in repo/.unpderpinnings. These are adapters that convert simple values files into more complex K8s app templates.

Following this we build any docker images, update image manifests, write to the target IRepo and push. ArgoCD will then manage the applications in the IRepo, syncing to the cluster(s)

  1. We build containers and determine tags
underpin build containers
  1. We then tag manifests. However its assumed for simplicity that we can choose some super tag that we just write into the kustomize in the previous stage and we control the tags or SHA or whatever it is all docker images are re-pinned with for this build. Allowing for other ways to get those tags is not hard its just unnecessary complexity for a PoC
#we dont need this really yet 
underpin build kustomize
  1. We finally update the infra
underpin infra update

These steps can all be tested locally but the intent is these run in a CI/CD pipeline runner.

running in the workflow

The above is for testing. In the workflow the following occurs

  • we clone the ARepo
  • we Build any master docker images in the ARepo
  • we init the target IRepo on a volume
  • We fan out over changed apps with the parameters to process each app and write to the IRepo
    • we run underpin run -n=<app-name> -o tmp/context/app/build
    • we build the docker app from that /tmp/context location, which is a self-contained app
      • this uses Kaniko as the build provider or Bentoml etc.
    • we set kustomize image on the app for whatever build context and image is needed
    • we copy to app target in the IRepo
  • we fan in and merge the IRepo changes

running as a GitHub action

mode 1: trigger the workflow

In this mode, the cloud native in you may want to separate your build processes into something that can be run and tested on K8s. Alternatively see mode 2 In this first mode, we use an Argo Workflow that runs on our management cluster to build our ARepo and transfer the manifests into the IRepo. ArgoCD then takes these manifests and deploys them to all clusters under management.

mode 2: run as inline action on app folders

In mode 2 we use just run underpin in a git action (which runs on a docker image). Here we need to pass app changes into the underpin step and it will transform and generate manifests that get pushed to the target repo (for all app changes). For each app we run all the steps above to generate templates, build containers and tag manifests. We push each app to the target IRepo.

other commands

Following are some commands for interacting with the Applications repo which is considered the source.

#see what changes have been observed on the ARepo branch or in the context
underpin source --changes
#preview a template e..g all docker files and yaml files used for the app
underpin source template <app-name>  

Underpin also has a simple agent to helm with templating

underpin agent <>

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

underpin-0.1.0.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

underpin-0.1.0-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file underpin-0.1.0.tar.gz.

File metadata

  • Download URL: underpin-0.1.0.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.10 Darwin/22.4.0

File hashes

Hashes for underpin-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b66b53d6863348db43a585616ee7c5115a864636f20261726a15c6996796dedc
MD5 72bbc1ed972daffd6aa2db63cc3f9e40
BLAKE2b-256 50b799dae869e3cbb0c3758ea1fdb5802caa956e4d56698c19278e3c6375b146

See more details on using hashes here.

File details

Details for the file underpin-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: underpin-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.10 Darwin/22.4.0

File hashes

Hashes for underpin-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3cdb66c29eea604848820a43005cdb7014b0159d7ff8985d34aa2d3c8f8c9997
MD5 592cf6f286d2c21f1a8085c32a74da85
BLAKE2b-256 9e7c3c2dbbf36e9b1282249e6b24f0283e87c95ed2f78bb930db705505cb3cc6

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