Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions charts/temporal/templates/server-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ metadata:
{{- end }}
spec:
type: {{ $serviceValues.service.type }}
{{- if hasKey $serviceValues.service "clusterIP" }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please switch this to with and use . in the block, rather than if.

clusterIP: {{ $serviceValues.service.clusterIP }}
{{- end }}
ports:
- port: {{ $serviceValues.service.port }}
targetPort: rpc
Expand Down
58 changes: 58 additions & 0 deletions charts/temporal/tests/service_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package test

import (
"path/filepath"
"strings"
"testing"

"github.com/gruntwork-io/terratest/modules/helm"
"github.com/gruntwork-io/terratest/modules/k8s"
"github.com/gruntwork-io/terratest/modules/random"
"github.com/stretchr/testify/require"
appsv1 "k8s.io/api/apps/v1"
)

func TestTemplateServerServiceDefault(t *testing.T) {
// t.Parallel()

helmChartPath, err := filepath.Abs("../")
releaseName := "temporal"
require.NoError(t, err)

namespaceName := "temporal-" + strings.ToLower(random.UniqueId())

var deployment appsv1.Deployment

options := &helm.Options{
KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
BuildDependencies: true,
}

output := helm.RenderTemplate(t, options, helmChartPath, releaseName, []string{"templates/server-service.yaml"})

helm.UnmarshalK8SYaml(t, output, &deployment)
}

func TestTemplateServerServiceFrontendClusterIP(t *testing.T) {
// t.Parallel()

helmChartPath, err := filepath.Abs("../")
releaseName := "temporal"
require.NoError(t, err)

namespaceName := "temporal-" + strings.ToLower(random.UniqueId())

var deployment appsv1.Deployment

options := &helm.Options{
SetValues: map[string]string{
"frontend.service.clusterIP": "None",
},
KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
BuildDependencies: true,
}

output := helm.RenderTemplate(t, options, helmChartPath, releaseName, []string{"templates/server-service.yaml"})

helm.UnmarshalK8SYaml(t, output, &deployment)
}