From f0e691494458e73ebf0e4b20fa4d410f351ffaee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Wed, 12 Feb 2020 18:12:05 +0100 Subject: [PATCH 1/3] change type of timeout --- x-pack/functionbeat/manager/gcp/template_builder.go | 7 +++---- x-pack/functionbeat/provider/gcp/gcp/config.go | 3 +-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/x-pack/functionbeat/manager/gcp/template_builder.go b/x-pack/functionbeat/manager/gcp/template_builder.go index da13f8eb8d5..f7622acc8b6 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 9085f066380..0af370edcf2 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"` From af6bfab25d18202b7fa808c9492f229e3f90b8db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Wed, 12 Feb 2020 19:21:08 +0100 Subject: [PATCH 2/3] add changelog entry --- CHANGELOG.next.asciidoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 3bae809bc2e..746ed9b1b95 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -98,6 +98,8 @@ 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 From fa0d3c4a9a2a56c5376816f7019e705ec51082b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Wed, 12 Feb 2020 19:26:37 +0100 Subject: [PATCH 3/3] rm unnecessary newline --- CHANGELOG.next.asciidoc | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 746ed9b1b95..c6fccc8ebb7 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -100,7 +100,6 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Fix timeout option of GCP functions. {issue}16282[16282] {pull}16287[16287] - ==== Added *Affecting all Beats*