Skip to content

Commit

Permalink
Merge branch 'master' into db2_connprops
Browse files Browse the repository at this point in the history
  • Loading branch information
pega-roska authored Aug 11, 2023
2 parents 82fc09a + c9c3275 commit dd44de9
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 2 deletions.
12 changes: 10 additions & 2 deletions charts/pega/templates/_pega-service.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,18 @@ metadata:
{{- end }}
spec:
type:
{{- if or (eq .root.Values.global.provider "gke") (eq .root.Values.global.provider "eks") -}}
{{- if (.node.service.serviceType) -}}
{{ indent 1 (.node.service.serviceType) }}
{{- else if or (eq .root.Values.global.provider "gke") (eq .root.Values.global.provider "eks") -}}
{{ indent 1 "NodePort" }}
{{- else -}}
{{ indent 1 (.node.service.serviceType | default "LoadBalancer") }}
{{ indent 1 "LoadBalancer" }}
{{- end }}
{{- if and ( and (.node.service.serviceType) (eq (toString .node.service.serviceType) "LoadBalancer")) (.node.service.loadBalancerSourceRanges) }}
loadBalancerSourceRanges:
{{- range .node.service.loadBalancerSourceRanges }}
- "{{ . }}"
{{- end }}
{{- end }}
# Specification of on which port the service is enabled
ports:
Expand Down
12 changes: 12 additions & 0 deletions charts/pega/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,18 @@ global:
httpEnabled: true
port: 80
targetPort: 8080
# Use this parameter to deploy a specific type of service using the serviceType parameter and specify the type of service in double quotes.
# This is an optional value and should be used based on the use case.
# This should be set only in case of eks, gke and other cloud providers. This option should not be used for k8s and minikube.
# For example if you want to deploy a service of type LoadBalancer, uncomment the following line and specify serviceType: "LoadBalancer"
# serviceType: ""
# Specify the CIDR ranges to restrict the service access to the given CIDR range.
# Each new CIDR block should be added in a separate line.
# Should be used only when serviceType is set to LoadBalancer.
# Uncomment the following lines and replace the CIDR blocks with your configuration requirements.
# loadBalancerSourceRanges:
# - "123.123.123.0/24"
# - "128.128.128.64/32"
# To configure TLS between the ingress/load balancer and the backend, set the following:
tls:
enabled: false
Expand Down
49 changes: 49 additions & 0 deletions terratest/src/test/pega/data/values_with_servicetype.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
global:
tier:
- name: "web"
nodeType: "WebUser"
requestor:
passivationTimeSec: 900
service:
httpEnabled: true
port: 80
targetPort: 8080
tls:
enabled: false
external_secret_name: ""
keystore:
keystorepassword:
port: 443
targetPort: 8443
cacertificate:
certificateFile:
certificateKeyFile:
traefik:
enabled: false
serverName: ""
insecureSkipVerify: false
serviceType: "LoadBalancer"
ingress:
domain:
tls:
enabled: true
certificate:
key:
cacertificate:
replicas: 1
javaOpts: ""
pegaDiagnosticUser: ""
pegaDiagnosticPassword: ""
deploymentStrategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
livenessProbe:
port: 8081
hpa:
enabled: true
pdb:
enabled: false
minAvailable: 1
45 changes: 45 additions & 0 deletions terratest/src/test/pega/pega-tier-service-with-servicetype_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package pega

import (
"fmt"
"github.com/gruntwork-io/terratest/modules/helm"
"github.com/stretchr/testify/require"
k8score "k8s.io/api/core/v1"
"path/filepath"
"strings"
"testing"
)

func TestPegaServiceWithServiceType(t *testing.T) {

var supportedVendors = []string{"openshift", "eks", "gke", "aks", "pks"}
var supportedOperations = []string{"install-deploy"}
var deploymentNames = []string{"pega", "myapp-dev"}

helmChartPath, err := filepath.Abs(PegaHelmChartPath)
require.NoError(t, err)

for _, vendor := range supportedVendors {
for _, operation := range supportedOperations {
for _, depName := range deploymentNames {
fmt.Println(vendor + "-" + operation)
var options = &helm.Options{
ValuesFiles: []string{"data/values_with_servicetype.yaml"},
SetValues: map[string]string{
"global.deployment.name": depName,
"global.provider": vendor,
"global.actions.execute": operation,
},
}
yamlContent := RenderTemplate(t, options, helmChartPath, []string{"templates/pega-tier-service.yaml"})
serviceyamlContent := strings.Split(yamlContent, "---")
var pegaServiceObj k8score.Service
UnmarshalK8SYaml(t, serviceyamlContent[1], &pegaServiceObj)
serviceType := pegaServiceObj.Spec.Type
require.Equal(t, k8score.ServiceType("LoadBalancer"), serviceType )
}
}
}
}


0 comments on commit dd44de9

Please sign in to comment.