Skip to content

Commit 23b0df7

Browse files
Saurabh-16kumas39
andauthored
US-622676 - helm chart changes for tcp keep alive probe (#837)
* US-622676 - helm chart changes for tcp keep alive probe * US-622676 - updating the documents * US-622676 - updating the documents * US-622676 - updating the readme * US-622676 - PR changes * US-622676 - Reverting the original change * US-622676 - code review comments --------- Co-authored-by: kumas39 <[email protected]>
1 parent 36a77e3 commit 23b0df7

File tree

4 files changed

+84
-11
lines changed

4 files changed

+84
-11
lines changed

charts/pega/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,20 @@ tier:
333333
runAsUser: RUN_AS_USER
334334
fsGroup: FS_GROUP
335335
```
336+
337+
Starting in Kubernetes version 1.29, you can configure the OS Kernel level setting net.ipv4.tcp_keepalive_time using standard sysctls command.
338+
The following code provides an example configuration. If needed, provide the value in seconds as per the cloud provider TCP connections timeout settings.
339+
340+
Example:
341+
342+
```yaml
343+
tier:
344+
- name: my-tier
345+
securityContext:
346+
sysctls:
347+
- name: net.ipv4.tcp_keepalive_time
348+
value: "300"
349+
```
336350
### service
337351

338352
Specify the `service` yaml block to expose a Pega tier to other Kubernetes run services, or externally to other systems. The name of the service will be based on the tier's name, so if your tier is "web", your service name will be "pega-web". If you omit service, no Kubernetes service object is created for the tier during the deployment. For more information on services, see the [Kubernetes Documentation](https://kubernetes.io/docs/concepts/services-networking/service).

charts/pega/templates/_pega-deployment.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ spec:
117117
runAsUser: 9001
118118
fsGroup: 0
119119
{{- end }}
120+
{{- if (.node.tcpKeepAliveProbe) }}
121+
sysctls:
122+
- name: "net.ipv4.tcp_keepalive_time"
123+
value: "{{ .node.tcpKeepAliveProbe }}"
124+
{{- end }}
120125
{{- if .node.securityContext }}
121126
{{ toYaml .node.securityContext | indent 8 }}
122127
{{- end }}

charts/pega/values.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,14 @@ global:
257257
# runAsUser: 9001
258258
# fsGroup: 0
259259

260+
# To configure net.ipv4.tcp_keepalive_time OS Kernel setting, set the value in seconds.
261+
# This setting only works for Kubernetes version 1.29 onwards. For more information, see below,
262+
# https://github.com/pegasystems/pega-helm-charts/blob/master/charts/pega/README.md#security-context
263+
# securityContext:
264+
# sysctls:
265+
# - name: net.ipv4.tcp_keepalive_time
266+
# value: "300"
267+
260268
# To specify security settings for a Container, include the securityContext field in the Container manifest
261269
# Security settings that you specify for a Container apply only to the pega container,
262270
# and they override settings made at the Pod level when there is overlap. Container settings
@@ -328,6 +336,14 @@ global:
328336
# runAsUser: 9001
329337
# fsGroup: 0
330338

339+
# To configure net.ipv4.tcp_keepalive_time OS Kernel setting, set the value in seconds.
340+
# This setting only works for Kubernetes version 1.29 onwards. For more information, see below,
341+
# https://github.com/pegasystems/pega-helm-charts/blob/master/charts/pega/README.md#security-context
342+
# securityContext:
343+
# sysctls:
344+
# - name: net.ipv4.tcp_keepalive_time
345+
# value: "300"
346+
331347
# To specify security settings for a Container, include the securityContext field in the Container manifest
332348
# Security settings that you specify for a Container apply only to the pega container,
333349
# and they override settings made at the Pod level when there is overlap. Container settings
@@ -399,6 +415,14 @@ global:
399415
# runAsUser: 9001
400416
# fsGroup: 0
401417

418+
# To configure net.ipv4.tcp_keepalive_time OS Kernel setting, set the value in seconds.
419+
# This setting only works for Kubernetes version 1.29 onwards. For more information, see below,
420+
# https://github.com/pegasystems/pega-helm-charts/blob/master/charts/pega/README.md#security-context
421+
# securityContext:
422+
# sysctls:
423+
# - name: net.ipv4.tcp_keepalive_time
424+
# value: "300"
425+
402426
# To specify security settings for a Container, include the securityContext field in the Container manifest
403427
# Security settings that you specify for a Container apply only to the pega container,
404428
# and they override settings made at the Pod level when there is overlap. Container settings

terratest/src/test/pega/pega-tier-deployment_test.go

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,16 @@ func TestPegaTierDeploymentWithPodAffinity(t *testing.T) {
7575
for _, vendor := range supportedVendors {
7676
var options = &helm.Options{
7777
SetValues: map[string]string{
78-
"global.provider": vendor,
79-
"global.actions.execute": "deploy",
80-
"global.deployment.name": "pega",
81-
"installer.upgrade.upgradeType": "zero-downtime",
82-
"global.tier[0].name": "web",
83-
"global.tier[1].name": "batch",
84-
"global.tier[2].name": "stream",
85-
affintiyBasePath + "nodeSelectorTerms[0].matchExpressions[0].key": "kubernetes.io/os",
86-
affintiyBasePath + "nodeSelectorTerms[0].matchExpressions[0].operator": "In",
87-
affintiyBasePath + "nodeSelectorTerms[0].matchExpressions[0].values[0]": "linux",
78+
"global.provider": vendor,
79+
"global.actions.execute": "deploy",
80+
"global.deployment.name": "pega",
81+
"installer.upgrade.upgradeType": "zero-downtime",
82+
"global.tier[0].name": "web",
83+
"global.tier[1].name": "batch",
84+
"global.tier[2].name": "stream",
85+
affintiyBasePath + "nodeSelectorTerms[0].matchExpressions[0].key": "kubernetes.io/os",
86+
affintiyBasePath + "nodeSelectorTerms[0].matchExpressions[0].operator": "In",
87+
affintiyBasePath + "nodeSelectorTerms[0].matchExpressions[0].values[0]": "linux",
8888
},
8989
}
9090

@@ -102,7 +102,37 @@ func TestPegaTierDeploymentWithPodAffinity(t *testing.T) {
102102
UnmarshalK8SYaml(t, yamlSplit[3], &depObjStream)
103103
deploymentAffinityStream := depObjStream.Spec.Template.Spec.Affinity
104104
require.Empty(t, deploymentAffinityStream)
105-
}
105+
}
106+
}
107+
108+
func TestPegaTierDeploymentWithTCPProbe(t *testing.T) {
109+
110+
var supportedVendors = []string{"k8s", "eks", "gke", "aks", "pks"}
111+
helmChartPath, err := filepath.Abs(PegaHelmChartPath)
112+
require.NoError(t, err)
113+
114+
var depObj appsv1.Deployment
115+
116+
for _, vendor := range supportedVendors {
117+
var options = &helm.Options{
118+
SetValues: map[string]string{
119+
"global.provider": vendor,
120+
"global.actions.execute": "deploy",
121+
"global.deployment.name": "pega",
122+
"global.tier[0].name": "web",
123+
"global.tier[0].tcpKeepAliveProbe": "10",
124+
},
125+
}
126+
127+
yamlContent := RenderTemplate(t, options, helmChartPath, []string{"templates/pega-tier-deployment.yaml"})
128+
yamlSplit := strings.Split(yamlContent, "---")
129+
130+
UnmarshalK8SYaml(t, yamlSplit[1], &depObj)
131+
require.Equal(t, "net.ipv4.tcp_keepalive_time", *&depObj.Spec.Template.Spec.SecurityContext.Sysctls[0].Name)
132+
require.Equal(t, "10", *&depObj.Spec.Template.Spec.SecurityContext.Sysctls[0].Value)
133+
134+
}
135+
106136
}
107137

108138
func TestPegaTierDeploymentWithFSGroup(t *testing.T) {

0 commit comments

Comments
 (0)