Skip to content

Commit

Permalink
Merge branch 'master' into feature/US-614412-2
Browse files Browse the repository at this point in the history
  • Loading branch information
pega-talba authored Jul 15, 2024
2 parents 45a4290 + dca7a84 commit 100e902
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 0 deletions.
25 changes: 25 additions & 0 deletions charts/pega/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1433,3 +1433,28 @@ behavior:
scaleUp:
stabilizationWindowSeconds: << provide scaleUp stabilization window in seconds >>
```

### Custom Ports

You can optionally specify custom ports for deployment tier. You can specify custom ports for your tiers as shown in the example below:

```yaml
tier:
- name: my-tier
custom:
ports:
- name: <name>
containerPort: <port>
```

You can optionally specify custom ports for tier specific service. You can specify custom ports for your service as shown in the example below:
```yaml
tier:
- name: my-tier
service:
customServicePorts:
- name: <name>
port: <port>
targetPort: <target port>
```
3 changes: 3 additions & 0 deletions charts/pega/templates/_pega-service.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ spec:
- name: https
port: {{ .node.service.tls.port }}
targetPort: {{ .node.service.tls.targetPort }}
{{- end }}
{{- if .node.service.customServicePorts }}
{{ toYaml .node.service.customServicePorts | indent 2 }}
{{- end }}
selector:
app: {{ .name }}
Expand Down
7 changes: 7 additions & 0 deletions charts/pega/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@ global:
# loadBalancerSourceRanges:
# - "123.123.123.0/24"
# - "128.128.128.64/32"

# Define custom ports for service here. If you want to use the custom ports for other services, please use the same configuration for those services.
# customServicePorts:
# - name: <name>
# port: <port>
# targetPort: <port>

# To configure TLS between the ingress/load balancer and the backend, set the following:
tls:
enabled: false
Expand Down
52 changes: 52 additions & 0 deletions terratest/src/test/pega/data/values_service_custom_ports.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
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
customServicePorts:
- name: port1
port: 5005
targetPort: 5005
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
37 changes: 37 additions & 0 deletions terratest/src/test/pega/pega-tier-service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,40 @@ type pegaServices struct {
Port int32
TargetPort intstr.IntOrString
}

func TestPegaTierServiceWithCustomPorts(t *testing.T) {
var supportedVendors = []string{"k8s", "openshift", "eks", "gke", "aks", "pks"}
var supportedOperations = []string{"deploy", "install-deploy", "upgrade-deploy"}
var deploymentNames = []string{"pega", "myapp-dev"}

helmChartPath, err := filepath.Abs(PegaHelmChartPath)
require.NoError(t, err)
var serviceObj k8score.Service
for _, vendor := range supportedVendors {
for _, operation := range supportedOperations {
for _, depName := range deploymentNames {

var options = &helm.Options{
ValuesFiles: []string{"data/values_service_custom_ports.yaml"},
SetValues: map[string]string{
"global.deployment.name": depName,
"global.provider": vendor,
"global.actions.execute": operation,
"installer.upgrade.upgradeType": "zero-downtime",
},
}
yamlContent := RenderTemplate(t, options, helmChartPath, []string{"templates/pega-tier-service.yaml"})
yamlSplit := strings.Split(yamlContent, "---")
UnmarshalK8SYaml(t, yamlSplit[1], &serviceObj)
ports := serviceObj.Spec.Ports
require.Equal(t, 2, len(ports))
require.Equal(t, "http", ports[0].Name)
require.Equal(t, int32(80), ports[0].Port)
require.Equal(t, int32(8080), ports[0].TargetPort.IntVal)
require.Equal(t, "port1", ports[1].Name)
require.Equal(t, int32(5005), ports[1].Port)
require.Equal(t, int32(5005), ports[1].TargetPort.IntVal)
}
}
}
}

0 comments on commit 100e902

Please sign in to comment.