Skip to content

Commit

Permalink
Add support of clusterIP in server service
Browse files Browse the repository at this point in the history
  • Loading branch information
vovcyan committed Jan 26, 2025
1 parent 31d1f4c commit b0e9ae5
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
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)
}

0 comments on commit b0e9ae5

Please sign in to comment.