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

🏃 ff release-0.2 to master #507

Merged
merged 21 commits into from
Jun 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
3f9a825
Pass appropriate context to leaderelector.Run
mrkm4ntr Apr 15, 2019
ce521f8
metrics: migrate workqueue provider to v1.14 removing deprecated metrics
abursavich May 19, 2019
d708e3d
Merge pull request #437 from abursavich/queuemetrics
k8s-ci-robot Jun 7, 2019
056a18a
Merge pull request #398 from mrkm4ntr/leaderelector-context
k8s-ci-robot Jun 7, 2019
df54457
:book: minor updates to the examples
Jun 10, 2019
0d3fbbc
:sparkles: make UseExistingCluster a pointer to support explicitly op…
adohe Jun 11, 2019
386a7bd
Merge pull request #463 from adohe/make_useexistingcluster_pointer
k8s-ci-robot Jun 11, 2019
f99287c
Merge pull request #482 from mengqiy/builtinexample
k8s-ci-robot Jun 11, 2019
3547c6c
:bug: stop registering webhooks with same path when adding multiple c…
Jun 11, 2019
e826e01
Merge pull request #486 from mengqiy/multicontroller
k8s-ci-robot Jun 19, 2019
8ad94f4
Fix runtime/scheme type aliases
DirectXMan12 Jun 19, 2019
3bc1570
Merge pull request #494 from DirectXMan12/bug/fix-runtime-scheme-alias
k8s-ci-robot Jun 19, 2019
4c27c48
Fix typo
ialidzhikov Jun 23, 2019
cc64c08
update jsonpatch
kdada Jun 25, 2019
71cdf35
Merge pull request #499 from kdada/master
k8s-ci-robot Jun 26, 2019
d36a00e
:warning: split the webhook builder out as a separate builder.
Jun 24, 2019
37842af
:running: fix go modules checksum mismatch
Jun 27, 2019
bace658
Merge pull request #497 from mengqiy/newwebhook
k8s-ci-robot Jun 27, 2019
0f2e574
:sparkles: enable conversion webhook in webhook builder
droot Jun 27, 2019
21c5daf
Merge pull request #504 from droot/feature/enable-conversion-webhook
k8s-ci-robot Jun 28, 2019
b5e34e4
Merge pull request #496 from ialidzhikov/fix-typo
k8s-ci-robot Jun 28, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@
*.swp
*.swo
*~

# Vscode files
.vscode
18 changes: 9 additions & 9 deletions Gopkg.lock

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

3 changes: 3 additions & 0 deletions alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ var (
// NewControllerManagedBy returns a new controller builder that will be started by the provided Manager
NewControllerManagedBy = builder.ControllerManagedBy

// NewWebhookManagedBy returns a new webhook builder that will be started by the provided Manager
NewWebhookManagedBy = builder.WebhookManagedBy

// NewManager returns a new Manager for creating Controllers.
NewManager = manager.New

Expand Down
13 changes: 3 additions & 10 deletions examples/builtins/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,11 @@ func main() {

// Setup webhooks
entryLog.Info("setting up webhook server")
hookServer := &webhook.Server{
Port: 9876,
CertDir: "/tmp/cert",
}
if err := mgr.Add(hookServer); err != nil {
entryLog.Error(err, "unable register webhook server with manager")
os.Exit(1)
}
hookServer := mgr.GetWebhookServer()

entryLog.Info("registering webhooks to the webhook server")
hookServer.Register("/mutate-pods", &webhook.Admission{Handler: &podAnnotator{}})
hookServer.Register("/validate-pods", &webhook.Admission{Handler: &podValidator{}})
hookServer.Register("/mutate-v1-pod", &webhook.Admission{Handler: &podAnnotator{}})
hookServer.Register("/validate-v1-pod", &webhook.Admission{Handler: &podValidator{}})

entryLog.Info("starting manager")
if err := mgr.Start(signals.SetupSignalHandler()); err != nil {
Expand Down
2 changes: 2 additions & 0 deletions examples/builtins/mutatingwebhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

// +kubebuilder:webhook:path=/mutate-v1-pod,mutating=true,failurePolicy=fail,groups="",resources=pods,verbs=create;update,versions=v1,name=mpod.kb.io

// podAnnotator annotates Pods
type podAnnotator struct {
client client.Client
Expand Down
2 changes: 2 additions & 0 deletions examples/builtins/validatingwebhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

// +kubebuilder:webhook:path=/validate-v1-pod,mutating=false,failurePolicy=fail,groups="",resources=pods,verbs=create;update,versions=v1,name=vpod.kb.io

// podValidator validates Pods
type podValidator struct {
client client.Client
Expand Down
25 changes: 0 additions & 25 deletions examples/conversion/pkg/apis/addtoscheme_jobs_v1.go

This file was deleted.

25 changes: 0 additions & 25 deletions examples/conversion/pkg/apis/addtoscheme_jobs_v2.go

This file was deleted.

32 changes: 0 additions & 32 deletions examples/conversion/pkg/apis/apis.go

This file was deleted.

22 changes: 0 additions & 22 deletions examples/conversion/pkg/apis/jobs/v1/doc.go

This file was deleted.

22 changes: 0 additions & 22 deletions examples/conversion/pkg/apis/jobs/v2/doc.go

This file was deleted.

9 changes: 8 additions & 1 deletion examples/crd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,19 @@ func main() {
Client: mgr.GetClient(),
scheme: mgr.GetScheme(),
})

if err != nil {
setupLog.Error(err, "unable to create controller")
os.Exit(1)
}

err = ctrl.NewWebhookManagedBy(mgr).
For(&api.ChaosPod{}).
Complete()
if err != nil {
setupLog.Error(err, "unable to create webhook")
os.Exit(1)
}

setupLog.Info("starting manager")
if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {
setupLog.Error(err, "problem running manager")
Expand Down
4 changes: 2 additions & 2 deletions examples/crd/pkg/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ type ChaosPodList struct {
Items []ChaosPod `json:"items"`
}

// +kubebuilder:webhook:failurePolicy=fail,groups=chaosapps.metamagical.io,resources=chaospods,verbs=create;update,versions=v1,name=vchaospod.kb.io,path=/validate-chaosapps-metamagical-io-v1-chaospod,mutating=false
// +kubebuilder:webhook:path=/validate-chaosapps-metamagical-io-v1-chaospod,mutating=false,failurePolicy=fail,groups=chaosapps.metamagical.io,resources=chaospods,verbs=create;update,versions=v1,name=vchaospod.kb.io

var _ webhook.Validator = &ChaosPod{}

Expand Down Expand Up @@ -93,7 +93,7 @@ func (c *ChaosPod) ValidateUpdate(old runtime.Object) error {
return nil
}

// +kubebuilder:webhook:failurePolicy=fail,groups=chaosapps.metamagical.io,resources=chaospods,verbs=create;update,versions=v1,name=mchaospod.kb.io,path=/mutate-chaosapps-metamagical-io-v1-chaospod,mutating=true
// +kubebuilder:webhook:path=/mutate-chaosapps-metamagical-io-v1-chaospod,mutating=true,failurePolicy=fail,groups=chaosapps.metamagical.io,resources=chaospods,verbs=create;update,versions=v1,name=mchaospod.kb.io

var _ webhook.Defaulter = &ChaosPod{}

Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ go 1.11

require (
cloud.google.com/go v0.26.0 // indirect
github.com/appscode/jsonpatch v0.0.0-20190108182946-7c0e3b262f30
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 // indirect
github.com/evanphx/json-patch v4.1.0+incompatible
github.com/evanphx/json-patch v4.5.0+incompatible
github.com/go-logr/logr v0.1.0
github.com/go-logr/zapr v0.1.0
github.com/gogo/protobuf v1.1.1 // indirect
Expand All @@ -23,7 +22,6 @@ require (
github.com/onsi/ginkgo v1.6.0
github.com/onsi/gomega v1.4.2
github.com/pborman/uuid v0.0.0-20170612153648-e790cca94e6c // indirect
github.com/pkg/errors v0.8.1 // indirect
github.com/prometheus/client_golang v0.9.0
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910
github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e // indirect
Expand All @@ -36,8 +34,10 @@ require (
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be // indirect
golang.org/x/sync v0.0.0-20190423024810-112230192c58 // indirect
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2 // indirect
gomodules.xyz/jsonpatch/v2 v2.0.0
google.golang.org/appengine v1.1.0 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/fsnotify.v1 v1.4.7
gopkg.in/inf.v0 v0.9.1 // indirect
k8s.io/api v0.0.0-20190409021203-6e4e0e4f393b
k8s.io/apiextensions-apiserver v0.0.0-20190409022649-727a075fdec8
Expand Down
11 changes: 4 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
cloud.google.com/go v0.26.0 h1:e0WKqKTd5BnrG8aKH3J3h+QvEIQtSUcf2n5UZ5ZgLtQ=
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/appscode/jsonpatch v0.0.0-20190108182946-7c0e3b262f30 h1:Kn3rqvbUFqSepE2OqVu0Pn1CbDw9IuMlONapol0zuwk=
github.com/appscode/jsonpatch v0.0.0-20190108182946-7c0e3b262f30/go.mod h1:4AJxUpXUhv4N+ziTvIcWWXgeorXpxPZOfk9HdEVr96M=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/evanphx/json-patch v4.0.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/evanphx/json-patch v4.1.0+incompatible h1:K1MDoo4AZ4wU0GIU/fPmtZg7VpzLjCxu+UwBD1FvwOc=
github.com/evanphx/json-patch v4.1.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/evanphx/json-patch v4.5.0+incompatible h1:ouOWdg56aJriqS0huScTkVXPC5IcNrDCXZ6OoTAWu7M=
github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/go-logr/logr v0.1.0 h1:M1Tv3VzNlEHg6uyACnRdtrploV2P7wZqH8BoQMtz0cg=
Expand Down Expand Up @@ -63,12 +60,10 @@ github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e h1:n/3MEhJQjQxrO
github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273 h1:agujYaXJSxSo18YNX3jzl+4G6Bstwt+kqv47GS12uL0=
github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc=
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
github.com/spf13/pflag v1.0.2 h1:Fy0orTDgHdbnzHcsOgfCN4LtHf0ec3wwtiwJqwvf3Gc=
github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4=
Expand All @@ -92,6 +87,8 @@ golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2 h1:+DCIGbF/swA92ohVg0//6X2IVY3KZs6p9mix0ziNYJM=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
gomodules.xyz/jsonpatch/v2 v2.0.0 h1:OyHbl+7IOECpPKfVK42oFr6N7+Y2dR+Jsb/IiDV3hOo=
gomodules.xyz/jsonpatch/v2 v2.0.0/go.mod h1:IhYNNY4jnS53ZnfE4PAmpKtDpTCj1JFXc+3mwe7XcUU=
google.golang.org/appengine v1.1.0 h1:igQkv0AAhEIvTEpD5LIpAfav2eeVO9HBTjvKHVJPRSs=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
Loading