demo script updates (#934)

Demo script updates.  Record-replay, a bugfix in the canary demo script, etc.
This commit is contained in:
Soam Vasani
2018-10-15 14:48:01 -07:00
committed by GitHub
parent 4cc42fb216
commit 8329ef36b3
21 changed files with 391 additions and 12 deletions
+9
View File
@@ -0,0 +1,9 @@
#!/bin/bash
fission spec destroy
# this one is generated in run.sh
rm specs/function-hello-go.yaml
rm *.~?~
+12
View File
@@ -0,0 +1,12 @@
package main
import (
"net/http"
)
// Handler is the entry point for this fission function
func Handler(w http.ResponseWriter, r *http.Request) {
msg := "Hello, CNCF Webinar!\n"
w.Write([]byte(msg))
}
+24
View File
@@ -0,0 +1,24 @@
#!/bin/bash
DEMO_RUN_FAST=1
ROOT_DIR=$(dirname $0)/..
. $ROOT_DIR/util.sh
desc "Declaratively specified app"
run "ls specs"
desc "Generate initial YAML, so we don't have to write it by hand"
run "fission function create --spec --name hello-go --env go --src hello.go --entrypoint Handler"
desc "Generated function YAML"
run "tail -25 specs/function-hello-go.yaml"
desc "Deploy on cluster, and wait for build result"
run "fission spec apply --wait"
desc "Invoke the function"
run "fission function test --name hello-go"
desc "Live-reload: auto build + deploy on save"
run "fission spec apply --watch"
+42
View File
@@ -0,0 +1,42 @@
Fission Specs
=============
This is a set of specifications for a Fission app. This includes functions,
environments, and triggers; we collectively call these things "resources".
How to use these specs
----------------------
These specs are handled with the 'fission spec' command. See 'fission spec --help'.
'fission spec apply' will "apply" all resources specified in this directory to your
cluster. That means it checks what resources exist on your cluster, what resources are
specified in the specs directory, and reconciles the difference by creating, updating or
deleting resources on the cluster.
'fission spec apply' will also package up your source code (or compiled binaries) and
upload the archives to the cluster if needed. It uses 'ArchiveUploadSpec' resources in
this directory to figure out which files to archive.
You can use 'fission spec apply --watch' to watch for file changes and continuously keep
the cluster updated.
You can add YAMLs to this directory by writing them manually, but it's easier to generate
them. Use 'fission function create --spec' to generate a function spec,
'fission environment create --spec' to generate an environment spec, and so on.
You can edit any of the files in this directory, except 'fission-deployment-config.yaml',
which contains a UID that you should never change. To apply your changes simply use
'fission spec apply'.
fission-deployment-config.yaml
------------------------------
fission-deployment-config.yaml contains a UID. This UID is what fission uses to correlate
resources on the cluster to resources in this directory.
All resources created by 'fission spec apply' are annotated with this UID. Resources on
the cluster that are _not_ annotated with this UID are never modified or deleted by
fission.
@@ -0,0 +1,7 @@
# This file is generated by the 'fission spec init' command.
# See the README in this directory for background and usage information.
# Do not edit the UID below: that will break 'fission spec apply'
apiVersion: fission.io/v1
kind: DeploymentConfig
name: declarative-specs
uid: e20fe7b4-b012-4ae0-98bd-0f968d21d397
@@ -0,0 +1,51 @@
include:
- hello.go
kind: ArchiveUploadSpec
name: hello-go
---
apiVersion: fission.io/v1
kind: Package
metadata:
creationTimestamp: null
name: hello-go-xfxy
namespace: default
spec:
deployment:
checksum: {}
environment:
name: go
namespace: default
source:
checksum: {}
type: url
url: archive://hello-go
status:
buildstatus: pending
---
apiVersion: fission.io/v1
kind: Function
metadata:
creationTimestamp: null
name: hello-go
namespace: default
spec:
InvokeStrategy:
ExecutionStrategy:
ExecutorType: poolmgr
MaxScale: 1
MinScale: 0
TargetCPUPercent: 80
StrategyType: execution
configmaps: null
environment:
name: go
namespace: default
package:
functionName: Handler
packageref:
name: hello-go-xfxy
namespace: default
resources: {}
secrets: null