Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add MVP implementation #1

Merged
merged 9 commits into from
Mar 23, 2022
Merged

feat: add MVP implementation #1

merged 9 commits into from
Mar 23, 2022

Conversation

martinohmann
Copy link
Member

@martinohmann martinohmann commented Mar 22, 2022

This PR provides an initial implementation for the webhook. The core logic in pkg/admission/handler.go has a test coverage of > 95%.

The general structure of this webhook roughly follows the example from the controller-runtime repository: https://github.com/kubernetes-sigs/controller-runtime/tree/master/examples/builtins

The webhook reads its configuration from a config.yaml file. You can find an example config at config.sample.yaml.

What's not included in this PR and will be added in followups to keep this change reviewable:

  • Config validation needs to be added to make the webhook fail to start with a helpful error when the config is invalid
  • GitHub Action to build docker images and push them to dockerhub (or ghcr.io, or both 😉 ) when a new tag is pushed
  • Helm Chart and helm repo setup via https://github.com/helm/chart-releaser-action
  • Documentation for usage and deployment instructions
  • Nice-to-have: more configuration options. For example instead of just matching images based on prefixes we could also support regexp matching and the usage of capture groups in the replacement pattern to make this more flexible

The initial logic was slightly wrong as it was missing a call to `defer
file.Close()` which is not needed anymore after the change.
@martinohmann martinohmann merged commit 4c084a9 into main Mar 23, 2022
@martinohmann martinohmann deleted the create-webhook branch March 23, 2022 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants