Skip to content

Commit 1ad6ff3

Browse files
author
Eric Stroczynski
authored
*: upgrade kubebuilder, add go/v3-alpha to the list of available plugins (#4282)
go.mod: upgrade kubebuilder to latest master commit internal/came/operator-sdk: add go/v3-alpha to the list of available plugins testdata: update v2 samples and add v3 samples test: test go/v3-alpha
1 parent 6341c41 commit 1ad6ff3

File tree

165 files changed

+4009
-230
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+4009
-230
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
entries:
2+
- description: >
3+
(go/v2) bumped controller-runtime from v0.6.3 to v0.6.4
4+
kind: change
5+
migration:
6+
header: Go projects should update their controller-runtime version to v0.6.4
7+
body: >
8+
In your go.mod file, update the sigs.k8s.io/controller-runtime version to v0.6.4

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ require (
3434
rsc.io/letsencrypt v0.0.3 // indirect
3535
sigs.k8s.io/controller-runtime v0.7.0-alpha.7
3636
sigs.k8s.io/controller-tools v0.3.0
37-
sigs.k8s.io/kubebuilder/v2 v2.3.2-0.20201111001842-c158f4fa4207
37+
sigs.k8s.io/kubebuilder/v2 v2.3.2-0.20201204230216-593f2e80cdf6
3838
sigs.k8s.io/yaml v1.2.0
3939
)
4040

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,8 +1361,8 @@ sigs.k8s.io/controller-runtime v0.7.0-alpha.7 h1:KtMmb2Ef/S38GNbf0Jpa+FWXqnxFYeW
13611361
sigs.k8s.io/controller-runtime v0.7.0-alpha.7/go.mod h1:pJ3YBrJiAqMAZKi6UVGuE98ZrroV1p+pIhoHsMm9wdU=
13621362
sigs.k8s.io/controller-tools v0.3.0 h1:y3YD99XOyWaXkiF1kd41uRvfp/64teWcrEZFuHxPhJ4=
13631363
sigs.k8s.io/controller-tools v0.3.0/go.mod h1:enhtKGfxZD1GFEoMgP8Fdbu+uKQ/cq1/WGJhdVChfvI=
1364-
sigs.k8s.io/kubebuilder/v2 v2.3.2-0.20201111001842-c158f4fa4207 h1:JtlaBrtWymJbh6ea+TJUZkzBb0x0dMKV+P0+ZPaldxk=
1365-
sigs.k8s.io/kubebuilder/v2 v2.3.2-0.20201111001842-c158f4fa4207/go.mod h1:J/D/179LBZhQOhRvmMRNbje/Bk+PjbN0/fzUupmO7+U=
1364+
sigs.k8s.io/kubebuilder/v2 v2.3.2-0.20201204230216-593f2e80cdf6 h1:SE+xhj4aauOCSeZKjRizd6VwHgkVfJABJpVk/xqYTiI=
1365+
sigs.k8s.io/kubebuilder/v2 v2.3.2-0.20201204230216-593f2e80cdf6/go.mod h1:J/D/179LBZhQOhRvmMRNbje/Bk+PjbN0/fzUupmO7+U=
13661366
sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbLXqhyOyX0=
13671367
sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU=
13681368
sigs.k8s.io/structured-merge-diff/v3 v3.0.0-20200116222232-67a7b8c61874/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw=

hack/generate/samples/generate_testdata.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
log "github.com/sirupsen/logrus"
2323

2424
"github.com/operator-framework/operator-sdk/hack/generate/samples/internal/ansible"
25-
gosamples "github.com/operator-framework/operator-sdk/hack/generate/samples/internal/go"
25+
golang "github.com/operator-framework/operator-sdk/hack/generate/samples/internal/go"
2626
"github.com/operator-framework/operator-sdk/hack/generate/samples/internal/helm"
2727
"github.com/operator-framework/operator-sdk/internal/testutils"
2828
)
@@ -54,5 +54,5 @@ func main() {
5454
ansible.GenerateMemcachedAnsibleSample(samplesPath)
5555

5656
log.Infof("creating Go Memcached Sample with Webhooks")
57-
gosamples.GenerateMemcachedGoWithWebhooksSample(samplesPath)
57+
golang.GenerateMemcachedGoWithWebhooksSample(samplesPath)
5858
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2020 The Operator-SDK Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package pkg
16+
17+
import (
18+
"path/filepath"
19+
20+
golangv2 "github.com/operator-framework/operator-sdk/hack/generate/samples/internal/go/v2"
21+
golangv3 "github.com/operator-framework/operator-sdk/hack/generate/samples/internal/go/v3"
22+
)
23+
24+
func GenerateMemcachedGoWithWebhooksSample(rootPath string) {
25+
golangv2.GenerateMemcachedGoWithWebhooksSample(filepath.Join(rootPath, "go", "v2"))
26+
golangv3.GenerateMemcachedGoWithWebhooksSample(filepath.Join(rootPath, "go", "v3"))
27+
}

hack/generate/samples/internal/go/memcached_with_webhooks.go renamed to hack/generate/samples/internal/go/v2/memcached_with_webhooks.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package gosamples
15+
package v2
1616

1717
import (
1818
"fmt"
@@ -59,6 +59,7 @@ func (mh *MemcachedGoWithWebhooks) Prepare() {
5959
func (mh *MemcachedGoWithWebhooks) Run() {
6060
log.Infof("creating the project")
6161
err := mh.ctx.Init(
62+
"--plugins", "go/v2",
6263
"--repo", "github.com/example/memcached-operator",
6364
"--domain",
6465
mh.ctx.Domain)
@@ -92,6 +93,8 @@ func (mh *MemcachedGoWithWebhooks) Run() {
9293

9394
mh.ctx.CreateBundle()
9495

96+
pkg.CheckError("formatting project", mh.ctx.Make("fmt"))
97+
9598
// Clean up built binaries, if any.
9699
pkg.CheckError("cleaning up", os.RemoveAll(filepath.Join(mh.ctx.Dir, "bin")))
97100
}
@@ -410,7 +413,8 @@ const watchCustomizedFragment = `return ctrl.NewControllerManagedBy(mgr).
410413
Complete(r)
411414
`
412415

413-
const webhooksFragment = `// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
416+
const webhooksFragment = `
417+
// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
414418
// +kubebuilder:webhook:verbs=create;update,path=/validate-cache-example-com-v1alpha1-memcached,mutating=false,failurePolicy=fail,groups=cache.example.com,resources=memcacheds,versions=v1alpha1,name=vmemcached.kb.io
415419
416420
var _ webhook.Validator = &Memcached{}

0 commit comments

Comments
 (0)