Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions changelog/fragments/go-v3-alpha.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
entries:
- description: >
(go/v2) bumped controller-runtime from v0.6.3 to v0.6.4
kind: change
migration:
header: Go projects should update their controller-runtime version to v0.6.4
body: >
In your go.mod file, update the sigs.k8s.io/controller-runtime version to v0.6.4
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ require (
rsc.io/letsencrypt v0.0.3 // indirect
sigs.k8s.io/controller-runtime v0.7.0-alpha.7
sigs.k8s.io/controller-tools v0.3.0
sigs.k8s.io/kubebuilder/v2 v2.3.2-0.20201111001842-c158f4fa4207
sigs.k8s.io/kubebuilder/v2 v2.3.2-0.20201204230216-593f2e80cdf6
sigs.k8s.io/yaml v1.2.0
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1361,8 +1361,8 @@ sigs.k8s.io/controller-runtime v0.7.0-alpha.7 h1:KtMmb2Ef/S38GNbf0Jpa+FWXqnxFYeW
sigs.k8s.io/controller-runtime v0.7.0-alpha.7/go.mod h1:pJ3YBrJiAqMAZKi6UVGuE98ZrroV1p+pIhoHsMm9wdU=
sigs.k8s.io/controller-tools v0.3.0 h1:y3YD99XOyWaXkiF1kd41uRvfp/64teWcrEZFuHxPhJ4=
sigs.k8s.io/controller-tools v0.3.0/go.mod h1:enhtKGfxZD1GFEoMgP8Fdbu+uKQ/cq1/WGJhdVChfvI=
sigs.k8s.io/kubebuilder/v2 v2.3.2-0.20201111001842-c158f4fa4207 h1:JtlaBrtWymJbh6ea+TJUZkzBb0x0dMKV+P0+ZPaldxk=
sigs.k8s.io/kubebuilder/v2 v2.3.2-0.20201111001842-c158f4fa4207/go.mod h1:J/D/179LBZhQOhRvmMRNbje/Bk+PjbN0/fzUupmO7+U=
sigs.k8s.io/kubebuilder/v2 v2.3.2-0.20201204230216-593f2e80cdf6 h1:SE+xhj4aauOCSeZKjRizd6VwHgkVfJABJpVk/xqYTiI=
sigs.k8s.io/kubebuilder/v2 v2.3.2-0.20201204230216-593f2e80cdf6/go.mod h1:J/D/179LBZhQOhRvmMRNbje/Bk+PjbN0/fzUupmO7+U=
sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbLXqhyOyX0=
sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU=
sigs.k8s.io/structured-merge-diff/v3 v3.0.0-20200116222232-67a7b8c61874/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw=
Expand Down
4 changes: 2 additions & 2 deletions hack/generate/samples/generate_testdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
log "github.com/sirupsen/logrus"

"github.com/operator-framework/operator-sdk/hack/generate/samples/internal/ansible"
gosamples "github.com/operator-framework/operator-sdk/hack/generate/samples/internal/go"
golang "github.com/operator-framework/operator-sdk/hack/generate/samples/internal/go"
"github.com/operator-framework/operator-sdk/hack/generate/samples/internal/helm"
"github.com/operator-framework/operator-sdk/internal/testutils"
)
Expand Down Expand Up @@ -54,5 +54,5 @@ func main() {
ansible.GenerateMemcachedAnsibleSample(samplesPath)

log.Infof("creating Go Memcached Sample with Webhooks")
gosamples.GenerateMemcachedGoWithWebhooksSample(samplesPath)
golang.GenerateMemcachedGoWithWebhooksSample(samplesPath)
}
27 changes: 27 additions & 0 deletions hack/generate/samples/internal/go/generate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2020 The Operator-SDK Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package pkg

import (
"path/filepath"

golangv2 "github.com/operator-framework/operator-sdk/hack/generate/samples/internal/go/v2"
golangv3 "github.com/operator-framework/operator-sdk/hack/generate/samples/internal/go/v3"
)

func GenerateMemcachedGoWithWebhooksSample(rootPath string) {
golangv2.GenerateMemcachedGoWithWebhooksSample(filepath.Join(rootPath, "go", "v2"))
golangv3.GenerateMemcachedGoWithWebhooksSample(filepath.Join(rootPath, "go", "v3"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package gosamples
package v2

import (
"fmt"
Expand Down Expand Up @@ -59,6 +59,7 @@ func (mh *MemcachedGoWithWebhooks) Prepare() {
func (mh *MemcachedGoWithWebhooks) Run() {
log.Infof("creating the project")
err := mh.ctx.Init(
"--plugins", "go/v2",
"--repo", "github.com/example/memcached-operator",
"--domain",
mh.ctx.Domain)
Expand Down Expand Up @@ -92,6 +93,8 @@ func (mh *MemcachedGoWithWebhooks) Run() {

mh.ctx.CreateBundle()

pkg.CheckError("formatting project", mh.ctx.Make("fmt"))

// Clean up built binaries, if any.
pkg.CheckError("cleaning up", os.RemoveAll(filepath.Join(mh.ctx.Dir, "bin")))
}
Expand Down Expand Up @@ -410,7 +413,8 @@ const watchCustomizedFragment = `return ctrl.NewControllerManagedBy(mgr).
Complete(r)
`

const webhooksFragment = `// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
const webhooksFragment = `
// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
// +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

var _ webhook.Validator = &Memcached{}
Expand Down
Loading