Add Container object to environment build and runtime specs (#413)

Environment Specs so far had only an image URL to specify a container image.

This was fine for public images but fell short in a few of cases:
(a) Using private image registries
(b) Specifying environment variables (this is needed for workflows helm install)
(c) Setting a SecurityContext for the container

This change adds the Container object to both build and runtime Environments. 

Compatibility is preserved -- the existing ImageURL field is still used.  See the comments in types.go for the overriding rules in the case that both Container and ImageURL are specified.
This commit is contained in:
Erwin van Eyk
2018-03-22 00:13:02 -07:00
committed by Soam Vasani
parent c76b6bacc0
commit 70a93a7302
14 changed files with 363 additions and 43 deletions
+4 -7
View File
@@ -23,6 +23,7 @@ import (
"log"
"net/http"
"os"
"reflect"
"testing"
"time"
@@ -214,11 +215,7 @@ func TestEnvironmentApi(t *testing.T) {
e, err := g.client.EnvironmentGet(m)
panicIf(err)
assert(testEnv.Spec.AllowedFunctionsPerContainer == e.Spec.AllowedFunctionsPerContainer, "env AllowedFunctionsPerContainer should match after reading")
assert(testEnv.Spec.Poolsize == e.Spec.Poolsize, "env Poolsize should match after reading")
assert(testEnv.Spec.Builder == e.Spec.Builder, "env Builder should match after reading")
assert(testEnv.Spec.Runtime == e.Spec.Runtime, "env Runtime should match after reading")
assert(testEnv.Spec.Version == e.Spec.Version, "env Version should match after reading")
assert(reflect.DeepEqual(testEnv.Spec, e.Spec), "env should match after reading")
testEnv.Metadata.ResourceVersion = m.ResourceVersion
testEnv.Spec.Runtime.Image = "another-img"
@@ -266,9 +263,9 @@ func TestWatchApi(t *testing.T) {
w, err := g.client.WatchGet(m)
panicIf(err)
assert((testWatch.Spec.Namespace == w.Spec.Namespace &&
assert(testWatch.Spec.Namespace == w.Spec.Namespace &&
testWatch.Spec.Type == w.Spec.Type &&
testWatch.Spec.FunctionReference == w.Spec.FunctionReference), "watch should match after reading")
testWatch.Spec.FunctionReference == w.Spec.FunctionReference, "watch should match after reading")
testWatch.Metadata.Name = "yyy"
m2, err := g.client.WatchCreate(testWatch)