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 latest changes for supporting GKE/PKS/AKS and HPAs #11

Merged
merged 8 commits into from
Apr 30, 2019
Merged
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
**/requirements.lock

# Generated example yaml
/examples
/build
*.tar.gz

# OSX trash
.DS_Store
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ deploy:
file:
- pega-kubernetes-example.tar.gz
- pega-openshift-example.tar.gz
- pega-eks-example.tar.gz
- pega-azure-aks-example.tar.gz
- pega-aws-eks-example.tar.gz
- pega-google-gke-example.tar.gz
- pega-pivotal-pks-example.tar.gz
skip_cleanup: true
on:
repo: pegasystems/pega-helm-charts
Expand Down
56 changes: 47 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,62 @@
dependencies:
helm repo add traefik https://kubernetes-charts.storage.googleapis.com
helm repo add cassandra https://kubernetes-charts-incubator.storage.googleapis.com/
helm repo add elasticsearch https://kubernetes-charts.storage.googleapis.com/
helm repo add fluentd-elasticsearch https://kubernetes-charts.storage.googleapis.com/
helm repo add kibana https://kubernetes-charts.storage.googleapis.com/
helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/
helm repo list
helm dependency update ./charts/pega/

examples: dependencies
mkdir -p ./build/kubernetes
helm template ./charts/pega/ --output-dir ./build/kubernetes --values ./charts/pega/values.yaml --namespace example --set provider=k8s --set actions.execute=deploy
helm template ./charts/pega/ \
--output-dir ./build/kubernetes \
--values ./charts/pega/values.yaml \
--namespace example \
--set provider=k8s \
--set actions.execute=deploy
tar -C ./build/kubernetes/pega/templates -cvzf ./pega-kubernetes-example.tar.gz .

mkdir -p ./build/openshift
helm template ./charts/pega/ --output-dir ./build/openshift --values ./charts/pega/values.yaml --namespace example --set provider=openshift --set actions.execute=deploy
helm template ./charts/pega/ \
--output-dir ./build/openshift \
--values ./charts/pega/values.yaml \
--namespace example \
--set provider=openshift \
--set actions.execute=deploy
tar -C ./build/openshift/pega/templates -cvzf ./pega-openshift-example.tar.gz .

mkdir -p ./build/aws-eks
helm template ./charts/pega/ --output-dir ./build/aws-eks --values ./charts/pega/values.yaml --namespace example --set provider=eks --set actions.execute=deploy
tar -C ./build/aws-eks/pega/templates -cvzf ./pega-eks-example.tar.gz .
helm template ./charts/pega/ \
--output-dir ./build/aws-eks \
--values ./charts/pega/values.yaml \
--namespace example \
--set provider=eks \
--set actions.execute=deploy
tar -C ./build/aws-eks/pega/templates -cvzf ./pega-aws-eks-example.tar.gz .

mkdir -p ./build/azure-aks
helm template ./charts/pega/ \
--output-dir ./build/azure-aks \
--values ./charts/pega/values.yaml \
--namespace example \
--set provider=aks \
--set actions.execute=deploy
tar -C ./build/azure-aks/pega/templates -cvzf ./pega-azure-aks-example.tar.gz .

mkdir -p ./build/google-gke
helm template ./charts/pega/ \
--output-dir ./build/google-gke \
--values ./charts/pega/values.yaml \
--namespace example \
--set provider=gke \
--set actions.execute=deploy
tar -C ./build/google-gke/pega/templates -cvzf ./pega-google-gke-example.tar.gz .

mkdir -p ./build/pivotal-pks
helm template ./charts/pega/ \
--output-dir ./build/pivotal-pks \
--values ./charts/pega/values.yaml \
--namespace example \
--set provider=pks \
--set actions.execute=deploy
tar -C ./build/pivotal-pks/pega/templates -cvzf ./pega-pivotal-pks-example.tar.gz .

clean:
rm -rf ./build
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Pega Deployment on Kubernetes

This project provides Helm charts and basic examples for deploying Pega on Kubernetes. This project **does not include** the required database installation image which you [may obtain from the Pega Community](https://community.pega.com/knowledgebase/products/platform/deploy).
This project provides Helm charts and basic examples for deploying Pega on Kubernetes. This project **does not include** the required database installation image which you [may obtain from the Pega Community](https://community.pega.com/knowledgebase/products/platform/deploy). Deploying Pega on Kubernetes requires Pega Infinity 8.2 or newer.

[![Build Status](https://travis-ci.org/pegasystems/pega-helm-charts.svg?branch=master)](https://travis-ci.org/pegasystems/pega-helm-charts)
![GitHub release](https://img.shields.io/github/release/pegasystems/pega-helm-charts.svg)
[![GitHub release](https://img.shields.io/github/release/pegasystems/pega-helm-charts.svg)](https://github.com/pegasystems/pega-helm-charts/releases)

## Getting Started

Expand Down
4 changes: 4 additions & 0 deletions charts/pega/requirements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ dependencies:
version: "1.1.0"
repository: https://kubernetes-charts.storage.googleapis.com/
condition: kibana.enabled
- name: metrics-server
version: "2.5.0"
repository: https://kubernetes-charts.storage.googleapis.com/
condition: metrics-server.enabled
18 changes: 6 additions & 12 deletions charts/pega/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{{- define "pegaEnvironmentConfig" }}pega-environment-config{{- end }}
{{- define "pegaVolumeConfig" }}pega-volume-config{{- end }}
{{- define "pegaVolumeCredentials" }}pega-volume-credentials{{- end }}
{{- define "pegaStorageClassEBS" }}pega-ebs-storage-class{{- end }}
{{- define "pegaDatabaseSecret" }}pega-database-secret{{- end }}
{{- define "pegaCredentialsSecret" }}pega-credentials-secret{{- end }}
{{- define "pegaRegistrySecret" }}pega-registry-secret{{- end }}
{{- define "pegaWebName" -}}pega-web{{- end -}}
{{- define "pegaBatchName" -}}pega-batch{{- end -}}
Expand Down Expand Up @@ -118,16 +117,6 @@ until cqlsh -u {{ $cassandraUser | quote }} -p {{ $cassandraPassword | quote }}
configMapKeyRef:
name: {{ template "pegaEnvironmentConfig" }}
key: CASSANDRA_PORT
- name: CASSANDRA_USERNAME
valueFrom:
configMapKeyRef:
name: {{ template "pegaEnvironmentConfig" }}
key: CASSANDRA_USERNAME
- name: CASSANDRA_PASSWORD
valueFrom:
configMapKeyRef:
name: {{ template "pegaEnvironmentConfig" }}
key: CASSANDRA_PASSWORD
- name: PEGA_SEARCH_URL
valueFrom:
configMapKeyRef:
Expand Down Expand Up @@ -158,6 +147,11 @@ until cqlsh -u {{ $cassandraUser | quote }} -p {{ $cassandraPassword | quote }}
configMapKeyRef:
name: {{ template "pegaEnvironmentConfig" }}
key: DATA_SCHEMA
- name: CUSTOMERDATA_SCHEMA
valueFrom:
configMapKeyRef:
name: {{ template "pegaEnvironmentConfig" }}
key: CUSTOMERDATA_SCHEMA
- name: DL-NAME
value: EMPTY
{{- end }}
Expand Down
4 changes: 2 additions & 2 deletions charts/pega/templates/_pega-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ metadata:
name: {{ .name }}
namespace: {{ .root.Release.Namespace }}
data:
# prconfig file to be used by {{ .name }}
# prconfig file to be used by {{ .name }}
prconfig.xml: |-
{{ .root.Files.Get .node.prconfigPath | indent 6 }}
# prlog4j2 file to be used by {{ .name }}
# prlog4j2 file to be used by {{ .name }}
prlog4j2.xml: |-
{{ .root.Files.Get .node.prlog4j2Path | indent 6 }}
{{- end }}
4 changes: 2 additions & 2 deletions charts/pega/templates/_pega-deployment.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
- name: {{ template "pegaVolumeCredentials" }}
secret:
# This name will be referred in the volume mounts kind.
secretName: {{ template "pegaDatabaseSecret" }}
secretName: {{ template "pegaCredentialsSecret" }}
# Used to specify permissions on files within the volume.
defaultMode: 420
initContainers:
Expand Down Expand Up @@ -82,4 +82,4 @@ spec:
{{- if .extraSpecData }}
{{ include .extraSpecData .root | indent 2 }}
{{- end }}
{{- end -}}
{{- end -}}
26 changes: 26 additions & 0 deletions charts/pega/templates/_pega_hpa.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{- define "pega.hpa" -}}
{{- if .hpa.enabled -}}
# The Horizontal Pod Autoscaler for {{ .deploymentName }} deployment
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ .name | quote}}
namespace: {{ .root.Release.Namespace }}
spec:
scaleTargetRef:
apiVersion: extensions/v1beta1
kind: Deployment
name: {{ .deploymentName | quote }}
minReplicas: {{ .hpa.minReplicas }}
maxReplicas: {{ .hpa.maxReplicas }}
metrics:
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .hpa.targetAverageCPUUtilization }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .hpa.targetAverageMemoryUtilization }}
{{- end -}}
{{- end -}}
13 changes: 0 additions & 13 deletions charts/pega/templates/eks/pega-ebs-storage-class.yaml

This file was deleted.

1 change: 1 addition & 0 deletions charts/pega/templates/pega-batch-hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ template "pega.hpa" dict "root" $ "name" (printf "%s-hpa" (include "pegaBatchName" .)) "deploymentName" (include "pegaBatchName" .) "hpa" .Values.batch.hpa}}
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
kind: Secret
apiVersion: v1
metadata:
name: {{ template "pegaDatabaseSecret" }}
name: {{ template "pegaCredentialsSecret" }}
namespace: {{ .Release.Namespace }}
data:
# Base64 encdoded username for connecting to the Pega DB
DB_USERNAME: {{ .Values.jdbc.username | b64enc }}
# Base64 encdoded password for connecting to the Pega DB
DB_PASSWORD: {{ .Values.jdbc.password | b64enc }}
# Base64 encdoded username for connecting to cassandra
CASSANDRA_USERNAME: {{ .Values.dds.username | b64enc }}
# Base64 encdoded password for connecting to cassandra
CASSANDRA_PASSWORD: {{ .Values.dds.password | b64enc }}
# Base64 encdoded username for a Tomcat user that will be created with the PegaDiagnosticUser role
PEGA_DIAGNOSTIC_USER: {{ .Values.web.pegaDiagnosticUser | b64enc }}
# Base64 encdoded password for a Tomcat user that will be created with the PegaDiagnosticUser role
Expand Down
6 changes: 2 additions & 4 deletions charts/pega/templates/pega-environment-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ data:
RULES_SCHEMA: {{ .Values.jdbc.rulesSchema }}
# Data schema of the Pega installation
DATA_SCHEMA: {{ .Values.jdbc.dataSchema }}
# CustomerData schema of the Pega installation
CUSTOMERDATA_SCHEMA: {{ .Values.jdbc.customerDataSchema }}
# URL to connect to Elastic Search
PEGA_SEARCH_URL: {{ include "properPegaSearchURL" . }}
# Whether to enable connecting to a cassandra cluster. "true" for enabled, "false for disabled"
Expand All @@ -23,7 +25,3 @@ data:
CASSANDRA_NODES: {{ include "cassandraNodes" . }}
# Port to connect to cassandra with
CASSANDRA_PORT: "{{ .Values.dds.port }}"
# Username for Cassandra DB
CASSANDRA_USERNAME: {{ .Values.dds.username }}
# Password for Cassandra DB
CASSANDRA_PASSWORD: {{ .Values.dds.password }}
8 changes: 8 additions & 0 deletions charts/pega/templates/pega-search-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ spec:
fsGroup: 1000
{{ end }}
initContainers:
{{ if eq .Values.provider "openshift" }}
- name: set-dir-owner
image: busybox:1.27.2
command: ['sh', '-c', 'chown -R 1000:1000 /usr/share/elasticsearch/data']
volumeMounts:
- name: esstorage
mountPath: /usr/share/elasticsearch/data
{{ end }}
- name: set-max-map-count
image: busybox:1.27.2
command: ['sysctl', '-w', 'vm.max_map_count=262144']
Expand Down
3 changes: 0 additions & 3 deletions charts/pega/templates/pega-stream-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ volumeClaimTemplates:
spec:
accessModes:
- ReadWriteOnce
{{- if eq .Values.provider "eks" }}
storageClassName: {{ template "pegaStorageClassEBS" }}
{{- end }}
resources:
requests:
storage: 5Gi
Expand Down
1 change: 1 addition & 0 deletions charts/pega/templates/pega-web-hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ template "pega.hpa" dict "root" $ "name" (printf "%s-hpa" (include "pegaWebName" .)) "deploymentName" (include "pegaWebName" .) "hpa" .Values.web.hpa}}
Loading