Skip to content

Commit

Permalink
Vendor k/* and c-r dependencies (gardener#4215)
Browse files Browse the repository at this point in the history
* Upgrade to k/*@v0.21.1 in go.mod

* [automated] make revendor for k/* dependencies

This deletes pkg/mock/client-go/kubernetes/mocks.go to resolve the
following deadlock: make revendor fails because of some dependencies
of the file and make generate fails because of missing revendoring.
File will be generated again in the next commit.

* [automated] make generate for k/* dependencies

* Upgrade to c-r@v0.9.0 in go.mod

* [automated] make revendor for c-r dependency

`make revendor` results in `hack/setup-envtest.sh` being broken, so reset
the file after running `make revendor`. Adaption to breaking changes
in the upstream file will be done in a later commit.

* manager.NewClientBuilder was removed in favor of cluster.DefaultNewClient

ref kubernetes-sigs/controller-runtime#1409

* client.*MergeFrom* now take client.Object instead of runtime.Object

ref kubernetes-sigs/controller-runtime#1395

* [automated] make generate for c-r dependency

* Adapt to changes in labels.NewRequirement

ref kubernetes/kubernetes#97538

* Adapt to new setup-envtest tool

Makes use of the new setup-envtest tool (kubernetes-sigs/controller-runtime#1488)
in hack/setup-envtest.sh instead of vendoring hack/setup-envtest.sh and fetching
binaries with that.

* [automated] make revendor for setup-envtest tool

* Adapt pkg/envtest to upstream changes

- Make use of the new Users concept in envtest to provision a dedicated
  user for gardener-apiserver and a valid kubeconfig

- Make use of the new way to configure API server args to easily configure
  kube-aggregator flags

- Also generate certs for aggregation layer on our own instead of reusing
  the API server ca/certs (which is semantically correct), which allows us
  to drop our fork including kubernetes-sigs/controller-runtime#1449

* Styling nits
  • Loading branch information
timebertt authored and Kristiyan Gostev committed Apr 21, 2022
1 parent 80c1306 commit 96a7d30
Show file tree
Hide file tree
Showing 1,756 changed files with 120,460 additions and 14,526 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ install-requirements:
@go install -mod=vendor github.com/onsi/ginkgo/ginkgo
@go install -mod=vendor github.com/ahmetb/gen-crd-api-reference-docs
@go install -mod=vendor github.com/golang/mock/mockgen
@go install -mod=vendor sigs.k8s.io/controller-runtime/tools/setup-envtest
@go install -mod=vendor sigs.k8s.io/controller-tools/cmd/controller-gen
@./hack/install-promtool.sh
@./hack/install-requirements.sh
Expand All @@ -164,7 +165,6 @@ install-requirements:
revendor:
@GO111MODULE=on go mod vendor
@GO111MODULE=on go mod tidy
@curl -sSLo hack/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/$(CR_VERSION)/hack/setup-envtest.sh

.PHONY: clean
clean:
Expand Down
2 changes: 1 addition & 1 deletion extensions/pkg/controller/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (o *operationAnnotationWrapper) Reconcile(ctx context.Context, request reco
}

if annotations[v1beta1constants.GardenerOperation] == v1beta1constants.GardenerOperationReconcile {
withOpAnnotation := obj.DeepCopyObject()
withOpAnnotation := obj.DeepCopyObject().(client.Object)
delete(annotations, v1beta1constants.GardenerOperation)
obj.SetAnnotations(annotations)
if err := o.client.Patch(ctx, obj, client.MergeFrom(withOpAnnotation)); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion extensions/pkg/controller/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func GetVerticalPodAutoscalerObject() *unstructured.Unstructured {

// RemoveAnnotation removes an annotation key passed as annotation
func RemoveAnnotation(ctx context.Context, c client.Client, obj client.Object, annotation string) error {
withAnnotation := obj.DeepCopyObject()
withAnnotation := obj.DeepCopyObject().(client.Object)

annotations := obj.GetAnnotations()
delete(annotations, annotation)
Expand Down
6 changes: 3 additions & 3 deletions extensions/pkg/terraformer/terraform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ var _ = Describe("terraformer", func() {
return nil
}),
c.EXPECT().
Patch(gomock.Any(), gomock.AssignableToTypeOf(secret.DeepCopyObject()), gomock.AssignableToTypeOf(client.MergeFromWithOptions(secret.DeepCopyObject(), client.MergeFromWithOptimisticLock{}))),
Patch(gomock.Any(), gomock.AssignableToTypeOf(secret.DeepCopy()), gomock.AssignableToTypeOf(client.MergeFromWithOptions(secret.DeepCopy(), client.MergeFromWithOptimisticLock{}))),

c.EXPECT().
Get(gomock.Any(), kutil.Key(namespace, stateName), gomock.AssignableToTypeOf(&corev1.ConfigMap{})).
Expand All @@ -637,7 +637,7 @@ var _ = Describe("terraformer", func() {
return nil
}),
c.EXPECT().
Patch(gomock.Any(), gomock.AssignableToTypeOf(config.DeepCopyObject()), gomock.AssignableToTypeOf(client.MergeFromWithOptions(config.DeepCopyObject(), client.MergeFromWithOptimisticLock{}))),
Patch(gomock.Any(), gomock.AssignableToTypeOf(config.DeepCopy()), gomock.AssignableToTypeOf(client.MergeFromWithOptions(config.DeepCopy(), client.MergeFromWithOptimisticLock{}))),

c.EXPECT().
Get(gomock.Any(), kutil.Key(namespace, configName), gomock.AssignableToTypeOf(&corev1.ConfigMap{})).
Expand All @@ -646,7 +646,7 @@ var _ = Describe("terraformer", func() {
return nil
}),
c.EXPECT().
Patch(gomock.Any(), gomock.AssignableToTypeOf(state.DeepCopyObject()), gomock.AssignableToTypeOf(client.MergeFromWithOptions(state.DeepCopyObject(), client.MergeFromWithOptimisticLock{}))),
Patch(gomock.Any(), gomock.AssignableToTypeOf(state.DeepCopy()), gomock.AssignableToTypeOf(client.MergeFromWithOptions(state.DeepCopy(), client.MergeFromWithOptimisticLock{}))),
)

Expect(t.RemoveTerraformerFinalizerFromConfig(ctx)).NotTo(HaveOccurred())
Expand Down
80 changes: 40 additions & 40 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,53 +16,54 @@ require (
github.com/gardener/landscaper/apis v0.7.0
github.com/gardener/machine-controller-manager v0.33.0
github.com/ghodss/yaml v1.0.0
github.com/go-logr/logr v0.3.0
github.com/go-openapi/spec v0.19.3
github.com/go-logr/logr v0.4.0
github.com/go-openapi/spec v0.19.5
github.com/gogo/protobuf v1.3.2
github.com/golang/mock v1.6.0
github.com/googleapis/gnostic v0.5.1
github.com/googleapis/gnostic v0.5.5
github.com/hashicorp/go-multierror v1.1.0
github.com/huandu/xstrings v1.3.2
github.com/json-iterator/go v1.1.10
github.com/json-iterator/go v1.1.11
github.com/mholt/archiver v3.1.1+incompatible
github.com/onsi/ginkgo v1.14.2
github.com/onsi/gomega v1.10.5
github.com/onsi/ginkgo v1.16.4
github.com/onsi/gomega v1.13.0
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.7.1
github.com/prometheus/client_golang v1.11.0
github.com/robfig/cron v1.2.0
github.com/sirupsen/logrus v1.6.0
github.com/sirupsen/logrus v1.7.0
github.com/spf13/cobra v1.1.1
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.7.0
github.com/texttheater/golang-levenshtein v0.0.0-20191208221605-eb6844b05fc6
go.uber.org/zap v1.15.0
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0
go.uber.org/zap v1.17.0
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e
gomodules.xyz/jsonpatch/v2 v2.1.0
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba
gomodules.xyz/jsonpatch/v2 v2.2.0
gonum.org/v1/gonum v0.8.2
gopkg.in/yaml.v2 v2.3.0
gopkg.in/yaml.v2 v2.4.0
istio.io/api v0.0.0-20201123152548-197f11e4ea09
istio.io/client-go v1.8.1
k8s.io/api v0.20.7
k8s.io/apiextensions-apiserver v0.20.7
k8s.io/apimachinery v0.20.7
k8s.io/apiserver v0.20.7
k8s.io/api v0.21.1
k8s.io/apiextensions-apiserver v0.21.1
k8s.io/apimachinery v0.21.1
k8s.io/apiserver v0.21.1
k8s.io/autoscaler v0.0.0-20190805135949-100e91ba756e
k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible
k8s.io/cluster-bootstrap v0.20.7
k8s.io/code-generator v0.20.7
k8s.io/component-base v0.20.7
k8s.io/gengo v0.0.0-20201113003025-83324d819ded
k8s.io/cluster-bootstrap v0.21.1
k8s.io/code-generator v0.21.1
k8s.io/component-base v0.21.1
k8s.io/gengo v0.0.0-20201214224949-b6c5ce23f027
k8s.io/helm v2.16.1+incompatible
k8s.io/klog v1.0.0
k8s.io/klog/v2 v2.4.0
k8s.io/kube-aggregator v0.20.7
k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd // keep this value in sync with k8s.io/apiserver
k8s.io/kubelet v0.20.7
k8s.io/metrics v0.20.7
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009
sigs.k8s.io/controller-runtime v0.8.3
k8s.io/klog/v2 v2.9.0
k8s.io/kube-aggregator v0.21.1
k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7 // keep this value in sync with k8s.io/apiserver
k8s.io/kubelet v0.21.1
k8s.io/metrics v0.21.1
k8s.io/utils v0.0.0-20210527160623-6fdb442a123b
sigs.k8s.io/controller-runtime v0.9.0
sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20210609022947-fbf50b04fe17
sigs.k8s.io/controller-tools v0.4.1
sigs.k8s.io/yaml v1.2.0
)
Expand All @@ -71,17 +72,16 @@ replace (
github.com/emicklei/go-restful => github.com/emicklei/go-restful v2.9.5+incompatible // keep this value in sync with k8s.io/apiserver
github.com/envoyproxy/go-control-plane => github.com/envoyproxy/go-control-plane v0.9.4
github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.4.1
github.com/prometheus/client_golang => github.com/prometheus/client_golang v1.7.1 // keep this value in sync with sigs.k8s.io/controller-runtime
google.golang.org/grpc => google.golang.org/grpc v1.27.0 // keep this value in sync with k8s.io/apiserver
k8s.io/api => k8s.io/api v0.20.7
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.20.7
k8s.io/apimachinery => k8s.io/apimachinery v0.20.7
k8s.io/apiserver => k8s.io/apiserver v0.20.7
k8s.io/client-go => k8s.io/client-go v0.20.7
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.20.7
k8s.io/code-generator => k8s.io/code-generator v0.20.7
k8s.io/component-base => k8s.io/component-base v0.20.7
github.com/prometheus/client_golang => github.com/prometheus/client_golang v1.11.0 // keep this value in sync with sigs.k8s.io/controller-runtime
google.golang.org/grpc => google.golang.org/grpc v1.27.1 // keep this value in sync with k8s.io/apiserver
k8s.io/api => k8s.io/api v0.21.1
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.21.1
k8s.io/apimachinery => k8s.io/apimachinery v0.21.1
k8s.io/apiserver => k8s.io/apiserver v0.21.1
k8s.io/client-go => k8s.io/client-go v0.21.1
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.21.1
k8s.io/code-generator => k8s.io/code-generator v0.21.1
k8s.io/component-base => k8s.io/component-base v0.21.1
k8s.io/helm => k8s.io/helm v2.13.1+incompatible
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.20.7
sigs.k8s.io/controller-runtime => github.com/gardener/controller-runtime v0.8.3-gardener.1
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.21.1
)
Loading

0 comments on commit 96a7d30

Please sign in to comment.