Skip to content

Commit 81a6cb3

Browse files
authored
Merge pull request #1804 from estroz/deps/c-r-v0.7.0
⚠ (go/v3-alpha) deps: bump controller-runtime to v0.7.0-alpha.6
2 parents b6a0bf1 + 522fbf8 commit 81a6cb3

31 files changed

+108
-92
lines changed

pkg/plugin/v3/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import (
4040
// KbDeclarativePatternVersion is the sigs.k8s.io/kubebuilder-declarative-pattern version
4141
// (used only to gen api with --pattern=addon)
4242
// TODO: remove this when a better solution for using addons is implemented.
43-
const KbDeclarativePatternVersion = "v0.0.0-20200522144838-848d48e5b073"
43+
const KbDeclarativePatternVersion = "1cbf859290cab81ae8e73fc5caebe792280175d1"
4444

4545
// DefaultMainPath is default file path of main.go
4646
const DefaultMainPath = "main.go"

pkg/plugin/v3/scaffolds/init.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import (
3737

3838
const (
3939
// ControllerRuntimeVersion is the kubernetes-sigs/controller-runtime version to be used in the project
40-
ControllerRuntimeVersion = "v0.6.3"
40+
ControllerRuntimeVersion = "v0.7.0-alpha.6"
4141
// ControllerToolsVersion is the kubernetes-sigs/controller-tools version to be used in the project
4242
ControllerToolsVersion = "v0.4.0"
4343
// KustomizeVersion is the kubernetes-sigs/kustomize version to be used in the project

pkg/plugin/v3/scaffolds/internal/templates/api/webhook_suitetest.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ const (
120120
package {{ .Resource.Version }}
121121
122122
import (
123+
"context"
123124
"path/filepath"
124125
"testing"
125126
"fmt"
@@ -144,7 +145,8 @@ import (
144145
var cfg *rest.Config
145146
var k8sClient client.Client
146147
var testEnv *envtest.Environment
147-
var stopCh = make(chan struct{})
148+
var ctx context.Context
149+
var cancel context.CancelFunc
148150
149151
func TestAPIs(t *testing.T) {
150152
RegisterFailHandler(Fail)
@@ -157,11 +159,13 @@ func TestAPIs(t *testing.T) {
157159
var _ = BeforeSuite(func() {
158160
logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))
159161
162+
ctx, cancel = context.WithCancel(context.TODO())
163+
160164
By("bootstrapping test environment")
161165
testEnv = &envtest.Environment{
162166
CRDDirectoryPaths: []string{filepath.Join({{ .BaseDirectoryRelativePath }}, "config", "crd", "bases")},
163167
WebhookInstallOptions: envtest.WebhookInstallOptions{
164-
DirectoryPaths: []string{filepath.Join({{ .BaseDirectoryRelativePath }}, "config", "webhook")},
168+
Paths: []string{filepath.Join({{ .BaseDirectoryRelativePath }}, "config", "webhook")},
165169
},
166170
}
167171
@@ -174,7 +178,7 @@ var _ = BeforeSuite(func() {
174178
Expect(err).NotTo(HaveOccurred())
175179
176180
%s
177-
181+
178182
k8sClient, err = client.New(cfg, client.Options{Scheme: scheme})
179183
Expect(err).NotTo(HaveOccurred())
180184
Expect(k8sClient).NotTo(BeNil())
@@ -194,7 +198,7 @@ var _ = BeforeSuite(func() {
194198
%s
195199
196200
go func() {
197-
err = mgr.Start(stopCh)
201+
err = mgr.Start(ctx)
198202
if err != nil {
199203
Expect(err).NotTo(HaveOccurred())
200204
}
@@ -215,7 +219,7 @@ var _ = BeforeSuite(func() {
215219
}, 60)
216220
217221
var _ = AfterSuite(func() {
218-
close(stopCh)
222+
cancel()
219223
By("tearing down the test environment")
220224
err := testEnv.Stop()
221225
Expect(err).NotTo(HaveOccurred())

pkg/plugin/v3/scaffolds/internal/templates/controllers/controller.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,7 @@ type {{ .Resource.Kind }}Reconciler struct {
9898
//
9999
// For more details, check Reconcile and its Result here:
100100
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@{{ .ControllerRuntimeVersion }}/pkg/reconcile
101-
func (r *{{ .Resource.Kind }}Reconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
102-
_ = context.Background()
101+
func (r *{{ .Resource.Kind }}Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
103102
_ = r.Log.WithValues("{{ .Resource.Kind | lower }}", req.NamespacedName)
104103
105104
// your logic here

testdata/project-v3-addon/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ all: manager
1717
ENVTEST_ASSETS_DIR=$(shell pwd)/testbin
1818
test: generate fmt vet manifests
1919
mkdir -p ${ENVTEST_ASSETS_DIR}
20-
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.6.3/hack/setup-envtest.sh
20+
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.7.0-alpha.6/hack/setup-envtest.sh
2121
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./... -coverprofile cover.out
2222

2323
# Build manager binary

testdata/project-v3-addon/config/crd/bases/crew.testproject.org_admirals.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ spec:
5858
type: array
5959
healthy:
6060
type: boolean
61+
phase:
62+
type: string
6163
required:
6264
- healthy
6365
type: object

testdata/project-v3-addon/config/crd/bases/crew.testproject.org_captains.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ spec:
5858
type: array
5959
healthy:
6060
type: boolean
61+
phase:
62+
type: string
6163
required:
6264
- healthy
6365
type: object

testdata/project-v3-addon/config/crd/bases/crew.testproject.org_firstmates.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ spec:
5858
type: array
5959
healthy:
6060
type: boolean
61+
phase:
62+
type: string
6163
required:
6264
- healthy
6365
type: object

testdata/project-v3-addon/go.mod

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ module sigs.k8s.io/kubebuilder/testdata/project-v3-addon
33
go 1.15
44

55
require (
6-
github.com/go-logr/logr v0.1.0
7-
github.com/onsi/ginkgo v1.12.1
8-
github.com/onsi/gomega v1.10.1
9-
k8s.io/apimachinery v0.18.6
10-
k8s.io/client-go v0.18.6
11-
sigs.k8s.io/controller-runtime v0.6.3
12-
sigs.k8s.io/kubebuilder-declarative-pattern v0.0.0-20200522144838-848d48e5b073
6+
github.com/go-logr/logr v0.2.1
7+
github.com/onsi/ginkgo v1.14.1
8+
github.com/onsi/gomega v1.10.2
9+
k8s.io/apimachinery v0.19.2
10+
k8s.io/client-go v0.19.2
11+
sigs.k8s.io/controller-runtime v0.7.0-alpha.6
12+
sigs.k8s.io/kubebuilder-declarative-pattern v0.0.0-20201109180626-1cbf859290ca
1313
)

testdata/project-v3-multigroup/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ all: manager
1717
ENVTEST_ASSETS_DIR=$(shell pwd)/testbin
1818
test: generate fmt vet manifests
1919
mkdir -p ${ENVTEST_ASSETS_DIR}
20-
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.6.3/hack/setup-envtest.sh
20+
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.7.0-alpha.6/hack/setup-envtest.sh
2121
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./... -coverprofile cover.out
2222

2323
# Build manager binary

0 commit comments

Comments
 (0)