From 3f041eb9f0a2511de1cb56e260a55d593f16d5d4 Mon Sep 17 00:00:00 2001 From: Alexandre Vilain Date: Wed, 22 Nov 2023 06:56:11 +0100 Subject: [PATCH] fix(config): only set frontend HTTP port if not nil --- internal/resource/config/configmap_builder.go | 11 ++++++++++- pkg/version/version.go | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/internal/resource/config/configmap_builder.go b/internal/resource/config/configmap_builder.go index 58023f27..5d66d739 100644 --- a/internal/resource/config/configmap_builder.go +++ b/internal/resource/config/configmap_builder.go @@ -240,7 +240,6 @@ func (b *ConfigmapBuilder) Update(object client.Object) error { RPC: config.RPC{ GRPCPort: *b.instance.Spec.Services.Frontend.Port, MembershipPort: *b.instance.Spec.Services.Frontend.MembershipPort, - HTTPPort: *b.instance.Spec.Services.Frontend.HTTPPort, BindOnLocalHost: false, BindOnIP: "0.0.0.0", }, @@ -292,6 +291,16 @@ func (b *ConfigmapBuilder) Update(object client.Object) error { } } + // Temporal >= 1.22 provides HTTP endpoint for the frontend + if b.instance.Spec.Version.GreaterOrEqual(version.V1_22_0) && + b.instance.Spec.Services.Frontend.HTTPPort != nil { + frontend, ok := temporalCfg.Services[string(primitives.FrontendService)] + if ok { + frontend.RPC.HTTPPort = *b.instance.Spec.Services.Frontend.HTTPPort + temporalCfg.Services[string(primitives.FrontendService)] = frontend + } + } + if b.instance.Spec.DynamicConfig != nil { temporalCfg.DynamicConfigClient = &dynamicconfig.FileBasedClientConfig{ Filepath: "/etc/temporal/config/dynamic_config.yaml", diff --git a/pkg/version/version.go b/pkg/version/version.go index f6935fac..c4f9caf0 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -38,6 +38,7 @@ var ( V1_18_0 = MustNewVersionFromString("1.18.0") //nolint:stylecheck,revive V1_20_0 = MustNewVersionFromString("1.20.0") //nolint:stylecheck,revive V1_21_0 = MustNewVersionFromString("1.21.0") //nolint:stylecheck,revive + V1_22_0 = MustNewVersionFromString("1.22.0") //nolint:stylecheck,revive ) // Version is a wrapper around semver.Version which supports correct