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 podLabels and deploymentLabels attributes to the SRS charts #826

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 12 additions & 1 deletion charts/backingservices/charts/srs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ To deploy Pega Platform with the SRS backing service, the SRS helm chart require
|-----------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `enabled` | Enable the Search and Reporting Service deployment as a backing service. Set this parameter to `true` to use SRS. |
| `deploymentName` | Specify the name of your SRS cluster. Your deployment creates resources prefixed with this string. This is also the service name for the SRS. |
| `srsRuntime` | Use this section to define specific resource configuration options like image, replica count, pod affinity, cpu and memory resource settings in the SRS. The default minimum required number of replicas is 2, but as a best practice, deploy 3 replicas to maintain high availability. |
| `deployment.labels` | Provide custom labels for the deployment as metadata to be consumed by other tools and libraries. |
| `srsRuntime` | Use this section to define specific resource configuration options like image, replica count, pod labels, pod affinity, cpu and memory resource settings in the SRS. The default minimum required number of replicas is 2, but as a best practice, deploy 3 replicas to maintain high availability. |
| `busybox` | When provisioning an internally managed Elasticsearch cluster, you can customize the location and pull policy of the Alpine image used during the deployment process by specifying `busybox.image` and `busybox.imagePullPolicy`. |
| `elasticsearch` | Define the elasticsearch cluster configurations. The [Elasticsearch](https://github.com/helm/charts/tree/master/stable/elasticsearch/values.yaml) chart defines the values for Elasticsearch provisioning in the SRS cluster. For internally provisioned Elasticsearch the default version is set to `7.17.9`. Set the `elasticsearch.imageTag` parameter in values.yaml to `7.16.3` to use this supported version in the SRS cluster. |
| `k8sProvider` | Specify your Kubernetes provider name. Supported values are [`eks`, `aks`, `minikube`, `gke`, `openshift`, `pks`].
Expand Down Expand Up @@ -174,13 +175,23 @@ srs:
# specify unique name for the deployment based on org app and/or srs applicable environment name. eg: acme-demo-dev-srs
deploymentName: "YOUR_SRS_DEPLOYMENT_NAME"

deployment:
# Specify additional deployment labels
labels:
key1: value1

# Configure the location of the busybox image that is used during the deployment process of
# the internal Elasticsearch cluster
busybox:
image: "alpine:3.16.0"
imagePullPolicy: "IfNotPresent"

srsRuntime:

# Specify additional pod labels
podLabels:
key1: value1

# Number of pods to provision
replicaCount: 2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ metadata:
name: {{ template "srs.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- if and (.Values.deployment) (.Values.deployment.labels) }}
{{ toYaml .Values.deployment.labels | indent 4 }}
{{- end }}
{{- include "srs.srs-service.labels" . | indent 4 }}
spec:
replicas: {{ .Values.srsRuntime.replicaCount }}
Expand All @@ -14,6 +17,9 @@ spec:
template:
metadata:
labels:
{{- if .Values.srsRuntime.podLabels }}
{{ toYaml .Values.srsRuntime.podLabels | indent 8 }}
{{- end }}
{{- include "srs.srs-service.match-labels" . | indent 8 }}
spec:
imagePullSecrets:
Expand Down
37 changes: 37 additions & 0 deletions terratest/src/test/backingservices/srs-deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ func TestSRSDeployment(t *testing.T) {
protocol: "https",
},
false,
[]label{},
[]label{},
})
}

Expand All @@ -58,6 +60,9 @@ func TestSRSDeploymentVariables(t *testing.T) {
"srs.enabled": "true",
"srs.deploymentName": "test-srs-dev",
"global.imageCredentials.registry": "docker-registry.io",
"srs.deployment.labels.key1": "value1",
"srs.deployment.labels.key2": "value2",
"srs.srsRuntime.podLabels.podkey1": "podValue1",
"srs.srsRuntime.replicaCount": "3",
"srs.srsRuntime.srsImage": "platform-services/search-n-reporting-service:1.0.0",
"srs.srsRuntime.imagePullSecretNames": "{secret1, secret2}",
Expand Down Expand Up @@ -101,6 +106,22 @@ func TestSRSDeploymentVariables(t *testing.T) {
region: "us-east-1",
},
true,
[]label{
{
key: "key1",
value: "value1",
},
{
key: "key2",
value: "value2",
},
},
[]label{
{
key: "podkey1",
value: "podValue1",
},
},
})
}

Expand Down Expand Up @@ -151,6 +172,8 @@ func TestSRSDeploymentVariablesDefaultInternetEgress(t *testing.T) {
protocol: "https",
},
true,
[]label{},
[]label{},
})
}

Expand Down Expand Up @@ -200,6 +223,13 @@ func VerifySRSDeployment(t *testing.T, deploymentObj appsv1.Deployment, expected
}
require.Equal(t, expectedDeployment.appName, deploymentObj.Spec.Template.Labels["app.kubernetes.io/name"])
deploymentSpec := deploymentObj.Spec.Template.Spec
// Verify labels
for _, labelpair := range expectedDeployment.depLabels {
require.Equal(t, labelpair.value, deploymentObj.Labels[labelpair.key])
}
for _, labelpair := range expectedDeployment.podLabels {
require.Equal(t, labelpair.value, deploymentObj.Spec.Template.Labels[labelpair.key])
}
VerifyDeployment(t, &deploymentSpec, expectedDeployment)
}

Expand Down Expand Up @@ -300,6 +330,8 @@ type srsDeployment struct {
podLimits podResources
elasticsearchEndPoint esDomain
imagePullSecretNames bool
depLabels []label
podLabels []label
}

type podResources struct {
Expand All @@ -315,3 +347,8 @@ type esDomain struct {
protocol string
region string
}

type label struct {
key string
value string
}