Skip to content

Commit

Permalink
Add CRD conversion webhook and move example
Browse files Browse the repository at this point in the history
- Add CRD conversion webhook pkg
- Move example to harvester/webhook-sample
  • Loading branch information
yaocw2020 authored and guangbochen committed May 11, 2023
1 parent 0dac506 commit a15c5da
Show file tree
Hide file tree
Showing 22 changed files with 443 additions and 557 deletions.
3 changes: 0 additions & 3 deletions Dockerfile

This file was deleted.

10 changes: 0 additions & 10 deletions Makefile

This file was deleted.

13 changes: 2 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
# webhook

Inspired by [rancher webhook](https://github.com/rancher/webhook) and [harvester webhook](https://github.com/harvester/harvester/tree/master/pkg/webhook), it's a framework for developing a Kubernetes webhook easily.
Developers need to only implement a validator or mutator interface and register it to the webhook server.
Developers need to only implement interface and register it to the webhook server. It supports validator, mutator and CRD conversion webhook.

## Example
The example implements a simple pod validator and pod mutator.
- pod validator: log when a pod is deleted.
- pod mutator: add label `example:example` when a pod is created.

### How to deploy
```shell
export KUBECONFIG=<your kubeconfig>
make apply
```
Go to [harvester/webhook-sample](https://github.com/harvester/webhook-sample) to look a simple example.
54 changes: 0 additions & 54 deletions example/admitter/mutator.go

This file was deleted.

43 changes: 0 additions & 43 deletions example/admitter/validator.go

This file was deleted.

118 changes: 0 additions & 118 deletions example/main.go

This file was deleted.

41 changes: 0 additions & 41 deletions example/manifests/deployment.yaml

This file was deleted.

36 changes: 0 additions & 36 deletions example/manifests/rbac.yaml

This file was deleted.

18 changes: 0 additions & 18 deletions example/manifests/service.yaml

This file was deleted.

Loading

0 comments on commit a15c5da

Please sign in to comment.