Fix executor doesn't apply user-configured container spec correctly (#1339)

The merge function executor used wasn't merge container correctly, and it
didn't merge all fields in spec except volumeMount & Env which confused people.

To apply the user-configured container correctly, this PR changes the way of merge
and follows rules:

1. Slices are merged and return an error if the elements in the slice have name conflicts.
2. Maps are merged, the value of map of dst container are overridden if the key is the same.
3. The rest of the fields of dst container are overridden directly.
This commit is contained in:
Ta-Ching Chen
2019-10-04 05:16:04 +08:00
committed by GitHub
parent 30dba5dae9
commit b18462b10b
6 changed files with 539 additions and 299 deletions
+20 -17
View File
@@ -1,22 +1,25 @@
#!/bin/bash
set -euxo pipefail
set -exo pipefail
if [ ! -f ${KUBECONFIG} ]
if [ ! -z "${KUBECONFIG}" ]
then
unset KUBECONFIG
else
K="kubectl --kubeconfig $KUBECONFIG --namespace default"
if $K get configmap ok-to-destroy
if [ ! -f "${KUBECONFIG}" ]
then
set +e # do not break if crd not found
$K delete functions --all
$K delete environments --all
$K delete httptriggers --all
$K delete kuberneteswatchtriggers --all
$K delete messagequeuetriggers --all
$K delete packages --all
$K delete timetriggers --all
set -e
unset KUBECONFIG
else
K="kubectl --kubeconfig $KUBECONFIG --namespace default"
if $K get configmap ok-to-destroy
then
set +e # do not break if crd not found
$K delete functions --all
$K delete environments --all
$K delete httptriggers --all
$K delete kuberneteswatchtriggers --all
$K delete messagequeuetriggers --all
$K delete packages --all
$K delete timetriggers --all
set -e
fi
fi
fi
@@ -26,8 +29,8 @@ set +x
echo "" > coverage.txt
# The executor unit test only works with NodePort-type services for
# now. So disable it for our travis ci tests.
for d in $(go list ./... | grep -v '/vendor/' | grep -v 'examples/go' | grep -v executor | grep -v 'benchmark'); do
# now. So disable it for our travis ci tests except some partial tests.
for d in $(go list ./... | grep -v '/vendor/' | grep -v 'examples/go' | grep -v executor | grep -v 'benchmark') github.com/fission/fission/pkg/executor/util; do
go test -v -coverprofile=profile.out -covermode=atomic $d
if [ -f profile.out ]; then
cat profile.out >> coverage.txt