Skip to content

Commit

Permalink
Merge branch 'master' into cmi-client
Browse files Browse the repository at this point in the history
  • Loading branch information
prashanth26 committed Dec 16, 2019
1 parent ae337fb commit 21a46c0
Show file tree
Hide file tree
Showing 51 changed files with 259 additions and 11,030 deletions.
4 changes: 2 additions & 2 deletions .ci/pipeline_definitions
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ machine-controller-manager:
image: 'eu.gcr.io/gardener-project/gardener/machine-controller-manager'
steps:
check:
image: 'golang:1.12.6'
image: 'golang:1.13.4'
test:
image: 'eu.gcr.io/gardener-project/cc/job-image-golang:0.6.0'
build:
image: 'golang:1.12.6'
image: 'golang:1.13.4'
output_dir: 'binary'
jobs:
head-update:
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
############# builder #############
FROM golang:1.13.1 AS builder
FROM golang:1.13.4 AS builder

WORKDIR /go/src/github.com/gardener/machine-controller-manager
COPY . .

RUN .ci/build

############# base #############
FROM alpine:3.10 as base
FROM alpine:3.10.3 as base

RUN apk add --update bash curl tzdata
WORKDIR /
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.24.0-dev
v0.26.0-dev
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/gardener/machine-controller-manager

go 1.12
go 1.13

require (
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect
Expand Down
29 changes: 29 additions & 0 deletions pkg/apis/machine/install/install.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) 2019 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 install

import (
"github.com/gardener/machine-controller-manager/pkg/apis/machine"
"github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
)

// Install registers the API group and adds types to a scheme.
func Install(scheme *runtime.Scheme) {
utilruntime.Must(machine.AddToScheme(scheme))
utilruntime.Must(v1alpha1.AddToScheme(scheme))
utilruntime.Must(scheme.SetVersionPriority(v1alpha1.SchemeGroupVersion))
}
10 changes: 6 additions & 4 deletions pkg/controller/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,12 @@ func (dc *controller) reconcileClusterMachineDeployment(key string) error {
return nil
}

// Validate MachineClass
_, secretRef, err := dc.ValidateMachineClass(&deployment.Spec.Template.Spec.Class)
if err != nil || secretRef == nil {
return err
if deployment.DeletionTimestamp == nil {
// Validate MachineClass if the machineDeployment is not triggerred for deletion
_, secretRef, err := dc.ValidateMachineClass(&deployment.Spec.Template.Spec.Class)
if err != nil || secretRef == nil {
return err
}
}

// Resync the MachineDeployment after 10 minutes to avoid missing out on missed out events
Expand Down
15 changes: 10 additions & 5 deletions pkg/controller/drain.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ const (
// DefaultMachineDrainTimeout is the default value for MachineDrainTimeout
DefaultMachineDrainTimeout = 12 * time.Hour

// DefaultMaxEvictRetries is the default value for MaxEvictRetries
DefaultMaxEvictRetries = int32(3)

// PodsWithoutPVDrainGracePeriod defines the grace period to wait for the pods without PV during machine drain.
// This is in addition to the maximum terminationGracePeriod amount the pods.
PodsWithoutPVDrainGracePeriod = 3 * time.Minute
Expand All @@ -97,7 +94,8 @@ const (
Interval = time.Second * 5

// PodEvictionRetryInterval is the interval in which to retry eviction for pods
PodEvictionRetryInterval = time.Second * 5
PodEvictionRetryInterval = time.Second * 20

// GetPvDetailsRetryInterval is the interval in which to retry getting PV details
GetPvDetailsRetryInterval = time.Second * 5
// GetPvDetailsMaxRetries is the number of max retries to get PV details
Expand All @@ -113,6 +111,11 @@ const (
unmanagedWarning = "Deleting pods not managed by ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet"
)

var (
// DefaultMaxEvictRetries is the default value for MaxEvictRetries
DefaultMaxEvictRetries = int32(DefaultMachineDrainTimeout.Seconds() / PodEvictionRetryInterval.Seconds())
)

// NewDrainOptions creates a new DrainOptions struct and returns a pointer to it
func NewDrainOptions(
client kubernetes.Interface,
Expand Down Expand Up @@ -323,6 +326,7 @@ func (o *DrainOptions) deletePod(pod *api.Pod) error {
gracePeriodSeconds := int64(0)
deleteOptions.GracePeriodSeconds = &gracePeriodSeconds

glog.V(3).Infof("Attempting to force-delete the pod:%q from node %q", pod.Name, o.nodeName)
return o.client.Core().Pods(pod.Namespace).Delete(pod.Name, deleteOptions)
}

Expand All @@ -343,7 +347,8 @@ func (o *DrainOptions) evictPod(pod *api.Pod, policyGroupVersion string) error {
},
DeleteOptions: deleteOptions,
}
// Remember to change change the URL manipulation func when Evction's version change
glog.V(3).Infof("Attempting to evict the pod:%q from node %q", pod.Name, o.nodeName)
// Remember to change the URL manipulation func when Evction's version change
return o.client.Policy().Evictions(eviction.Namespace).Evict(eviction)
}

Expand Down
12 changes: 6 additions & 6 deletions pkg/controller/drain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ var _ = Describe("drain", func() {
}

if err != nil {
fmt.Fprintf(GinkgoWriter, "Error simulating evition for the pod %s/%s: %s", pod.Namespace, pod.Name, err)
fmt.Fprintf(GinkgoWriter, "Error simulating eviction for the pod %s/%s: %s", pod.Namespace, pod.Name, err)
}
}

Expand Down Expand Up @@ -642,7 +642,7 @@ var _ = Describe("drain", func() {
},
attemptEviction: false,
terminationGracePeriod: terminationGracePeriodShort,
force: true,
force: true,
},
nil,
&expectation{
Expand All @@ -668,7 +668,7 @@ var _ = Describe("drain", func() {
},
attemptEviction: true,
terminationGracePeriod: terminationGracePeriodShort,
force: true,
force: true,
},
[]podDrainHandler{deletePod},
&expectation{
Expand All @@ -695,8 +695,8 @@ var _ = Describe("drain", func() {
maxEvictRetries: 1,
attemptEviction: true,
terminationGracePeriod: terminationGracePeriodShort,
force: true,
evictError: apierrors.NewTooManyRequestsError(""),
force: true,
evictError: apierrors.NewTooManyRequestsError(""),
},
nil,
&expectation{
Expand All @@ -707,7 +707,7 @@ var _ = Describe("drain", func() {
nPodsWithExclusiveAndSharedPV: 0,
},
timeout: terminationGracePeriodMedium,
drainTimeout: false,
drainTimeout: true,
drainError: nil,
nEvictions: 0,
minDrainDuration: 0,
Expand Down
17 changes: 7 additions & 10 deletions pkg/controller/machineset.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,14 +462,14 @@ func (c *controller) reconcileClusterMachineSet(key string) error {
return nil
}

// Validate MachineClass
_, secretRef, err := c.ValidateMachineClass(&machineSet.Spec.Template.Spec.Class)
if err != nil || secretRef == nil {
return err
}

// Manipulate finalizers
if machineSet.DeletionTimestamp == nil {
// Validate MachineClass
_, secretRef, err := c.ValidateMachineClass(&machineSet.Spec.Template.Spec.Class)
if err != nil || secretRef == nil {
return err
}

// Manipulate finalizers
c.addMachineSetFinalizers(machineSet)
}

Expand Down Expand Up @@ -631,9 +631,6 @@ func (c *controller) prepareMachineForDeletion(targetMachine *v1alpha1.Machine,
if err != nil {
utilruntime.HandleError(fmt.Errorf("Couldn't get key for %v %#v: %v", machineSet.Kind, machineSet, err))
return
} else if targetMachine.Status.CurrentStatus.Phase == "" {
// Machine is still not created properly
return
}

if err := c.machineControl.DeleteMachine(targetMachine.Namespace, targetMachine.Name, machineSet); err != nil {
Expand Down
76 changes: 0 additions & 76 deletions vendor/github.com/google/btree/btree_mem.go

This file was deleted.

Loading

0 comments on commit 21a46c0

Please sign in to comment.