diff --git a/go.mod b/go.mod index b3c5b67..47bb065 100644 --- a/go.mod +++ b/go.mod @@ -16,8 +16,8 @@ require ( github.com/gorilla/mux v1.8.0 github.com/morikuni/aec v1.0.0 github.com/opencontainers/runtime-spec v1.0.3-0.20200929063507-e6143ca7d51d - github.com/openfaas/faas-provider v0.18.6 - github.com/openfaas/faas/gateway v0.0.0-20210726163109-539f0a2c946e + github.com/openfaas/faas-provider v0.18.9 + github.com/openfaas/faas/gateway v0.0.0-20220124164130-cdb6badddaed github.com/pkg/errors v0.9.1 github.com/sethvargo/go-password v0.2.0 github.com/spf13/cobra v1.2.1 diff --git a/go.sum b/go.sum index 7e8d76f..7a9d362 100644 --- a/go.sum +++ b/go.sum @@ -662,10 +662,12 @@ github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mo github.com/opencontainers/selinux v1.6.0/go.mod h1:VVGKuOLlE7v4PJyT6h7mNWvq1rzqiriPsEqVhc+svHE= github.com/opencontainers/selinux v1.8.0 h1:+77ba4ar4jsCbL1GLbFL8fFM57w6suPfSS9PDLDY7KM= github.com/opencontainers/selinux v1.8.0/go.mod h1:RScLhm78qiWa2gbVCcGkC7tCGdgk3ogry1nUQF8Evvo= -github.com/openfaas/faas-provider v0.18.6 h1:wypzvPKZqta8t4rx3W6Dm14ommBCc+rQ4DKDiBdGB7M= github.com/openfaas/faas-provider v0.18.6/go.mod h1:fq1JL0mX4rNvVVvRLaLRJ3H6o667sHuyP5p/7SZEe98= -github.com/openfaas/faas/gateway v0.0.0-20210726163109-539f0a2c946e h1:FeJv/Kj1Bgvc8W89GYKP33MlEl++vat/rmMtLKmQjS4= -github.com/openfaas/faas/gateway v0.0.0-20210726163109-539f0a2c946e/go.mod h1:dTwtGnbhwl7CjLuYTvp8fgNHq93PrQSTDKkNRpLce18= +github.com/openfaas/faas-provider v0.18.7/go.mod h1:S217qfIaMrv+XKJxgbhBzJzCfyFvoIF+BvYdDo6XIDQ= +github.com/openfaas/faas-provider v0.18.9 h1:nHPlq9PYLGLuyhuXfASlBPOvXiZC/fJqHOr6m+0Fn1s= +github.com/openfaas/faas-provider v0.18.9/go.mod h1:S217qfIaMrv+XKJxgbhBzJzCfyFvoIF+BvYdDo6XIDQ= +github.com/openfaas/faas/gateway v0.0.0-20220124164130-cdb6badddaed h1:IUR44PymXKr2Dj/fd5AsmHQQ7qKBqqkRsv7L05WUUvM= +github.com/openfaas/faas/gateway v0.0.0-20220124164130-cdb6badddaed/go.mod h1:whIGF77conBmsgi5s56E2yjX3dXiw4DXypt4+eTxVQM= github.com/openfaas/nats-queue-worker v0.0.0-20210726161954-ada9a31504c9/go.mod h1:ajlN2z+D8JPBq3kWNv4WLT6mtKPqlgeE3dYEx39d1tk= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= diff --git a/vendor/github.com/openfaas/faas-provider/go.mod b/vendor/github.com/openfaas/faas-provider/go.mod index f3f0c18..47966ba 100644 --- a/vendor/github.com/openfaas/faas-provider/go.mod +++ b/vendor/github.com/openfaas/faas-provider/go.mod @@ -1,6 +1,6 @@ module github.com/openfaas/faas-provider -go 1.13 +go 1.16 require ( github.com/gorilla/mux v1.8.0 diff --git a/vendor/github.com/openfaas/faas-provider/go.sum b/vendor/github.com/openfaas/faas-provider/go.sum index ff64f46..e1e069f 100644 --- a/vendor/github.com/openfaas/faas-provider/go.sum +++ b/vendor/github.com/openfaas/faas-provider/go.sum @@ -11,8 +11,6 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -go.uber.org/goleak v0.10.0 h1:G3eWbSNIskeRqtsN/1uI5B+eP73y3JUuBsv9AZjehb4= -go.uber.org/goleak v0.10.0/go.mod h1:VCZuO8V8mFPlL0F5J5GK1rtHV3DrFcQ1R8ryq7FK0aI= go.uber.org/goleak v1.1.0 h1:MJDxhkyAAWXEJf/y4NSOPYD/bBx7JAzIjUbv12/4FFs= go.uber.org/goleak v1.1.0/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -27,7 +25,6 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20191108193012-7d206e10da11 h1:Yq9t9jnGoR+dBuitxdo9l6Q7xh/zOyNnYUtDKaQ3x0E= golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= diff --git a/vendor/github.com/openfaas/faas-provider/types/function_deployment.go b/vendor/github.com/openfaas/faas-provider/types/function_deployment.go new file mode 100644 index 0000000..22b2abd --- /dev/null +++ b/vendor/github.com/openfaas/faas-provider/types/function_deployment.go @@ -0,0 +1,51 @@ +package types + +// FunctionDeployment represents a request to create or update a Function. +type FunctionDeployment struct { + + // Service is the name of the function deployment + Service string `json:"service"` + + // Image is a fully-qualified container image + Image string `json:"image"` + + // Namespace for the function, if supported by the faas-provider + Namespace string `json:"namespace,omitempty"` + + // EnvProcess overrides the fprocess environment variable and can be used + // with the watchdog + EnvProcess string `json:"envProcess,omitempty"` + + // EnvVars can be provided to set environment variables for the function runtime. + EnvVars map[string]string `json:"envVars,omitempty"` + + // Constraints are specific to the faas-provider. + Constraints []string `json:"constraints,omitempty"` + + // Secrets list of secrets to be made available to function + Secrets []string `json:"secrets,omitempty"` + + // Labels are metadata for functions which may be used by the + // faas-provider or the gateway + Labels *map[string]string `json:"labels,omitempty"` + + // Annotations are metadata for functions which may be used by the + // faas-provider or the gateway + Annotations *map[string]string `json:"annotations,omitempty"` + + // Limits for function + Limits *FunctionResources `json:"limits,omitempty"` + + // Requests of resources requested by function + Requests *FunctionResources `json:"requests,omitempty"` + + // ReadOnlyRootFilesystem removes write-access from the root filesystem + // mount-point. + ReadOnlyRootFilesystem bool `json:"readOnlyRootFilesystem,omitempty"` +} + +// FunctionResources Memory and CPU +type FunctionResources struct { + Memory string `json:"memory,omitempty"` + CPU string `json:"cpu,omitempty"` +} diff --git a/vendor/github.com/openfaas/faas-provider/types/model.go b/vendor/github.com/openfaas/faas-provider/types/function_status.go similarity index 50% rename from vendor/github.com/openfaas/faas-provider/types/model.go rename to vendor/github.com/openfaas/faas-provider/types/function_status.go index e923e6e..969a403 100644 --- a/vendor/github.com/openfaas/faas-provider/types/model.go +++ b/vendor/github.com/openfaas/faas-provider/types/function_status.go @@ -2,72 +2,6 @@ package types import "time" -// Secret for underlying orchestrator -type Secret struct { - // Name of the secret - Name string `json:"name"` - - // Namespace if applicable for the secret - Namespace string `json:"namespace,omitempty"` - - // Value is a string representing the string's value - Value string `json:"value,omitempty"` - - // RawValue can be used to provide binary data when - // Value is not set - RawValue []byte `json:"rawValue,omitempty"` -} - -// FunctionDeployment represents a request to create or update a Function. -type FunctionDeployment struct { - - // Service is the name of the function deployment - Service string `json:"service"` - - // Image is a fully-qualified container image - Image string `json:"image"` - - // Namespace for the function, if supported by the faas-provider - Namespace string `json:"namespace,omitempty"` - - // EnvProcess overrides the fprocess environment variable and can be used - // with the watchdog - EnvProcess string `json:"envProcess,omitempty"` - - // EnvVars can be provided to set environment variables for the function runtime. - EnvVars map[string]string `json:"envVars,omitempty"` - - // Constraints are specific to the faas-provider. - Constraints []string `json:"constraints,omitempty"` - - // Secrets list of secrets to be made available to function - Secrets []string `json:"secrets,omitempty"` - - // Labels are metadata for functions which may be used by the - // faas-provider or the gateway - Labels *map[string]string `json:"labels,omitempty"` - - // Annotations are metadata for functions which may be used by the - // faas-provider or the gateway - Annotations *map[string]string `json:"annotations,omitempty"` - - // Limits for function - Limits *FunctionResources `json:"limits,omitempty"` - - // Requests of resources requested by function - Requests *FunctionResources `json:"requests,omitempty"` - - // ReadOnlyRootFilesystem removes write-access from the root filesystem - // mount-point. - ReadOnlyRootFilesystem bool `json:"readOnlyRootFilesystem,omitempty"` -} - -// FunctionResources Memory and CPU -type FunctionResources struct { - Memory string `json:"memory,omitempty"` - CPU string `json:"cpu,omitempty"` -} - // FunctionStatus exported for system/functions endpoint type FunctionStatus struct { @@ -128,4 +62,24 @@ type FunctionStatus struct { // CreatedAt is the time read back from the faas backend's // data store for when the function or its container was created. CreatedAt time.Time `json:"createdAt,omitempty"` + + // Usage represents CPU and RAM used by all of the + // functions' replicas. Divide by AvailableReplicas for an + // average value per replica. + Usage *FunctionUsage `json:"usage,omitempty"` +} + +// FunctionUsage represents CPU and RAM used by all of the +// functions' replicas. +// +// CPU is measured in seconds consumed since the last measurement +// RAM is measured in total bytes consumed +// +type FunctionUsage struct { + // CPU is the increase in CPU usage since the last measurement + // equivalent to Kubernetes' concept of millicores. + CPU float64 `json:"cpu,omitempty"` + + //TotalMemoryBytes is the total memory usage in bytes. + TotalMemoryBytes float64 `json:"totalMemoryBytes,omitempty"` } diff --git a/vendor/github.com/openfaas/faas-provider/types/secret.go b/vendor/github.com/openfaas/faas-provider/types/secret.go new file mode 100644 index 0000000..71f9373 --- /dev/null +++ b/vendor/github.com/openfaas/faas-provider/types/secret.go @@ -0,0 +1,17 @@ +package types + +// Secret for underlying orchestrator +type Secret struct { + // Name of the secret + Name string `json:"name"` + + // Namespace if applicable for the secret + Namespace string `json:"namespace,omitempty"` + + // Value is a string representing the string's value + Value string `json:"value,omitempty"` + + // RawValue can be used to provide binary data when + // Value is not set + RawValue []byte `json:"rawValue,omitempty"` +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 091a787..bbe3013 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -209,7 +209,7 @@ github.com/opencontainers/runtime-spec/specs-go github.com/opencontainers/selinux/go-selinux github.com/opencontainers/selinux/go-selinux/label github.com/opencontainers/selinux/pkg/pwalk -# github.com/openfaas/faas-provider v0.18.6 +# github.com/openfaas/faas-provider v0.18.9 ## explicit github.com/openfaas/faas-provider github.com/openfaas/faas-provider/auth @@ -217,7 +217,7 @@ github.com/openfaas/faas-provider/httputil github.com/openfaas/faas-provider/logs github.com/openfaas/faas-provider/proxy github.com/openfaas/faas-provider/types -# github.com/openfaas/faas/gateway v0.0.0-20210726163109-539f0a2c946e +# github.com/openfaas/faas/gateway v0.0.0-20220124164130-cdb6badddaed ## explicit github.com/openfaas/faas/gateway/requests # github.com/pkg/errors v0.9.1