Split out the Package type into a first class Kubernetes resource (#295)
Split out the Package type into a first class Kubernetes resource. Before this change, packages were implicitly tied to functions. This wasn't ideal because: * Functions will need to share packages * A package storage system may be more generally useful than just functions (for example, for storing static assets) This change does the following: * Updates the fission and tpr types to add a new Package and PackageSpec. It also creates a PackageRef type, and a FunctionPackageRef type. The PackageRef simply references a package, but the FunctionPackageRef includes the name of a function within the package. This allows us to share packages between different functions. * Updates fetcher and other components for first-class packages * Allows customization of fetcher image pull policy in the helm charts
This commit is contained in:
+6
-11
@@ -27,7 +27,6 @@ import (
|
||||
|
||||
"k8s.io/client-go/1.5/pkg/api"
|
||||
|
||||
"bytes"
|
||||
"github.com/fission/fission"
|
||||
"github.com/fission/fission/controller/client"
|
||||
"github.com/fission/fission/tpr"
|
||||
@@ -83,8 +82,8 @@ func TestFunctionApi(t *testing.T) {
|
||||
},
|
||||
Spec: fission.FunctionSpec{
|
||||
EnvironmentName: "nodejs",
|
||||
Deployment: fission.Package{
|
||||
Literal: []byte("code1"),
|
||||
Deployment: fission.FunctionPackageRef{
|
||||
FunctionName: "xxx",
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -94,22 +93,18 @@ func TestFunctionApi(t *testing.T) {
|
||||
})
|
||||
assertNotFoundFailure(err, "function")
|
||||
|
||||
m, err := g.client.FunctionCreate(testFunc)
|
||||
_, err = g.client.FunctionCreate(testFunc)
|
||||
panicIf(err)
|
||||
|
||||
_, err = g.client.FunctionCreate(testFunc)
|
||||
assertNameReuseFailure(err, "function")
|
||||
|
||||
code, err := g.client.FunctionGetRawDeployment(m)
|
||||
panicIf(err)
|
||||
assert(bytes.Compare(code, testFunc.Spec.Deployment.Literal) == 0, "code from FunctionGetRawDeployment must match created function")
|
||||
|
||||
testFunc.Spec.Deployment.Literal = []byte("code2")
|
||||
testFunc.Spec.Deployment.FunctionName = "yyy"
|
||||
_, err = g.client.FunctionUpdate(testFunc)
|
||||
panicIf(err)
|
||||
|
||||
testFunc.Metadata.Name = name2
|
||||
m, err = g.client.FunctionCreate(testFunc)
|
||||
_, err = g.client.FunctionCreate(testFunc)
|
||||
panicIf(err)
|
||||
|
||||
funcs, err := g.client.FunctionList()
|
||||
@@ -327,7 +322,7 @@ func TestMain(m *testing.M) {
|
||||
|
||||
go Start(8888)
|
||||
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
time.Sleep(time.Second)
|
||||
g.client = client.MakeClient("http://localhost:8888")
|
||||
|
||||
resp, err := http.Get("http://localhost:8888/")
|
||||
|
||||
Reference in New Issue
Block a user