Add a test for semantically equal DaemonSet updates

This commit is contained in:
Janet Kuo 2017-03-20 12:07:17 -07:00
parent eb77144474
commit d0b5de855f
2 changed files with 53 additions and 0 deletions

View File

@ -66,6 +66,7 @@ static="static"
storageclass="storageclass"
subjectaccessreviews="subjectaccessreviews"
thirdpartyresources="thirdpartyresources"
daemonsets="daemonsets"
# Stops the running kubectl proxy, if there is one.
@ -2574,6 +2575,22 @@ run_rs_tests() {
fi
}
run_daemonset_tests() {
kube::log::status "Testing kubectl(v1:daemonsets)"
### Create a rolling update DaemonSet
# Pre-condition: no DaemonSet exists
kube::test::get_object_assert daemonsets "{{range.items}}{{$id_field}}:{{end}}" ''
# Command
kubectl apply -f hack/testdata/rollingupdate-daemonset.yaml "${kube_flags[@]}"
# Template Generation should be 1
kube::test::get_object_assert 'daemonsets bind' "{{${template_generation_field}}}" '1'
kubectl apply -f hack/testdata/rollingupdate-daemonset.yaml "${kube_flags[@]}"
# Template Generation should stay 1
kube::test::get_object_assert 'daemonsets bind' "{{${template_generation_field}}}" '1'
kubectl delete -f hack/testdata/rollingupdate-daemonset.yaml "${kube_flags[@]}"
}
run_multi_resources_tests() {
kube::log::status "Testing kubectl(v1:multiple resources)"
@ -2798,6 +2815,7 @@ runTests() {
deployment_second_image_field="(index .spec.template.spec.containers 1).image"
change_cause_annotation='.*kubernetes.io/change-cause.*'
pdb_min_available=".spec.minAvailable"
template_generation_field=".spec.templateGeneration"
# Make sure "default" namespace exists.
if kube::test::if_supports_resource "${namespaces}" ; then
@ -3180,6 +3198,14 @@ runTests() {
fi
##################
# DaemonSets #
##################
if kube::test::if_supports_resource "${daemonsets}" ; then
run_daemonset_tests
fi
###########################
# Replication controllers #
###########################

View File

@ -0,0 +1,27 @@
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: bind
spec:
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 10%
template:
metadata:
labels:
service: bind
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "service"
operator: "In"
values: ["bind"]
topologyKey: "kubernetes.io/hostname"
namespaces: []
containers:
- name: kubernetes-pause
image: gcr.io/google-containers/pause:2.0