From 9b3b1489a33292137e2aba238454146bac8315ef Mon Sep 17 00:00:00 2001 From: Tim Usner Date: Mon, 30 Mar 2020 17:41:22 +0200 Subject: [PATCH] Allow Gardener to restart CCM & MCM --- .../cloud-controller-manager-svc.yaml | 18 ++ .../templates/cloud-controller-manager.yaml | 22 +- .../cloud-controller-manager/values.yaml | 1 + .../seed/templates/deployment.yaml | 3 + .../seed/values.yaml | 2 + go.mod | 4 +- go.sum | 10 +- pkg/controller/controlplane/valuesprovider.go | 3 + .../controlplane/valuesprovider_test.go | 3 + .../worker/machine_controller_manager.go | 4 + pkg/controller/worker/machines.go | 11 +- pkg/controller/worker/machines_test.go | 8 +- .../pkg/controller/status.go | 4 +- .../worker/genericactuator/actuator_delete.go | 2 +- .../genericactuator/actuator_reconcile.go | 12 +- .../pkg/controller/worker/machines.go | 14 +- .../pkg/terraformer/terraformer.go | 2 +- .../gardener/pkg/api/extensions/accessor.go | 41 ++-- .../gardener/pkg/apis/core/types_common.go | 2 +- .../gardener/pkg/apis/core/types_quota.go | 2 +- .../gardener/pkg/apis/core/types_shoot.go | 10 + .../pkg/apis/core/v1alpha1/types_common.go | 4 +- .../pkg/apis/core/v1alpha1/types_quota.go | 2 +- .../pkg/apis/core/v1alpha1/types_shoot.go | 12 + .../core/v1alpha1/zz_generated.conversion.go | 38 ++- .../core/v1alpha1/zz_generated.deepcopy.go | 32 ++- .../core/v1beta1/constants/types_constants.go | 3 + .../pkg/apis/core/v1beta1/helper/errors.go | 35 ++- .../pkg/apis/core/v1beta1/types_common.go | 6 +- .../pkg/apis/core/v1beta1/types_quota.go | 2 +- .../pkg/apis/core/v1beta1/types_shoot.go | 13 ++ .../core/v1beta1/zz_generated.conversion.go | 38 ++- .../core/v1beta1/zz_generated.deepcopy.go | 32 ++- .../pkg/apis/core/validation/shoot.go | 45 ++++ .../pkg/apis/core/zz_generated.deepcopy.go | 32 ++- .../pkg/apis/extensions/v1alpha1/register.go | 2 + .../pkg/apis/extensions/v1alpha1/types.go | 2 +- .../v1alpha1/types_containerruntime.go | 77 +++++++ .../extensions/v1alpha1/types_defaults.go | 1 + .../v1alpha1/types_operatingsystemconfig.go | 3 + .../apis/extensions/v1alpha1/types_worker.go | 8 +- .../v1alpha1/zz_generated.deepcopy.go | 95 ++++++++ .../gardener/pkg/client/kubernetes/client.go | 1 + .../gardener/pkg/operation/botanist/addons.go | 2 +- .../pkg/operation/botanist/cleanup.go | 4 +- .../operation/botanist/containerruntime.go | 216 ++++++++++++++++++ .../pkg/operation/botanist/controlplane.go | 29 ++- .../gardener/pkg/operation/botanist/dns.go | 9 +- .../pkg/operation/botanist/extension.go | 7 +- .../pkg/operation/botanist/infrastructure.go | 7 +- .../pkg/operation/botanist/network.go | 7 +- .../botanist/operatingsystemconfig.go | 22 ++ .../gardener/pkg/operation/botanist/worker.go | 11 +- .../gardener/pkg/operation/common/types.go | 3 + .../gardener/pkg/operation/shoot/shoot.go | 5 + .../gardener/pkg/utils/errors/errors.go | 2 +- .../gardener/gardener/pkg/utils/flow/flow.go | 5 +- .../gardener/pkg/utils/retry/retry.go | 6 + vendor/modules.txt | 4 +- 59 files changed, 868 insertions(+), 132 deletions(-) create mode 100644 charts/internal/cloud-controller-manager/templates/cloud-controller-manager-svc.yaml create mode 100644 vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/types_containerruntime.go create mode 100644 vendor/github.com/gardener/gardener/pkg/operation/botanist/containerruntime.go diff --git a/charts/internal/cloud-controller-manager/templates/cloud-controller-manager-svc.yaml b/charts/internal/cloud-controller-manager/templates/cloud-controller-manager-svc.yaml new file mode 100644 index 000000000..365fa6d1b --- /dev/null +++ b/charts/internal/cloud-controller-manager/templates/cloud-controller-manager-svc.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: cloud-controller-manager + namespace: {{ .Release.Namespace }} + labels: + app: kubernetes + role: cloud-controller-manager +spec: + type: ClusterIP + clusterIP: None + ports: + - name: metrics + port: {{ include "cloud-controller-manager.port" . }} + protocol: TCP + selector: + app: kubernetes + role: cloud-controller-manager \ No newline at end of file diff --git a/charts/internal/cloud-controller-manager/templates/cloud-controller-manager.yaml b/charts/internal/cloud-controller-manager/templates/cloud-controller-manager.yaml index 6f531598d..534d0caba 100644 --- a/charts/internal/cloud-controller-manager/templates/cloud-controller-manager.yaml +++ b/charts/internal/cloud-controller-manager/templates/cloud-controller-manager.yaml @@ -1,22 +1,3 @@ -apiVersion: v1 -kind: Service -metadata: - name: cloud-controller-manager - namespace: {{ .Release.Namespace }} - labels: - app: kubernetes - role: cloud-controller-manager -spec: - type: ClusterIP - clusterIP: None - ports: - - name: metrics - port: {{ include "cloud-controller-manager.port" . }} - protocol: TCP - selector: - app: kubernetes - role: cloud-controller-manager ---- apiVersion: apps/v1 kind: Deployment metadata: @@ -48,6 +29,9 @@ spec: networking.gardener.cloud/to-private-networks: allowed networking.gardener.cloud/to-shoot-apiserver: allowed networking.gardener.cloud/from-prometheus: allowed +{{- if .Values.podLabels }} +{{ toYaml .Values.podLabels | indent 8 }} +{{- end }} spec: tolerations: - effect: NoExecute diff --git a/charts/internal/cloud-controller-manager/values.yaml b/charts/internal/cloud-controller-manager/values.yaml index 033cbe71c..96c10b7d4 100644 --- a/charts/internal/cloud-controller-manager/values.yaml +++ b/charts/internal/cloud-controller-manager/values.yaml @@ -3,6 +3,7 @@ clusterName: shoot-foo-bar kubernetesVersion: 1.7.5 podNetwork: 192.168.0.0/16 podAnnotations: {} +podLabels: {} featureGates: {} # CustomResourceValidation: true # RotateKubeletServerCertificate: false diff --git a/charts/internal/machine-controller-manager/seed/templates/deployment.yaml b/charts/internal/machine-controller-manager/seed/templates/deployment.yaml index 39297ebe2..8c303660c 100644 --- a/charts/internal/machine-controller-manager/seed/templates/deployment.yaml +++ b/charts/internal/machine-controller-manager/seed/templates/deployment.yaml @@ -32,6 +32,9 @@ spec: networking.gardener.cloud/to-seed-apiserver: allowed networking.gardener.cloud/to-shoot-apiserver: allowed networking.gardener.cloud/from-prometheus: allowed +{{- if .Values.podLabels }} +{{ toYaml .Values.podLabels | indent 8 }} +{{- end }} spec: serviceAccountName: machine-controller-manager terminationGracePeriodSeconds: 5 diff --git a/charts/internal/machine-controller-manager/seed/values.yaml b/charts/internal/machine-controller-manager/seed/values.yaml index 4fa079e27..544808a47 100644 --- a/charts/internal/machine-controller-manager/seed/values.yaml +++ b/charts/internal/machine-controller-manager/seed/values.yaml @@ -5,6 +5,8 @@ replicas: 1 podAnnotations: {} +podLabels: {} + providerName: provider-foo namespace: diff --git a/go.mod b/go.mod index 24da6e5d0..190b2f6f0 100644 --- a/go.mod +++ b/go.mod @@ -6,8 +6,8 @@ require ( github.com/ahmetb/gen-crd-api-reference-docs v0.1.5 github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f github.com/gardener/etcd-druid v0.1.3 - github.com/gardener/gardener v1.1.1-0.20200323102039-58593d8be86a - github.com/gardener/gardener-extensions v1.5.0 + github.com/gardener/gardener v1.1.1-0.20200330051317-a326f96cf32b + github.com/gardener/gardener-extensions v1.5.1-0.20200330101454-c65957bd80b5 github.com/gardener/machine-controller-manager v0.26.0 github.com/go-logr/logr v0.1.0 github.com/gobuffalo/packr/v2 v2.1.0 diff --git a/go.sum b/go.sum index 4f82bb8e1..c6b4cb2e0 100644 --- a/go.sum +++ b/go.sum @@ -128,12 +128,10 @@ github.com/gardener/etcd-druid v0.1.3 h1:uiPKUHubieRziHR7lr7I0WzIglf2aNVWf94Gm5N github.com/gardener/etcd-druid v0.1.3/go.mod h1:/A8kSp7DSo7oOhsOhD9Se/xF6BOD9TQJMawf6k7AOsU= github.com/gardener/external-dns-management v0.7.3 h1:SAW9ur2mjZ+x89xbmcplJgqNUmFGYIZLI2E+PaBhhG0= github.com/gardener/external-dns-management v0.7.3/go.mod h1:Y3om11E865x4aQ7cmcHjknb8RMgCO153huRb/SvP+9o= -github.com/gardener/gardener v1.1.1-0.20200311075931-7f7e52b986e7 h1:UD25lsw3fYBK7pUlXkGwUXmlpnksG9JbdwC75XZTBOQ= -github.com/gardener/gardener v1.1.1-0.20200311075931-7f7e52b986e7/go.mod h1:lGAx5NkFDWoC4hPIL+lHJamafBxmOt5MrHq9hGtp5VI= -github.com/gardener/gardener v1.1.1-0.20200323102039-58593d8be86a h1:TkMIvx1xRmd3xLuORXEqsQhpni49+wfuT4keC6d3Tsc= -github.com/gardener/gardener v1.1.1-0.20200323102039-58593d8be86a/go.mod h1:lGAx5NkFDWoC4hPIL+lHJamafBxmOt5MrHq9hGtp5VI= -github.com/gardener/gardener-extensions v1.5.0 h1:6JkU0/DV2bJvwkuPoP7/nPlyCrzPGKfw5j4f+wtXBeI= -github.com/gardener/gardener-extensions v1.5.0/go.mod h1:yCdFgMAz++ex3d1fmhN3Yti9MR9HN9iKTUjz5eI0uIQ= +github.com/gardener/gardener v1.1.1-0.20200330051317-a326f96cf32b h1:MkEDp9PdrZPkIAPGj6oNcKl0fBaOcJ1ddKsAA7bVWnI= +github.com/gardener/gardener v1.1.1-0.20200330051317-a326f96cf32b/go.mod h1:lGAx5NkFDWoC4hPIL+lHJamafBxmOt5MrHq9hGtp5VI= +github.com/gardener/gardener-extensions v1.5.1-0.20200330101454-c65957bd80b5 h1:zDXG4369jfXvZlPNQe4YX38VA0h5SDq2xk8dqLg73e4= +github.com/gardener/gardener-extensions v1.5.1-0.20200330101454-c65957bd80b5/go.mod h1:+0MkNqbRaTvPMfEe/MoS31L5FM8W32WYvhpH4Y53Y5s= github.com/gardener/gardener-resource-manager v0.10.0 h1:6OUKoWI3oha42F0oJN8OEo3UR+D3onOCel4Th+zgotU= github.com/gardener/gardener-resource-manager v0.10.0/go.mod h1:0pKTHOhvU91eQB0EYr/6Ymd7lXc/5Hi8P8tF/gpV0VQ= github.com/gardener/hvpa-controller v0.0.0-20191014062307-fad3bdf06a25 h1:nOFITmV7vt4fcYPEXgj66Qs83FdDEMvL/LQcR0diRRE= diff --git a/pkg/controller/controlplane/valuesprovider.go b/pkg/controller/controlplane/valuesprovider.go index 670a11cef..d4c0784e3 100644 --- a/pkg/controller/controlplane/valuesprovider.go +++ b/pkg/controller/controlplane/valuesprovider.go @@ -317,6 +317,9 @@ func getCCMChartValues( "checksum/secret-cloudprovider": checksums[v1beta1constants.SecretNameCloudProvider], "checksum/configmap-cloud-provider-config-cloud-controller-manager": checksums[openstacktypes.CloudProviderConfigCloudControllerManagerName], }, + "podLabels": map[string]interface{}{ + v1beta1constants.LabelPodMaintenanceRestart: "true", + }, } if cpConfig.CloudControllerManager != nil { diff --git a/pkg/controller/controlplane/valuesprovider_test.go b/pkg/controller/controlplane/valuesprovider_test.go index 3f8d9e2b1..842a7b24c 100644 --- a/pkg/controller/controlplane/valuesprovider_test.go +++ b/pkg/controller/controlplane/valuesprovider_test.go @@ -186,6 +186,9 @@ var _ = Describe("ValuesProvider", func() { "checksum/secret-cloudprovider": "8bafb35ff1ac60275d62e1cbd495aceb511fb354f74a20f7d06ecb48b3a68432", "checksum/configmap-cloud-provider-config-cloud-controller-manager": "08a7bc7fe8f59b055f173145e211760a83f02cf89635cef26ebb351378635606", }, + "podLabels": map[string]interface{}{ + "maintenance.gardener.cloud/restart": "true", + }, "featureGates": map[string]bool{ "CustomResourceValidation": true, }, diff --git a/pkg/controller/worker/machine_controller_manager.go b/pkg/controller/worker/machine_controller_manager.go index 758f61350..8ce4521c5 100644 --- a/pkg/controller/worker/machine_controller_manager.go +++ b/pkg/controller/worker/machine_controller_manager.go @@ -22,6 +22,7 @@ import ( "github.com/gardener/gardener-extension-provider-openstack/pkg/openstack" extensionscontroller "github.com/gardener/gardener-extensions/pkg/controller" + v1beta1constants "github.com/gardener/gardener/pkg/apis/core/v1beta1/constants" "github.com/gardener/gardener/pkg/utils/chart" kutil "github.com/gardener/gardener/pkg/utils/kubernetes" appsv1 "k8s.io/api/apps/v1" @@ -65,6 +66,9 @@ func (w *workerDelegate) GetMachineControllerManagerChartValues(ctx context.Cont "namespace": map[string]interface{}{ "uid": namespace.UID, }, + "podLabels": map[string]interface{}{ + v1beta1constants.LabelPodMaintenanceRestart: "true", + }, }, nil } diff --git a/pkg/controller/worker/machines.go b/pkg/controller/worker/machines.go index 99695ea5a..ba35ad0b0 100644 --- a/pkg/controller/worker/machines.go +++ b/pkg/controller/worker/machines.go @@ -112,7 +112,7 @@ func (w *workerDelegate) generateMachineConfig(ctx context.Context) error { } for _, pool := range w.worker.Spec.Pools { - zoneLen := len(pool.Zones) + zoneLen := int32(len(pool.Zones)) workerPoolHash, err := worker.WorkerPoolHash(pool, w.cluster) if err != nil { @@ -134,6 +134,7 @@ func (w *workerDelegate) generateMachineConfig(ctx context.Context) error { } for zoneIndex, zone := range pool.Zones { + zoneIdx := int32(zoneIndex) machineClassSpec := map[string]interface{}{ "region": w.worker.Spec.Region, "availabilityZone": zone, @@ -170,10 +171,10 @@ func (w *workerDelegate) generateMachineConfig(ctx context.Context) error { Name: deploymentName, ClassName: className, SecretName: className, - Minimum: worker.DistributeOverZones(zoneIndex, pool.Minimum, zoneLen), - Maximum: worker.DistributeOverZones(zoneIndex, pool.Maximum, zoneLen), - MaxSurge: worker.DistributePositiveIntOrPercent(zoneIndex, pool.MaxSurge, zoneLen, pool.Maximum), - MaxUnavailable: worker.DistributePositiveIntOrPercent(zoneIndex, pool.MaxUnavailable, zoneLen, pool.Minimum), + Minimum: worker.DistributeOverZones(zoneIdx, pool.Minimum, zoneLen), + Maximum: worker.DistributeOverZones(zoneIdx, pool.Maximum, zoneLen), + MaxSurge: worker.DistributePositiveIntOrPercent(zoneIdx, pool.MaxSurge, zoneLen, pool.Maximum), + MaxUnavailable: worker.DistributePositiveIntOrPercent(zoneIdx, pool.MaxUnavailable, zoneLen, pool.Minimum), Labels: pool.Labels, Annotations: pool.Annotations, Taints: pool.Taints, diff --git a/pkg/controller/worker/machines_test.go b/pkg/controller/worker/machines_test.go index 759984106..e98a40df1 100644 --- a/pkg/controller/worker/machines_test.go +++ b/pkg/controller/worker/machines_test.go @@ -106,14 +106,14 @@ var _ = Describe("Machines", func() { securityGroupName string namePool1 string - minPool1 int - maxPool1 int + minPool1 int32 + maxPool1 int32 maxSurgePool1 intstr.IntOrString maxUnavailablePool1 intstr.IntOrString namePool2 string - minPool2 int - maxPool2 int + minPool2 int32 + maxPool2 int32 maxSurgePool2 intstr.IntOrString maxUnavailablePool2 intstr.IntOrString diff --git a/vendor/github.com/gardener/gardener-extensions/pkg/controller/status.go b/vendor/github.com/gardener/gardener-extensions/pkg/controller/status.go index 9c6a1e84f..5361fb5b0 100644 --- a/vendor/github.com/gardener/gardener-extensions/pkg/controller/status.go +++ b/vendor/github.com/gardener/gardener-extensions/pkg/controller/status.go @@ -21,7 +21,7 @@ import ( ) // LastOperation creates a new LastOperation from the given parameters. -func LastOperation(t gardencorev1beta1.LastOperationType, state gardencorev1beta1.LastOperationState, progress int, description string) *gardencorev1beta1.LastOperation { +func LastOperation(t gardencorev1beta1.LastOperationType, state gardencorev1beta1.LastOperationState, progress int32, description string) *gardencorev1beta1.LastOperation { return &gardencorev1beta1.LastOperation{ LastUpdateTime: metav1.Now(), Type: t, @@ -48,6 +48,6 @@ func ReconcileSucceeded(t gardencorev1beta1.LastOperationType, description strin } // ReconcileError returns a LastOperation with state error and a LastError with the given description and codes. -func ReconcileError(t gardencorev1beta1.LastOperationType, description string, progress int, codes ...gardencorev1beta1.ErrorCode) (*gardencorev1beta1.LastOperation, *gardencorev1beta1.LastError) { +func ReconcileError(t gardencorev1beta1.LastOperationType, description string, progress int32, codes ...gardencorev1beta1.ErrorCode) (*gardencorev1beta1.LastOperation, *gardencorev1beta1.LastError) { return LastOperation(t, gardencorev1beta1.LastOperationStateError, progress, description), LastError(description, codes...) } diff --git a/vendor/github.com/gardener/gardener-extensions/pkg/controller/worker/genericactuator/actuator_delete.go b/vendor/github.com/gardener/gardener-extensions/pkg/controller/worker/genericactuator/actuator_delete.go index b3fe5c7cd..e7d13d3e1 100644 --- a/vendor/github.com/gardener/gardener-extensions/pkg/controller/worker/genericactuator/actuator_delete.go +++ b/vendor/github.com/gardener/gardener-extensions/pkg/controller/worker/genericactuator/actuator_delete.go @@ -92,7 +92,7 @@ func (a *genericActuator) Delete(ctx context.Context, worker *extensionsv1alpha1 defer cancel() if err := a.waitUntilMachineResourcesDeleted(timeoutCtx, worker, workerDelegate); err != nil { - return gardencorev1beta1helper.DetermineError(fmt.Sprintf("Failed while waiting for all machine resources to be deleted: '%s'", err.Error())) + return gardencorev1beta1helper.DetermineError(err, fmt.Sprintf("Failed while waiting for all machine resources to be deleted: '%s'", err.Error())) } // Delete the machine-controller-manager. diff --git a/vendor/github.com/gardener/gardener-extensions/pkg/controller/worker/genericactuator/actuator_reconcile.go b/vendor/github.com/gardener/gardener-extensions/pkg/controller/worker/genericactuator/actuator_reconcile.go index feb2ccac9..b69f40498 100644 --- a/vendor/github.com/gardener/gardener-extensions/pkg/controller/worker/genericactuator/actuator_reconcile.go +++ b/vendor/github.com/gardener/gardener-extensions/pkg/controller/worker/genericactuator/actuator_reconcile.go @@ -146,7 +146,7 @@ func (a *genericActuator) Reconcile(ctx context.Context, worker *extensionsv1alp defer cancel() if err := a.waitUntilWantedMachineDeploymentsAvailable(timeoutCtx, cluster, worker, wantedMachineDeployments); err != nil { - return gardencorev1beta1helper.DetermineError(fmt.Sprintf("Failed while waiting for all machine deployments to be ready: '%s'", err.Error())) + return gardencorev1beta1helper.DetermineError(err, fmt.Sprintf("Failed while waiting for all machine deployments to be ready: '%s'", err.Error())) } // Delete all old machine deployments (i.e. those which were not previously computed but exist in the cluster). @@ -213,7 +213,7 @@ func (a *genericActuator) deployMachineDeployments(ctx context.Context, cluster var ( labels = map[string]string{"name": deployment.Name} existingMachineDeployment = getExistingMachineDeployment(existingMachineDeployments, deployment.Name) - replicas int + replicas int32 ) switch { @@ -239,11 +239,11 @@ func (a *genericActuator) deployMachineDeployments(ctx context.Context, cluster replicas = deployment.Minimum // If the shoot worker pool minimum was updated and if the current machine deployment replica // count is less than minimum, we update the machine deployment replica count to updated minimum. - case int(existingMachineDeployment.Spec.Replicas) < deployment.Minimum: + case existingMachineDeployment.Spec.Replicas < deployment.Minimum: replicas = deployment.Minimum // If the shoot worker pool maximum was updated and if the current machine deployment replica // count is greater than maximum, we update the machine deployment replica count to updated maximum. - case int(existingMachineDeployment.Spec.Replicas) > deployment.Maximum: + case existingMachineDeployment.Spec.Replicas > deployment.Maximum: replicas = deployment.Maximum // In this case the machine deployment must exist (otherwise the above case was already true), // and the cluster autoscaler must be enabled. We do not want to override the machine deployment's @@ -430,10 +430,10 @@ func shootIsAwake(isHibernated bool, existingMachineDeployments *machinev1alpha1 return true } -func getDeploymentSpecReplicas(existingMachineDeployments *machinev1alpha1.MachineDeploymentList, name string) int { +func getDeploymentSpecReplicas(existingMachineDeployments *machinev1alpha1.MachineDeploymentList, name string) int32 { for _, existingMachineDeployment := range existingMachineDeployments.Items { if existingMachineDeployment.Name == name { - return int(existingMachineDeployment.Spec.Replicas) + return existingMachineDeployment.Spec.Replicas } } return -1 diff --git a/vendor/github.com/gardener/gardener-extensions/pkg/controller/worker/machines.go b/vendor/github.com/gardener/gardener-extensions/pkg/controller/worker/machines.go index 9039bd362..db4b8faff 100644 --- a/vendor/github.com/gardener/gardener-extensions/pkg/controller/worker/machines.go +++ b/vendor/github.com/gardener/gardener-extensions/pkg/controller/worker/machines.go @@ -44,8 +44,8 @@ type MachineDeployment struct { Name string ClassName string SecretName string - Minimum int - Maximum int + Minimum int32 + Maximum int32 MaxSurge intstr.IntOrString MaxUnavailable intstr.IntOrString Labels map[string]string @@ -139,9 +139,9 @@ func WorkerPoolHash(pool extensionsv1alpha1.WorkerPool, cluster *extensionscontr // of index . // The distribution happens equally. In case of an uneven number , the last zone will have // one more node than the others. -func DistributeOverZones(zoneIndex, size, zoneSize int) int { +func DistributeOverZones(zoneIndex, size, zoneSize int32) int32 { first := size / zoneSize - second := 0 + second := int32(0) if zoneIndex < (size % zoneSize) { second = 1 } @@ -153,7 +153,7 @@ func DistributeOverZones(zoneIndex, size, zoneSize int) int { // always just returns the initial percentage. Otherwise, the total value is used to determine // the weight of a specific zone in relation to the other zones and adapt the given percentage // accordingly. -func DistributePercentOverZones(zoneIndex int, percent string, zoneSize, total int) string { +func DistributePercentOverZones(zoneIndex int32, percent string, zoneSize, total int32) string { percents, err := strconv.Atoi(percent[:len(percent)-1]) if err != nil { panic(fmt.Sprintf("given value %q is not a percent value", percent)) @@ -181,11 +181,11 @@ func DistributePercentOverZones(zoneIndex int, percent string, zoneSize, total i // always just returns the initial percentage. Otherwise, the total value is used to determine // the weight of a specific zone in relation to the other zones and adapt the given percentage // accordingly. -func DistributePositiveIntOrPercent(zoneIndex int, intOrPercent intstr.IntOrString, zoneSize int, total int) intstr.IntOrString { +func DistributePositiveIntOrPercent(zoneIndex int32, intOrPercent intstr.IntOrString, zoneSize, total int32) intstr.IntOrString { if intOrPercent.Type == intstr.String { return intstr.FromString(DistributePercentOverZones(zoneIndex, intOrPercent.StrVal, zoneSize, total)) } - return intstr.FromInt(DistributeOverZones(zoneIndex, int(intOrPercent.IntVal), zoneSize)) + return intstr.FromInt(int(DistributeOverZones(zoneIndex, intOrPercent.IntVal, zoneSize))) } // DiskSize extracts the numerical component of DiskSize strings, i.e. strings like "10Gi" and diff --git a/vendor/github.com/gardener/gardener-extensions/pkg/terraformer/terraformer.go b/vendor/github.com/gardener/gardener-extensions/pkg/terraformer/terraformer.go index 4168cdb45..53d7f8920 100644 --- a/vendor/github.com/gardener/gardener-extensions/pkg/terraformer/terraformer.go +++ b/vendor/github.com/gardener/gardener-extensions/pkg/terraformer/terraformer.go @@ -224,7 +224,7 @@ func (t *terraformer) execute(ctx context.Context, scriptName string) error { if terraformErrors := retrieveTerraformErrors(logList); terraformErrors != nil { errorMessage += fmt.Sprintf(" The following issues have been found in the logs:\n\n%s", strings.Join(terraformErrors, "\n\n")) } - return gardencorev1beta1helper.DetermineError(errorMessage) + return gardencorev1beta1helper.DetermineError(errors.New(errorMessage), errorMessage) } return nil } diff --git a/vendor/github.com/gardener/gardener/pkg/api/extensions/accessor.go b/vendor/github.com/gardener/gardener/pkg/api/extensions/accessor.go index 91219e0bf..415986f33 100644 --- a/vendor/github.com/gardener/gardener/pkg/api/extensions/accessor.go +++ b/vendor/github.com/gardener/gardener/pkg/api/extensions/accessor.go @@ -84,6 +84,25 @@ func nestedString(obj map[string]interface{}, fields ...string) string { return v } +func nestedInt32(obj map[string]interface{}, fields ...string) int32 { + v, ok, err := unstructured.NestedFieldNoCopy(obj, fields...) + if err != nil || !ok { + return 0 + } + + switch x := v.(type) { + case int64: + // safe, as the DefaultUnstructuredConverter uses int64 to store int16, int32, etc. + return int32(x) + case int32: + return x + case int: + return int32(x) + default: + return 0 + } +} + func nestedInt64(obj map[string]interface{}, fields ...string) int64 { v, ok, err := unstructured.NestedInt64(obj, fields...) if err != nil || !ok { @@ -101,24 +120,6 @@ func nestedStringReference(obj map[string]interface{}, fields ...string) *string return &v } -func nestedInt(obj map[string]interface{}, fields ...string) int { - v, ok, err := unstructured.NestedFieldNoCopy(obj, fields...) - if err != nil || !ok { - return 0 - } - - switch x := v.(type) { - case int64: - return int(x) - case int32: - return int(x) - case int: - return x - default: - return 0 - } -} - func nestedRawExtension(obj map[string]interface{}, fields ...string) *runtime.RawExtension { val, ok, err := unstructured.NestedFieldNoCopy(obj, fields...) if err != nil || !ok { @@ -151,8 +152,8 @@ func (u unstructuredLastOperationAccessor) GetLastUpdateTime() metav1.Time { } // GetProgress implements LastOperation. -func (u unstructuredLastOperationAccessor) GetProgress() int { - return nestedInt(u.UnstructuredContent(), "status", "lastOperation", "progress") +func (u unstructuredLastOperationAccessor) GetProgress() int32 { + return nestedInt32(u.UnstructuredContent(), "status", "lastOperation", "progress") } // GetState implements LastOperation. diff --git a/vendor/github.com/gardener/gardener/pkg/apis/core/types_common.go b/vendor/github.com/gardener/gardener/pkg/apis/core/types_common.go index 39212c3ac..ea3be15ac 100644 --- a/vendor/github.com/gardener/gardener/pkg/apis/core/types_common.go +++ b/vendor/github.com/gardener/gardener/pkg/apis/core/types_common.go @@ -81,7 +81,7 @@ type LastOperation struct { // Last time the operation state transitioned from one to another. LastUpdateTime metav1.Time // The progress in percentage (0-100) of the last operation. - Progress int + Progress int32 // Status of the last operation, one of Aborted, Processing, Succeeded, Error, Failed. State LastOperationState // Type of the last operation, one of Create, Reconcile, Delete. diff --git a/vendor/github.com/gardener/gardener/pkg/apis/core/types_quota.go b/vendor/github.com/gardener/gardener/pkg/apis/core/types_quota.go index 0067b1341..bf9e0a976 100644 --- a/vendor/github.com/gardener/gardener/pkg/apis/core/types_quota.go +++ b/vendor/github.com/gardener/gardener/pkg/apis/core/types_quota.go @@ -44,7 +44,7 @@ type QuotaList struct { // QuotaSpec is the specification of a Quota. type QuotaSpec struct { // ClusterLifetimeDays is the lifetime of a Shoot cluster in days before it will be terminated automatically. - ClusterLifetimeDays *int + ClusterLifetimeDays *int32 // Metrics is a list of resources which will be put under constraints. Metrics corev1.ResourceList // Scope is the scope of the Quota object, either 'project' or 'secret'. diff --git a/vendor/github.com/gardener/gardener/pkg/apis/core/types_shoot.go b/vendor/github.com/gardener/gardener/pkg/apis/core/types_shoot.go index 59ff219e3..a5be941f8 100644 --- a/vendor/github.com/gardener/gardener/pkg/apis/core/types_shoot.go +++ b/vendor/github.com/gardener/gardener/pkg/apis/core/types_shoot.go @@ -711,6 +711,8 @@ type Volume struct { type CRI struct { // The name of the CRI library Name CRIName + // ContainerRuntimes is the list of the required container runtimes supported for a worker pool. + ContainerRuntimes []ContainerRuntime } // CRIName is a type alias for the CRI name string. @@ -720,6 +722,14 @@ const ( CRINameContainerD CRIName = "containerd" ) +// ContainerRuntime contains information about worker's available container runtime +type ContainerRuntime struct { + // Type is the type of the Container Runtime. + Type string + // ProviderConfig is the configuration passed to the ContainerRuntime resource. + ProviderConfig *ProviderConfig +} + var ( // DefaultWorkerMaxSurge is the default value for Worker MaxSurge. DefaultWorkerMaxSurge = intstr.FromInt(1) diff --git a/vendor/github.com/gardener/gardener/pkg/apis/core/v1alpha1/types_common.go b/vendor/github.com/gardener/gardener/pkg/apis/core/v1alpha1/types_common.go index 2db0d5b78..2cc51aad7 100644 --- a/vendor/github.com/gardener/gardener/pkg/apis/core/v1alpha1/types_common.go +++ b/vendor/github.com/gardener/gardener/pkg/apis/core/v1alpha1/types_common.go @@ -105,7 +105,7 @@ type LastOperation struct { // Last time the operation state transitioned from one to another. LastUpdateTime metav1.Time `json:"lastUpdateTime"` // The progress in percentage (0-100) of the last operation. - Progress int `json:"progress"` + Progress int32 `json:"progress"` // Status of the last operation, one of Aborted, Processing, Succeeded, Error, Failed. State LastOperationState `json:"state"` // Type of the last operation, one of Create, Reconcile, Delete. @@ -123,7 +123,7 @@ func (l *LastOperation) GetLastUpdateTime() metav1.Time { } // GetProgress implements LastOperation. -func (l *LastOperation) GetProgress() int { +func (l *LastOperation) GetProgress() int32 { return l.Progress } diff --git a/vendor/github.com/gardener/gardener/pkg/apis/core/v1alpha1/types_quota.go b/vendor/github.com/gardener/gardener/pkg/apis/core/v1alpha1/types_quota.go index 43607386a..4116507c4 100644 --- a/vendor/github.com/gardener/gardener/pkg/apis/core/v1alpha1/types_quota.go +++ b/vendor/github.com/gardener/gardener/pkg/apis/core/v1alpha1/types_quota.go @@ -48,7 +48,7 @@ type QuotaList struct { type QuotaSpec struct { // ClusterLifetimeDays is the lifetime of a Shoot cluster in days before it will be terminated automatically. // +optional - ClusterLifetimeDays *int `json:"clusterLifetimeDays,omitempty"` + ClusterLifetimeDays *int32 `json:"clusterLifetimeDays,omitempty"` // Metrics is a list of resources which will be put under constraints. Metrics corev1.ResourceList `json:"metrics"` // Scope is the scope of the Quota object, either 'project' or 'secret'. diff --git a/vendor/github.com/gardener/gardener/pkg/apis/core/v1alpha1/types_shoot.go b/vendor/github.com/gardener/gardener/pkg/apis/core/v1alpha1/types_shoot.go index 133072bf4..58018138b 100644 --- a/vendor/github.com/gardener/gardener/pkg/apis/core/v1alpha1/types_shoot.go +++ b/vendor/github.com/gardener/gardener/pkg/apis/core/v1alpha1/types_shoot.go @@ -866,6 +866,9 @@ type Volume struct { type CRI struct { // The name of the CRI library Name CRIName `json:"name"` + // ContainerRuntimes is the list of the required container runtimes supported for a worker pool. + // +optional + ContainerRuntimes []ContainerRuntime `json:"containerRuntimes,omitempty"` } // CRIName is a type alias for the CRI name string. @@ -875,6 +878,15 @@ const ( CRINameContainerD CRIName = "containerd" ) +// ContainerRuntime contains information about worker's available container runtime +type ContainerRuntime struct { + // Type is the type of the Container Runtime. + Type string `json:"type"` + // ProviderConfig is the configuration passed to the ContainerRuntime resource. + // +optional + ProviderConfig *ProviderConfig `json:"providerConfig,omitempty"` +} + var ( // DefaultWorkerMaxSurge is the default value for Worker MaxSurge. DefaultWorkerMaxSurge = intstr.FromInt(1) diff --git a/vendor/github.com/gardener/gardener/pkg/apis/core/v1alpha1/zz_generated.conversion.go b/vendor/github.com/gardener/gardener/pkg/apis/core/v1alpha1/zz_generated.conversion.go index 371a5389b..dd9153d7b 100644 --- a/vendor/github.com/gardener/gardener/pkg/apis/core/v1alpha1/zz_generated.conversion.go +++ b/vendor/github.com/gardener/gardener/pkg/apis/core/v1alpha1/zz_generated.conversion.go @@ -281,6 +281,16 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddGeneratedConversionFunc((*ContainerRuntime)(nil), (*core.ContainerRuntime)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ContainerRuntime_To_core_ContainerRuntime(a.(*ContainerRuntime), b.(*core.ContainerRuntime), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ContainerRuntime)(nil), (*ContainerRuntime)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ContainerRuntime_To_v1alpha1_ContainerRuntime(a.(*core.ContainerRuntime), b.(*ContainerRuntime), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*ControllerDeployment)(nil), (*core.ControllerDeployment)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_ControllerDeployment_To_core_ControllerDeployment(a.(*ControllerDeployment), b.(*core.ControllerDeployment), scope) }); err != nil { @@ -1668,6 +1678,7 @@ func Convert_core_BackupEntryStatus_To_v1alpha1_BackupEntryStatus(in *core.Backu func autoConvert_v1alpha1_CRI_To_core_CRI(in *CRI, out *core.CRI, s conversion.Scope) error { out.Name = core.CRIName(in.Name) + out.ContainerRuntimes = *(*[]core.ContainerRuntime)(unsafe.Pointer(&in.ContainerRuntimes)) return nil } @@ -1678,6 +1689,7 @@ func Convert_v1alpha1_CRI_To_core_CRI(in *CRI, out *core.CRI, s conversion.Scope func autoConvert_core_CRI_To_v1alpha1_CRI(in *core.CRI, out *CRI, s conversion.Scope) error { out.Name = CRIName(in.Name) + out.ContainerRuntimes = *(*[]ContainerRuntime)(unsafe.Pointer(&in.ContainerRuntimes)) return nil } @@ -1886,6 +1898,28 @@ func Convert_core_Condition_To_v1alpha1_Condition(in *core.Condition, out *Condi return autoConvert_core_Condition_To_v1alpha1_Condition(in, out, s) } +func autoConvert_v1alpha1_ContainerRuntime_To_core_ContainerRuntime(in *ContainerRuntime, out *core.ContainerRuntime, s conversion.Scope) error { + out.Type = in.Type + out.ProviderConfig = (*core.ProviderConfig)(unsafe.Pointer(in.ProviderConfig)) + return nil +} + +// Convert_v1alpha1_ContainerRuntime_To_core_ContainerRuntime is an autogenerated conversion function. +func Convert_v1alpha1_ContainerRuntime_To_core_ContainerRuntime(in *ContainerRuntime, out *core.ContainerRuntime, s conversion.Scope) error { + return autoConvert_v1alpha1_ContainerRuntime_To_core_ContainerRuntime(in, out, s) +} + +func autoConvert_core_ContainerRuntime_To_v1alpha1_ContainerRuntime(in *core.ContainerRuntime, out *ContainerRuntime, s conversion.Scope) error { + out.Type = in.Type + out.ProviderConfig = (*ProviderConfig)(unsafe.Pointer(in.ProviderConfig)) + return nil +} + +// Convert_core_ContainerRuntime_To_v1alpha1_ContainerRuntime is an autogenerated conversion function. +func Convert_core_ContainerRuntime_To_v1alpha1_ContainerRuntime(in *core.ContainerRuntime, out *ContainerRuntime, s conversion.Scope) error { + return autoConvert_core_ContainerRuntime_To_v1alpha1_ContainerRuntime(in, out, s) +} + func autoConvert_v1alpha1_ControllerDeployment_To_core_ControllerDeployment(in *ControllerDeployment, out *core.ControllerDeployment, s conversion.Scope) error { out.Type = in.Type out.ProviderConfig = (*core.ProviderConfig)(unsafe.Pointer(in.ProviderConfig)) @@ -3460,7 +3494,7 @@ func Convert_core_QuotaList_To_v1alpha1_QuotaList(in *core.QuotaList, out *Quota } func autoConvert_v1alpha1_QuotaSpec_To_core_QuotaSpec(in *QuotaSpec, out *core.QuotaSpec, s conversion.Scope) error { - out.ClusterLifetimeDays = (*int)(unsafe.Pointer(in.ClusterLifetimeDays)) + out.ClusterLifetimeDays = (*int32)(unsafe.Pointer(in.ClusterLifetimeDays)) out.Metrics = *(*v1.ResourceList)(unsafe.Pointer(&in.Metrics)) out.Scope = in.Scope return nil @@ -3472,7 +3506,7 @@ func Convert_v1alpha1_QuotaSpec_To_core_QuotaSpec(in *QuotaSpec, out *core.Quota } func autoConvert_core_QuotaSpec_To_v1alpha1_QuotaSpec(in *core.QuotaSpec, out *QuotaSpec, s conversion.Scope) error { - out.ClusterLifetimeDays = (*int)(unsafe.Pointer(in.ClusterLifetimeDays)) + out.ClusterLifetimeDays = (*int32)(unsafe.Pointer(in.ClusterLifetimeDays)) out.Metrics = *(*v1.ResourceList)(unsafe.Pointer(&in.Metrics)) out.Scope = in.Scope return nil diff --git a/vendor/github.com/gardener/gardener/pkg/apis/core/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/gardener/gardener/pkg/apis/core/v1alpha1/zz_generated.deepcopy.go index 4907b5521..d8fa013ef 100644 --- a/vendor/github.com/gardener/gardener/pkg/apis/core/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/github.com/gardener/gardener/pkg/apis/core/v1alpha1/zz_generated.deepcopy.go @@ -432,6 +432,13 @@ func (in *BackupEntryStatus) DeepCopy() *BackupEntryStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CRI) DeepCopyInto(out *CRI) { *out = *in + if in.ContainerRuntimes != nil { + in, out := &in.ContainerRuntimes, &out.ContainerRuntimes + *out = make([]ContainerRuntime, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } return } @@ -663,6 +670,27 @@ func (in *Condition) DeepCopy() *Condition { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ContainerRuntime) DeepCopyInto(out *ContainerRuntime) { + *out = *in + if in.ProviderConfig != nil { + in, out := &in.ProviderConfig, &out.ProviderConfig + *out = new(ProviderConfig) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerRuntime. +func (in *ContainerRuntime) DeepCopy() *ContainerRuntime { + if in == nil { + return nil + } + out := new(ContainerRuntime) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ControllerDeployment) DeepCopyInto(out *ControllerDeployment) { *out = *in @@ -2439,7 +2467,7 @@ func (in *QuotaSpec) DeepCopyInto(out *QuotaSpec) { *out = *in if in.ClusterLifetimeDays != nil { in, out := &in.ClusterLifetimeDays, &out.ClusterLifetimeDays - *out = new(int) + *out = new(int32) **out = **in } if in.Metrics != nil { @@ -3251,7 +3279,7 @@ func (in *Worker) DeepCopyInto(out *Worker) { if in.CRI != nil { in, out := &in.CRI, &out.CRI *out = new(CRI) - **out = **in + (*in).DeepCopyInto(*out) } if in.Kubernetes != nil { in, out := &in.Kubernetes, &out.Kubernetes diff --git a/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/constants/types_constants.go b/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/constants/types_constants.go index 479f10be3..bd02f3c08 100644 --- a/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/constants/types_constants.go +++ b/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/constants/types_constants.go @@ -267,4 +267,7 @@ const ( // EventResourceReferenced indicates that the resource deletion is in waiting mode because the resource is still // being referenced by at least one other resource (e.g. a SecretBinding is still referenced by a Shoot) EventResourceReferenced = "ResourceReferenced" + + // LabelPodMaintenanceRestart is a constant for a label that describes that a pod should be restarted during maintenance. + LabelPodMaintenanceRestart = "maintenance.gardener.cloud/restart" ) diff --git a/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/helper/errors.go b/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/helper/errors.go index 46e667d08..780efb2b0 100644 --- a/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/helper/errors.go +++ b/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/helper/errors.go @@ -52,16 +52,36 @@ var ( dependenciesRegexp = regexp.MustCompile(`(?i)(PendingVerification|Access Not Configured|accessNotConfigured|DependencyViolation|OptInRequired|DeleteConflict|Conflict|inactive billing state|ReadOnlyDisabledSubscription|is already being used|not available in the current hardware cluster)`) ) -// DetermineError determines the Garden error code for the given error message. -func DetermineError(message string) error { - code := determineErrorCode(message) - if code == "" { +// DetermineError determines the Garden error code for the given error and creates a new error with the given message. +func DetermineError(err error, message string) error { + if err == nil { return errors.New(message) } - return &errorWithCode{code, message} + + errMsg := message + if errMsg == "" { + errMsg = err.Error() + } + + code := determineErrorCode(err) + if code == "" { + return errors.New(errMsg) + } + return &errorWithCode{code, errMsg} } -func determineErrorCode(message string) gardencorev1beta1.ErrorCode { +func determineErrorCode(err error) gardencorev1beta1.ErrorCode { + var coder Coder + + // first try to re-use code from error + if errors.As(err, &coder) { + switch coder.Code() { + case gardencorev1beta1.ErrorInfraUnauthorized, gardencorev1beta1.ErrorInfraQuotaExceeded, gardencorev1beta1.ErrorInfraInsufficientPrivileges, gardencorev1beta1.ErrorInfraDependencies: + return coder.Code() + } + } + + message := err.Error() switch { case unauthorizedRegexp.MatchString(message): return gardencorev1beta1.ErrorInfraUnauthorized @@ -86,7 +106,8 @@ type Coder interface { func ExtractErrorCodes(err error) []gardencorev1beta1.ErrorCode { var codes []gardencorev1beta1.ErrorCode for _, err := range utilerrors.Errors(err) { - if coder, ok := err.(Coder); ok { + var coder Coder + if errors.As(err, &coder) { codes = append(codes, coder.Code()) } } diff --git a/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/types_common.go b/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/types_common.go index 75c6714ca..04ea84563 100644 --- a/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/types_common.go +++ b/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/types_common.go @@ -28,6 +28,8 @@ const ( ErrorInfraQuotaExceeded ErrorCode = "ERR_INFRA_QUOTA_EXCEEDED" // ErrorInfraDependencies indicates that the last error occurred due to dependent objects on the cloud provider level. ErrorInfraDependencies ErrorCode = "ERR_INFRA_DEPENDENCIES" + // ErrorCleanupClusterResources indicates that the last error occurred due to resources in the cluster are stuck in deletion. + ErrorCleanupClusterResources ErrorCode = "ERR_CLEANUP_CLUSTER_RESOURCES" ) // LastError indicates the last occurred error for an operation on a resource. @@ -105,7 +107,7 @@ type LastOperation struct { // Last time the operation state transitioned from one to another. LastUpdateTime metav1.Time `json:"lastUpdateTime"` // The progress in percentage (0-100) of the last operation. - Progress int `json:"progress"` + Progress int32 `json:"progress"` // Status of the last operation, one of Aborted, Processing, Succeeded, Error, Failed. State LastOperationState `json:"state"` // Type of the last operation, one of Create, Reconcile, Delete. @@ -123,7 +125,7 @@ func (l *LastOperation) GetLastUpdateTime() metav1.Time { } // GetProgress implements LastOperation. -func (l *LastOperation) GetProgress() int { +func (l *LastOperation) GetProgress() int32 { return l.Progress } diff --git a/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/types_quota.go b/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/types_quota.go index cda5b1040..137cba58c 100644 --- a/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/types_quota.go +++ b/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/types_quota.go @@ -48,7 +48,7 @@ type QuotaList struct { type QuotaSpec struct { // ClusterLifetimeDays is the lifetime of a Shoot cluster in days before it will be terminated automatically. // +optional - ClusterLifetimeDays *int `json:"clusterLifetimeDays,omitempty"` + ClusterLifetimeDays *int32 `json:"clusterLifetimeDays,omitempty"` // Metrics is a list of resources which will be put under constraints. Metrics corev1.ResourceList `json:"metrics"` // Scope is the scope of the Quota object, either 'project' or 'secret'. diff --git a/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/types_shoot.go b/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/types_shoot.go index 4d16e8e33..aad0313b9 100644 --- a/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/types_shoot.go +++ b/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/types_shoot.go @@ -863,6 +863,9 @@ type Volume struct { type CRI struct { // The name of the CRI library Name CRIName `json:"name"` + // ContainerRuntimes is the list of the required container runtimes supported for a worker pool. + // +optional + ContainerRuntimes []ContainerRuntime `json:"containerRuntimes,omitempty"` } // CRIName is a type alias for the CRI name string. @@ -872,6 +875,16 @@ const ( CRINameContainerD CRIName = "containerd" ) +// ContainerRuntime contains information about worker's available container runtime +type ContainerRuntime struct { + // Type is the type of the Container Runtime. + Type string `json:"type"` + + // ProviderConfig is the configuration passed to container runtime resource. + // +optional + ProviderConfig *ProviderConfig `json:"providerConfig,omitempty"` +} + var ( // DefaultWorkerMaxSurge is the default value for Worker MaxSurge. DefaultWorkerMaxSurge = intstr.FromInt(1) diff --git a/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/zz_generated.conversion.go b/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/zz_generated.conversion.go index 13f1c2340..3b7216f7d 100644 --- a/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/zz_generated.conversion.go +++ b/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/zz_generated.conversion.go @@ -281,6 +281,16 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddGeneratedConversionFunc((*ContainerRuntime)(nil), (*core.ContainerRuntime)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_ContainerRuntime_To_core_ContainerRuntime(a.(*ContainerRuntime), b.(*core.ContainerRuntime), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ContainerRuntime)(nil), (*ContainerRuntime)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ContainerRuntime_To_v1beta1_ContainerRuntime(a.(*core.ContainerRuntime), b.(*ContainerRuntime), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*ControllerDeployment)(nil), (*core.ControllerDeployment)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_ControllerDeployment_To_core_ControllerDeployment(a.(*ControllerDeployment), b.(*core.ControllerDeployment), scope) }); err != nil { @@ -1538,6 +1548,7 @@ func Convert_core_BackupEntryStatus_To_v1beta1_BackupEntryStatus(in *core.Backup func autoConvert_v1beta1_CRI_To_core_CRI(in *CRI, out *core.CRI, s conversion.Scope) error { out.Name = core.CRIName(in.Name) + out.ContainerRuntimes = *(*[]core.ContainerRuntime)(unsafe.Pointer(&in.ContainerRuntimes)) return nil } @@ -1548,6 +1559,7 @@ func Convert_v1beta1_CRI_To_core_CRI(in *CRI, out *core.CRI, s conversion.Scope) func autoConvert_core_CRI_To_v1beta1_CRI(in *core.CRI, out *CRI, s conversion.Scope) error { out.Name = CRIName(in.Name) + out.ContainerRuntimes = *(*[]ContainerRuntime)(unsafe.Pointer(&in.ContainerRuntimes)) return nil } @@ -1756,6 +1768,28 @@ func Convert_core_Condition_To_v1beta1_Condition(in *core.Condition, out *Condit return autoConvert_core_Condition_To_v1beta1_Condition(in, out, s) } +func autoConvert_v1beta1_ContainerRuntime_To_core_ContainerRuntime(in *ContainerRuntime, out *core.ContainerRuntime, s conversion.Scope) error { + out.Type = in.Type + out.ProviderConfig = (*core.ProviderConfig)(unsafe.Pointer(in.ProviderConfig)) + return nil +} + +// Convert_v1beta1_ContainerRuntime_To_core_ContainerRuntime is an autogenerated conversion function. +func Convert_v1beta1_ContainerRuntime_To_core_ContainerRuntime(in *ContainerRuntime, out *core.ContainerRuntime, s conversion.Scope) error { + return autoConvert_v1beta1_ContainerRuntime_To_core_ContainerRuntime(in, out, s) +} + +func autoConvert_core_ContainerRuntime_To_v1beta1_ContainerRuntime(in *core.ContainerRuntime, out *ContainerRuntime, s conversion.Scope) error { + out.Type = in.Type + out.ProviderConfig = (*ProviderConfig)(unsafe.Pointer(in.ProviderConfig)) + return nil +} + +// Convert_core_ContainerRuntime_To_v1beta1_ContainerRuntime is an autogenerated conversion function. +func Convert_core_ContainerRuntime_To_v1beta1_ContainerRuntime(in *core.ContainerRuntime, out *ContainerRuntime, s conversion.Scope) error { + return autoConvert_core_ContainerRuntime_To_v1beta1_ContainerRuntime(in, out, s) +} + func autoConvert_v1beta1_ControllerDeployment_To_core_ControllerDeployment(in *ControllerDeployment, out *core.ControllerDeployment, s conversion.Scope) error { out.Type = in.Type out.ProviderConfig = (*core.ProviderConfig)(unsafe.Pointer(in.ProviderConfig)) @@ -3280,7 +3314,7 @@ func Convert_core_QuotaList_To_v1beta1_QuotaList(in *core.QuotaList, out *QuotaL } func autoConvert_v1beta1_QuotaSpec_To_core_QuotaSpec(in *QuotaSpec, out *core.QuotaSpec, s conversion.Scope) error { - out.ClusterLifetimeDays = (*int)(unsafe.Pointer(in.ClusterLifetimeDays)) + out.ClusterLifetimeDays = (*int32)(unsafe.Pointer(in.ClusterLifetimeDays)) out.Metrics = *(*v1.ResourceList)(unsafe.Pointer(&in.Metrics)) out.Scope = in.Scope return nil @@ -3292,7 +3326,7 @@ func Convert_v1beta1_QuotaSpec_To_core_QuotaSpec(in *QuotaSpec, out *core.QuotaS } func autoConvert_core_QuotaSpec_To_v1beta1_QuotaSpec(in *core.QuotaSpec, out *QuotaSpec, s conversion.Scope) error { - out.ClusterLifetimeDays = (*int)(unsafe.Pointer(in.ClusterLifetimeDays)) + out.ClusterLifetimeDays = (*int32)(unsafe.Pointer(in.ClusterLifetimeDays)) out.Metrics = *(*v1.ResourceList)(unsafe.Pointer(&in.Metrics)) out.Scope = in.Scope return nil diff --git a/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/zz_generated.deepcopy.go b/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/zz_generated.deepcopy.go index 266d5f8d4..052b4e070 100644 --- a/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/zz_generated.deepcopy.go +++ b/vendor/github.com/gardener/gardener/pkg/apis/core/v1beta1/zz_generated.deepcopy.go @@ -432,6 +432,13 @@ func (in *BackupEntryStatus) DeepCopy() *BackupEntryStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CRI) DeepCopyInto(out *CRI) { *out = *in + if in.ContainerRuntimes != nil { + in, out := &in.ContainerRuntimes, &out.ContainerRuntimes + *out = make([]ContainerRuntime, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } return } @@ -663,6 +670,27 @@ func (in *Condition) DeepCopy() *Condition { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ContainerRuntime) DeepCopyInto(out *ContainerRuntime) { + *out = *in + if in.ProviderConfig != nil { + in, out := &in.ProviderConfig, &out.ProviderConfig + *out = new(ProviderConfig) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerRuntime. +func (in *ContainerRuntime) DeepCopy() *ContainerRuntime { + if in == nil { + return nil + } + out := new(ContainerRuntime) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ControllerDeployment) DeepCopyInto(out *ControllerDeployment) { *out = *in @@ -2395,7 +2423,7 @@ func (in *QuotaSpec) DeepCopyInto(out *QuotaSpec) { *out = *in if in.ClusterLifetimeDays != nil { in, out := &in.ClusterLifetimeDays, &out.ClusterLifetimeDays - *out = new(int) + *out = new(int32) **out = **in } if in.Metrics != nil { @@ -3112,7 +3140,7 @@ func (in *Worker) DeepCopyInto(out *Worker) { if in.CRI != nil { in, out := &in.CRI, &out.CRI *out = new(CRI) - **out = **in + (*in).DeepCopyInto(*out) } if in.Kubernetes != nil { in, out := &in.Kubernetes, &out.Kubernetes diff --git a/vendor/github.com/gardener/gardener/pkg/apis/core/validation/shoot.go b/vendor/github.com/gardener/gardener/pkg/apis/core/validation/shoot.go index b5d02749a..40a38fe92 100644 --- a/vendor/github.com/gardener/gardener/pkg/apis/core/validation/shoot.go +++ b/vendor/github.com/gardener/gardener/pkg/apis/core/validation/shoot.go @@ -1076,6 +1076,8 @@ func ValidateWorkers(workers []core.Worker, fldPath *field.Path) field.ErrorList allErrs = append(allErrs, field.Forbidden(fldPath, fmt.Sprintf("at least one worker pool must exist having either no taints or only the %q taint", corev1.TaintEffectPreferNoSchedule))) } + allErrs = append(allErrs, ValidateContainerRuntimesConfigurations(workers, fldPath.Child("workers"))...) + return allErrs } @@ -1237,5 +1239,48 @@ func ValidateCRI(CRI *core.CRI, fldPath *field.Path) field.ErrorList { allErrs = append(allErrs, field.NotSupported(fldPath.Child("name"), CRI.Name, avaliableWorkerCRINames.List())) } + if CRI.ContainerRuntimes != nil { + allErrs = append(ValidateContainerRuntimes(CRI.ContainerRuntimes, fldPath.Child("containerruntimes"))) + } + + return allErrs +} + +func ValidateContainerRuntimes(containerRuntime []core.ContainerRuntime, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + crSet := make(map[string]bool) + + for i, cr := range containerRuntime { + if len(cr.Type) == 0 { + allErrs = append(allErrs, field.Required(fldPath.Index(i).Child("type"), "must specify a container runtime type")) + } + if crSet[cr.Type] { + allErrs = append(allErrs, field.Duplicate(fldPath.Index(i).Child("type"), fmt.Sprintf("must specify different type, %s already exist", cr.Type))) + } + crSet[cr.Type] = true + } + + return allErrs +} + +// ValidateContainerRuntimesConfigurations checks that all container runtimes with the same type have the same configurations. +func ValidateContainerRuntimesConfigurations(workers []core.Worker, fldPath *field.Path) field.ErrorList { + definedContainerRuntimesMap := map[string]core.ContainerRuntime{} + allErrs := field.ErrorList{} + + for i, worker := range workers { + if worker.CRI != nil { + for j, cr := range worker.CRI.ContainerRuntimes { + if val, ok := definedContainerRuntimesMap[cr.Type]; ok { + if !apiequality.Semantic.DeepEqual(cr.ProviderConfig, val.ProviderConfig) { + allErrs = append(allErrs, field.Invalid(fldPath.Index(i).Child("cri", "containerRuntimes").Index(j).Child("providerConfig"), &cr.ProviderConfig, fmt.Sprintf("must specify same provider config for all the ContainerRuntimes from type %s", cr.Type))) + } + } else { + definedContainerRuntimesMap[cr.Type] = cr + } + } + } + } + return allErrs } diff --git a/vendor/github.com/gardener/gardener/pkg/apis/core/zz_generated.deepcopy.go b/vendor/github.com/gardener/gardener/pkg/apis/core/zz_generated.deepcopy.go index ac812f116..ee89428b2 100644 --- a/vendor/github.com/gardener/gardener/pkg/apis/core/zz_generated.deepcopy.go +++ b/vendor/github.com/gardener/gardener/pkg/apis/core/zz_generated.deepcopy.go @@ -432,6 +432,13 @@ func (in *BackupEntryStatus) DeepCopy() *BackupEntryStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CRI) DeepCopyInto(out *CRI) { *out = *in + if in.ContainerRuntimes != nil { + in, out := &in.ContainerRuntimes, &out.ContainerRuntimes + *out = make([]ContainerRuntime, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } return } @@ -663,6 +670,27 @@ func (in *Condition) DeepCopy() *Condition { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ContainerRuntime) DeepCopyInto(out *ContainerRuntime) { + *out = *in + if in.ProviderConfig != nil { + in, out := &in.ProviderConfig, &out.ProviderConfig + *out = new(ProviderConfig) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerRuntime. +func (in *ContainerRuntime) DeepCopy() *ContainerRuntime { + if in == nil { + return nil + } + out := new(ContainerRuntime) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ControllerDeployment) DeepCopyInto(out *ControllerDeployment) { *out = *in @@ -2439,7 +2467,7 @@ func (in *QuotaSpec) DeepCopyInto(out *QuotaSpec) { *out = *in if in.ClusterLifetimeDays != nil { in, out := &in.ClusterLifetimeDays, &out.ClusterLifetimeDays - *out = new(int) + *out = new(int32) **out = **in } if in.Metrics != nil { @@ -3246,7 +3274,7 @@ func (in *Worker) DeepCopyInto(out *Worker) { if in.CRI != nil { in, out := &in.CRI, &out.CRI *out = new(CRI) - **out = **in + (*in).DeepCopyInto(*out) } if in.Kubernetes != nil { in, out := &in.Kubernetes, &out.Kubernetes diff --git a/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/register.go b/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/register.go index b3ba007e3..32e4f7dbc 100644 --- a/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/register.go +++ b/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/register.go @@ -49,6 +49,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &BackupEntryList{}, &Cluster{}, &ClusterList{}, + &ContainerRuntime{}, + &ContainerRuntimeList{}, &ControlPlane{}, &ControlPlaneList{}, &Extension{}, diff --git a/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/types.go b/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/types.go index 554734f96..9029f9402 100644 --- a/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/types.go +++ b/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/types.go @@ -48,7 +48,7 @@ type LastOperation interface { // GetLastUpdateTime returns the last update time of the last operation. GetLastUpdateTime() metav1.Time // GetProgress returns progress of the last operation. - GetProgress() int + GetProgress() int32 // GetState returns the LastOperationState of the last operation. GetState() gardencorev1beta1.LastOperationState // GetType returns the LastOperationType of the last operation. diff --git a/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/types_containerruntime.go b/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/types_containerruntime.go new file mode 100644 index 000000000..dbce0cfb0 --- /dev/null +++ b/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/types_containerruntime.go @@ -0,0 +1,77 @@ +// Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// 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 v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +var _ Object = (*ContainerRuntime)(nil) + +const ( +// ContainerRuntimeResource is a constant for the name of the Container Runtime Extension resource. +ContainerRuntimeResource = "ContainerRuntime" +// CRINameWorkerLabel is the name of the label describing the CRI name used in this node. +CRINameWorkerLabel = "worker.gardener.cloud/cri-name" +// ContainerRuntimeNameWorkerLabel is a label describing a Container Runtime which should be supported on the node. +ContainerRuntimeNameWorkerLabel = "containerruntime.worker.gardener.cloud/%s" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ContainerRuntime is a specification for a container runtime resource. +type ContainerRuntime struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec ContainerRuntimeSpec `json:"spec"` + Status ContainerRuntimeStatus `json:"status"` +} + +// GetExtensionSpec implements Object. +func (i *ContainerRuntime) GetExtensionSpec() Spec { + return &i.Spec +} + +// GetExtensionStatus implements Object. +func (i *ContainerRuntime) GetExtensionStatus() Status { + return &i.Status +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ContainerRuntimeList is a list of ContainerRuntime resources. +type ContainerRuntimeList struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + + Items []ContainerRuntime `json:"items"` +} + +// ContainerRuntimeSpec is the spec for a ContainerRuntime resource. +type ContainerRuntimeSpec struct { + // BinaryPath is the Worker's machine path where container runtime extensions should copy the binaries to. + BinaryPath string `json:"binaryPath"` + // DefaultSpec is a structure containing common fields used by all extension resources. + DefaultSpec `json:",inline"` +} + +// ContainerRuntimeStatus is the status for a ContainerRuntime resource. +type ContainerRuntimeStatus struct { + // DefaultStatus is a structure containing common fields used by all extension resources. + DefaultStatus `json:",inline"` +} diff --git a/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/types_defaults.go b/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/types_defaults.go index 9affd7831..d0ad80e42 100644 --- a/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/types_defaults.go +++ b/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/types_defaults.go @@ -25,6 +25,7 @@ type DefaultSpec struct { Type string `json:"type"` // ProviderConfig is the provider specific configuration. // +optional + ProviderConfig *runtime.RawExtension `json:"providerConfig,omitempty"` } diff --git a/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/types_operatingsystemconfig.go b/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/types_operatingsystemconfig.go index 6373cbdc4..ecbda5780 100644 --- a/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/types_operatingsystemconfig.go +++ b/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/types_operatingsystemconfig.go @@ -218,3 +218,6 @@ const ( // CRINameContainerD is a constant for ContainerD CRI name CRINameContainerD = "containerd" ) + +// ContainerDRuntimeContainersBinFolder is the folder where Container Runtime binaries should be saved for ContainerD usage +const ContainerDRuntimeContainersBinFolder = "/var/bin/containerruntimes" diff --git a/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/types_worker.go b/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/types_worker.go index 235b4d2f8..014b51223 100644 --- a/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/types_worker.go +++ b/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/types_worker.go @@ -88,7 +88,7 @@ type WorkerPool struct { // MachineType contains information about the machine type that should be used for this worker pool. MachineType string `json:"machineType"` // Maximum is the maximum size of the worker pool. - Maximum int `json:"maximum"` + Maximum int32 `json:"maximum"` // MaxSurge is maximum number of VMs that are created during an update. MaxSurge intstr.IntOrString `json:"maxSurge"` // MaxUnavailable is the maximum number of VMs that can be unavailable during an update. @@ -107,7 +107,7 @@ type WorkerPool struct { // AMIs, ...) by the provider itself. MachineImage MachineImage `json:"machineImage,omitempty"` // Minimum is the minimum size of the worker pool. - Minimum int `json:"minimum"` + Minimum int32 `json:"minimum"` // Name is the name of this worker pool. Name string `json:"name"` // ProviderConfig is a provider specific configuration for the worker pool. @@ -171,7 +171,7 @@ type MachineDeployment struct { // Name is the name of the `MachineDeployment` resource. Name string `json:"name"` // Minimum is the minimum number for this machine deployment. - Minimum int `json:"minimum"` + Minimum int32 `json:"minimum"` // Maximum is the maximum number for this machine deployment. - Maximum int `json:"maximum"` + Maximum int32 `json:"maximum"` } diff --git a/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/zz_generated.deepcopy.go index c0ea1aae3..fe22bef42 100644 --- a/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/github.com/gardener/gardener/pkg/apis/extensions/v1alpha1/zz_generated.deepcopy.go @@ -340,6 +340,101 @@ func (in *ClusterSpec) DeepCopy() *ClusterSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ContainerRuntime) DeepCopyInto(out *ContainerRuntime) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerRuntime. +func (in *ContainerRuntime) DeepCopy() *ContainerRuntime { + if in == nil { + return nil + } + out := new(ContainerRuntime) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ContainerRuntime) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ContainerRuntimeList) DeepCopyInto(out *ContainerRuntimeList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ContainerRuntime, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerRuntimeList. +func (in *ContainerRuntimeList) DeepCopy() *ContainerRuntimeList { + if in == nil { + return nil + } + out := new(ContainerRuntimeList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ContainerRuntimeList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ContainerRuntimeSpec) DeepCopyInto(out *ContainerRuntimeSpec) { + *out = *in + in.DefaultSpec.DeepCopyInto(&out.DefaultSpec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerRuntimeSpec. +func (in *ContainerRuntimeSpec) DeepCopy() *ContainerRuntimeSpec { + if in == nil { + return nil + } + out := new(ContainerRuntimeSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ContainerRuntimeStatus) DeepCopyInto(out *ContainerRuntimeStatus) { + *out = *in + in.DefaultStatus.DeepCopyInto(&out.DefaultStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerRuntimeStatus. +func (in *ContainerRuntimeStatus) DeepCopy() *ContainerRuntimeStatus { + if in == nil { + return nil + } + out := new(ContainerRuntimeStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ControlPlane) DeepCopyInto(out *ControlPlane) { *out = *in diff --git a/vendor/github.com/gardener/gardener/pkg/client/kubernetes/client.go b/vendor/github.com/gardener/gardener/pkg/client/kubernetes/client.go index 92ed4b1be..94fe2dbdf 100644 --- a/vendor/github.com/gardener/gardener/pkg/client/kubernetes/client.go +++ b/vendor/github.com/gardener/gardener/pkg/client/kubernetes/client.go @@ -228,6 +228,7 @@ var supportedKubernetesVersions = []string{ "1.15", "1.16", "1.17", + "1.18", } func checkIfSupportedKubernetesVersion(gitVersion string) error { diff --git a/vendor/github.com/gardener/gardener/pkg/operation/botanist/addons.go b/vendor/github.com/gardener/gardener/pkg/operation/botanist/addons.go index 53833cf47..1324438df 100644 --- a/vendor/github.com/gardener/gardener/pkg/operation/botanist/addons.go +++ b/vendor/github.com/gardener/gardener/pkg/operation/botanist/addons.go @@ -40,7 +40,7 @@ const DNSIngressName = "ingress" // EnsureIngressDNSRecord creates the respective wildcard DNS record for the nginx-ingress-controller. func (b *Botanist) EnsureIngressDNSRecord(ctx context.Context) error { - if !b.Shoot.NginxIngressEnabled() || b.Shoot.HibernationEnabled { + if !b.Shoot.NginxIngressEnabled() { return b.DestroyIngressDNSRecord(ctx) } diff --git a/vendor/github.com/gardener/gardener/pkg/operation/botanist/cleanup.go b/vendor/github.com/gardener/gardener/pkg/operation/botanist/cleanup.go index 9fbe463c4..31565b719 100644 --- a/vendor/github.com/gardener/gardener/pkg/operation/botanist/cleanup.go +++ b/vendor/github.com/gardener/gardener/pkg/operation/botanist/cleanup.go @@ -18,7 +18,9 @@ import ( "context" "time" + gardencorev1beta1 "github.com/gardener/gardener/pkg/apis/core/v1beta1" v1beta1constants "github.com/gardener/gardener/pkg/apis/core/v1beta1/constants" + "github.com/gardener/gardener/pkg/apis/core/v1beta1/helper" "github.com/gardener/gardener/pkg/operation/common" "github.com/gardener/gardener/pkg/utils/flow" utilclient "github.com/gardener/gardener/pkg/utils/kubernetes/client" @@ -170,7 +172,7 @@ func cleanResourceFn(cleanOps utilclient.CleanOps, c client.Client, list runtime return retry.Until(ctx, DefaultInterval, func(ctx context.Context) (done bool, err error) { if err := cleanOps.CleanAndEnsureGone(ctx, c, list, opts...); err != nil { if utilclient.AreObjectsRemaining(err) { - return retry.MinorError(err) + return retry.MinorError(helper.NewErrorWithCode(gardencorev1beta1.ErrorCleanupClusterResources, err.Error())) } return retry.SevereError(err) } diff --git a/vendor/github.com/gardener/gardener/pkg/operation/botanist/containerruntime.go b/vendor/github.com/gardener/gardener/pkg/operation/botanist/containerruntime.go new file mode 100644 index 000000000..6ae14de79 --- /dev/null +++ b/vendor/github.com/gardener/gardener/pkg/operation/botanist/containerruntime.go @@ -0,0 +1,216 @@ +// Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file +// +// 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 botanist + +import ( + "context" + "errors" + "fmt" + + gardencorev1beta1 "github.com/gardener/gardener/pkg/apis/core/v1beta1" + v1beta1constants "github.com/gardener/gardener/pkg/apis/core/v1beta1/constants" + gardencorev1beta1helper "github.com/gardener/gardener/pkg/apis/core/v1beta1/helper" + extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1" + "github.com/gardener/gardener/pkg/client/kubernetes" + "github.com/gardener/gardener/pkg/operation/shoot" + "github.com/gardener/gardener/pkg/utils/flow" + kutil "github.com/gardener/gardener/pkg/utils/kubernetes" + "github.com/gardener/gardener/pkg/utils/kubernetes/health" + "github.com/gardener/gardener/pkg/utils/retry" + + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/sets" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" +) + +// DeployContainerRuntimeResources creates the `Container runtime` resource in the shoot namespace in the seed +// cluster. Gardener waits until an external controller did reconcile the resources successfully. +func (b *Botanist) DeployContainerRuntimeResources(ctx context.Context) error { + fns := []flow.TaskFn{} + requiredContainerRuntimeTypes := sets.NewString() + for _, worker := range b.Shoot.Info.Spec.Provider.Workers { + if worker.CRI != nil { + for _, containerRuntime := range worker.CRI.ContainerRuntimes { + if !requiredContainerRuntimeTypes.Has(containerRuntime.Type) { + + requiredContainerRuntimeTypes.Insert(containerRuntime.Type) + + var ( + cr = containerRuntime + toApply = extensionsv1alpha1.ContainerRuntime{ + ObjectMeta: metav1.ObjectMeta{ + Name: containerRuntime.Type, + Namespace: b.Shoot.SeedNamespace, + }, + } + ) + + fns = append(fns, func(ctx context.Context) error { + _, err := controllerutil.CreateOrUpdate(ctx, b.K8sSeedClient.Client(), &toApply, func() error { + metav1.SetMetaDataAnnotation(&toApply.ObjectMeta, v1beta1constants.GardenerOperation, v1beta1constants.GardenerOperationReconcile) + toApply.Spec.BinaryPath = extensionsv1alpha1.ContainerDRuntimeContainersBinFolder + toApply.Spec.Type = cr.Type + if cr.ProviderConfig != nil { + toApply.Spec.ProviderConfig = &cr.ProviderConfig.RawExtension + } + return nil + }) + return err + }) + } + } + } + } + + return flow.Parallel(fns...)(ctx) +} + +// DeleteStaleContainerRuntimeResources deletes unused container runtime resources from the shoot namespace in the seed. +func (b *Botanist) DeleteStaleContainerRuntimeResources(ctx context.Context) error { + wantedContainerRuntimes := sets.NewString() + for _, worker := range b.Shoot.Info.Spec.Provider.Workers { + if worker.CRI != nil { + for _, containerRuntime := range worker.CRI.ContainerRuntimes { + wantedContainerRuntimes.Insert(containerRuntime.Type) + } + } + } + + deployedContainerRuntimes := &extensionsv1alpha1.ContainerRuntimeList{} + if err := b.K8sSeedClient.Client().List(ctx, deployedContainerRuntimes, client.InNamespace(b.Shoot.SeedNamespace)); err != nil { + return err + } + + fns := make([]flow.TaskFn, 0, meta.LenList(deployedContainerRuntimes)) + for _, deployedContainerRuntime := range deployedContainerRuntimes.Items { + if !wantedContainerRuntimes.Has(deployedContainerRuntime.Spec.Type) { + toDelete := &extensionsv1alpha1.ContainerRuntime{ + ObjectMeta: metav1.ObjectMeta{ + Name: deployedContainerRuntime.Name, + Namespace: deployedContainerRuntime.Namespace, + }, + } + fns = append(fns, func(ctx context.Context) error { + return client.IgnoreNotFound(b.K8sSeedClient.Client().Delete(ctx, toDelete, kubernetes.DefaultDeleteOptions...)) + }) + } + } + + return flow.Parallel(fns...)(ctx) +} + +// WaitUntilContainerRuntimeResourcesReady waits until all container runtime resources report `Succeeded` in their last operation state. +// The state must be reported before the passed context is cancelled or a container runtime's timeout has been reached. +// As soon as one timeout has been overstepped the function returns an error, further waits on container runtime will be aborted. +func (b *Botanist) WaitUntilContainerRuntimeResourcesReady(ctx context.Context) error { + fns := []flow.TaskFn{} + requiredContainerRuntimeTypes := sets.NewString() + + for _, worker := range b.Shoot.Info.Spec.Provider.Workers { + if worker.CRI != nil { + for _, containerRuntime := range worker.CRI.ContainerRuntimes { + if !requiredContainerRuntimeTypes.Has(containerRuntime.Type) { + + requiredContainerRuntimeTypes.Insert(containerRuntime.Type) + + var ( + name = containerRuntime.Type + namespace = b.Shoot.SeedNamespace + ) + fns = append(fns, func(ctx context.Context) error { + if err := retry.UntilTimeout(ctx, DefaultInterval, shoot.ExtensionDefaultTimeout, func(ctx context.Context) (bool, error) { + req := &extensionsv1alpha1.ContainerRuntime{} + if err := b.K8sSeedClient.Client().Get(ctx, kutil.Key(namespace, name), req); err != nil { + return retry.SevereError(err) + } + + if err := health.CheckExtensionObject(req); err != nil { + b.Logger.WithError(err).Errorf("Container runtime %s/%s did not get ready yet", namespace, name) + return retry.MinorError(err) + } + + return retry.Ok() + }); err != nil { + return gardencorev1beta1helper.DetermineError(err, fmt.Sprintf("failed waiting for container runtime %s to be ready: %v", name, err)) + } + return nil + }) + } + } + } + } + + return flow.ParallelExitOnError(fns...)(ctx) +} + +// DeleteContainerRuntimeResources deletes all container runtime resources from the Shoot namespace in the Seed. +func (b *Botanist) DeleteContainerRuntimeResources(ctx context.Context) error { + return b.K8sSeedClient.Client().DeleteAllOf(ctx, &extensionsv1alpha1.ContainerRuntime{}, client.InNamespace(b.Shoot.SeedNamespace)) +} + +// WaitUntilContainerRuntimeResourcesDeleted waits until all container runtime resources are gone or the context is cancelled. +func (b *Botanist) WaitUntilContainerRuntimeResourcesDeleted(ctx context.Context) error { + var ( + lastError *gardencorev1beta1.LastError + containerRuntimes = &extensionsv1alpha1.ContainerRuntimeList{} + ) + + if err := b.K8sSeedClient.Client().List(ctx, containerRuntimes, client.InNamespace(b.Shoot.SeedNamespace)); err != nil { + return err + } + + fns := make([]flow.TaskFn, 0, len(containerRuntimes.Items)) + for _, containerRuntime := range containerRuntimes.Items { + if containerRuntime.GetDeletionTimestamp() == nil { + continue + } + + var ( + name = containerRuntime.Name + namespace = containerRuntime.Namespace + ) + + fns = append(fns, func(ctx context.Context) error { + if err := retry.UntilTimeout(ctx, DefaultInterval, shoot.ExtensionDefaultTimeout, func(ctx context.Context) (bool, error) { + retrievedContainerRuntime := extensionsv1alpha1.ContainerRuntime{} + if err := b.K8sSeedClient.Client().Get(ctx, kutil.Key(namespace, name), &retrievedContainerRuntime); err != nil { + if apierrors.IsNotFound(err) { + return retry.Ok() + } + return retry.SevereError(err) + } + + if lastErr := retrievedContainerRuntime.Status.LastError; lastErr != nil { + b.Logger.Errorf("Container runtime %s did not get deleted yet, lastError is: %s", name, lastErr.Description) + lastError = lastErr + } + + return retry.MinorError(gardencorev1beta1helper.WrapWithLastError(fmt.Errorf("container runtime %s is still present", name), lastError)) + }); err != nil { + message := fmt.Sprintf("Failed waiting for container runtime delete") + if lastError != nil { + return gardencorev1beta1helper.DetermineError(errors.New(lastError.Description), fmt.Sprintf("%s: %s", message, lastError.Description)) + } + return gardencorev1beta1helper.DetermineError(err, fmt.Sprintf("%s: %s", message, err.Error())) + } + return nil + }) + } + + return flow.Parallel(fns...)(ctx) +} diff --git a/vendor/github.com/gardener/gardener/pkg/operation/botanist/controlplane.go b/vendor/github.com/gardener/gardener/pkg/operation/botanist/controlplane.go index 53fb9165b..b8ce788d4 100644 --- a/vendor/github.com/gardener/gardener/pkg/operation/botanist/controlplane.go +++ b/vendor/github.com/gardener/gardener/pkg/operation/botanist/controlplane.go @@ -16,6 +16,7 @@ package botanist import ( "context" + "errors" "fmt" "hash/crc32" "path/filepath" @@ -30,6 +31,7 @@ import ( gardenletfeatures "github.com/gardener/gardener/pkg/gardenlet/features" "github.com/gardener/gardener/pkg/operation/common" "github.com/gardener/gardener/pkg/utils" + "github.com/gardener/gardener/pkg/utils/flow" kutil "github.com/gardener/gardener/pkg/utils/kubernetes" "github.com/gardener/gardener/pkg/utils/kubernetes/health" "github.com/gardener/gardener/pkg/utils/retry" @@ -289,6 +291,14 @@ func (b *Botanist) HibernateControlPlane(ctx context.Context) error { if err := c.Delete(ctx, &corev1.Service{ObjectMeta: metav1.ObjectMeta{Name: v1beta1constants.DeploymentNameKubeAPIServer, Namespace: b.Shoot.SeedNamespace}}, kubernetes.DefaultDeleteOptions...); client.IgnoreNotFound(err) != nil { return err } + + if err := flow.Parallel( + func(ctx context.Context) error { return b.DestroyInternalDomainDNSRecord(ctx) }, + func(ctx context.Context) error { return b.DestroyExternalDomainDNSRecord(ctx) }, + func(ctx context.Context) error { return b.DestroyIngressDNSRecord(ctx) }, + )(ctx); err != nil { + return err + } } for _, etcd := range []string{v1beta1constants.ETCDEvents, v1beta1constants.ETCDMain} { @@ -425,7 +435,7 @@ func (b *Botanist) waitUntilControlPlaneReady(ctx context.Context, name string) } return retry.Ok() }); err != nil { - return gardencorev1beta1helper.DetermineError(fmt.Sprintf("failed to create control plane: %v", err)) + return gardencorev1beta1helper.DetermineError(err, fmt.Sprintf("failed to create control plane: %v", err)) } return nil } @@ -463,9 +473,9 @@ func (b *Botanist) waitUntilControlPlaneDeleted(ctx context.Context, name string }); err != nil { message := fmt.Sprintf("Failed to delete control plane") if lastError != nil { - return gardencorev1beta1helper.DetermineError(fmt.Sprintf("%s: %s", message, lastError.Description)) + return gardencorev1beta1helper.DetermineError(errors.New(lastError.Description), fmt.Sprintf("%s: %s", message, lastError.Description)) } - return gardencorev1beta1helper.DetermineError(fmt.Sprintf("%s: %s", message, err.Error())) + return gardencorev1beta1helper.DetermineError(err, fmt.Sprintf("%s: %s", message, err.Error())) } return nil } @@ -990,6 +1000,9 @@ func (b *Botanist) DeployKubeControllerManager(ctx context.Context) error { "checksum/secret-kube-controller-manager-server": b.CheckSums[common.KubeControllerManagerServerName], "checksum/secret-service-account-key": b.CheckSums["service-account-key"], }, + "podLabels": map[string]interface{}{ + v1beta1constants.LabelPodMaintenanceRestart: "true", + }, } if b.Shoot.HibernationEnabled == b.Shoot.Info.Status.IsHibernated { @@ -1300,3 +1313,13 @@ func determineSchedule(shoot *gardencorev1beta1.Shoot, schedule string, f func(* creationHour := shoot.CreationTimestamp.Hour() return fmt.Sprintf(schedule, creationMinute, creationHour), nil } + +// RestartControlPlanePods restarts (deletes) pods of the shoot control plane. +func (b *Botanist) RestartControlPlanePods(ctx context.Context) error { + return b.K8sSeedClient.Client().DeleteAllOf( + ctx, + &corev1.Pod{}, + client.InNamespace(b.Shoot.SeedNamespace), + client.MatchingLabels{v1beta1constants.LabelPodMaintenanceRestart: "true"}, + ) +} diff --git a/vendor/github.com/gardener/gardener/pkg/operation/botanist/dns.go b/vendor/github.com/gardener/gardener/pkg/operation/botanist/dns.go index 14dc1d565..bd520f531 100644 --- a/vendor/github.com/gardener/gardener/pkg/operation/botanist/dns.go +++ b/vendor/github.com/gardener/gardener/pkg/operation/botanist/dns.go @@ -32,7 +32,6 @@ import ( dnsv1alpha1 "github.com/gardener/external-dns-management/pkg/apis/dns/v1alpha1" corev1 "k8s.io/api/core/v1" - apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/sets" "sigs.k8s.io/controller-runtime/pkg/client" @@ -225,14 +224,14 @@ func (b *Botanist) waitUntilDNSProviderReady(ctx context.Context, name string) e b.Logger.Infof("Waiting for %q DNS provider to be ready... (status=%s, message=%s)", name, status, message) return retry.MinorError(fmt.Errorf("DNS provider %q is not ready (status=%s, message=%s)", name, status, message)) }); err != nil { - return gardencorev1beta1helper.DetermineError(fmt.Sprintf("Failed to create DNS provider for %q DNS record: %q (status=%s, message=%s)", name, err.Error(), status, message)) + return gardencorev1beta1helper.DetermineError(err, fmt.Sprintf("Failed to create DNS provider for %q DNS record: %q (status=%s, message=%s)", name, err.Error(), status, message)) } return nil } func (b *Botanist) deleteDNSProvider(ctx context.Context, name string) error { - if err := b.K8sSeedClient.Client().Delete(ctx, &dnsv1alpha1.DNSProvider{ObjectMeta: metav1.ObjectMeta{Namespace: b.Shoot.SeedNamespace, Name: name}}); err != nil && !apierrors.IsNotFound(err) { + if err := b.K8sSeedClient.Client().Delete(ctx, &dnsv1alpha1.DNSProvider{ObjectMeta: metav1.ObjectMeta{Namespace: b.Shoot.SeedNamespace, Name: name}}); client.IgnoreNotFound(err) != nil { return err } @@ -280,14 +279,14 @@ func (b *Botanist) waitUntilDNSEntryReady(ctx context.Context, name string) erro b.Logger.Infof("Waiting for %q DNS record to be ready... (status=%s, message=%s)", name, status, message) return retry.MinorError(fmt.Errorf("DNS record %q is not ready (status=%s, message=%s)", name, status, message)) }); err != nil { - return gardencorev1beta1helper.DetermineError(fmt.Sprintf("Failed to create %q DNS record: %q (status=%s, message=%s)", name, err.Error(), status, message)) + return gardencorev1beta1helper.DetermineError(err, fmt.Sprintf("Failed to create %q DNS record: %q (status=%s, message=%s)", name, err.Error(), status, message)) } return nil } func (b *Botanist) deleteDNSEntry(ctx context.Context, name string) error { - if err := b.K8sSeedClient.Client().Delete(ctx, &dnsv1alpha1.DNSEntry{ObjectMeta: metav1.ObjectMeta{Namespace: b.Shoot.SeedNamespace, Name: name}}); err != nil && !apierrors.IsNotFound(err) { + if err := b.K8sSeedClient.Client().Delete(ctx, &dnsv1alpha1.DNSEntry{ObjectMeta: metav1.ObjectMeta{Namespace: b.Shoot.SeedNamespace, Name: name}}); client.IgnoreNotFound(err) != nil { return err } diff --git a/vendor/github.com/gardener/gardener/pkg/operation/botanist/extension.go b/vendor/github.com/gardener/gardener/pkg/operation/botanist/extension.go index 7b2fbdc36..0a4337190 100644 --- a/vendor/github.com/gardener/gardener/pkg/operation/botanist/extension.go +++ b/vendor/github.com/gardener/gardener/pkg/operation/botanist/extension.go @@ -16,6 +16,7 @@ package botanist import ( "context" + "errors" "fmt" gardencorev1beta1 "github.com/gardener/gardener/pkg/apis/core/v1beta1" @@ -122,7 +123,7 @@ func (b *Botanist) WaitUntilExtensionResourcesReady(ctx context.Context) error { return retry.Ok() }); err != nil { - return gardencorev1beta1helper.DetermineError(fmt.Sprintf("failed waiting for extension %s to be ready: %v", name, err)) + return gardencorev1beta1helper.DetermineError(err, fmt.Sprintf("failed waiting for extension %s to be ready: %v", name, err)) } return nil }) @@ -177,9 +178,9 @@ func (b *Botanist) WaitUntilExtensionResourcesDeleted(ctx context.Context) error }); err != nil { message := fmt.Sprintf("Failed waiting for extension delete") if lastError != nil { - return gardencorev1beta1helper.DetermineError(fmt.Sprintf("%s: %s", message, lastError.Description)) + return gardencorev1beta1helper.DetermineError(errors.New(lastError.Description), fmt.Sprintf("%s: %s", message, lastError.Description)) } - return gardencorev1beta1helper.DetermineError(fmt.Sprintf("%s: %s", message, err.Error())) + return gardencorev1beta1helper.DetermineError(err, fmt.Sprintf("%s: %s", message, err.Error())) } return nil }) diff --git a/vendor/github.com/gardener/gardener/pkg/operation/botanist/infrastructure.go b/vendor/github.com/gardener/gardener/pkg/operation/botanist/infrastructure.go index e3fd222ee..ec5f22caf 100644 --- a/vendor/github.com/gardener/gardener/pkg/operation/botanist/infrastructure.go +++ b/vendor/github.com/gardener/gardener/pkg/operation/botanist/infrastructure.go @@ -16,6 +16,7 @@ package botanist import ( "context" + "errors" "fmt" "time" @@ -124,7 +125,7 @@ func (b *Botanist) WaitUntilInfrastructureReady(ctx context.Context) error { return retry.Ok() }); err != nil { - return gardencorev1beta1helper.DetermineError(fmt.Sprintf("failed to create infrastructure: %v", err)) + return gardencorev1beta1helper.DetermineError(err, fmt.Sprintf("failed to create infrastructure: %v", err)) } return nil } @@ -152,9 +153,9 @@ func (b *Botanist) WaitUntilInfrastructureDeleted(ctx context.Context) error { }); err != nil { message := fmt.Sprintf("Failed to delete infrastructure") if lastError != nil { - return gardencorev1beta1helper.DetermineError(fmt.Sprintf("%s: %s", message, lastError.Description)) + return gardencorev1beta1helper.DetermineError(errors.New(lastError.Description), fmt.Sprintf("%s: %s", message, lastError.Description)) } - return gardencorev1beta1helper.DetermineError(fmt.Sprintf("%s: %s", message, err.Error())) + return gardencorev1beta1helper.DetermineError(err, fmt.Sprintf("%s: %s", message, err.Error())) } return nil diff --git a/vendor/github.com/gardener/gardener/pkg/operation/botanist/network.go b/vendor/github.com/gardener/gardener/pkg/operation/botanist/network.go index ba71a94cf..7f50f3d14 100644 --- a/vendor/github.com/gardener/gardener/pkg/operation/botanist/network.go +++ b/vendor/github.com/gardener/gardener/pkg/operation/botanist/network.go @@ -16,6 +16,7 @@ package botanist import ( "context" + "errors" "fmt" "time" @@ -84,7 +85,7 @@ func (b *Botanist) WaitUntilNetworkIsReady(ctx context.Context) error { } return retry.Ok() }); err != nil { - return gardencorev1beta1helper.DetermineError(fmt.Sprintf("failed to create network: %v", err)) + return gardencorev1beta1helper.DetermineError(err, fmt.Sprintf("failed to create network: %v", err)) } return nil } @@ -112,9 +113,9 @@ func (b *Botanist) WaitUntilNetworkIsDeleted(ctx context.Context) error { }); err != nil { message := fmt.Sprintf("Failed to delete Network") if lastError != nil { - return gardencorev1beta1helper.DetermineError(fmt.Sprintf("%s: %s", message, lastError.Description)) + return gardencorev1beta1helper.DetermineError(errors.New(lastError.Description), fmt.Sprintf("%s: %s", message, lastError.Description)) } - return gardencorev1beta1helper.DetermineError(fmt.Sprintf("%s: %s", message, err.Error())) + return gardencorev1beta1helper.DetermineError(err, fmt.Sprintf("%s: %s", message, err.Error())) } return nil diff --git a/vendor/github.com/gardener/gardener/pkg/operation/botanist/operatingsystemconfig.go b/vendor/github.com/gardener/gardener/pkg/operation/botanist/operatingsystemconfig.go index dae138d18..bcb64eadc 100644 --- a/vendor/github.com/gardener/gardener/pkg/operation/botanist/operatingsystemconfig.go +++ b/vendor/github.com/gardener/gardener/pkg/operation/botanist/operatingsystemconfig.go @@ -164,6 +164,20 @@ func (b *Botanist) deployOperatingSystemConfigsForWorker(ctx context.Context, ma sshKey := b.Secrets[v1beta1constants.SecretNameSSHKeyPair].Data[secrets.DataKeySSHAuthorizedKeys] + criNamesConfig := map[string]interface{}{ + "containerd": extensionsv1alpha1.CRINameContainerD, + } + + workerNameLabel := map[string]interface{}{ + "workerLabel": extensionsv1alpha1.CRINameWorkerLabel, + } + + criConfig := map[string]interface{}{ + "containerRuntimesBinaryPath": extensionsv1alpha1.ContainerDRuntimeContainersBinFolder, + "names": criNamesConfig, + "labels": workerNameLabel, + } + originalConfig["osc"] = map[string]interface{}{ "type": machineImage.Name, "purpose": extensionsv1alpha1.OperatingSystemConfigPurposeReconcile, @@ -171,6 +185,7 @@ func (b *Botanist) deployOperatingSystemConfigsForWorker(ctx context.Context, ma "secretName": secretName, "customization": customization, "sshKey": string(sshKey), + "cri": criConfig, } if data := worker.CABundle; data != nil { @@ -320,6 +335,13 @@ func (b *Botanist) deployOperatingSystemConfigsForWorker(ctx context.Context, ma criConfig := map[string]interface{}{ "name": worker.CRI.Name, } + if len(worker.CRI.ContainerRuntimes) > 0 { + crWorkerLabels := make([]string, len(worker.CRI.ContainerRuntimes)) + for i, cr := range worker.CRI.ContainerRuntimes { + crWorkerLabels[i] = fmt.Sprintf(extensionsv1alpha1.ContainerRuntimeNameWorkerLabel, cr.Type) + "=true" + } + criConfig["labels"] = crWorkerLabels + } workerConfig["cri"] = criConfig } diff --git a/vendor/github.com/gardener/gardener/pkg/operation/botanist/worker.go b/vendor/github.com/gardener/gardener/pkg/operation/botanist/worker.go index b1011ec0f..3497b912e 100644 --- a/vendor/github.com/gardener/gardener/pkg/operation/botanist/worker.go +++ b/vendor/github.com/gardener/gardener/pkg/operation/botanist/worker.go @@ -16,6 +16,7 @@ package botanist import ( "context" + "errors" "fmt" "time" @@ -85,8 +86,8 @@ func (b *Botanist) DeployWorker(ctx context.Context) error { pools = append(pools, extensionsv1alpha1.WorkerPool{ Name: worker.Name, - Minimum: int(worker.Minimum), - Maximum: int(worker.Maximum), + Minimum: worker.Minimum, + Maximum: worker.Maximum, MaxSurge: *worker.MaxSurge, MaxUnavailable: *worker.MaxUnavailable, Annotations: worker.Annotations, @@ -158,7 +159,7 @@ func (b *Botanist) WaitUntilWorkerReady(ctx context.Context) error { b.Shoot.MachineDeployments = worker.Status.MachineDeployments return retry.Ok() }); err != nil { - return gardencorev1beta1helper.DetermineError(fmt.Sprintf("Error while waiting for worker object to become ready: %v", err)) + return gardencorev1beta1helper.DetermineError(err, fmt.Sprintf("Error while waiting for worker object to become ready: %v", err)) } return nil } @@ -186,9 +187,9 @@ func (b *Botanist) WaitUntilWorkerDeleted(ctx context.Context) error { }); err != nil { message := fmt.Sprintf("Error while waiting for worker object to be deleted") if lastError != nil { - return gardencorev1beta1helper.DetermineError(fmt.Sprintf("%s: %s", message, lastError.Description)) + return gardencorev1beta1helper.DetermineError(errors.New(lastError.Description), fmt.Sprintf("%s: %s", message, lastError.Description)) } - return gardencorev1beta1helper.DetermineError(fmt.Sprintf("%s: %s", message, err.Error())) + return gardencorev1beta1helper.DetermineError(err, fmt.Sprintf("%s: %s", message, err.Error())) } return nil diff --git a/vendor/github.com/gardener/gardener/pkg/operation/common/types.go b/vendor/github.com/gardener/gardener/pkg/operation/common/types.go index d01e755b2..8ea75e3e7 100644 --- a/vendor/github.com/gardener/gardener/pkg/operation/common/types.go +++ b/vendor/github.com/gardener/gardener/pkg/operation/common/types.go @@ -349,6 +349,9 @@ const ( // ShootTaskDeployInfrastructure is a name for a Shoot's infrastructure deployment task. ShootTaskDeployInfrastructure = "deployInfrastructure" + // ShootTaskRestartControlPlanePods is a name for a Shoot task which is dedicated to restart related control plane pods. + ShootTaskRestartControlPlanePods = "restartControlPlanePods" + // ShootOperationRetry is a constant for an annotation on a Shoot indicating that a failed Shoot reconciliation shall be retried. ShootOperationRetry = "retry" diff --git a/vendor/github.com/gardener/gardener/pkg/operation/shoot/shoot.go b/vendor/github.com/gardener/gardener/pkg/operation/shoot/shoot.go index 40533f003..f7c8c8c8e 100644 --- a/vendor/github.com/gardener/gardener/pkg/operation/shoot/shoot.go +++ b/vendor/github.com/gardener/gardener/pkg/operation/shoot/shoot.go @@ -460,6 +460,11 @@ func ComputeRequiredExtensions(shoot *gardencorev1beta1.Shoot, seed *gardencorev if pool.Machine.Image != nil { requiredExtensions.Insert(fmt.Sprintf("%s/%s", extensionsv1alpha1.OperatingSystemConfigResource, pool.Machine.Image.Name)) } + if pool.CRI != nil { + for _, cr := range pool.CRI.ContainerRuntimes { + requiredExtensions.Insert(fmt.Sprintf("%s/%s", extensionsv1alpha1.ContainerRuntimeResource, cr.Type)) + } + } } if !gardencorev1beta1helper.TaintsHave(seed.Spec.Taints, gardencorev1beta1.SeedTaintDisableDNS) { diff --git a/vendor/github.com/gardener/gardener/pkg/utils/errors/errors.go b/vendor/github.com/gardener/gardener/pkg/utils/errors/errors.go index 79409cdc4..b4003eb6a 100644 --- a/vendor/github.com/gardener/gardener/pkg/utils/errors/errors.go +++ b/vendor/github.com/gardener/gardener/pkg/utils/errors/errors.go @@ -104,7 +104,7 @@ func (t *reconciliationError) Cause() error { } // GetID returns the ID of the error if possible. -// If err does not implement ErrorID or is nill an empty string will be returned. +// If err does not implement ErrorID or is nil an empty string will be returned. func GetID(err error) string { type errorIDer interface { ErrorID() string diff --git a/vendor/github.com/gardener/gardener/pkg/utils/flow/flow.go b/vendor/github.com/gardener/gardener/pkg/utils/flow/flow.go index 45a1c38b7..924bde4d4 100644 --- a/vendor/github.com/gardener/gardener/pkg/utils/flow/flow.go +++ b/vendor/github.com/gardener/gardener/pkg/utils/flow/flow.go @@ -132,8 +132,9 @@ type Stats struct { } // ProgressPercent retrieves the progress of a Flow execution in percent. -func (s *Stats) ProgressPercent() int { - return (100 * s.Succeeded.Len()) / s.All.Len() +func (s *Stats) ProgressPercent() int32 { + progress := (100 * s.Succeeded.Len()) / s.All.Len() + return int32(progress) } // Copy deeply copies a Stats object. diff --git a/vendor/github.com/gardener/gardener/pkg/utils/retry/retry.go b/vendor/github.com/gardener/gardener/pkg/utils/retry/retry.go index 363eb1417..ceb50e895 100644 --- a/vendor/github.com/gardener/gardener/pkg/utils/retry/retry.go +++ b/vendor/github.com/gardener/gardener/pkg/utils/retry/retry.go @@ -111,6 +111,12 @@ func (r *retryError) Cause() error { return r.ctxError } +// Unwrap implements the Unwrap function +// https://golang.org/pkg/errors/#Unwrap +func (r *retryError) Unwrap() error { + return r.err +} + // Error implements error. func (r *retryError) Error() string { if r.err != nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index 32e2c3cbf..814f5170b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -52,7 +52,7 @@ github.com/gardener/etcd-druid/api/v1alpha1 github.com/gardener/external-dns-management/pkg/apis/dns github.com/gardener/external-dns-management/pkg/apis/dns/v1alpha1 github.com/gardener/external-dns-management/pkg/client/dns/clientset/versioned/scheme -# github.com/gardener/gardener v1.1.1-0.20200323102039-58593d8be86a +# github.com/gardener/gardener v1.1.1-0.20200330051317-a326f96cf32b github.com/gardener/gardener/pkg/api/extensions github.com/gardener/gardener/pkg/apis/core github.com/gardener/gardener/pkg/apis/core/helper @@ -119,7 +119,7 @@ github.com/gardener/gardener/test/framework/config github.com/gardener/gardener/test/framework/reporter github.com/gardener/gardener/test/integration/framework github.com/gardener/gardener/test/integration/shoots -# github.com/gardener/gardener-extensions v1.5.0 +# github.com/gardener/gardener-extensions v1.5.1-0.20200330101454-c65957bd80b5 github.com/gardener/gardener-extensions/hack github.com/gardener/gardener-extensions/hack/.ci github.com/gardener/gardener-extensions/hack/api-reference/template