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

Add GKE support for Constellation and Constellation Messaging #770

Merged
merged 44 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
ec35d8f
Added support of GKE to constellation chart
May 13, 2024
d79a712
Merge branch 'pegasystems:master' into bugfix/clln-gke-support
alemax22 May 15, 2024
4b5fdcc
Test
May 16, 2024
36d6fb9
Trial
May 16, 2024
fdb1fed
Updated Tests on Constellation with new changes
May 16, 2024
74ecae9
Added TLS support for GKE ingress
May 17, 2024
5087a38
Prepared files for clln msg service
May 17, 2024
86b0a66
Partially implemented messaging constellation for GKE
May 17, 2024
42d0cbd
Renamed files
alemax22 May 17, 2024
5afbfef
Added Test for ingress presence in constellation
alemax22 May 17, 2024
565352a
Refactored common helpers in root template folder
May 21, 2024
df3d97a
Merge branch 'pegasystems:master' into bugfix/clln-gke-support
alemax22 May 21, 2024
cd14433
Refactored keys of constellation and constellation messaging in a way…
May 21, 2024
e3e1461
Added new changes
May 21, 2024
2686a75
Refactored cosntellation and constellation messaging deault values
May 23, 2024
5dd4567
Merged changes
May 23, 2024
3d984b6
Merged with pega master
alemax22 Jun 3, 2024
404fcd0
Added unit test for backend config of constellation
alemax22 Jun 3, 2024
7e788e7
Added unit test for backend config of constellation messaging
alemax22 Jun 3, 2024
5c830e4
Updated documentation of constellation
Jun 4, 2024
ed5a9c7
Merge branch 'pegasystems:master' into bugfix/clln-gke-support
alemax22 Jun 4, 2024
9131501
Documented liveness and readiness probe of constellation
Jun 4, 2024
75ff1e3
Updated documentation of constellation and constellation messaging
Jun 4, 2024
189ef50
Updated documentation of constellation and constellation messaging se…
Jun 5, 2024
19f85ac
Added Unit Test on ingress enablement for constellation and constella…
Jun 5, 2024
7912e91
Update values.yaml by adding new line at the end of the file
alemax22 Jun 5, 2024
60029be
Update values.yaml by adding new line at the end of the file
alemax22 Jun 5, 2024
0fafd9a
Update values.yaml by adding new line at the end of the file
alemax22 Jun 5, 2024
002ed1d
Update values.yaml by adding new line at the end of the file
alemax22 Jun 5, 2024
de4b3e9
Update values.yaml of constellation messaging
alemax22 Jun 5, 2024
5542495
Removed trailing spaces
alemax22 Jun 5, 2024
2108ff1
Duplicated templates to subcharts in such a way to pass helm lint tests
alemax22 Jun 5, 2024
09912bf
Created supplemental.tpl aldo into template folder of backing services
Jun 6, 2024
2fe874f
Merge branch 'pegasystems:master' into bugfix/clln-gke-support
alemax22 Jul 8, 2024
378a015
Fix merge
Jul 10, 2024
6baa13e
Fix merge
Jul 10, 2024
3466e0a
Merge branch 'pegasystems:master' into bugfix/clln-gke-support
alemax22 Jul 18, 2024
0000b5f
Merge branch 'master' into bugfix/clln-gke-support
alemax22 Jul 19, 2024
7e4d2aa
Merge branch 'master' into bugfix/clln-gke-support
alemax22 Jul 23, 2024
d87e5af
Created secret for constellation messaging, added enabled in ingress …
Jul 30, 2024
6afbb77
Merge branch 'master' into bugfix/clln-gke-support
alemax22 Aug 6, 2024
fa91b64
Merge branch 'master' into bugfix/clln-gke-support
alemax22 Aug 13, 2024
161b7e2
Merge branch 'master' into bugfix/clln-gke-support
alemax22 Aug 13, 2024
4441ff0
Merge branch 'master' into bugfix/clln-gke-support
alemax22 Aug 14, 2024
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
87 changes: 80 additions & 7 deletions charts/backingservices/charts/constellation-messaging/README.md

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- define "messagingRegistryCredentialsSecretTemplate" }}
alemax22 marked this conversation as resolved.
Show resolved Hide resolved
kind: Secret
apiVersion: v1
metadata:
name: {{ include "backingservicesRegistrySecret" (dict "root" .Values "defaultname" "constellation-messaging" ) }}
namespace: {{ .Release.Namespace }}
annotations:
"helm.sh/hook": pre-install, pre-upgrade
"helm.sh/hook-weight": "0"
"helm.sh/hook-delete-policy": before-hook-creation
data:
.dockerconfigjson: {{ template "imagePullSecret" . }}
type: kubernetes.io/dockerconfigjson
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{{- /*
imagePullSecret
backingservicesRegistrySecret
deploymentName
tlssecretsnippet
backingservices.gke.backendConfig
podAffinity
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.
*/}}

{{- define "imagePullSecret" }}
{{- printf "{\"auths\": {\"%s\": {\"auth\": \"%s\"}}}" .Values.docker.registry.url (printf "%s:%s" .Values.docker.registry.username .Values.docker.registry.password | b64enc) | b64enc }}
{{- end }}

{{- define "backingservicesRegistrySecret" }}
{{- $depName := printf "%s" (include "deploymentName" (dict "root" .root "defaultname" .defaultname )) -}}
{{- $depName -}}-registry-secret
{{- end }}

{{- define "deploymentName" }}{{ $deploymentNamePrefix := .defaultname }}{{ if (.root.deployment) }}{{ if (.root.deployment.name) }}{{ $deploymentNamePrefix = .root.deployment.name }}{{ end }}{{ end }}{{ if (.root.name) }}{{ $deploymentNamePrefix = .root.name }}{{ end }}{{ $deploymentNamePrefix }}{{- end }}

{{- define "tlssecretsnippet" -}}
tls:
- hosts:
- {{ include "domainName" (dict "node" .node) }}
secretName: {{ .node.ingress.tls.secretName }}
{{- end -}}

{{- define "domainName" }}
{{- if .node.ingress -}}
{{- if .node.ingress.domain -}}
{{ .node.ingress.domain }}
{{- end -}}
{{- else if .node.service.domain -}}
{{ .node.service.domain }}
{{- end -}}
{{- end }}


{{- define "backingservices.gke.backendConfig" -}}
apiVersion: cloud.google.com/v1
kind: BackendConfig
metadata:
name: {{ .name }}
spec:
timeoutSec: 40
connectionDraining:
drainingTimeoutSec: 60
healthCheck:
checkIntervalSec: 5
healthyThreshold: 1
port: {{ .healthCheckPort }}
requestPath: {{ .requestPath }}
timeoutSec: 5
type: HTTP
unhealthyThreshold: 2
---
{{ end }}

{{- define "podAffinity" }}
{{- if .affinity }}
affinity:
{{- toYaml .affinity | nindent 2 }}
{{- end }}
{{ end }}
Original file line number Diff line number Diff line change
@@ -1,28 +1,37 @@
{{- $depName := printf "%s" (include "deploymentName" (dict "root" .Values "defaultname" "constellation-messaging" )) }}
{{- $srvTargetPort := .Values.service.targetPort }}{{ if .Values.pegaMessagingTargetPort }}{{ $srvTargetPort = .Values.pegaMessagingTargetPort }}{{ end }}
{{- if .Values.enabled }}
kind: Deployment
apiVersion: apps/v1
metadata:
name: {{ .Values.name }}
name: {{ $depName }}
labels:
app: {{ .Values.name }}
app: {{ $depName }}
spec:
replicas: {{ .Values.replicas }}
selector:
matchLabels:
app: {{ .Values.name }}
app: {{ $depName }}
template:
metadata:
labels:
app: {{ .Values.name }}
app: {{ $depName }}
spec:
imagePullSecrets:
- name: {{ include "backingservicesRegistrySecret" ( dict "root" .Values "defaultname" "constellation-messaging" ) }}
{{ if .Values.docker.imagePullSecretNames }}
{{- range .Values.docker.imagePullSecretNames }}
- name: {{ . }}
{{- end }}
{{ else if .Values.imagePullSecretNames }}
{{- range .Values.imagePullSecretNames }}
- name: {{ . }}
- name: {{ . }}
{{- end }}
{{ end }}
containers:
- name: c11n-messaging
imagePullPolicy: {{ .Values.imagePullPolicy }}
image: {{ .Values.image }}
imagePullPolicy: {{ .Values.docker.messaging.imagePullPolicy }}
image: {{ .Values.docker.messaging.image }}
resources:
{{ if .Values.resources }}
{{ toYaml .Values.resources | nindent 10 }}
Expand All @@ -32,10 +41,28 @@ spec:
{{ toYaml .Values.securityContext | nindent 10 }}
{{- end }}
args:
- --max-semi-space-size=1024
- port={{ .Values.pegaMessagingTargetPort }}
- path=/c11n-messaging
- --max-semi-space-size=1024
- port={{ $srvTargetPort }}
- urlPath={{ .Values.urlPath }}
livenessProbe:
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
successThreshold: {{ .Values.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
httpGet:
path: {{ .Values.urlPath }}/ping
port: {{ $srvTargetPort }}
readinessProbe:
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
successThreshold: {{ .Values.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
httpGet:
path: {{ .Values.urlPath }}/ping
port: {{ $srvTargetPort }}
ports:
- containerPort: {{ .Values.pegaMessagingTargetPort }}
- containerPort: {{ $srvTargetPort }}
{{- include "podAffinity" .Values | indent 6 }}
{{ end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- $depName := printf "%s" (include "deploymentName" (dict "root" .Values "defaultname" "constellation-messaging" )) }}
{{- $requestPath := printf "%s/ping" .Values.urlPath }}
{{- $srvPort := .Values.service.port }}{{ if .Values.pegaMessagingPort }}{{ $srvPort = .Values.pegaMessagingPort }}{{ end }}

{{- if .Values.enabled }}
{{- if (eq .Values.provider "gke") }}
{{- if .Values.ingress.enabled }}
{{ template "backingservices.gke.backendConfig" dict "root" .Values "name" $depName "requestPath" $requestPath "healthCheckPort" $srvPort }}
{{ end }}
{{ end }}
{{ end }}
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{{- if and .Values.enabled .Values.ingress.domain }}
{{- $depName := printf "%s" (include "deploymentName" (dict "root" .Values "defaultname" "constellation-messaging" )) }}
{{- $srvPort := .Values.service.port }}{{ if .Values.pegaMessagingPort }}{{ $srvPort = .Values.pegaMessagingPort }}{{ end }}
{{- if .Values.enabled }}
{{- if and (.Values.ingress) (eq .Values.ingress.enabled true) }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Values.name }}
name: {{ $depName }}
{{- if .Values.ingress.annotations }}
annotations:
{{ toYaml .Values.ingress.annotations | indent 4 }}
Expand All @@ -12,14 +15,22 @@ spec:
ingressClassName: {{ .Values.ingress.ingressClassName }}
{{- end }}
rules:
- host: {{ .Values.ingress.domain }}
http:
paths:
- path: /c11n-messaging
pathType: Prefix
backend:
service:
name: {{ .Values.name }}
port:
number: {{ $.Values.pegaMessagingPort }}
- host: {{ .Values.ingress.domain }}
http:
paths:
- path: {{ .Values.urlPath }}
pathType: Prefix
backend:
service:
name: {{ $depName }}
port:
number: {{ $srvPort }}
{{ if (.Values.ingress.tls) }}
{{- if (eq .Values.ingress.tls.enabled true) }}
{{- if .Values.ingress.tls.secretName }}
{{- include "tlssecretsnippet" (dict "node" .Values) | indent 2 }}
{{- end }}
{{- end }}
{{- end }}
{{ end }}
{{ end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{- if .Values.enabled }}
{{- include "messagingRegistryCredentialsSecretTemplate" . }}
{{ end }}
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
{{ $depName := printf "%s" (include "deploymentName" (dict "root" .Values "defaultname" "constellation-messaging" )) }}
{{- $srvTargetPort := .Values.service.targetPort }}{{ if .Values.pegaMessagingTargetPort }}{{ $srvTargetPort = .Values.pegaMessagingTargetPort }}{{ end }}
{{- $srvPort := .Values.service.port }}{{ if .Values.pegaMessagingPort }}{{ $srvPort = .Values.pegaMessagingPort }}{{ end }}
{{- if .Values.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.name }}
name: {{ $depName }}
labels:
app: {{ .Values.name }}
app: {{ $depName }}
{{- if and (.Values.service) (.Values.service.annotations) }}
annotations:
# Custom annotations
{{ toYaml .Values.service.annotation | indent 4 }}
{{- else if (eq .Values.provider "gke") }}
annotations:
cloud.google.com/neg: '{"ingress": true}'
cloud.google.com/app-protocols: '{"https":"HTTPS","http":"HTTP"}'
cloud.google.com/backend-config: '{"ports": {"{{ $srvPort }}": "{{ $depName }}"}}'
{{- end }}
spec:
type: NodePort
selector:
app: {{ .Values.name }}
app: {{ $depName }}
ports:
- protocol: TCP
port: {{ .Values.pegaMessagingPort }}
targetPort: {{ .Values.pegaMessagingTargetPort }}
- name: http
protocol: TCP
port: {{ $srvPort }}
targetPort: {{ $srvTargetPort }}
type: {{ .Values.service.serviceType }}
{{ end }}
58 changes: 46 additions & 12 deletions charts/backingservices/charts/constellation-messaging/values.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
---
enabled: false
name: YOUR_MESSAGING_SERVICE_DEPLOYMENT_NAME
deployment:
name: "constellation-messaging"
# Cloud provider details
provider: "aws"

image: YOUR_MESSAGING_SERVICE_IMAGE:TAG
replicas: 1

# To avoid exposing Docker credentials, create a separate Docker config secret.
# Specify secret names as an array of comma-separated strings. For example: ["secret1", "secret2"]
imagePullSecretNames: []
imagePullPolicy: Always
# Docker repos and tag for image
docker:
# If using a custom Docker registry, supply the credentials here to pull Docker images.
registry:
url: YOUR_DOCKER_REGISTRY_URL
username: YOUR_DOCKER_REGISTRY_USERNAME
password: YOUR_DOCKER_REGISTRY_PASSWORD
# To avoid exposing Docker credentials, create a separate Docker config secret.
# Specify secret names as an array of comma-separated strings. For example: ["secret1", "secret2"]
imagePullSecretNames: []
# Docker image information for the Pega docker image, containing the application server.
messaging:
image: YOUR_MESSAGING_SERVICE_IMAGE:TAG
imagePullPolicy: Always

pegaMessagingPort: 3000
pegaMessagingTargetPort: 3000
urlPath: /c11n-messaging

# set memoryRequest & memoryLimit to Limit memory usage for container https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-memory
# resources:
Expand All @@ -27,12 +36,37 @@ securityContext:
readOnlyRootFilesystem: false
# set allowPrivilegeEscalation to false to Restrict container from acquiring additional privileges https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
allowPrivilegeEscalation: true # false
serviceType: NodePort

# Service
service:
port: 3000
targetPort: 3000
serviceType: NodePort

# An ingress will be provisioned if a hostname is defined, or omitted if the hostname is empty.
# ingressClassName and annotations are optional and will be included if defined.
# Due to the diverse requirements for ingresses and TLS configuration, it may be necessary to define the ingress separately from this chart.
ingress:
domain:
alemax22 marked this conversation as resolved.
Show resolved Hide resolved
enabled: true
domain: YOUR_CUSTOM_DOMAIN_NAME_HERE
ingressClassName:
# Additional annotations for the ingress can be specified here
annotations:
tls:
enabled: false
secretName:

# Deployment Spec
replicas: 1
livenessProbe:
initialDelaySeconds: 5
timeoutSeconds: 5
periodSeconds: 30
successThreshold: 1
failureThreshold: 3
readinessProbe:
initialDelaySeconds: 5
timeoutSeconds: 5
periodSeconds: 30
successThreshold: 1
failureThreshold: 3
Loading
Loading