When terminating a function and replacing it during an update,
there was often an error about task precondition not met
which meant having to try and or wait or being left in an
inconsistent state.
The new flow makes sure "Wait" is called in either code path
and allows for a custom gap between the SIGTERM and SIGKILL
through the grace_period env var - set as a Go duration.
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
* Fixes upstream deprecations for containerd
* Fixes deprecations in ioutil package usage
* Break out separate files for function handlers
* Upgrades containerd to 1.7.22
* Fixes default namespace functionality
* Pre-deploy checks as per license agreement
* Removes extra log messages for payload in HTTP handlers, you
can enable FAAS_DEBUG=1 in the CLI instead to see this from
the client's perspective
* Add additional Google DNS server 8.8.4.4 for functions
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
The scale and delete endpoints no-longer accept namespace
via the query string, but through the body.
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This gives a default value, for belt and braces, for people
who are supplying a lot of load.
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com>
Test case included for default and non-default
Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com>
Changed Fake Labeller Implementation
Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com>
Load the secret value from the RawValue field, if it is empty, use the
string value. Add unit tests for the creation handler.
Refactor secret parser tests.
Resolves#208
Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
* Inlines the namespace check for valid faasd namespaces
* Creates a const for the namespace label applied to faasd
namespaces
Tested with go build and go test.
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit adds the checks that the namespace supplied by the user has
the `openfaas=true` label. Without this check the user can
deploy/update/read functions in any namespace using the CLI.
The UI is not effected because it calls the listnamesaces endpoint,
which has the check for the label
Signed-off-by: Alistair Hey <alistair@heyal.co.uk>
Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com>
Included Test cases for utils
Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com>
Multi namespace handling in invoke
Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com>
List Namespaces capability included
Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com>
remove faasd namespace from list result
Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com>
Create Secret Folder Path
Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com>
Filter only namespaces with openfass label
Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com>
Include Testcase for utility function
Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com>
move default function secets to openfaas-fn namespace secrets
Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com>
Corrected issue with secret moving
Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com>
Have to change them since we are trying to resolve system services and the system services are in the /var/lib/faasd/hosts file instead of /var/lib/faasd-provider/hosts file.
Signed-off-by: Shikachuu <zcmate@gmail.com>
This is an optimization that uses the results cache created by
CNI on the filesystem to store and fetch IP addresses for
containers in the core services and for functions. As part of
the change, the dependency on the syscall code from Weave net
has been removed, and the code should compile on MacOS again.
Updates and rebases the work in #38 by carlosedp
Tested in the original PR, further testing in the incoming
PR.
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
By setting the hostname, the container will resolve to its
name instead of just localhost.
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit adds fprocess to the return values from faasd provider
/system/functions and /system/function/{name}
This has unit tests and has been tested on a faasd installation
Signed-off-by: Alistair Hey <alistair@heyal.co.uk>
This commit adds the EnvVars set on the process to the retuurn from the
faasd provider. It gets the container process and then filters out PATH
and fprocess (if found) and returns the remaining envVars as a map.
This has using tests for getting the EnvVars from procees.env and has
been tested on amd_64 faasd by building, deploying and using curl
against the provider and gateway.
Signed-off-by: Alistair Hey <alistair@heyal.co.uk>
This commit allows the provider to return a list of the names of the
secrets mapped into an openfaas function. This was tested by building
and deploying faasd on multipass and curling the provider directly and
seeing the returned secrets list!
Signed-off-by: Alistair Hey <alistair@heyal.co.uk>
The update flow used to delete the active function before
synchronously pulling the next and starting it. That meant
functions would always face downtime during the pull.
This changes the order to pre-pull and reduce any down time.
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
By moving to a reference instead of a value type, this patch
means the annotations are not leaked into other objects in
the result of ListFunctions. Tested on x86 with a Linux host
and I could no longer reproduce the issue in #128
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
Provide support for annotations in faasd with namespaced container
labels. Unit tested and confirmed with end to end test via faasd
deployed to multipass VM
Signed-off-by: Alex Tomic <atomic777@gmail.com>
Memory limits now work and a function will be killed with OOM
however, it will remain in a stopped state and will not
restart automatically.
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This patch reports stopped tasks as having zero scale, which
means the gateway will send a "scale up" request, the same
way as it does for paused containers, or those which have
no task due to a reboot of the machine.
The scale up logic will now delete the stopped task and
recreate the task.
Tested with nodeinfo and figlet on a Dell XPS with
Ubuntu 16.04. The scaling logic has been re-written, but
re-tested by manually pausing and manually removing
the task of a container.
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
Logs can now be viewed with the following, adding -f to follow
the logs.
journalctl -t default:gateway
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
Fixes an issue introduced in #45 which was undetected. When
users do not pass in "labels" to the deployment - or a valid
empty object, then a nil dereference causes a panic.
Fixes: #101
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>