Skip to content

Commit

Permalink
Kaw 0.12.0 (#234)
Browse files Browse the repository at this point in the history
* Bump kaw to 0.12.0

Signed-off-by: Quique Llorente <[email protected]>

* Adapt to kaw 0.12.0

Signed-off-by: Quique Llorente <[email protected]>
  • Loading branch information
qinqon authored Jul 28, 2020
1 parent 7728339 commit a47cfca
Show file tree
Hide file tree
Showing 12 changed files with 495 additions and 118 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/onsi/gomega v1.8.1
github.com/pkg/errors v0.9.1
github.com/prometheus/procfs v0.0.8 // indirect
github.com/qinqon/kube-admission-webhook v0.11.0
github.com/qinqon/kube-admission-webhook v0.12.0
k8s.io/api v0.18.2
k8s.io/apimachinery v0.18.2
k8s.io/client-go v12.0.0+incompatible
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,8 @@ github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+Gx
github.com/prometheus/prometheus v2.3.2+incompatible/go.mod h1:oAIUtOny2rjMX0OWN5vPR5/q/twIROJvdqnQKDdil/s=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/prometheus/tsdb v0.8.0/go.mod h1:fSI0j+IUQrDd7+ZtR9WKIGtoYAYAJUKcKhYLG25tN4g=
github.com/qinqon/kube-admission-webhook v0.11.0 h1:rQMjl+ClHwea8yy+8R4B8Iibd5Bsnn3zJiuNAPY2BMs=
github.com/qinqon/kube-admission-webhook v0.11.0/go.mod h1:VX4R05NoFy8Tm/571Dg0GIjTvhFEsTe7QLYdKuuTfrE=
github.com/qinqon/kube-admission-webhook v0.12.0 h1:5VLcdJo7JWjIhjqjrLZT/ry80J7/sZ83EUmTPFeXIGQ=
github.com/qinqon/kube-admission-webhook v0.12.0/go.mod h1:VX4R05NoFy8Tm/571Dg0GIjTvhFEsTe7QLYdKuuTfrE=
github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc=
Expand Down
2 changes: 1 addition & 1 deletion pkg/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (k *KubeMacPoolManager) Run(rangeStart, rangeEnd net.HardwareAddr) error {
}

log.Info("Setting up webhooks")
err = webhook.AddToManager(k.runtimeManager, poolManager)
err = webhook.AddToManager(k.podNamespace, k.runtimeManager, poolManager)
if err != nil {
return errors.Wrap(err, "unable to register webhooks to the manager")
}
Expand Down
15 changes: 12 additions & 3 deletions pkg/webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,25 @@ const (
var AddToWebhookFuncs []func(*webhookserver.Server, *pool_manager.PoolManager) error

// AddToManager adds all Controllers to the Manager
func AddToManager(mgr manager.Manager, poolManager *pool_manager.PoolManager) error {
s := webhookserver.New(mgr.GetClient(), names.MUTATE_WEBHOOK_CONFIG, certificate.MutatingWebhook, certificate.OneYearDuration, webhookserver.WithPort(WebhookServerPort))
func AddToManager(namespace string, mgr manager.Manager, poolManager *pool_manager.PoolManager) error {
certOptions := certificate.Options{
Namespace: namespace,
WebhookName: names.MUTATE_WEBHOOK_CONFIG,
WebhookType: certificate.MutatingWebhook,
CARotateInterval: certificate.OneYearDuration,
}
s, err := webhookserver.New(mgr.GetClient(), certOptions, webhookserver.WithPort(WebhookServerPort))
if err != nil {
return errors.Wrap(err, "failed creating new webhook server")
}

for _, f := range AddToWebhookFuncs {
if err := f(s, poolManager); err != nil {
return err
}
}

err := s.Add(mgr)
err = s.Add(mgr)
if err != nil {
return errors.Wrap(err, "failed adding webhook server to manager")
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a47cfca

Please sign in to comment.