Categorygithub.com/Becram/kubernetes-webhook
modulepackage
0.0.0-20220508073851-a45707509779
Repository: https://github.com/becram/kubernetes-webhook.git
Documentation: pkg.go.dev

# README

#Kubernetes Webhook

USAGE:

##Create Cluster

First, we need to create a Kubernetes cluster:

āÆ make cluster

šŸ”§ Creating Kubernetes cluster...
kind create cluster --config dev/manifests/kind/kind.cluster.yaml
Creating cluster "kind" ...
 āœ“ Ensuring node image (kindest/node:v1.21.1) šŸ–¼
 āœ“ Preparing nodes šŸ“¦
 āœ“ Writing configuration šŸ“œ
 āœ“ Starting control-plane šŸ•¹ļø
 āœ“ Installing CNI šŸ”Œ
 āœ“ Installing StorageClass šŸ’¾
Set kubectl context to "kind-kind"
You can now use your cluster with:

kubectl cluster-info --context kind-kind

Have a nice day! šŸ‘‹

##Deploy Admission Webhook

āÆ make deploy

šŸ“¦ Building kubernetes-webhook Docker image...
docker build -t kubernetes-webhook:1.0 . 
                                        
Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them

šŸ“¦ Pushing admission-webhook image into Kind's Docker daemon...
kind load docker-image kubernetes-webhook:1.0
Image: "kubernetes-webhook:1.0" with ID "sha256:1358caa0f5bc712f4f431a58c033c84194e74971e7749122d97401942f38729b" not yet present on node "kind-control-plane", loading...

ā™»ļø  Deleting kubernetes-webhook deployment if existing...
kubectl delete -f dev/manifests/webhook/ || true
deployment.apps "kubernetes-webhook" deleted
service "kubernetes-webhook" deleted
secret "kubernetes-webhook-tls" deleted

āš™ļø  Applying cluster config...
kubectl apply -f dev/manifests/cluster-config/
namespace/apps unchanged
mutatingwebhookconfiguration.admissionregistration.k8s.io/kubernetes-webhook.acme.com configured
validatingwebhookconfiguration.admissionregistration.k8s.io/kubernetes-webhook.acme.com configured

šŸš€ Deploying kubernetes-webhook...
kubectl apply -f dev/manifests/webhook/
deployment.apps/kubernetes-webhook created
service/kubernetes-webhook created
secret/kubernetes-webhook-tls created

##Deploying Pods

āÆ make pod
šŸš€ Deploying test pod...
kubectl apply -f dev/manifests/pods/test-pod.yaml
pod/test-pod created

#View Webhook service logs

āÆ make logs

#THANK YOU

# Packages

No description provided by the author

# Functions

ServeHealth returns 200 when things are good.
ServeMutatePods returns an admission review with pod mutations as a json patch in the review response.
ServeValidatePods validates an admission request and then writes an admission review to `w`.