From 3676602fa233ec7ccffbfc2dd4944f3fd9b23da6 Mon Sep 17 00:00:00 2001 From: Soam Vasani Date: Wed, 14 Nov 2018 10:30:26 -0800 Subject: [PATCH] Specs for JVM example (#825) --- examples/jvm/java/specs/README | 42 +++++++++++++++ .../java/specs/fission-deployment-config.yaml | 7 +++ .../jvm/java/specs/function-hello-java.yaml | 52 +++++++++++++++++++ 3 files changed, 101 insertions(+) create mode 100644 examples/jvm/java/specs/README create mode 100644 examples/jvm/java/specs/fission-deployment-config.yaml create mode 100644 examples/jvm/java/specs/function-hello-java.yaml diff --git a/examples/jvm/java/specs/README b/examples/jvm/java/specs/README new file mode 100644 index 00000000..1db3f9a5 --- /dev/null +++ b/examples/jvm/java/specs/README @@ -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. + diff --git a/examples/jvm/java/specs/fission-deployment-config.yaml b/examples/jvm/java/specs/fission-deployment-config.yaml new file mode 100644 index 00000000..73c47424 --- /dev/null +++ b/examples/jvm/java/specs/fission-deployment-config.yaml @@ -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: java +uid: 3305cef5-21e6-4a55-b977-5c76ee62b0a6 diff --git a/examples/jvm/java/specs/function-hello-java.yaml b/examples/jvm/java/specs/function-hello-java.yaml new file mode 100644 index 00000000..2b1268cd --- /dev/null +++ b/examples/jvm/java/specs/function-hello-java.yaml @@ -0,0 +1,52 @@ +include: +- src/ +- pom.xml +kind: ArchiveUploadSpec +name: helloworld-java + +--- +apiVersion: fission.io/v1 +kind: Package +metadata: + creationTimestamp: null + name: helloworld-java-127w + namespace: default +spec: + deployment: + checksum: {} + environment: + name: java + namespace: default + source: + checksum: {} + type: url + url: archive://helloworld-java +status: + buildstatus: pending + +--- +apiVersion: fission.io/v1 +kind: Function +metadata: + creationTimestamp: null + name: hello-java + namespace: default +spec: + InvokeStrategy: + ExecutionStrategy: + ExecutorType: poolmgr + MaxScale: 1 + MinScale: 0 + TargetCPUPercent: 80 + StrategyType: execution + configmaps: null + environment: + name: java + namespace: default + package: + functionName: io.fission.HelloWorld + packageref: + name: helloworld-java-127w + namespace: default + resources: {} + secrets: null