Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of clusterIP in server service #633

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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" }}
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)
}