Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.4 cherrypick batch update #32583

Merged
merged 9 commits into from
Sep 13, 2016
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,29 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: heapster-v1.2.0-beta.2
name: heapster-v1.2.0-beta.3
namespace: kube-system
labels:
k8s-app: heapster
kubernetes.io/cluster-service: "true"
version: v1.2.0-beta.2
version: v1.2.0-beta.3
spec:
replicas: 1
selector:
matchLabels:
k8s-app: heapster
version: v1.2.0-beta.2
version: v1.2.0-beta.3
template:
metadata:
labels:
k8s-app: heapster
version: v1.2.0-beta.2
version: v1.2.0-beta.3
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]'
spec:
containers:
- image: gcr.io/google_containers/heapster:v1.2.0-beta.2
- image: gcr.io/google_containers/heapster:v1.2.0-beta.3
name: heapster
livenessProbe:
httpGet:
Expand All @@ -67,7 +67,7 @@ spec:
- name: ssl-certs
mountPath: /etc/ssl/certs
readOnly: true
- image: gcr.io/google_containers/heapster:v1.2.0-beta.2
- image: gcr.io/google_containers/heapster:v1.2.0-beta.3
name: eventer
resources:
# keep request = limit to keep this container in guaranteed class
Expand Down Expand Up @@ -110,7 +110,7 @@ spec:
- --memory={{ base_metrics_memory }}
- --extra-memory={{metrics_memory_per_node}}Mi
- --threshold=5
- --deployment=heapster-v1.2.0-beta.2
- --deployment=heapster-v1.2.0-beta.3
- --container=heapster
- --poll-period=300000
- --estimator=exponential
Expand Down Expand Up @@ -139,7 +139,7 @@ spec:
- --memory={{base_eventer_memory}}
- --extra-memory={{eventer_memory_per_node}}Ki
- --threshold=5
- --deployment=heapster-v1.2.0-beta.2
- --deployment=heapster-v1.2.0-beta.3
- --container=eventer
- --poll-period=300000
- --estimator=exponential
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,29 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: heapster-v1.2.0-beta.2
name: heapster-v1.2.0-beta.3
namespace: kube-system
labels:
k8s-app: heapster
kubernetes.io/cluster-service: "true"
version: v1.2.0-beta.2
version: v1.2.0-beta.3
spec:
replicas: 1
selector:
matchLabels:
k8s-app: heapster
version: v1.2.0-beta.2
version: v1.2.0-beta.3
template:
metadata:
labels:
k8s-app: heapster
version: v1.2.0-beta.2
version: v1.2.0-beta.3
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]'
spec:
containers:
- image: gcr.io/google_containers/heapster:v1.2.0-beta.2
- image: gcr.io/google_containers/heapster:v1.2.0-beta.3
name: heapster
livenessProbe:
httpGet:
Expand All @@ -68,7 +68,7 @@ spec:
- name: ssl-certs
mountPath: /etc/ssl/certs
readOnly: true
- image: gcr.io/google_containers/heapster:v1.2.0-beta.2
- image: gcr.io/google_containers/heapster:v1.2.0-beta.3
name: eventer
resources:
# keep request = limit to keep this container in guaranteed class
Expand Down Expand Up @@ -111,7 +111,7 @@ spec:
- --memory={{ base_metrics_memory }}
- --extra-memory={{ metrics_memory_per_node }}Mi
- --threshold=5
- --deployment=heapster-v1.2.0-beta.2
- --deployment=heapster-v1.2.0-beta.3
- --container=heapster
- --poll-period=300000
- --estimator=exponential
Expand Down Expand Up @@ -140,7 +140,7 @@ spec:
- --memory={{ base_eventer_memory }}
- --extra-memory={{ eventer_memory_per_node }}Ki
- --threshold=5
- --deployment=heapster-v1.2.0-beta.2
- --deployment=heapster-v1.2.0-beta.3
- --container=eventer
- --poll-period=300000
- --estimator=exponential
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,29 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: heapster-v1.2.0-beta.2
name: heapster-v1.2.0-beta.3
namespace: kube-system
labels:
k8s-app: heapster
kubernetes.io/cluster-service: "true"
version: v1.2.0-beta.2
version: v1.2.0-beta.3
spec:
replicas: 1
selector:
matchLabels:
k8s-app: heapster
version: v1.2.0-beta.2
version: v1.2.0-beta.3
template:
metadata:
labels:
k8s-app: heapster
version: v1.2.0-beta.2
version: v1.2.0-beta.3
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]'
spec:
containers:
- image: gcr.io/google_containers/heapster:v1.2.0-beta.2
- image: gcr.io/google_containers/heapster:v1.2.0-beta.3
name: heapster
livenessProbe:
httpGet:
Expand All @@ -63,7 +63,7 @@ spec:
- /heapster
- --source=kubernetes.summary_api:''
- --sink=influxdb:http://monitoring-influxdb:8086
- image: gcr.io/google_containers/heapster:v1.2.0-beta.2
- image: gcr.io/google_containers/heapster:v1.2.0-beta.3
name: eventer
resources:
# keep request = limit to keep this container in guaranteed class
Expand Down Expand Up @@ -102,7 +102,7 @@ spec:
- --memory={{ base_metrics_memory }}
- --extra-memory={{ metrics_memory_per_node }}Mi
- --threshold=5
- --deployment=heapster-v1.2.0-beta.2
- --deployment=heapster-v1.2.0-beta.3
- --container=heapster
- --poll-period=300000
- --estimator=exponential
Expand Down Expand Up @@ -131,7 +131,7 @@ spec:
- --memory={{ base_eventer_memory }}
- --extra-memory={{ eventer_memory_per_node }}Ki
- --threshold=5
- --deployment=heapster-v1.2.0-beta.2
- --deployment=heapster-v1.2.0-beta.3
- --container=eventer
- --poll-period=300000
- --estimator=exponential
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,29 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: heapster-v1.2.0-beta.2
name: heapster-v1.2.0-beta.3
namespace: kube-system
labels:
k8s-app: heapster
kubernetes.io/cluster-service: "true"
version: v1.2.0-beta.2
version: v1.2.0-beta.3
spec:
replicas: 1
selector:
matchLabels:
k8s-app: heapster
version: v1.2.0-beta.2
version: v1.2.0-beta.3
template:
metadata:
labels:
k8s-app: heapster
version: v1.2.0-beta.2
version: v1.2.0-beta.3
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]'
spec:
containers:
- image: gcr.io/google_containers/heapster:v1.2.0-beta.2
- image: gcr.io/google_containers/heapster:v1.2.0-beta.3
name: heapster
livenessProbe:
httpGet:
Expand Down Expand Up @@ -83,7 +83,7 @@ spec:
- --memory={{ base_metrics_memory }}
- --extra-memory={{ metrics_memory_per_node }}Mi
- --threshold=5
- --deployment=heapster-v1.2.0-beta.2
- --deployment=heapster-v1.2.0-beta.3
- --container=heapster
- --poll-period=300000
- --estimator=exponential
6 changes: 3 additions & 3 deletions cluster/gce/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ function kube-up() {
create-loadbalancer
# If replication of master fails, we need to ensure that the replica is removed from etcd clusters.
if ! replicate-master; then
remove-replica-from-etcd 4001 || true
remove-replica-from-etcd 2379 || true
remove-replica-from-etcd 4002 || true
fi
else
Expand Down Expand Up @@ -769,7 +769,7 @@ function replicate-master() {
echo "Experimental: replicating existing master ${EXISTING_MASTER_ZONE}/${EXISTING_MASTER_NAME} as ${ZONE}/${REPLICA_NAME}"

# Before we do anything else, we should configure etcd to expect more replicas.
if ! add-replica-to-etcd 4001 2380; then
if ! add-replica-to-etcd 2379 2380; then
echo "Failed to add master replica to etcd cluster."
return 1
fi
Expand Down Expand Up @@ -1161,7 +1161,7 @@ function kube-down() {
set-existing-master

# Un-register the master replica from etcd and events etcd.
remove-replica-from-etcd 4001
remove-replica-from-etcd 2379
remove-replica-from-etcd 4002

# Delete the master replica (if it exists).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"containers": [
{
"name": "cluster-autoscaler",
"image": "gcr.io/google_containers/cluster-autoscaler:v0.3.0-beta6",
"image": "gcr.io/google_containers/cluster-autoscaler:v0.3.0",
"command": [
"/bin/sh",
"-c",
Expand Down
14 changes: 14 additions & 0 deletions pkg/api/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,20 @@ func TaintToleratedByTolerations(taint *Taint, tolerations []Toleration) bool {
return tolerated
}

// MatchTaint checks if the taint matches taintToMatch. Taints are unique by key:effect,
// if the two taints have same key:effect, regard as they match.
func (t *Taint) MatchTaint(taintToMatch Taint) bool {
return t.Key == taintToMatch.Key && t.Effect == taintToMatch.Effect
}

// taint.ToString() converts taint struct to string in format key=value:effect or key:effect.
func (t *Taint) ToString() string {
if len(t.Value) == 0 {
return fmt.Sprintf("%v:%v", t.Key, t.Effect)
}
return fmt.Sprintf("%v=%v:%v", t.Key, t.Value, t.Effect)
}

func GetAvoidPodsFromNodeAnnotations(annotations map[string]string) (AvoidPods, error) {
var avoidPods AvoidPods
if len(annotations) > 0 && annotations[PreferAvoidPodsAnnotationKey] != "" {
Expand Down
101 changes: 101 additions & 0 deletions pkg/api/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,107 @@ func TestGetAffinityFromPod(t *testing.T) {
}
}

func TestTaintToString(t *testing.T) {
testCases := []struct {
taint *Taint
expectedString string
}{
{
taint: &Taint{
Key: "foo",
Value: "bar",
Effect: TaintEffectNoSchedule,
},
expectedString: "foo=bar:NoSchedule",
},
{
taint: &Taint{
Key: "foo",
Effect: TaintEffectNoSchedule,
},
expectedString: "foo:NoSchedule",
},
}

for i, tc := range testCases {
if tc.expectedString != tc.taint.ToString() {
t.Errorf("[%v] expected taint %v converted to %s, got %s", i, tc.taint, tc.expectedString, tc.taint.ToString())
}
}
}

func TestMatchTaint(t *testing.T) {
testCases := []struct {
description string
taint *Taint
taintToMatch Taint
expectMatch bool
}{
{
description: "two taints with the same key,value,effect should match",
taint: &Taint{
Key: "foo",
Value: "bar",
Effect: TaintEffectNoSchedule,
},
taintToMatch: Taint{
Key: "foo",
Value: "bar",
Effect: TaintEffectNoSchedule,
},
expectMatch: true,
},
{
description: "two taints with the same key,effect but different value should match",
taint: &Taint{
Key: "foo",
Value: "bar",
Effect: TaintEffectNoSchedule,
},
taintToMatch: Taint{
Key: "foo",
Value: "different-value",
Effect: TaintEffectNoSchedule,
},
expectMatch: true,
},
{
description: "two taints with the different key cannot match",
taint: &Taint{
Key: "foo",
Value: "bar",
Effect: TaintEffectNoSchedule,
},
taintToMatch: Taint{
Key: "different-key",
Value: "bar",
Effect: TaintEffectNoSchedule,
},
expectMatch: false,
},
{
description: "two taints with the different effect cannot match",
taint: &Taint{
Key: "foo",
Value: "bar",
Effect: TaintEffectNoSchedule,
},
taintToMatch: Taint{
Key: "foo",
Value: "bar",
Effect: TaintEffectPreferNoSchedule,
},
expectMatch: false,
},
}

for _, tc := range testCases {
if tc.expectMatch != tc.taint.MatchTaint(tc.taintToMatch) {
t.Errorf("[%s] expect taint %s match taint %s", tc.description, tc.taint.ToString(), tc.taintToMatch.ToString())
}
}
}

func TestGetAvoidPodsFromNode(t *testing.T) {
controllerFlag := true
testCases := []struct {
Expand Down