Skip to content

Commit cb08356

Browse files
bump dependencies
Signed-off-by: varshaprasad96 <[email protected]>
1 parent 95ed52a commit cb08356

File tree

24 files changed

+548
-411
lines changed

24 files changed

+548
-411
lines changed

Makefile

+7-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export IMAGE_VERSION = v1.9.0
99
export SIMPLE_VERSION = $(shell (test "$(shell git describe)" = "$(shell git describe --abbrev=0)" && echo $(shell git describe)) || echo $(shell git describe --abbrev=0)+git)
1010
export GIT_VERSION = $(shell git describe --dirty --tags --always)
1111
export GIT_COMMIT = $(shell git rev-parse HEAD)
12-
export K8S_VERSION = 1.20.2
12+
export K8S_VERSION = 1.21.2
1313

1414
# Build settings
1515
export TOOLS_DIR = tools/bin
@@ -144,13 +144,16 @@ e2e_targets := test-e2e $(e2e_tests)
144144

145145
.PHONY: test-e2e-setup
146146
export KIND_CLUSTER := operator-sdk-e2e
147-
export KUBEBUILDER_ASSETS := $(PWD)/$(TOOLS_DIR)
148-
test-e2e-setup: build
147+
test-e2e-setup: build envtest
149148
$(SCRIPTS_DIR)/fetch kind 0.11.0
150-
$(SCRIPTS_DIR)/fetch envtest 0.8.3
151149
$(SCRIPTS_DIR)/fetch kubectl $(K8S_VERSION) # Install kubectl AFTER envtest because envtest includes its own kubectl binary
152150
[[ "`$(TOOLS_DIR)/kind get clusters`" =~ "$(KIND_CLUSTER)" ]] || $(TOOLS_DIR)/kind create cluster --image="kindest/node:v$(K8S_VERSION)" --name $(KIND_CLUSTER)
153151

152+
# install envtest binary
153+
envtest:
154+
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
155+
$(shell go env GOPATH)/bin/setup-envtest use -p path $(K8S_VERSION)
156+
154157
.PHONY: test-e2e-teardown
155158
test-e2e-teardown:
156159
$(SCRIPTS_DIR)/fetch kind 0.11.0

go.mod

+24-26
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,42 @@ go 1.16
55
require (
66
github.com/blang/semver/v4 v4.0.0
77
github.com/fatih/structtag v1.1.0
8-
github.com/go-logr/logr v0.3.0
8+
github.com/go-logr/logr v0.4.0
99
github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334
10-
github.com/kr/text v0.1.0
10+
github.com/kr/text v0.2.0
1111
github.com/markbates/inflect v1.0.4
1212
github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2
13-
github.com/onsi/ginkgo v1.15.2
14-
github.com/onsi/gomega v1.11.0
15-
github.com/operator-framework/api v0.8.2-0.20210526151024-41d37db9141f
16-
github.com/operator-framework/java-operator-plugins v0.0.0-20210629174633-88afbd6d98b2
17-
github.com/operator-framework/operator-lib v0.4.1
18-
github.com/operator-framework/operator-registry v1.15.3
19-
github.com/prometheus/client_golang v1.7.1
13+
github.com/onsi/ginkgo v1.16.4
14+
github.com/onsi/gomega v1.13.0
15+
github.com/operator-framework/api v0.10.0
16+
github.com/operator-framework/java-operator-plugins v0.0.0-20210708174638-463fb91f3d5e
17+
github.com/operator-framework/operator-lib v0.5.0
18+
github.com/operator-framework/operator-registry v1.17.4
19+
github.com/prometheus/client_golang v1.11.0
2020
github.com/prometheus/client_model v0.2.0
2121
github.com/sergi/go-diff v1.1.0
22-
github.com/sirupsen/logrus v1.7.0
23-
github.com/spf13/afero v1.2.2
24-
github.com/spf13/cobra v1.1.1
22+
github.com/sirupsen/logrus v1.8.1
23+
github.com/spf13/afero v1.6.0
24+
github.com/spf13/cobra v1.1.3
2525
github.com/spf13/pflag v1.0.5
2626
github.com/spf13/viper v1.7.0
27-
github.com/stretchr/testify v1.6.1
27+
github.com/stretchr/testify v1.7.0
2828
github.com/thoas/go-funk v0.8.0
2929
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
3030
golang.org/x/mod v0.4.2
31-
golang.org/x/sys v0.0.0-20210521090106-6ca3eb03dfc2 // indirect
32-
golang.org/x/tools v0.1.1
31+
golang.org/x/tools v0.1.3
3332
gomodules.xyz/jsonpatch/v3 v3.0.1
34-
helm.sh/helm/v3 v3.4.1
35-
k8s.io/api v0.20.2
36-
k8s.io/apiextensions-apiserver v0.20.2
37-
k8s.io/apimachinery v0.20.2
38-
k8s.io/cli-runtime v0.20.2
39-
k8s.io/client-go v0.20.2
40-
k8s.io/kubectl v0.20.2
33+
helm.sh/helm/v3 v3.6.2
34+
k8s.io/api v0.21.2
35+
k8s.io/apiextensions-apiserver v0.21.2
36+
k8s.io/apimachinery v0.21.2
37+
k8s.io/cli-runtime v0.21.0
38+
k8s.io/client-go v0.21.2
39+
k8s.io/kubectl v0.21.0
4140
rsc.io/letsencrypt v0.0.3 // indirect
42-
sigs.k8s.io/controller-runtime v0.8.3
43-
sigs.k8s.io/controller-tools v0.5.0
44-
sigs.k8s.io/kubebuilder/v3 v3.0.0-beta.1
41+
sigs.k8s.io/controller-runtime v0.9.2
42+
sigs.k8s.io/controller-tools v0.6.0
43+
sigs.k8s.io/kubebuilder/v3 v3.0.0-alpha.0.0.20210707171043-359e8aa70c2b
4544
sigs.k8s.io/yaml v1.2.0
4645
)
4746

@@ -53,7 +52,6 @@ replace (
5352
github.com/containerd/containerd => github.com/containerd/containerd v1.4.3
5453
github.com/mattn/go-sqlite3 => github.com/mattn/go-sqlite3 v1.10.0
5554
golang.org/x/text => golang.org/x/text v0.3.3 // Required to fix CVE-2020-14040
56-
sigs.k8s.io/kubebuilder/v3 => sigs.k8s.io/kubebuilder/v3 v3.0.0-alpha.0.0.20210518234629-191170994550
5755
)
5856

5957
exclude github.com/spf13/viper v1.3.2 // Required to fix CVE-2018-1098

go.sum

+313-187
Large diffs are not rendered by default.

internal/ansible/handler/logging_enqueue_object_test.go

+1-8
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,8 @@ var _ = Describe("LoggingEnqueueRequestForObject", func() {
175175
))
176176

177177
// verify workqueue
178-
Expect(q.Len()).To(Equal(2))
178+
Expect(q.Len()).To(Equal(1))
179179
i, _ := q.Get()
180-
Expect(i).To(Equal(reconcile.Request{
181-
NamespacedName: types.NamespacedName{
182-
Namespace: pod.Namespace,
183-
Name: pod.Name,
184-
},
185-
}))
186-
i, _ = q.Get()
187180
Expect(i).To(Equal(reconcile.Request{
188181
NamespacedName: types.NamespacedName{
189182
Namespace: newpod.Namespace,

internal/clientbuilder/clientbuilder.go

-52
This file was deleted.

internal/cmd/ansible-operator/run/cmd.go

+17-3
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ import (
2626

2727
"github.com/spf13/cobra"
2828
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
29+
"k8s.io/client-go/rest"
2930
ctrl "sigs.k8s.io/controller-runtime"
3031
"sigs.k8s.io/controller-runtime/pkg/cache"
32+
"sigs.k8s.io/controller-runtime/pkg/client"
3133
"sigs.k8s.io/controller-runtime/pkg/client/config"
3234
"sigs.k8s.io/controller-runtime/pkg/healthz"
3335
logf "sigs.k8s.io/controller-runtime/pkg/log"
@@ -43,7 +45,6 @@ import (
4345
"github.com/operator-framework/operator-sdk/internal/ansible/proxy/controllermap"
4446
"github.com/operator-framework/operator-sdk/internal/ansible/runner"
4547
"github.com/operator-framework/operator-sdk/internal/ansible/watches"
46-
"github.com/operator-framework/operator-sdk/internal/clientbuilder"
4748
"github.com/operator-framework/operator-sdk/internal/util/k8sutil"
4849
sdkVersion "github.com/operator-framework/operator-sdk/internal/version"
4950
)
@@ -145,8 +146,21 @@ func run(cmd *cobra.Command, f *flags.Flags) {
145146
// Set default manager options
146147
// TODO: probably should expose the host & port as an environment variables
147148
options = f.ToManagerOptions(options)
148-
if options.ClientBuilder == nil {
149-
options.ClientBuilder = clientbuilder.NewUnstructedCached()
149+
if options.NewClient == nil {
150+
options.NewClient = func(cache cache.Cache, config *rest.Config, options client.Options, uncachedObjects ...client.Object) (client.Client, error) {
151+
// Create the Client for Write operations.
152+
c, err := client.New(config, options)
153+
if err != nil {
154+
return nil, err
155+
}
156+
157+
return client.NewDelegatingClient(client.NewDelegatingClientInput{
158+
CacheReader: cache,
159+
Client: c,
160+
UncachedObjects: uncachedObjects,
161+
CacheUnstructured: true,
162+
})
163+
}
150164
}
151165

152166
namespace, found := os.LookupEnv(k8sutil.WatchNamespaceEnvVar)

internal/cmd/helm-operator/run/cmd.go

+18-4
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ import (
2424

2525
"github.com/spf13/cobra"
2626
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
27+
"k8s.io/client-go/rest"
2728
ctrl "sigs.k8s.io/controller-runtime"
2829
"sigs.k8s.io/controller-runtime/pkg/cache"
30+
"sigs.k8s.io/controller-runtime/pkg/client"
2931
"sigs.k8s.io/controller-runtime/pkg/client/config"
3032
"sigs.k8s.io/controller-runtime/pkg/healthz"
3133
logf "sigs.k8s.io/controller-runtime/pkg/log"
@@ -34,7 +36,6 @@ import (
3436
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
3537
crmetrics "sigs.k8s.io/controller-runtime/pkg/metrics"
3638

37-
"github.com/operator-framework/operator-sdk/internal/clientbuilder"
3839
"github.com/operator-framework/operator-sdk/internal/helm/controller"
3940
"github.com/operator-framework/operator-sdk/internal/helm/flags"
4041
"github.com/operator-framework/operator-sdk/internal/helm/metrics"
@@ -128,10 +129,23 @@ func run(cmd *cobra.Command, f *flags.Flags) {
128129

129130
// Set default manager options
130131
options = f.ToManagerOptions(options)
131-
if options.ClientBuilder == nil {
132-
options.ClientBuilder = clientbuilder.NewUnstructedCached()
133-
}
134132

133+
if options.NewClient == nil {
134+
options.NewClient = func(cache cache.Cache, config *rest.Config, options client.Options, uncachedObjects ...client.Object) (client.Client, error) {
135+
// Create the Client for Write operations.
136+
c, err := client.New(config, options)
137+
if err != nil {
138+
return nil, err
139+
}
140+
141+
return client.NewDelegatingClient(client.NewDelegatingClientInput{
142+
CacheReader: cache,
143+
Client: c,
144+
UncachedObjects: uncachedObjects,
145+
CacheUnstructured: true,
146+
})
147+
}
148+
}
135149
namespace, found := os.LookupEnv(k8sutil.WatchNamespaceEnvVar)
136150
log = log.WithValues("Namespace", namespace)
137151
if found {

internal/plugins/ansible/v1/scaffolds/init.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import (
3535

3636
const (
3737
// kustomizeVersion is the sigs.k8s.io/kustomize version to be used in the project
38-
kustomizeVersion = "v3.5.4"
38+
kustomizeVersion = "v3.8.7"
3939

4040
imageName = "controller:latest"
4141
)

internal/plugins/helm/v1/scaffolds/init.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import (
3232

3333
const (
3434
// kustomizeVersion is the sigs.k8s.io/kustomize version to be used in the project
35-
kustomizeVersion = "v3.5.4"
35+
kustomizeVersion = "v3.8.7"
3636

3737
imageName = "controller:latest"
3838
)

testdata/ansible/memcached-operator/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ ifeq (,$(shell which kustomize 2>/dev/null))
9393
@{ \
9494
set -e ;\
9595
mkdir -p $(dir $(KUSTOMIZE)) ;\
96-
curl -sSLo - https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v3.5.4/kustomize_v3.5.4_$(OS)_$(ARCH).tar.gz | \
96+
curl -sSLo - https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v3.8.7/kustomize_v3.8.7_$(OS)_$(ARCH).tar.gz | \
9797
tar xzf - -C bin/ ;\
9898
}
9999
else

testdata/ansible/memcached-operator/bundle/manifests/memcached-operator-manager-config_v1_configmap.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ data:
77
healthProbeBindAddress: :6789
88
metrics:
99
bindAddress: 127.0.0.1:8080
10+
1011
leaderElection:
1112
leaderElect: true
1213
resourceName: 811c9dc5.example.com

testdata/go/v2/memcached-operator/config/crd/kustomization.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ patchesStrategicMerge:
1111
#- patches/webhook_in_memcacheds.yaml
1212
#+kubebuilder:scaffold:crdkustomizewebhookpatch
1313

14-
# [CERTMANAGER] To enable webhook, uncomment all the sections with [CERTMANAGER] prefix.
14+
# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
1515
# patches here are for enabling the CA injection for each CRD
1616
#- patches/cainjection_in_memcacheds.yaml
1717
#+kubebuilder:scaffold:crdkustomizecainjectionpatch
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
2-
# Ignore all files which are not go type
3-
!**/*.go
4-
!**/*.mod
5-
!**/*.sum
2+
# Ignore build and test binaries.
3+
bin/
4+
testbin/

testdata/go/v3/memcached-operator/Makefile

+8-6
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,8 @@ fmt: ## Run go fmt against code.
8585
vet: ## Run go vet against code.
8686
go vet ./...
8787

88-
ENVTEST_ASSETS_DIR=$(shell pwd)/testbin
89-
test: manifests generate fmt vet ## Run tests.
90-
mkdir -p ${ENVTEST_ASSETS_DIR}
91-
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.8.3/hack/setup-envtest.sh
92-
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./... -coverprofile cover.out
88+
test: manifests generate fmt vet envtest ## Run tests.
89+
go test ./... -coverprofile cover.out
9390

9491
##@ Build
9592

@@ -123,12 +120,17 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi
123120

124121
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
125122
controller-gen: ## Download controller-gen locally if necessary.
126-
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.4.1)
123+
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.6.1)
127124

128125
KUSTOMIZE = $(shell pwd)/bin/kustomize
129126
kustomize: ## Download kustomize locally if necessary.
130127
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected])
131128

129+
ENVTEST = $(shell pwd)/bin/setup-envtest
130+
envtest: ## Download envtest-setup locally if necessary.
131+
$(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest)
132+
$(ENVTEST) use 1.21
133+
132134
# go-get-tool will 'go get' any package $2 and install it to $1.
133135
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
134136
define go-get-tool

testdata/go/v3/memcached-operator/bundle/manifests/cache.example.com_memcacheds.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
22
kind: CustomResourceDefinition
33
metadata:
44
annotations:
5-
controller-gen.kubebuilder.io/version: v0.4.1
5+
controller-gen.kubebuilder.io/version: v0.6.1
66
creationTimestamp: null
77
name: memcacheds.cache.example.com
88
spec:

testdata/go/v3/memcached-operator/config/crd/bases/cache.example.com_memcacheds.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
44
kind: CustomResourceDefinition
55
metadata:
66
annotations:
7-
controller-gen.kubebuilder.io/version: v0.4.1
7+
controller-gen.kubebuilder.io/version: v0.6.1
88
creationTimestamp: null
99
name: memcacheds.cache.example.com
1010
spec:

testdata/go/v3/memcached-operator/config/crd/kustomization.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ patchesStrategicMerge:
1111
#- patches/webhook_in_memcacheds.yaml
1212
#+kubebuilder:scaffold:crdkustomizewebhookpatch
1313

14-
# [CERTMANAGER] To enable webhook, uncomment all the sections with [CERTMANAGER] prefix.
14+
# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
1515
# patches here are for enabling the CA injection for each CRD
1616
#- patches/cainjection_in_memcacheds.yaml
1717
#+kubebuilder:scaffold:crdkustomizecainjectionpatch

testdata/go/v3/memcached-operator/controllers/memcached_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ type MemcachedReconciler struct {
5555
// the user.
5656
//
5757
// For more details, check Reconcile and its Result here:
58-
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.8.3/pkg/reconcile
58+
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.9.2/pkg/reconcile
5959
func (r *MemcachedReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
6060
log := ctrllog.FromContext(ctx)
6161

0 commit comments

Comments
 (0)