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

Added tolerations to the constellation and constellation messaging charts #820

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2dd68ca
Aligned all _supplemental files of backingservices chart with new def…
alemax22 Oct 2, 2024
73fc6a0
Added tolerations to deployments of constellation and constellation m…
alemax22 Oct 2, 2024
6c3f34e
Updated docuemntation of constellation
alemax22 Oct 2, 2024
fd30c00
Created Unit Test for new implementation and created additional contr…
alemax22 Oct 2, 2024
104837c
Merge branch 'pegasystems:master' into feature/tolerations-constellation
alemax22 Oct 9, 2024
72ed2ae
Merge branch 'pegasystems:master' into feature/tolerations-constellation
alemax22 Oct 20, 2024
7464e84
Merge branch 'pegasystems:master' into feature/tolerations-constellation
alemax22 Oct 23, 2024
b241b51
Merge branch 'pegasystems:master' into feature/tolerations-constellation
alemax22 Oct 30, 2024
1bc2851
Merge branch 'pegasystems:master' into feature/tolerations-constellation
alemax22 Nov 6, 2024
4c54e25
Merge branch 'pegasystems:master' into feature/tolerations-constellation
alemax22 Nov 7, 2024
23aa667
Merge branch 'master' into feature/tolerations-constellation
alemax22 Nov 11, 2024
4233af3
Merge branch 'master' into feature/tolerations-constellation
alemax22 Nov 14, 2024
327152f
Merge branch 'master' into feature/tolerations-constellation
alemax22 Nov 26, 2024
49a534d
Merge branch 'pegasystems:master' into feature/tolerations-constellation
alemax22 Dec 9, 2024
5f66421
Merge branch 'master' into feature/tolerations-constellation
alemax22 Dec 23, 2024
75380c5
Merge branch 'master' into feature/tolerations-constellation
alemax22 Dec 26, 2024
4a57d0d
Merge branch 'master' into feature/tolerations-constellation
alemax22 Jan 6, 2025
e833b7e
Merge branch 'master' into feature/tolerations-constellation
alemax22 Jan 21, 2025
df97e7b
Merge branch 'master' into feature/tolerations-constellation
Saurabh-16 Jan 27, 2025
a763670
Merge branch 'master' into feature/tolerations-constellation
alemax22 Jan 27, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Complete information on the design of the service including architecture, scalab
| `deployment.labels` | Provide custom labels for the deployment as metadata to be consumed by other tools and libraries. |
| `imagePullSecretNames` | Deprected, use `docker.imagePullSecretNames`. List pre-existing secrets to be used for pulling docker images. |
| `affinity` | Define pod affinity so that it is restricted to run on particular node(s), or to prefer to run on particular nodes. |
| `tolerations` | Define pod tolerations so that it is allowed to run on node(s) with particular taints. |
| `docker.imagePullSecretNames` | List pre-existing secrets to be used for pulling docker images. |
| `docker.registry.url` | Specify the image registry url. |
| `docker.registry.username` | Specify the username for the docker registry. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ deploymentName
tlssecretsnippet
backingservices.gke.backendConfig
podAffinity
tolerations
are copied from backingservices/templates/_supplemental.tpl because helm lint requires
charts to render standalone. See: https://github.com/helm/helm/issues/11260 for more details.
*/}}
Expand Down Expand Up @@ -63,4 +64,11 @@ spec:
affinity:
{{- toYaml .affinity | nindent 2 }}
{{- end }}
{{ end }}

{{- define "tolerations" }}
{{- if .tolerations }}
tolerations:
{{- toYaml .tolerations | nindent 2 }}
{{- end }}
{{ end }}
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,5 @@ spec:
ports:
- containerPort: {{ $srvTargetPort }}
{{- include "podAffinity" .Values | indent 6 }}
{{- include "tolerations" .Values | indent 6 }}
{{ end }}
3 changes: 3 additions & 0 deletions charts/backingservices/charts/constellation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ The values.yaml file provides configuration options to define the values for the
| `docker.messaging.imagePullPolicy` | Specify the image pull policy configurations for the image. |
| `affinity` | Specify the pod affinity so that pods are restricted to run on particular node(s), or to prefer to run on particular nodes.
|
| `tolerations` | Specify pod tolerations so that it is allowed to run on node(s) with particular taints.
|


Example:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ deploymentName
tlssecretsnippet
backingservices.gke.backendConfig
podAffinity
tolerations
are copied from backingservices/templates/_supplemental.tpl because helm lint requires
charts to render standalone. See: https://github.com/helm/helm/issues/11260 for more details.
*/}}
Expand Down Expand Up @@ -63,4 +64,11 @@ spec:
affinity:
{{- toYaml .affinity | nindent 2 }}
{{- end }}
{{ end }}

{{- define "tolerations" }}
{{- if .tolerations }}
tolerations:
{{- toYaml .tolerations | nindent 2 }}
{{- end }}
{{ end }}
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,5 @@ spec:
ports:
- containerPort: {{ .Values.service.targetPort }}
{{- include "podAffinity" .Values | indent 6 }}
{{- include "tolerations" .Values | indent 6 }}
{{ end }}
8 changes: 8 additions & 0 deletions charts/backingservices/templates/_supplemental.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ deploymentName
tlssecretsnippet
backingservices.gke.backendConfig
podAffinity
tolerations
are copied from backingservices/templates/_supplemental.tpl because helm lint requires
charts to render standalone. See: https://github.com/helm/helm/issues/11260 for more details.
*/}}
Expand Down Expand Up @@ -63,4 +64,11 @@ spec:
affinity:
{{- toYaml .affinity | nindent 2 }}
{{- end }}
{{ end }}

{{- define "tolerations" }}
{{- if .tolerations }}
tolerations:
{{- toYaml .tolerations | nindent 2 }}
{{- end }}
{{ end }}
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,33 @@ func TestConstellationMessagingDeploymentWithAffinity(t *testing.T) {
require.Equal(t, "kubernetes.io/os", deploymentAffinity.NodeSelectorTerms[0].MatchExpressions[0].Key)
require.Equal(t, "In", string(deploymentAffinity.NodeSelectorTerms[0].MatchExpressions[0].Operator))
require.Equal(t, "linux", deploymentAffinity.NodeSelectorTerms[0].MatchExpressions[0].Values[0])
require.Empty(t, cllnMessagingDeploymentObj.Spec.Template.Spec.Tolerations)
}

func TestConstellationMessagingDeploymentWithTolerations(t *testing.T) {

helmChartParser := NewHelmConfigParser(
NewHelmTestFromTemplate(t, helmChartRelativePath, map[string]string{
"constellation-messaging.enabled": "true",
"constellation-messaging.name": "constellation-messaging",
"constellation-messaging.tolerations[0].key": "key1",
"constellation-messaging.tolerations[0].value": "value1",
"constellation-messaging.tolerations[0].operator": "Equal",
"constellation-messaging.tolerations[0].effect": "NotSchedule",
},
[]string{"charts/constellation-messaging/templates/messaging-deployment.yaml"}),
)

var cllnMessagingDeploymentObj appsv1.Deployment
helmChartParser.getResourceYAML(SearchResourceOption{
Name: "constellation-messaging",
Kind: "Deployment",
}, &cllnMessagingDeploymentObj)

deploymentTolerations := cllnMessagingDeploymentObj.Spec.Template.Spec.Tolerations
require.Equal(t, "key1", deploymentTolerations[0].Key)
require.Equal(t, "value1", deploymentTolerations[0].Value)
require.Equal(t, "Equal", string(deploymentTolerations[0].Operator))
require.Equal(t, "NotSchedule", string(deploymentTolerations[0].Effect))
require.Empty(t, cllnMessagingDeploymentObj.Spec.Template.Spec.Affinity)
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,32 @@ func TestConstellationStaticDeploymentWithAffinity(t *testing.T) {
require.Equal(t, "kubernetes.io/os", deploymentAffinity.NodeSelectorTerms[0].MatchExpressions[0].Key)
require.Equal(t, "In", string(deploymentAffinity.NodeSelectorTerms[0].MatchExpressions[0].Operator))
require.Equal(t, "linux", deploymentAffinity.NodeSelectorTerms[0].MatchExpressions[0].Values[0])
require.Empty(t, cllnDeploymentObj.Spec.Template.Spec.Tolerations)
}

func TestConstellationStaticDeploymentWithTolerations(t *testing.T) {

helmChartParser := NewHelmConfigParser(
NewHelmTestFromTemplate(t, helmChartRelativePath, map[string]string{
"constellation.enabled": "true",
"constellation.tolerations[0].key": "key1",
"constellation.tolerations[0].value": "value1",
"constellation.tolerations[0].operator": "Equal",
"constellation.tolerations[0].effect": "NotSchedule",
},
[]string{"charts/constellation/templates/clln-deployment.yaml"}),
)

var cllnDeploymentObj appsv1.Deployment
helmChartParser.getResourceYAML(SearchResourceOption{
Name: "constellation",
Kind: "Deployment",
}, &cllnDeploymentObj)

deploymentTolerations := cllnDeploymentObj.Spec.Template.Spec.Tolerations
require.Equal(t, "key1", deploymentTolerations[0].Key)
require.Equal(t, "value1", deploymentTolerations[0].Value)
require.Equal(t, "Equal", string(deploymentTolerations[0].Operator))
require.Equal(t, "NotSchedule", string(deploymentTolerations[0].Effect))
require.Empty(t, cllnDeploymentObj.Spec.Template.Spec.Affinity)
}