# Development Guide

# Pre-requisites

Access to Kubernetes cluster

First of all, you will need access to a Kubernetes cluster. The easiest way to start is minikube.

Tools to build K8s Vault Webhook

Apart from kubernetes cluster, there are some tools which are needed to build and test k8s-vault-webhook.

# Build

Build Localy

To achieve this, execute this command:-

make build-code

Build Image

k8s-vault-webhook gets packaged as a container image for running on Kubernetes cluster. These instructions will guide you to build image.

make build-image

# Testing

If you want to play it on Kubernetes. You can use minikube.

#Start minikube
$ minikube start --vm-driver virtualbox
...
๐Ÿ˜„  minikube v1.0.1 on linux (amd64)
๐Ÿคน  Downloading Kubernetes v1.14.1 images in the background ...
๐Ÿ”ฅ  Creating kvm2 VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
๐Ÿ“ถ  "minikube" IP address is 192.168.39.240
๐Ÿณ  Configuring Docker as the container runtime ...
๐Ÿณ  Version of container runtime is 18.06.3-ce
โŒ›  Waiting for image downloads to complete ...
โœจ  Preparing Kubernetes environment ...
๐Ÿšœ  Pulling images required by Kubernetes v1.14.1 ...
๐Ÿš€  Launching Kubernetes v1.14.1 using kube๐Ÿ˜„  minikube v1.0.1 on linux (amd64)
๐Ÿคน  Downloading Kubernetes v1.14.1 images in the background ...
๐Ÿ”ฅ  Creating kvm2 VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
๐Ÿ“ถ  "minikube" IP address is 192.168.39.240
๐Ÿณ  Configuring Docker as the container runtime ...
๐Ÿณ  Version of container runtime is 18.06.3-ce
โŒ›  Waiting for image downloads to complete ...
โœจ  Preparing Kubernetes environment ...
๐Ÿšœ  Pulling images required by Kubernetes v1.14.1 ...
๐Ÿš€  Launching Kubernetes v1.14.1 using kubeadm ... 
โŒ›  Waiting for pods: apiserver proxy etcd scheduler controller dns
๐Ÿ”‘  Configuring cluster permissions ...
๐Ÿค”  Verifying component health .....
๐Ÿ’—  kubectl is now configured to use "minikube"
๐Ÿ„  Done! Thank you for using minikube!adm ... 
โŒ›  Waiting for pods: apiserver proxy etcd scheduler controller dns
๐Ÿ”‘  Configuring cluster permissions ...
๐Ÿค”  Verifying component health .....
๐Ÿ’—  kubectl is now configured to use "minikube"
๐Ÿ„  Done! Thank you for using minikube!
#Deploy the image on minikube
$ helm upgrade k8s-vault-webhook \
    ot-helm/k8s-vault-webhook --namespace vault --install
...
Release "k8s-vault-webhook" has been upgraded. Happy Helming!
NAME: k8s-vault-webhook
LAST DEPLOYED: Mon May  3 19:55:03 2021
NAMESPACE: vault
STATUS: deployed
REVISION: 2
TEST SUITE: None

Running Test Cases

make test