Declarative application specifications for Fission (#422)

This change enables users to have declarative specifications for Fission resources. Users can specify their "app" in a set of spec files, and use a new fission CLI command to "apply" these specs to a running cluster.

The new "spec" CLI also includes archiving of local source files, and a file watcher that re-builds archives and uploads them on file changes, and a package build watcher that waits for package builds on the CLI. 

A "--spec" option is also added to "function create", and will be added to other resources in future changes.  This option causes a YAML to be outputted to the specs directory instead of the resource being created on the cluster.

The CLI "fission spec --help" outputs usage information.
This commit is contained in:
Soam Vasani
2018-02-05 21:58:44 -08:00
committed by GitHub
parent 6af13e7e29
commit 07c7b759d2
26 changed files with 2013 additions and 85 deletions
+19 -20
View File
@@ -35,8 +35,8 @@ type (
// "sha256" is the only currently supported one. Sum is hex
// encoded.
Checksum struct {
Type ChecksumType `json:"type"`
Sum string `json:"sum"`
Type ChecksumType `json:"type,omitempty"`
Sum string `json:"sum,omitempty"`
}
// ArchiveType is either literal or URL, indicating whether
@@ -48,18 +48,18 @@ type (
// binary files.
Archive struct {
// Type defines how the package is specified: literal or URL.
Type ArchiveType `json:"type"`
Type ArchiveType `json:"type,omitempty"`
// Literal contents of the package. Can be used for
// encoding packages below TODO (256KB?) size.
Literal []byte `json:"literal"`
Literal []byte `json:"literal,omitempty"`
// URL references a package.
URL string `json:"url"`
URL string `json:"url,omitempty"`
// Checksum ensures the integrity of packages
// refereced by URL. Ignored for literals.
Checksum Checksum `json:"checksum"`
Checksum Checksum `json:"checksum,omitempty"`
}
EnvironmentReference struct {
@@ -81,14 +81,14 @@ type (
PackageSpec struct {
Environment EnvironmentReference `json:"environment"`
Source Archive `json:"source"`
Deployment Archive `json:"deployment"`
BuildCommand string `json:"buildcmd"`
Source Archive `json:"source,omitempty"`
Deployment Archive `json:"deployment,omitempty"`
BuildCommand string `json:"buildcmd,omitempty"`
// In the future, we can have a debug build here too
}
PackageStatus struct {
BuildStatus BuildStatus `json:"buildstatus"`
BuildLog string `json:"buildlog"` // output of the build (errors etc)
BuildStatus BuildStatus `json:"buildstatus,omitempty"`
BuildLog string `json:"buildlog,omitempty"` // output of the build (errors etc)
}
PackageRef struct {
@@ -97,7 +97,7 @@ type (
// Including resource version in the reference forces the function to be updated on
// package update, making it possible to cache the function based on its metadata.
ResourceVersion string `json:"resourceversion"`
ResourceVersion string `json:"resourceversion,omitempty"`
}
FunctionPackageRef struct {
PackageRef PackageRef `json:"packageref"`
@@ -110,7 +110,7 @@ type (
// build and runtime environments.
//
// This is optional: if unspecified, the environment has a default name.
FunctionName string `json:"functionName"`
FunctionName string `json:"functionName,omitempty"`
}
//ExecutorType is the primary executor for an environment
@@ -211,10 +211,10 @@ type (
}
Builder struct {
// Image for containing the language runtime.
Image string `json:"image"`
Image string `json:"image,omitempty"`
// (Optional) Default build command to run for this build environment.
Command string `json:"command"`
Command string `json:"command,omitempty"`
}
EnvironmentSpec struct {
// Environment API version
@@ -228,17 +228,16 @@ type (
// Optional, but strongly encouraged. Used to populate
// links from UI, CLI, etc.
DocumentationURL string `json:"documentationurl"`
DocumentationURL string `json:"documentationurl,omitempty"`
// Optional
// Defaults to 'Single'
AllowedFunctionsPerContainer AllowedFunctionsPerContainer `json:"allowedFunctionsPerContainer"`
// Optional, defaults to 'AllowedFunctionsPerContainerSingle'
AllowedFunctionsPerContainer AllowedFunctionsPerContainer `json:"allowedFunctionsPerContainer,omitempty"`
// Request and limit resources for the environment
Resources v1.ResourceRequirements `json:"resources"`
// The initial pool size for environment
Poolsize int `json:"poolsize"`
Poolsize int `json:"poolsize,omitempty"`
}
AllowedFunctionsPerContainer string