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

Add validating webhook controller for blueprint resource #1213

Merged
merged 9 commits into from
Feb 8, 2022
Merged

Conversation

viveksinghggits
Copy link
Contributor

@viveksinghggits viveksinghggits commented Jan 27, 2022

Change Overview

Add validaating webhook for the blueprint resources that is going to do some basic check even before the blueprint is actually created in the cluster.

Pull request type

Please check the type of change your PR introduces:

  • 🚧 Work in Progress
  • 🌈 Refactoring (no functional changes, no api changes)
  • 🐹 Trivial/Minor
  • 🐛 Bugfix
  • 🌻 Feature
  • 🗺️ Documentation
  • 🤖 Test

Issues

Test Plan

  • 💪 Manual
  • ⚡ Unit test
  • 💚 E2E

Deploy kanister from local repo and make sure invalid blueprints are not created

 » k create -f examples/stable/mysql/mysql-blueprint.yaml -n kanister
Error from server (Invalid blueprint, validation of phase restoreFromBlobStore in action restore, error: Required arg missing: command
): error when creating "examples/stable/mysql/mysql-blueprint.yaml": admission webhook "blueprints.cr.kanister.io" denied the request: Invalid blueprint, validation of phase restoreFromBlobStore in action restore, error: Required arg missing: command

Install kanister 0.72.0 and upgrade that to new changes make sure things are working.

  • Update docs

pkg/blueprint/validate/validate.go Outdated Show resolved Hide resolved
pkg/blueprint/validate/validate.go Outdated Show resolved Hide resolved
pkg/handler/handler.go Outdated Show resolved Hide resolved
pkg/handler/handler.go Outdated Show resolved Hide resolved
pkg/kancontroller/kancontroller.go Outdated Show resolved Hide resolved
@viveksinghggits viveksinghggits force-pushed the kan-val-wh branch 2 times, most recently from 69bcdb1 to d458888 Compare February 1, 2022 12:57
go.mod Show resolved Hide resolved
go.mod Show resolved Hide resolved
pkg/blueprint/validate/validate.go Outdated Show resolved Hide resolved
@pavannd1
Copy link
Contributor

pavannd1 commented Feb 3, 2022

LGTM - minor comments

This commit adds go code to add a webhook server that
does basics check on the bluerint resources when they
are created.
We are doing the only checks that we introduced as
part of #1187
In the cases if we dont want to run the webhook server in kanister
controller pod but just want to have the `healthz` endpoint and
prom endpoint in that case if we don't mount the webhook certs we
will just be running the standard http server and the webhook server.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants