Commit Graph

847 Commits

Author SHA1 Message Date
Alex Ellis (OpenFaaS Ltd)
d188521ee1 Fix errors_test
It seems like errors_test was referencing a global variable
and not its own local variable for printing an error message
in a failed test.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
0.14.9
2022-10-04 09:28:40 +01:00
Alex Ellis (OpenFaaS Ltd)
b61b51e3f7 Remove openfaas-cloud commands
OpenFaaS Cloud has long been deprecated, these commands
should no longer be used by anyone.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2022-10-04 09:26:12 +01:00
Richard Gee
35fcca5759 Make describe output for envvars deterministic
As `describe` uses a map to store the env var kv pairs its output varies
in its order.  This is undesirable.

This change introduces a means by which env var output ordering is
predictable.

Signed-off-by: Richard Gee <richard@technologee.co.uk>
0.14.8
2022-09-25 09:35:31 +01:00
Richard Gee
e390a02607 Add multiple env vars to describe test table
As env vars are stored in a `map[string]string` the print output of this
through describe is non-deterministic.  This change introduces a test case
that will cause `TestDescribeOuput()` to become flakey as the four env vars
could be emitted in a different order each time the test is run.

This will be addressed in a future commit which will make env var ordering
consistent and repeatable.

Signed-off-by: Richard Gee <richard@technologee.co.uk>
2022-09-25 09:35:31 +01:00
Alex Ellis (OpenFaaS Ltd)
d08553ed3f Update examples to remove Swarm format in stack.yml
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2022-09-21 17:45:45 +01:00
Alex Ellis (OpenFaaS Ltd)
dff5735940 Fix typo in help message for publish command
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2022-09-21 15:58:28 +01:00
Han Verstraete (OpenFaaS Ltd)
0451db85fa Fix generate command for read-only root filesystem setting
The readonly_root_filesystem setting was not included in the resulting
CRD when running faas-cli generate.

Signed-off-by: Han Verstraete (OpenFaaS Ltd) <han@openfaas.com>
0.14.7
2022-09-20 16:48:56 +01:00
Alex Ellis
b88dc1905f Update ISSUE_TEMPLATE.md
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2022-09-13 09:01:56 +01:00
Alex Ellis (OpenFaaS Ltd)
f7f12659f4 Clarify the template not found message
The message used to capitalise the template name, which
was confusing since they are case sensitive.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2022-09-04 09:34:31 +01:00
Alex Ellis (OpenFaaS Ltd)
4fe2b3fa24 Rename build_redist to extract_binaries
This is a clearer name for the task that happens in the script

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2022-08-22 17:59:39 +01:00
Alex Ellis (OpenFaaS Ltd)
fcf50cef7b Upgrade to Go 1.18 and introduce timeout for deploy
* Go is upgraded to 1.18 for builds
* Alpine Linux is upgraded for the runtime container
* The deploy command gains a timeout for use with faaasd
which is synchronous and would time-out otherwise.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
0.14.6
2022-08-22 17:52:57 +01:00
Alex Ellis (OpenFaaS Ltd)
3534df7157 Add flag to setup QEMU for the publish command
The new flag will run a community container image to setup
the qemu-user-static binary on the host, so that multi-arch
builds can take place.

This is only compatible with AMD64 at the current time.

Tested on Darwin M1 with MacOS, and saw an error.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
0.14.5
2022-08-06 10:40:27 +01:00
Lucas Roesler
17baca4d8f fix: add section header for usage data in describe output
Add the header `Usage:` for the usage data to help it fit with the other
fields better

Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
0.14.4
2022-03-17 15:45:19 +00:00
Lucas Roesler
f3f2eadcf6 fix: remove extra spaces from the describe output
Ensure that the values for maps and slices are aligned with the string
values.

Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
2022-03-17 15:45:19 +00:00
Lucas Roesler
ece60be517 feat: create dynamic printer for the function describe output
The printer object accepts a parameter to control how verbose it is.
When verbose is false, empty values will be omitted from the describe
output.

Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
2022-03-17 15:45:19 +00:00
Lucas Roesler
b65e279f9f feat: Add missing fields to the describe output
Add the function
* constraints
* environment variables
* secrets
* requests and limits

This can be tested as follows:

Create a test cluster using KinD

```sh
kind create cluster --config=cluster.yaml
arkade install openfaas -a=false --function-pull-policy=IfNotPresent --wait

faas-cli store deploy nodeinfo --annotation sample=true --label status=418
```

Now deploy a sample function

```sh
$ faas-cli describe nodeinfo
Name:                nodeinfo
Status:              Ready
Replicas:            1
Available replicas:  1
Invocations:         0
Image:               ghcr.io/openfaas/nodeinfo:latest
Function process:    <default>
URL:                 http://127.0.0.1:8080/function/nodeinfo
Async URL:           http://127.0.0.1:8080/async-function/nodeinfo
Labels               faas_function : nodeinfo
                     status : 418
Annotations          sample : true
                     prometheus.io.scrape : false
Constraints          <none>
Environment          <none>
Secrets              <none>
Requests             <none>
Limits               <none>

```

Now we add some more interesting values, like a secret and env variables.

```sh
$ faas-cli secret create db-password --from-literal=password
Creating secret: db-password.
Created: 202 Accepted

$ faas-cli store deploy nodeinfo --annotation sample=true --label status=418 --secret db-password --env db-user=postgres --env db-host=rds.aws.example.com

Deployed. 202 Accepted.
URL: http://127.0.0.1:8080/function/nodeinfo

$ faas-cli describe nodeinfo
Name:                nodeinfo
Status:              Ready
Replicas:            1
Available replicas:  1
Invocations:         0
Image:               ghcr.io/openfaas/nodeinfo:latest
Function process:    <default>
URL:                 http://127.0.0.1:8080/function/nodeinfo
Async URL:           http://127.0.0.1:8080/async-function/nodeinfo
Labels:              faas_function: nodeinfo
                     status: 418
                     uid: 736815901
Annotations:         prometheus.io.scrape: false
                     sample: true
Constraints:         <none>
Environment:         <none>
Secrets:              - db-password
Requests:            <none>
Limits:              <none>
```

To see how multiple Secrets and the Requests and Limits are rendered, use

```yaml
version: 1.0
provider:
  name: openfaas
  gateway: http://127.0.0.1:8080
functions:
  nodeinfo:
    lang: Dockerfile
    image: ghcr.io/openfaas/nodeinfo:latest
    secrets:
      - cache-password
      - db-password
    environment:
      db-host: rds.aws.example.com
      cache-host: redis.aws.example.com
    labels:
      status: 481
    annotations:
      sample: "true"
    requests:
      cpu: 100m
      memory: 128Mi
    limits:
      cpu: 200m
      memory: 256Mi
```
then

```sh
$ faas-cli secret create cache-password --from-literal=password
Creating secret: cache-password.
Created: 202 Accepted
$ faas-cli deploy
Deploying: nodeinfo.

Deployed. 202 Accepted.
URL: http://127.0.0.1:8080/function/nodeinfo

$ faas-cli describe nodeinfo
Name:                nodeinfo
Status:              Ready
Replicas:            1
Available replicas:  1
Invocations:         0
Image:               ghcr.io/openfaas/nodeinfo:latest
Function process:    <default>
URL:                 http://127.0.0.1:8080/function/nodeinfo
Async URL:           http://127.0.0.1:8080/async-function/nodeinfo
Labels:              faas_function: nodeinfo
                     status: 481
                     uid: 679245186
Annotations:         prometheus.io.scrape: false
                     sample: true
Constraints:         <none>
Environment:         <none>
Secrets:             - cache-password
                     - db-password
Requests:            CPU: 100m
                     Memory: 128Mi
Limits:              CPU: 200m
                     Memory: 256Mi
```

Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
2022-03-17 15:45:19 +00:00
Alex Ellis (OpenFaaS Ltd)
56b1a7db77 Fix an issue with gateway URL mutation
The gateway URL was not being deep cloned, but mutated and
that affected downstream tests in the certifier.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
0.14.3
2022-02-24 11:48:35 +00:00
Alex Ellis (OpenFaaS Ltd)
830ec7286d Switch to idomatic approach for creating URLs
Switches to more Go-idomatic approach for creating URLs and
populating querystrings.

There is an unexplained error in the certifier project, and
this indirection is not helping with debugging errors.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2022-02-24 11:42:33 +00:00
Alex Ellis (OpenFaaS Ltd)
b1c09c0243 Add usage metrics for describe command
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
0.14.2
2022-01-26 16:28:03 +00:00
Alex Ellis (OpenFaaS Ltd)
d94600d2d2 Move to Go 1.17 and fix license-check
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
0.14.1
2021-12-03 11:52:49 +00:00
Alex Ellis (OpenFaaS Ltd)
ad610f1071 Support PKCE for auth command for OpenFaaS Pro users
* Enables PKCE in the place of implicit auth flow.
* Auth command requires EULA acceptance and valid OpenFaaS Pro
license or trial.
* Updates feature status from alpha to generally-available

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
0.14.0
2021-12-03 11:30:13 +00:00
Haris Razis
b562392b12 Fix describe command formatting
When the Labels were empty they would appear on the same line as the Annotations.

Signed-off-by: Haris Razis <haris@razis.com>
0.13.15
2021-11-04 16:38:56 +00:00
Alex Ellis (OpenFaaS Ltd)
08e3e965c8 Escape fragment for auth command
The fragment needed to be escaped so that it could be sent
to the server via a query string. This was failing with
keycloak.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
0.13.14
2021-10-12 09:32:06 +01:00
Yankee Maharjan
a230119be0 Add default namespace for functions CRD
Signed-off-by: Yankee Maharjan <yankee.exe@gmail.com>
2021-07-05 12:05:31 +01:00
Yankee Maharjan
38f62308d5 Show help message with no stack file and flags
Signed-off-by: Yankee Maharjan <yankee.exe@gmail.com>
2021-06-24 15:45:52 +01:00
Alex Ellis (OpenFaaS Ltd)
72816d486c Fix tests for comparing secrets
Given that the secret now contains a byte array, it can no
longer be compared in the way it was.

This introduces go-cmp to take over the job.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
0.13.13
2021-06-17 12:29:18 +01:00
Alex Ellis (OpenFaaS Ltd)
9655c00b32 Create secrets from files in binary format
Changes the behaviour for inputting files so that their contents
are stored in binary format instead of being converted to a
string.

The existing Value field is still populated for existing
clients and providers which do not support RawValue.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
0.13.12
2021-06-17 12:21:11 +01:00
Alex Ellis (OpenFaaS Ltd)
77ad215bcc Generate annotations in OpenFaaS CR output
The faas-cli generate command was missing support for
annotations. Fixes: #890

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
0.13.11
2021-06-03 08:50:11 +01:00
Alex Ellis (OpenFaaS Ltd)
047e2803de Update for the demo
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2021-06-03 08:50:11 +01:00
Richard Gee
6d80dda57f Add ordering to env for knative generate
Signed-off-by: Richard Gee <richard@technologee.co.uk>
2021-05-12 12:27:33 +01:00
Richard Gee
a68302fc7d Add sort order to generate command
The output from faas-cli generate is not deterministic.  The function
detail is stored in a map which is by design non-deterministic.
This behaviour is undesirable as generating from the same stack will
result in a different file, hence makes tracking diffs, particularly
in git, quite a challenge.

This change seeks to introduce a pre-processing stage where a slice
of function names is created and a rudimentary sort applied. This slice
is then used to iterate through the map using the function name.

Signed-off-by: Richard Gee <richard@technologee.co.uk>
2021-05-12 12:27:33 +01:00
Gábor Lipták
817968f250 Bump alpine to 3.13
Signed-off-by: Gábor Lipták <gliptak@gmail.com>
2021-04-29 14:25:57 +01:00
Alex Ellis
927cc77f1d Update ISSUE_TEMPLATE.md 2021-04-12 16:47:41 +01:00
Alex Ellis
80042ef4a4 Update ISSUE_TEMPLATE.md 2021-04-12 08:25:32 +01:00
Alex Ellis (OpenFaaS Ltd)
6aa5d8326e Change a tab to spaces for alignment of message
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2021-04-02 10:34:47 +01:00
Carlos Panato
1ef557f974 build: fix image name when having the case registry:8080/foo/bar
Signed-off-by: Carlos Panato <ctadeu@gmail.com>
2021-04-02 10:26:56 +01:00
Carlos Panato
6f0be272d1 list: add sort by createdAt field
Signed-off-by: Carlos Panato <ctadeu@gmail.com>
0.13.10
2021-03-26 11:45:15 +00:00
Nitishkumar Singh
7de6613ff8 skip already existing templates while build and publish
Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com>
2021-03-12 07:55:26 +00:00
Richard Gee
2cec97955a Remove "openfaas-fn" as default namespace
A user deployed to Okteto where the namespace by default is their username.  Byforcing openfaas-fn by default this was preventing a zero value from being passed which had the effect of always over-riding the users default namespace.

Signed-off-by: Richard Gee <richard@technologee.co.uk>
0.13.9
2021-03-11 20:46:40 +00:00
Alex Ellis (OpenFaaS Ltd)
6e1d484801 Add sort to the list command
Allows listing by name and invocations.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
0.13.8
2021-02-27 21:58:17 +00:00
Alex Ellis (OpenFaaS Ltd)
6b5e7a14a5 Fix bug with registry-login command
The wrong type was used for the password-stdin flag

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
0.13.6 0.13.7
2021-02-22 12:55:17 +00:00
Alex Ellis (OpenFaaS Ltd)
0cb0b56c47 Add new-line to login message
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2021-02-22 12:13:19 +00:00
Alex Ellis (OpenFaaS Ltd)
4cd3b8cfca Update dependencies for npm
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2021-02-19 09:48:09 +00:00
Alex Ellis (OpenFaaS Ltd)
5644507a2d Update axios version to version without CVE
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2021-02-19 09:42:52 +00:00
Alex Ellis (OpenFaaS Ltd)
2a401be645 Update axios for security issue found
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2021-02-19 09:40:46 +00:00
Vivek Singh
ec002af3c1 Update GetSystemInfo API return type
This updates the GetSystemInfo API to return typed struct rather than `map[string]interface{}`
It also removes support for legacy vesion info response from gateway which are available prior to version
0.8.4

Signed-off-by: Vivek Singh <vivekkmr45@yahoo.in>
0.13.5
2021-02-16 09:19:23 +00:00
Alex Ellis (OpenFaaS Ltd)
a1394b0e8e Update message for checkTLSInsecure test
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2021-02-16 09:18:15 +00:00
Alex Ellis (OpenFaaS Ltd)
0f0caac7b5 Update intro
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2021-02-14 09:42:54 +00:00
Alex Ellis (OpenFaaS Ltd)
e86c575461 Don't warn about insecure connections to localhost
This message isn't strictly required or beneficial when
connecting to 127.0.0.1 or localhost, where certificates from
Let's Encrypt are not applicable. If using Kubernetes or SSH
port forwarding, then the connection is encrypted already.

Tested by creating an SSH tunnel to a faasd instance, and
seeing no warning, then connecting to the same faasd instance
with its IP addresses, and continuing to see the error.

The warning message has been updated since SSL is not
applicable to HTTPS currently.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2021-02-14 09:39:07 +00:00
Alex Ellis (OpenFaaS Ltd)
3cfd4a0fad Migrate logs command parameters to match journalctl
Moves some of the flags for the logs commands to align more
closely with the journalctl syntax and fixes some typos in
the original.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
0.13.4
2021-02-13 10:08:39 +00:00