diff --git a/examples/spec-example/README.md b/examples/spec-example/hello-spec-exmaple/README.md similarity index 100% rename from examples/spec-example/README.md rename to examples/spec-example/hello-spec-exmaple/README.md diff --git a/examples/spec-example/hello/__init__.py b/examples/spec-example/hello-spec-exmaple/hello/__init__.py similarity index 100% rename from examples/spec-example/hello/__init__.py rename to examples/spec-example/hello-spec-exmaple/hello/__init__.py diff --git a/examples/spec-example/hello/build.sh b/examples/spec-example/hello-spec-exmaple/hello/build.sh similarity index 100% rename from examples/spec-example/hello/build.sh rename to examples/spec-example/hello-spec-exmaple/hello/build.sh diff --git a/examples/spec-example/hello/hello.py b/examples/spec-example/hello-spec-exmaple/hello/hello.py similarity index 100% rename from examples/spec-example/hello/hello.py rename to examples/spec-example/hello-spec-exmaple/hello/hello.py diff --git a/examples/spec-example/hello/requirements.txt b/examples/spec-example/hello-spec-exmaple/hello/requirements.txt similarity index 100% rename from examples/spec-example/hello/requirements.txt rename to examples/spec-example/hello-spec-exmaple/hello/requirements.txt diff --git a/examples/spec-example/specs/env.yaml b/examples/spec-example/hello-spec-exmaple/specs/env.yaml similarity index 100% rename from examples/spec-example/specs/env.yaml rename to examples/spec-example/hello-spec-exmaple/specs/env.yaml diff --git a/examples/spec-example/specs/fission-config.yaml b/examples/spec-example/hello-spec-exmaple/specs/fission-config.yaml similarity index 100% rename from examples/spec-example/specs/fission-config.yaml rename to examples/spec-example/hello-spec-exmaple/specs/fission-config.yaml diff --git a/examples/spec-example/specs/hello.yaml b/examples/spec-example/hello-spec-exmaple/specs/hello.yaml similarity index 100% rename from examples/spec-example/specs/hello.yaml rename to examples/spec-example/hello-spec-exmaple/specs/hello.yaml diff --git a/examples/spec-example/podspec-example/README.md b/examples/spec-example/podspec-example/README.md new file mode 100644 index 00000000..9800286c --- /dev/null +++ b/examples/spec-example/podspec-example/README.md @@ -0,0 +1,24 @@ +# Adding podspec for builder of environment + +If you see the files in the `specs` directory you will get to know that we have just generated the +environment spec using the command +``` +fission env create --name python --image fission/python-env --builder fission/python-builder --spec +``` +and changed the env-python.yaml file to have below `podspec` for builder for the environment. + +``` +nodeSelector: + machinecap: high +tolerations: +- key: "env" + value: "prod" + operator: "Equal" + effect: "NoSchedule" + +``` + +If we create this environment, the builder pod that will be created will have the `PodSpec` that +we have mentioned for builder in the environment spec. + + diff --git a/examples/spec-example/podspec-example/specs/README b/examples/spec-example/podspec-example/specs/README new file mode 100644 index 00000000..1db3f9a5 --- /dev/null +++ b/examples/spec-example/podspec-example/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/spec-example/podspec-example/specs/env-python.yaml b/examples/spec-example/podspec-example/specs/env-python.yaml new file mode 100644 index 00000000..3f09753d --- /dev/null +++ b/examples/spec-example/podspec-example/specs/env-python.yaml @@ -0,0 +1,25 @@ +apiVersion: fission.io/v1 +kind: Environment +metadata: + creationTimestamp: null + name: python + namespace: default +spec: + builder: + command: build + image: fission/python-builder + podspec: + nodeSelector: + machinecap: high + tolerations: + - key: "env" + value: "prod" + operator: "Equal" + effect: "NoSchedule" + keeparchive: false + poolsize: 3 + resources: {} + runtime: + image: fission/python-env + terminationGracePeriod: 360 + version: 2 diff --git a/examples/spec-example/podspec-example/specs/fission-deployment-config.yaml b/examples/spec-example/podspec-example/specs/fission-deployment-config.yaml new file mode 100644 index 00000000..70028adf --- /dev/null +++ b/examples/spec-example/podspec-example/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: podspec-example +uid: c0803d62-03a2-4934-b9b2-82f2a221a333