diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index b6870de277a5..3ad041763bbb 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -68,6 +68,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d *Functionbeat* +- Fix timeout option of GCP functions. {issue}16282[16282] {pull}16287[16287] ==== Added diff --git a/x-pack/functionbeat/manager/gcp/template_builder.go b/x-pack/functionbeat/manager/gcp/template_builder.go index da13f8eb8d5d..f7622acc8b63 100644 --- a/x-pack/functionbeat/manager/gcp/template_builder.go +++ b/x-pack/functionbeat/manager/gcp/template_builder.go @@ -8,7 +8,6 @@ import ( "errors" "fmt" "path/filepath" - "time" cloudfunctions "google.golang.org/api/cloudfunctions/v1" yaml "gopkg.in/yaml.v2" @@ -115,7 +114,7 @@ func (d *defaultTemplateBuilder) cloudFunction(name string, config *fngcp.Functi Runtime: runtime, ServiceAccountEmail: config.ServiceAccountEmail, SourceArchiveUrl: sourceArchiveURL, - Timeout: config.Timeout.String(), + Timeout: config.Timeout, VpcConnector: config.VPCConnector, } } @@ -142,8 +141,8 @@ func (d *defaultTemplateBuilder) RawTemplate(name string) (string, error) { }, } - if config.Timeout > 0*time.Second { - properties["timeout"] = config.Timeout.String() + if config.Timeout != "" { + properties["timeout"] = config.Timeout } if config.MemorySize != "" { properties["availableMemoryMb"] = config.MemorySize diff --git a/x-pack/functionbeat/provider/gcp/gcp/config.go b/x-pack/functionbeat/provider/gcp/gcp/config.go index 9085f0663805..0af370edcf28 100644 --- a/x-pack/functionbeat/provider/gcp/gcp/config.go +++ b/x-pack/functionbeat/provider/gcp/gcp/config.go @@ -6,14 +6,13 @@ package gcp import ( "fmt" - "time" ) // FunctionConfig stores the configuration of a Google Cloud Function type FunctionConfig struct { Description string `config:"description"` MemorySize string `config:"memory_size"` - Timeout time.Duration `config:"timeout" validate:"nonzero,positive"` + Timeout string `config:"timeout"` ServiceAccountEmail string `config:"service_account_email"` Labels map[string]string `config:"labels"` VPCConnector string `config:"vpc_connector"`