The source in the repository contains a PodPreset resource that's implemented via a CRD that is paired with a mutating webhook in order to modify pod specs on the fly.
In order to deploy the PodPreset resource into your cluster, do the following:
-
Deploy Kubernetes.
-
Install kustomize.
-
Run CRD, choose to execute inside or outside the cluster.
Inside cluster:
make docker-build make deploy
Outside cluster (for debugging/development):
make install make run
-
Build the webhook container image.
make docker-build-webhook
-
Install the webhook.
make deploy-webhook
-
Apply desired pod presets as needed, example given below.
kubectl create -f config/samples/apod-preset.yaml
kubectl create -f config/samples/apod.yaml
PodPresets has had a long history in various forms throughout its alpha life (it's still alpha). As of August 2018, the PodPreset resource still exists in the Kubernetes core, but is planned to be superceded by the code here.
The Makefile utilizes pre-generated certificates for use with the mutating webhook. An example script that generates new certificates is located in webhook/pki/gen-certs.sh. The cabundle patch file needs to be adjusted accordingly afterwards, unless the deployment file is used directly.
This repository is only one piece required for full integration with Service Catalog. Also review the podpresetbinding-crd repository for functionality that auto-generates pod presets upon service bindings being ready.
Until the podpresetbinding-crd work is complete, this repo will likely undergo force pushes to add additional necessary changes.