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
+25 -3
View File
@@ -18,7 +18,7 @@ package fission
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/pkg/api/v1"
apiv1 "k8s.io/client-go/pkg/api/v1"
)
type (
@@ -133,7 +133,7 @@ type (
ConfigMaps []ConfigMapReference `json:"configmaps"`
// cpu and memory resources as per K8S standards
Resources v1.ResourceRequirements `json:"resources"`
Resources apiv1.ResourceRequirements `json:"resources"`
// InvokeStrategy is a set of controls which affect how function executes
InvokeStrategy InvokeStrategy
@@ -208,6 +208,16 @@ type (
// server listens for function requests. Optional;
// default 8888.
FunctionEndpointPort int32 `json:"functionendpointport"`
// Container allows the modification of the deployed runtime
// container using the Kubernetes Container spec. Fission overrides
// the following fields:
// - Name
// - Image; set to the Runtime.Image
// - TerminationMessagePath
// - ImagePullPolicy
// (optional)
Container *apiv1.Container `json:"container,omitempty"`
}
Builder struct {
// Image for containing the language runtime.
@@ -215,6 +225,18 @@ type (
// (Optional) Default build command to run for this build environment.
Command string `json:"command,omitempty"`
// Container allows the modification of the deployed builder
// container using the Kubernetes Container spec. Fission overrides
// the following fields:
// - Name
// - Image; set to the Builder.Image
// - Command; set to the Builder.Command
// - TerminationMessagePath
// - ImagePullPolicy
// - ReadinessProbe
// (optional)
Container *apiv1.Container `json:"container,omitempty"`
}
EnvironmentSpec struct {
// Environment API version
@@ -237,7 +259,7 @@ type (
AllowAccessToExternalNetwork bool `json:"allowAccessToExternalNetwork,omitempty"`
// Request and limit resources for the environment
Resources v1.ResourceRequirements `json:"resources"`
Resources apiv1.ResourceRequirements `json:"resources"`
// The initial pool size for environment
Poolsize int `json:"poolsize,omitempty"`