mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-14 06:15:45 +00:00
Add a test for semantically equal DaemonSet updates
This commit is contained in:
parent
eb77144474
commit
d0b5de855f
@ -66,6 +66,7 @@ static="static"
|
|||||||
storageclass="storageclass"
|
storageclass="storageclass"
|
||||||
subjectaccessreviews="subjectaccessreviews"
|
subjectaccessreviews="subjectaccessreviews"
|
||||||
thirdpartyresources="thirdpartyresources"
|
thirdpartyresources="thirdpartyresources"
|
||||||
|
daemonsets="daemonsets"
|
||||||
|
|
||||||
|
|
||||||
# Stops the running kubectl proxy, if there is one.
|
# Stops the running kubectl proxy, if there is one.
|
||||||
@ -2574,6 +2575,22 @@ run_rs_tests() {
|
|||||||
fi
|
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() {
|
run_multi_resources_tests() {
|
||||||
kube::log::status "Testing kubectl(v1:multiple resources)"
|
kube::log::status "Testing kubectl(v1:multiple resources)"
|
||||||
|
|
||||||
@ -2798,6 +2815,7 @@ runTests() {
|
|||||||
deployment_second_image_field="(index .spec.template.spec.containers 1).image"
|
deployment_second_image_field="(index .spec.template.spec.containers 1).image"
|
||||||
change_cause_annotation='.*kubernetes.io/change-cause.*'
|
change_cause_annotation='.*kubernetes.io/change-cause.*'
|
||||||
pdb_min_available=".spec.minAvailable"
|
pdb_min_available=".spec.minAvailable"
|
||||||
|
template_generation_field=".spec.templateGeneration"
|
||||||
|
|
||||||
# Make sure "default" namespace exists.
|
# Make sure "default" namespace exists.
|
||||||
if kube::test::if_supports_resource "${namespaces}" ; then
|
if kube::test::if_supports_resource "${namespaces}" ; then
|
||||||
@ -3180,6 +3198,14 @@ runTests() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
##################
|
||||||
|
# DaemonSets #
|
||||||
|
##################
|
||||||
|
|
||||||
|
if kube::test::if_supports_resource "${daemonsets}" ; then
|
||||||
|
run_daemonset_tests
|
||||||
|
fi
|
||||||
|
|
||||||
###########################
|
###########################
|
||||||
# Replication controllers #
|
# Replication controllers #
|
||||||
###########################
|
###########################
|
||||||
|
27
hack/testdata/rollingupdate-daemonset.yaml
vendored
Normal file
27
hack/testdata/rollingupdate-daemonset.yaml
vendored
Normal 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
|
Loading…
Reference in New Issue
Block a user