Set package initial status if its empty (#1522)

If the user applies package YAML file has no status field,
the package won't be able to be compiled or deployed due
to lack of status. This PR aims to add a check at buildermgr
to set initial package status to those packages.
This commit is contained in:
Ta-Ching Chen
2020-02-02 00:39:02 +08:00
committed by GitHub
parent e9804a5b76
commit dd07c68201
9 changed files with 204 additions and 14 deletions
@@ -0,0 +1,18 @@
apiVersion: fission.io/v1
kind: Environment
metadata:
creationTimestamp: null
name: go-spec-kubectl
namespace: default
spec:
builder:
command: build
image: fission/go-builder-1.12:1.7.1
imagepullsecret: ""
keeparchive: false
poolsize: 3
resources: {}
runtime:
image: fission/go-env-1.12:1.7.1
terminationGracePeriod: 5
version: 2
@@ -0,0 +1,47 @@
apiVersion: fission.io/v1
kind: Package
metadata:
creationTimestamp: null
name: go-b4bbb0e0-2d93-47f0-8c4e-eea644eec2a9
namespace: default
spec:
deployment:
checksum: {}
environment:
name: go-spec-kubectl
namespace: default
source:
checksum:
sum: aa595bb952047c517d849f8fc9e490fdabc37d83795392074a0b15a59748004f
type: sha256
type: url
url: https://raw.githubusercontent.com/fission/fission/master/examples/go/hello.gogo # this is intentional
---
apiVersion: fission.io/v1
kind: Function
metadata:
creationTimestamp: null
name: go-spec-kubectl
namespace: default
spec:
InvokeStrategy:
ExecutionStrategy:
ExecutorType: poolmgr
MaxScale: 0
MinScale: 0
SpecializationTimeout: 120
TargetCPUPercent: 0
StrategyType: execution
configmaps: null
environment:
name: go-spec-kubectl
namespace: default
functionTimeout: 60
package:
functionName: Handler
packageref:
name: go-b4bbb0e0-2d93-47f0-8c4e-eea644eec2a9
namespace: default
resources: {}
secrets: null
+50
View File
@@ -0,0 +1,50 @@
#!/bin/bash
set -euo pipefail
source $(dirname $0)/../../utils.sh
TEST_ID=$(generate_test_id)
echo "TEST_ID = $TEST_ID"
tmp_dir="/tmp/test-$TEST_ID"
mkdir -p $tmp_dir
ROOT=$(dirname $0)/../../..
cd $ROOT/test/tests/test_kubectl
cleanup() {
kubectl delete -f spec-yaml -R || true
}
if [ -z "${TEST_NOCLEANUP:-}" ]; then
trap cleanup EXIT
else
log "TEST_NOCLEANUP is set; not cleaning up test artifacts afterwards."
fi
name="go-spec-kubectl"
pkgName="go-b4bbb0e0-2d93-47f0-8c4e-eea644eec2a9"
# cleanup first
cleanup
# apply environment & function
kubectl apply -f spec-yaml -R
# wait for build to finish
timeout 90 bash -c "wait_for_builder $name"
timeout 90 bash -c "waitBuildExpectedStatus $pkgName failed"
sed -i 's/gogo/go/g' spec-yaml/function-go.yaml
# before we enable "/status" this should be failed.
kubectl apply -f spec-yaml/function-go.yaml
timeout 90 bash -c "waitBuildExpectedStatus $pkgName failed"
kubectl replace -f spec-yaml/function-go.yaml
timeout 90 bash -c "waitBuild $pkgName"
fission fn test --name $name
log "Test PASSED"