Skip to content

Commit

Permalink
Update to Gardener v1.11.1. (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit91 authored Jan 29, 2021
1 parent 0bcfe19 commit 225a6d1
Show file tree
Hide file tree
Showing 13 changed files with 201 additions and 126 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
vendor
tools/vendor
VERSION
bin
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ else
DOCKER_TTY_ARG=t
endif

export CGO_ENABLED := 0
export GO111MODULE := on

#########################################
Expand Down Expand Up @@ -119,7 +118,7 @@ format:

.PHONY: test
test:
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/test.sh --skipPackage test/e2e/networkpolicies,test/integration -r ./cmd/... ./pkg/...
@SKIP_FETCH_TOOLS=1 $(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/test.sh ./cmd/... ./pkg/...

.PHONY: test-in-docker
test-in-docker: revendor
Expand All @@ -129,7 +128,7 @@ test-in-docker: revendor

.PHONY: test-cov
test-cov:
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/test-cover.sh -r ./cmd/... ./pkg/...
@SKIP_FETCH_TOOLS=1 $(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/test-cover.sh -r ./cmd/... ./pkg/...

.PHONY: test-clean
test-clean:
Expand Down
40 changes: 19 additions & 21 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ require (
github.com/ajeddeloh/yaml v0.0.0-00010101000000-000000000000 // indirect
github.com/blang/semver v3.5.1+incompatible
github.com/coreos/container-linux-config-transpiler v0.9.0
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect
github.com/coreos/go-systemd/v22 v22.1.0
github.com/coreos/ignition v0.35.0 // indirect
github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c // indirect
github.com/emicklei/go-restful v2.12.0+incompatible // indirect
github.com/gardener/controller-manager-library v0.2.0 // indirect
github.com/gardener/etcd-druid v0.3.0
github.com/gardener/gardener v1.10.2
github.com/gardener/machine-controller-manager v0.34.0
github.com/gardener/gardener v1.11.1
github.com/gardener/machine-controller-manager v0.35.2
github.com/go-logr/logr v0.3.0
github.com/gobuffalo/packr/v2 v2.8.0
github.com/golang/mock v1.4.4
Expand All @@ -25,8 +25,8 @@ require (
github.com/metal-stack/duros-controller v0.1.1
github.com/metal-stack/firewall-controller v1.0.1
github.com/metal-stack/machine-controller-manager-provider-metal v0.1.3
github.com/metal-stack/metal-go v0.11.2
github.com/metal-stack/metal-lib v0.6.7
github.com/metal-stack/metal-go v0.11.5
github.com/metal-stack/metal-lib v0.6.9
github.com/onsi/ginkgo v1.14.2
github.com/onsi/gomega v1.10.3
github.com/pkg/errors v0.9.1
Expand All @@ -37,27 +37,25 @@ require (
k8s.io/api v0.19.4
k8s.io/apiextensions-apiserver v0.19.4
k8s.io/apimachinery v0.19.4
k8s.io/apiserver v0.17.11
k8s.io/apiserver v0.18.8
k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible
k8s.io/code-generator v0.17.11
k8s.io/component-base v0.17.11
k8s.io/kubelet v0.17.11
k8s.io/code-generator v0.18.8
k8s.io/component-base v0.18.8
k8s.io/kubelet v0.18.8
sigs.k8s.io/controller-runtime v0.6.4
)

replace (
github.com/ajeddeloh/yaml => github.com/ajeddeloh/yaml v0.0.0-20170912190910-6b94386aeefd // indirect
github.com/gardener/controller-manager-library v0.2.0 => github.com/gardener/controller-manager-library v0.1.1-0.20200204110458-c263b9bb97ad
github.com/gardener/gardener-resource-manager v0.13.1 => github.com/gardener/gardener-resource-manager v0.17.1
k8s.io/api => k8s.io/api v0.17.11
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.17.11
k8s.io/apimachinery => k8s.io/apimachinery v0.17.11
k8s.io/apiserver => k8s.io/apiserver v0.17.11
k8s.io/client-go => k8s.io/client-go v0.17.11
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.17.11
k8s.io/code-generator => k8s.io/code-generator v0.17.11
k8s.io/component-base => k8s.io/component-base v0.17.11
k8s.io/api => k8s.io/api v0.18.8
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.18.8
k8s.io/apimachinery => k8s.io/apimachinery v0.18.8
k8s.io/apiserver => k8s.io/apiserver v0.18.8
k8s.io/client-go => k8s.io/client-go v0.18.8
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.18.8
k8s.io/code-generator => k8s.io/code-generator v0.18.8
k8s.io/component-base => k8s.io/component-base v0.18.8
k8s.io/helm => k8s.io/helm v2.13.1+incompatible
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.17.11
sigs.k8s.io/controller-runtime => sigs.k8s.io/controller-runtime v0.5.10
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.18.8
)
132 changes: 85 additions & 47 deletions go.sum

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions pkg/apis/metal/validation/cloudprofile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import (
. "github.com/metal-stack/gardener-extension-provider-metal/pkg/apis/metal/validation"
"k8s.io/apimachinery/pkg/util/validation/field"

. "github.com/gardener/gardener/pkg/utils/validation/gomega"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gstruct"
Expand Down Expand Up @@ -96,12 +94,12 @@ var _ = Describe("CloudProfileConfig validation", func() {

errorList := ValidateCloudProfileConfig(cloudProfileConfig, cloudProfile)

Expect(errorList).To(ConsistOfFields(Fields{
Expect(errorList).To(ConsistOf(PointTo(MatchFields(IgnoreExtras, Fields{
"Type": Equal(field.ErrorTypeInvalid),
"Field": Equal("metalControlPlanes.prod"),
"BadValue": Equal("random-partition"),
"Detail": Equal("the control plane has a partition that is not a configured zone in any of the cloud profile regions: [partition-a partition-b partition-c]"),
}))
}))))
})
})
})
17 changes: 8 additions & 9 deletions pkg/apis/metal/validation/control_plane_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"k8s.io/apimachinery/pkg/util/validation/field"

gardencorev1beta1 "github.com/gardener/gardener/pkg/apis/core/v1beta1"
. "github.com/gardener/gardener/pkg/utils/validation/gomega"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -43,47 +42,47 @@ var _ = Describe("ControlPlaneconfig validation", func() {

errorList := ValidateControlPlaneConfig(controlPlaneConfig, cloudProfile, field.NewPath("spec"))

Expect(errorList).To(ConsistOfFields(Fields{
Expect(errorList).To(ConsistOf(PointTo(MatchFields(IgnoreExtras, Fields{
"Type": Equal(field.ErrorTypeRequired),
"Field": Equal("spec.iamconfig"),
"Detail": Equal("iam config must be specified"),
}))
}))))
})

It("should forbid empty issuer url", func() {
controlPlaneConfig.IAMConfig.IssuerConfig.Url = ""

errorList := ValidateControlPlaneConfig(controlPlaneConfig, cloudProfile, field.NewPath("spec"))

Expect(errorList).To(ConsistOfFields(Fields{
Expect(errorList).To(ConsistOf(PointTo(MatchFields(IgnoreExtras, Fields{
"Type": Equal(field.ErrorTypeRequired),
"Field": Equal("spec.iamconfig.issuerConfig.url"),
"Detail": Equal("url must be specified"),
}))
}))))
})

It("should forbid empty client id", func() {
controlPlaneConfig.IAMConfig.IssuerConfig.ClientId = ""

errorList := ValidateControlPlaneConfig(controlPlaneConfig, cloudProfile, field.NewPath("spec"))

Expect(errorList).To(ConsistOfFields(Fields{
Expect(errorList).To(ConsistOf(PointTo(MatchFields(IgnoreExtras, Fields{
"Type": Equal(field.ErrorTypeRequired),
"Field": Equal("spec.iamconfig.issuerConfig.clientId"),
"Detail": Equal("clientId must be specified"),
}))
}))))
})

It("should forbid group namespace length of zero", func() {
controlPlaneConfig.IAMConfig.GroupConfig = &apismetal.NamespaceGroupConfig{NamespaceMaxLength: 0}

errorList := ValidateControlPlaneConfig(controlPlaneConfig, cloudProfile, field.NewPath("spec"))

Expect(errorList).To(ConsistOfFields(Fields{
Expect(errorList).To(ConsistOf(PointTo(MatchFields(IgnoreExtras, Fields{
"Type": Equal(field.ErrorTypeRequired),
"Field": Equal("spec.iamconfig.groupConfig.namespaceMaxLength"),
"Detail": Equal("namespaceMaxLength must be a positive integer"),
}))
}))))
})
})
})
22 changes: 10 additions & 12 deletions pkg/apis/metal/validation/infrastructure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
. "github.com/metal-stack/gardener-extension-provider-metal/pkg/apis/metal/validation"
"k8s.io/apimachinery/pkg/util/validation/field"

. "github.com/gardener/gardener/pkg/utils/validation/gomega"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gstruct"
Expand Down Expand Up @@ -112,59 +110,59 @@ var _ = Describe("InfrastructureConfig validation", func() {

errorList := ValidateInfrastructureConfig(infrastructureConfig)

Expect(errorList).To(ConsistOfFields(Fields{
Expect(errorList).To(ConsistOf(PointTo(MatchFields(IgnoreExtras, Fields{
"Type": Equal(field.ErrorTypeRequired),
"Field": Equal("partitionID"),
"Detail": Equal("partitionID must be specified"),
}))
}))))
})

It("should forbid empty project", func() {
infrastructureConfig.ProjectID = ""

errorList := ValidateInfrastructureConfig(infrastructureConfig)

Expect(errorList).To(ConsistOfFields(Fields{
Expect(errorList).To(ConsistOf(PointTo(MatchFields(IgnoreExtras, Fields{
"Type": Equal(field.ErrorTypeRequired),
"Field": Equal("projectID"),
"Detail": Equal("projectID must be specified"),
}))
}))))
})

It("should forbid empty firewall image", func() {
infrastructureConfig.Firewall.Image = ""

errorList := ValidateInfrastructureConfig(infrastructureConfig)

Expect(errorList).To(ConsistOfFields(Fields{
Expect(errorList).To(ConsistOf(PointTo(MatchFields(IgnoreExtras, Fields{
"Type": Equal(field.ErrorTypeRequired),
"Field": Equal("firewall.image"),
"Detail": Equal("firewall image must be specified"),
}))
}))))
})

It("should forbid empty firewall size", func() {
infrastructureConfig.Firewall.Size = ""

errorList := ValidateInfrastructureConfig(infrastructureConfig)

Expect(errorList).To(ConsistOfFields(Fields{
Expect(errorList).To(ConsistOf(PointTo(MatchFields(IgnoreExtras, Fields{
"Type": Equal(field.ErrorTypeRequired),
"Field": Equal("firewall.size"),
"Detail": Equal("firewall size must be specified"),
}))
}))))
})

It("should forbid empty network", func() {
infrastructureConfig.Firewall.Networks = []string{"internet", ""}

errorList := ValidateInfrastructureConfig(infrastructureConfig)

Expect(errorList).To(ConsistOfFields(Fields{
Expect(errorList).To(ConsistOf(PointTo(MatchFields(IgnoreExtras, Fields{
"Type": Equal(field.ErrorTypeRequired),
"Field": Equal("firewall.networks[1]"),
"Detail": Equal("firewall network must not be an empty string"),
}))
}))))
})
})
})
Expand Down
2 changes: 0 additions & 2 deletions pkg/apis/metal/validation/shoot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
. "github.com/metal-stack/gardener-extension-provider-metal/pkg/apis/metal/validation"
"k8s.io/apimachinery/pkg/util/validation/field"

// . "github.com/gardener/gardener/pkg/utils/validation/gomega"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gstruct"
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/controlplane/valuesprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -808,15 +808,15 @@ func (vp *valuesProvider) deployControlPlaneShootDroptailerCerts(ctx context.Con
return errors.Wrap(err, "could not create shoot Gardener client")
}

_, err = cs.CoreV1().Namespaces().Get(metal.DroptailerNamespace, metav1.GetOptions{})
_, err = cs.CoreV1().Namespaces().Get(ctx, metal.DroptailerNamespace, metav1.GetOptions{})
if err != nil {
if apierrors.IsNotFound(err) {
ns := &corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: metal.DroptailerNamespace,
},
}
_, err := cs.CoreV1().Namespaces().Create(ns)
_, err := cs.CoreV1().Namespaces().Create(ctx, ns, metav1.CreateOptions{})
if err != nil {
return errors.Wrap(err, "could not create droptailer namespace")
}
Expand Down
47 changes: 47 additions & 0 deletions pkg/controller/worker/helper.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package worker

import (
"context"

api "github.com/metal-stack/gardener-extension-provider-metal/pkg/apis/metal"
"github.com/metal-stack/gardener-extension-provider-metal/pkg/apis/metal/v1alpha1"

"github.com/gardener/gardener/extensions/pkg/controller"
kutil "github.com/gardener/gardener/pkg/utils/kubernetes"
"github.com/pkg/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/util/retry"
)

func (w *workerDelegate) decodeWorkerProviderStatus() (*api.WorkerStatus, error) {
workerStatus := &api.WorkerStatus{}

if w.worker.Status.ProviderStatus == nil {
return workerStatus, nil
}

if _, _, err := w.decoder.Decode(w.worker.Status.ProviderStatus.Raw, nil, workerStatus); err != nil {
return nil, errors.Wrapf(err, "could not decode WorkerStatus '%s'", kutil.ObjectName(w.worker))
}

return workerStatus, nil
}

func (w *workerDelegate) updateWorkerProviderStatus(ctx context.Context, workerStatus *api.WorkerStatus) error {
var workerStatusV1alpha1 = &v1alpha1.WorkerStatus{
TypeMeta: metav1.TypeMeta{
APIVersion: v1alpha1.SchemeGroupVersion.String(),
Kind: "WorkerStatus",
},
}

if err := w.scheme.Convert(workerStatus, workerStatusV1alpha1, nil); err != nil {
return err
}

return controller.TryUpdateStatus(ctx, retry.DefaultBackoff, w.client, w.worker, func() error {
w.worker.Status.ProviderStatus = &runtime.RawExtension{Object: workerStatusV1alpha1}
return nil
})
}
13 changes: 13 additions & 0 deletions pkg/controller/worker/machine_dependencies.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package worker

import "context"

// DeployMachineDependencies implements genericactuator.WorkerDelegate.
func (w *workerDelegate) DeployMachineDependencies(_ context.Context) error {
return nil
}

// CleanupMachineDependencies implements genericactuator.WorkerDelegate.
func (w *workerDelegate) CleanupMachineDependencies(_ context.Context) error {
return nil
}
Loading

0 comments on commit 225a6d1

Please sign in to comment.