diff --git a/.github/workflows/github-actions-stale.yml b/.github/workflows/github-actions-stale.yml new file mode 100644 index 000000000..20f8ed183 --- /dev/null +++ b/.github/workflows/github-actions-stale.yml @@ -0,0 +1,25 @@ +name: Mark stale issues and pull requests +on: + schedule: + - cron: '0 23 * * *' # once a day at 11pm UTC time zone +jobs: + stale: + permissions: + issues: write # for commenting on an issue and editing labels + pull-requests: write # for commenting on a PR and editing labels + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v9 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + # timing + days-before-stale: 60 # 60 days of inactivity + days-before-close: 30 # 30 more days of inactivity + # labels to watch for, add, and remove + only-labels: 'pending info' # only mark issues/PRs as stale if they have this label + labels-to-remove-when-unstale: 'pending info' # remove label when unstale -- should be manually added back if information is insufficient + # automated messages to issue/PR authors + stale-issue-message: 'This issue has been marked as stale because it has been open for 60 days with no activity. This issue will be automatically closed in 30 days if no further activity occurs.' + stale-pr-message: 'This pull request has been marked as stale because it has been open for 60 days with no activity. This pull request will be automatically closed in 30 days if no further activity occurs.' + close-issue-message: 'This issue was closed because it has been inactive for 30 days since being marked as stale.' + close-pr-message: 'This pull request was closed because it has been inactive for 30 days since being marked as stale.' \ No newline at end of file diff --git a/charts/addons/Chart.yaml b/charts/addons/Chart.yaml index 38764c2e0..2d1a299f9 100644 --- a/charts/addons/Chart.yaml +++ b/charts/addons/Chart.yaml @@ -3,4 +3,4 @@ apiVersion: v1 appVersion: "1.0" description: A Helm chart for Kubernetes name: addons -version: "3.20.0" +version: "3.23.0" diff --git a/charts/backingservices/Chart.yaml b/charts/backingservices/Chart.yaml index d4d326e77..4d08f63a6 100644 --- a/charts/backingservices/Chart.yaml +++ b/charts/backingservices/Chart.yaml @@ -17,4 +17,4 @@ description: Helm Chart to provision the latest Search and Reporting Service (SR # The chart version: Pega provides this as a useful way to track changes you make to this chart. # As a best practice, you should increment the version number each time you make changes to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: "3.20.0" +version: "3.23.0" diff --git a/charts/backingservices/charts/srs/README.md b/charts/backingservices/charts/srs/README.md index 0aa2bee2c..6562cf24e 100644 --- a/charts/backingservices/charts/srs/README.md +++ b/charts/backingservices/charts/srs/README.md @@ -37,7 +37,7 @@ The service deployment provisions runtime service pods along with a dependency o >= 8.6 - 1.29.1 + 1.31.2 < 1.25 Not enabled 7.10.2, 7.16.3 & 7.17.9 @@ -66,7 +66,7 @@ The service deployment provisions runtime service pods along with a dependency o ### If your deployment uses the internally-provisioned Elasticsearch: ### To migrate to Elasticsearch version 7.17.9 or 8.10.3 from the Elasticsearch version 7.10.2 or 7.16.3, perform the following steps: -1. Update the SRS Docker image version to use v1.29.1. This version has backward compatibility with Elasticsearch versions 7.10.x and 7.16.x, so your SRS will continue to work even before you update your Elasticsearch service. +1. Update the SRS Docker image version to use v1.31.2. This version has backward compatibility with Elasticsearch versions 7.10.x and 7.16.x, so your SRS will continue to work even before you update your Elasticsearch service. 2. To update Elasticsearch version to 7.17.9 perform the following actions: * Update the Elasticsearch `dependencies.version` parameter in the [requirement.yaml](../../requirements.yaml) to 7.17.3. @@ -81,7 +81,7 @@ To migrate to Elasticsearch version 7.17.9 or 8.10.3 from the Elasticsearch vers ### If your deployment connects to an externally-managed Elasticsearch service: ### To migrate to Elasticsearch version 7.17.9 or 8.10.3 from the Elasticsearch version 7.10.2 or 7.16.3, perform the following steps: -1. Update the SRS Docker image version to use v1.29.1. This version has backward compatibility with Elasticsearch versions 7.10.x and 7.16.x, so your SRS will continue to work even before you update your Elasticsearch service. +1. Update the SRS Docker image version to use v1.31.2. This version has backward compatibility with Elasticsearch versions 7.10.x and 7.16.x, so your SRS will continue to work even before you update your Elasticsearch service. 2. To use Elasticsearch version 7.17.9, upgrade your external Elasticsearch cluster to 7.17.9 according to your organization’s best practices. For more information, see official Elasticsearch version 7.17 documentation. 3. To use Elasticsearch version 8.10.3, upgrade your external Elasticsearch cluster to 8.10.3 according to your organization’s best practices. For more information, see official Elasticsearch version 8.10 documentation. 4. Restart the SRS pods diff --git a/charts/pega/Chart.yaml b/charts/pega/Chart.yaml index aba5f427b..aa3a93961 100644 --- a/charts/pega/Chart.yaml +++ b/charts/pega/Chart.yaml @@ -1,7 +1,7 @@ --- apiVersion: v1 name: pega -version: "3.20.0" +version: "3.23.0" description: Pega installation on kubernetes keywords: - pega diff --git a/charts/pega/README.md b/charts/pega/README.md index 2997e298e..ed6b6a684 100644 --- a/charts/pega/README.md +++ b/charts/pega/README.md @@ -467,17 +467,31 @@ ingress: You can optionally configure the resource allocation and limits for a tier using the following parameters. The default value is used if you do not specify an alternative value. See [Managing Kubernetes Resources](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/) for more information about how Kubernetes manages resources. +Example: +```yaml +resources: + requests: + memory: "12Gi" + cpu: 3 + ephemeral-storage: + limits: + memory: "12Gi" + cpu: 4 + ephemeral-storage: +``` + + Parameter | Description | Default value --- | --- | --- `replicas` | Specify the number of Pods to deploy in the tier. | `1` -`cpuRequest` | Initial CPU request for pods in the current tier. | `3` -`cpuLimit` | CPU limit for pods in the current tier. | `4` -`memRequest` | Initial memory request for pods in the current tier. | `12Gi` -`memLimit` | Memory limit for pods in the current tier. | `12Gi` +`cpuRequest` | Deprecated, use `resources.requests.cpu`. Initial CPU request for pods in the current tier. | `3` +`cpuLimit` | Deprecated, use `resources.limits.cpu`. CPU limit for pods in the current tier. | `4` +`memRequest` | Deprecated, use `resources.requests.memory`. Initial memory request for pods in the current tier. | `12Gi` +`memLimit` | Deprecated, use `resources.limits.memory`. Memory limit for pods in the current tier. | `12Gi` `initialHeap` | Specify the initial heap size of the JVM. | `8192m` `maxHeap` | Specify the maximum heap size of the JVM. | `8192m` -`ephemeralStorageRequest`| Ephemeral storage request for the tomcat container. | - -`ephemeralStorageLimit` | Ephemeral storage limit for the tomcat container. | - +`ephemeralStorageRequest`| Deprecated, use `resources.requests.ephemeral-storage`. Ephemeral storage request for the tomcat container. | - +`ephemeralStorageLimit` | Deprecated, use `resources.limits.ephemeral-storage`. Ephemeral storage limit for the tomcat container. | - ### JVM Arguments You can optionally pass in JVM arguments to Tomcat. Depending on the parameter/attribute used, the arguments will be placed into `JAVA_OPTS` or `CATALINA_OPTS` environmental variables. @@ -506,6 +520,25 @@ tier: disktype: ssd ``` +### Tolerations + +Pega supports configuring tolerations for workloads. Taints are applied to nodes and tolerations are applied to pods. For more information about taints and tolerations please refer official K8S [documentation](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/). + +Example: + +```yaml +tier: +- name: "my-tier" + nodeType: "WebUser" + + tolerations: + - key: "key1" + operator: "Equal" + value: "value1" + effect: "NoSchedule" + +``` + ### Liveness, readiness, and startup probes Pega uses liveness, readiness, and startup probes to determine application health in your deployments. For an overview of these probes, see [Configure Liveness, Readiness and Startup Probes](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/). Configure a probe for *liveness* to determine if a Pod has entered a broken state; configure it for *readiness* to determine if the application is available to be exposed; configure it for *startup* to determine if a pod is ready to be checked for liveness. You can configure probes independently for each tier. If not explicitly configured, default probes are used during the deployment. Set the following parameters as part of a `livenessProbe`, `readinessProbe`, or `startupProbe` configuration. diff --git a/charts/pega/charts/installer/config/prlog4j2.xml b/charts/pega/charts/installer/config/prlog4j2.xml index b54b95d1a..c22a83cb1 100644 --- a/charts/pega/charts/installer/config/prlog4j2.xml +++ b/charts/pega/charts/installer/config/prlog4j2.xml @@ -130,9 +130,6 @@ - - - diff --git a/charts/pega/config/deploy/context.xml.tmpl b/charts/pega/config/deploy/context.xml.tmpl index 1ef3717b3..814c61fe8 100644 --- a/charts/pega/config/deploy/context.xml.tmpl +++ b/charts/pega/config/deploy/context.xml.tmpl @@ -21,8 +21,7 @@ minEvictableIdleTimeMillis="60000" /> - {{ if or .Env.SET_RW .Env.JDBC_RW_URL }} - - {{ end }} {{ if and .Env.JDBC_RO_URL .Env.DB_RO_USERNAME .Env.DB_RO_PASSWORD }} # labelSelector: + # Tolerations allow the scheduler to schedule pods with matching taints. + # For more information please refer https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration + # If you want to apply tolerations to other tiers, please use the same configuration as described here. + # tolerations: + # - key: "key1" + # operator: "Equal" + # value: "value1" + # effect: "NoSchedule" + # Set enabled to true to include a Pod Disruption Budget for this tier. # To enable this budget, specifiy either a pdb.minAvailable or pdb.maxUnavailable # value and comment out the other parameter. @@ -283,6 +292,13 @@ global: enabled: false minAvailable: 1 # maxUnavailable: "50%" + resources: + requests: + memory: "12Gi" + cpu: 3 + limits: + memory: "12Gi" + cpu: 4 - name: "batch" # Create a background tier for batch processing. This tier uses @@ -319,6 +335,13 @@ global: enabled: false minAvailable: 1 # maxUnavailable: "50%" + resources: + requests: + memory: "12Gi" + cpu: 3 + limits: + memory: "12Gi" + cpu: 4 - name: "stream" # Create a stream tier for queue processing. This tier deploys @@ -384,6 +407,13 @@ global: enabled: false minAvailable: 1 # maxUnavailable: "50%" + resources: + requests: + memory: "12Gi" + cpu: 3 + limits: + memory: "12Gi" + cpu: 4 - name: "bix" # Create a background tier for BIX processing. This tier uses @@ -412,6 +442,13 @@ global: enabled: false minAvailable: 1 # maxUnavailable: "50%" + resources: + requests: + memory: "12Gi" + cpu: 3 + limits: + memory: "12Gi" + cpu: 4 - name: "realtime" # Create a dedicated tier for real-time data grid processing. @@ -439,6 +476,13 @@ global: enabled: false minAvailable: 1 # maxUnavailable: "50%" + resources: + requests: + memory: "12Gi" + cpu: 3 + limits: + memory: "12Gi" + cpu: 4 # External services @@ -648,8 +692,8 @@ stream: # so that it is easy to distinguish them from topics created by other applications. # Pega supports customizing the name pattern for your Externalized Kafka configuration for each deployment. streamNamePattern: "pega-{stream.name}" - # Your replicationFactor value cannot be more than the number of Kafka brokers and 3. - replicationFactor: "1" + # Your replicationFactor value cannot be more than the number of Kafka brokers. Pega recommended value is 3. + replicationFactor: "3" # To avoid exposing trustStorePassword, keyStorePassword, and jaasConfig parameters, leave the values empty and # configure them using an External Secrets Manager, making sure you configure the keys in the secret in the order: # STREAM_TRUSTSTORE_PASSWORD, STREAM_KEYSTORE_PASSWORD and STREAM_JAAS_CONFIG. diff --git a/charts/pega/values-minimal.yaml b/charts/pega/values-minimal.yaml index 8803b4d22..8445d910a 100755 --- a/charts/pega/values-minimal.yaml +++ b/charts/pega/values-minimal.yaml @@ -170,13 +170,16 @@ global: # Set resource consumption to minimal levels replicas: 1 - cpuRequest: 200m - memRequest: "6Gi" - cpuLimit: 2 - memLimit: "6Gi" javaOpts: "" initialHeap: "4096m" maxHeap: "4096m" + resources: + requests: + memory: "6Gi" + cpu: 200m + limits: + memory: "6Gi" + cpu: 2 volumeClaimTemplate: resources: requests: @@ -294,8 +297,8 @@ stream: # so that it is easy to distinguish them from topics created by other applications. # Pega supports customizing the name pattern for your Externalized Kafka configuration for each deployment. streamNamePattern: "pega-{stream.name}" - # Your replicationFactor value cannot be more than the number of Kafka brokers and 3. - replicationFactor: "1" + # Your replicationFactor value cannot be more than the number of Kafka brokers.Pega recommended value is 3. + replicationFactor: "3" # To avoid exposing trustStorePassword, keyStorePassword, and jaasConfig parameters, leave the values empty and # configure them using an External Secrets Manager, making sure you configure the keys in the secret in the order: # STREAM_TRUSTSTORE_PASSWORD, STREAM_KEYSTORE_PASSWORD and STREAM_JAAS_CONFIG. diff --git a/charts/pega/values.yaml b/charts/pega/values.yaml index 56283fd59..10b2a3a11 100644 --- a/charts/pega/values.yaml +++ b/charts/pega/values.yaml @@ -232,15 +232,16 @@ global: livenessProbe: port: 8081 - # Optionally overridde default resource specifications - # cpuRequest: 2 - # memRequest: "12Gi" - # cpuLimit: 4 - # memLimit: "12Gi" - # initialHeap: "4096m" + # Optionally overridde the default or add additional resource specifications. + # initialHeap: "8192m" # maxHeap: "8192m" - # ephemeralStorageRequest: - # ephemeralStorageLimit: + resources: + requests: + memory: "12Gi" + cpu: 3 + limits: + memory: "12Gi" + cpu: 4 # To configure an alternative user for custom image, set value for runAsUser. # To configure an alternative group for volume mounts, set value for fsGroup @@ -269,6 +270,15 @@ global: # whenUnsatisfiable: # labelSelector: + # Tolerations allow the scheduler to schedule pods with matching taints. + # For more information please refer https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration + # If you want to apply tolerations to other tiers, please use the same configuration as described here. + # tolerations: + # - key: "key1" + # operator: "Equal" + # value: "value1" + # effect: "NoSchedule" + # Set enabled to true to include a Pod Disruption Budget for this tier. # To enable this budget, specifiy either a pdb.minAvailable or pdb.maxUnavailable # value and comment out the other parameter. @@ -313,6 +323,14 @@ global: minAvailable: 1 # maxUnavailable: "50%" + resources: + requests: + memory: "12Gi" + cpu: 3 + limits: + memory: "12Gi" + cpu: 4 + - name: "stream" # Create a stream tier for queue processing. This tier deploys # as a stateful set to ensure durability of queued data. It may @@ -371,6 +389,14 @@ global: minAvailable: 1 # maxUnavailable: "50%" + resources: + requests: + memory: "12Gi" + cpu: 3 + limits: + memory: "12Gi" + cpu: 4 + # External services # Cassandra automatic deployment settings. @@ -579,8 +605,8 @@ stream: # so that it is easy to distinguish them from topics created by other applications. # Pega supports customizing the name pattern for your Externalized Kafka configuration for each deployment. streamNamePattern: "pega-{stream.name}" - # Your replicationFactor value cannot be more than the number of Kafka brokers and 3. - replicationFactor: "1" + # Your replicationFactor value cannot be more than the number of Kafka brokers. Pega recommended value is 3. + replicationFactor: "3" # To avoid exposing trustStorePassword, keyStorePassword, and jaasConfig parameters, leave the values empty and # configure them using an External Secrets Manager, making sure you configure the keys in the secret in the order: # STREAM_TRUSTSTORE_PASSWORD, STREAM_KEYSTORE_PASSWORD and STREAM_JAAS_CONFIG. diff --git a/terratest/src/test/go.mod b/terratest/src/test/go.mod index 70a88112e..7e4c6194a 100644 --- a/terratest/src/test/go.mod +++ b/terratest/src/test/go.mod @@ -1,22 +1,70 @@ module github.com/pegasystems/pega-helm-charts/terratest/src/test -go 1.16 +go 1.21 + +toolchain go1.21.1 require ( github.com/GoogleCloudPlatform/gke-managed-certs v0.3.4 + github.com/gruntwork-io/terratest v0.28.5 + github.com/stretchr/testify v1.6.1 + k8s.io/api v0.20.0 + k8s.io/apimachinery v0.20.0 + k8s.io/ingress-gce v1.15.2 +) + +require ( + cloud.google.com/go v0.97.0 // indirect + github.com/PuerkitoBio/purell v1.1.1 // indirect + github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect + github.com/aws/aws-sdk-go v1.35.24 // indirect + github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c // indirect github.com/emicklei/go-restful v2.16.0+incompatible // indirect + github.com/ghodss/yaml v1.0.0 // indirect github.com/go-errors/errors v1.1.1 // indirect + github.com/go-logr/logr v0.2.0 // indirect + github.com/go-openapi/jsonpointer v0.19.3 // indirect + github.com/go-openapi/jsonreference v0.19.3 // indirect github.com/go-openapi/spec v0.19.8 // indirect github.com/go-openapi/swag v0.19.9 // indirect github.com/go-sql-driver/mysql v1.5.0 // indirect + github.com/gogo/protobuf v1.3.1 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/google/gofuzz v1.1.0 // indirect + github.com/google/uuid v1.1.2 // indirect + github.com/googleapis/gnostic v0.4.1 // indirect github.com/gruntwork-io/gruntwork-cli v0.6.1 // indirect - github.com/gruntwork-io/terratest v0.28.5 github.com/imdario/mergo v0.3.9 // indirect + github.com/jmespath/go-jmespath v0.4.0 // indirect + github.com/json-iterator/go v1.1.10 // indirect github.com/mailru/easyjson v0.7.1 // indirect - github.com/stretchr/testify v1.6.1 + github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/pquerna/otp v1.2.0 // indirect + github.com/russross/blackfriday/v2 v2.0.1 // indirect + github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/urfave/cli v1.22.2 // indirect + golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0 // indirect + golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420 // indirect + golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1 // indirect + golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359 // indirect + golang.org/x/text v0.3.6 // indirect + golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e // indirect + google.golang.org/appengine v1.6.7 // indirect + google.golang.org/protobuf v1.27.1 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.3.0 // indirect gopkg.in/yaml.v3 v3.0.0 // indirect - k8s.io/api v0.20.0 - k8s.io/apimachinery v0.20.0 - k8s.io/ingress-gce v1.15.2 -) \ No newline at end of file + k8s.io/client-go v0.20.0 // indirect + k8s.io/klog/v2 v2.4.0 // indirect + k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd // indirect + k8s.io/utils v0.0.0-20201110183641-67b214c5f920 // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.0.2 // indirect + sigs.k8s.io/yaml v1.2.0 // indirect +) diff --git a/terratest/src/test/go.sum b/terratest/src/test/go.sum index 6b7ad2ba0..ed61d3b39 100644 --- a/terratest/src/test/go.sum +++ b/terratest/src/test/go.sum @@ -143,7 +143,6 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7 github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180108230652-97fdf19511ea/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= @@ -500,7 +499,6 @@ github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYe github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c/go.mod h1:DM5xW0nvfNNm2uytzsvhI3OnX8uzaRAg8UX/CnDqbto= github.com/rubiojr/go-vhd v0.0.0-20200706105327-02e210299021/go.mod h1:DM5xW0nvfNNm2uytzsvhI3OnX8uzaRAg8UX/CnDqbto= -github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -1078,7 +1076,6 @@ k8s.io/ingress-gce v1.15.2 h1:NLHlUVcyW5yQkyPCuFoWTNdmxYHroqwq+NxjpmAK1E8= k8s.io/ingress-gce v1.15.2/go.mod h1:UWfk3BXm6f9S8irufnVZgriM3I3FmnaEIenuO241rbQ= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= -k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= @@ -1104,7 +1101,6 @@ rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.14/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI= -sigs.k8s.io/structured-merge-diff v1.0.1-0.20191108220359-b1b620dd3f06 h1:zD2IemQ4LmOcAumeiyDWXKUI2SO0NYDe3H6QGvPOVgU= sigs.k8s.io/structured-merge-diff v1.0.1-0.20191108220359-b1b620dd3f06/go.mod h1:/ULNhyfzRopfcjskuui0cTITekDduZ7ycKN3oUT9R18= sigs.k8s.io/structured-merge-diff/v3 v3.0.0-20200116222232-67a7b8c61874/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw= sigs.k8s.io/structured-merge-diff/v3 v3.0.0/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw= @@ -1112,4 +1108,4 @@ sigs.k8s.io/structured-merge-diff/v4 v4.0.2 h1:YHQV7Dajm86OuqnIR6zAelnDWBRjo+YhY sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q= -sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= \ No newline at end of file +sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= diff --git a/terratest/src/test/pega/data/expectedInstallDeployContext.xml.tmpl b/terratest/src/test/pega/data/expectedInstallDeployContext.xml.tmpl index 1ef3717b3..814c61fe8 100644 --- a/terratest/src/test/pega/data/expectedInstallDeployContext.xml.tmpl +++ b/terratest/src/test/pega/data/expectedInstallDeployContext.xml.tmpl @@ -21,8 +21,7 @@ minEvictableIdleTimeMillis="60000" /> - {{ if or .Env.SET_RW .Env.JDBC_RW_URL }} - - {{ end }} {{ if and .Env.JDBC_RO_URL .Env.DB_RO_USERNAME .Env.DB_RO_PASSWORD }} - - - diff --git a/terratest/src/test/pega/data/values_legacy_resource_configuration.yaml b/terratest/src/test/pega/data/values_legacy_resource_configuration.yaml new file mode 100644 index 000000000..834941f73 --- /dev/null +++ b/terratest/src/test/pega/data/values_legacy_resource_configuration.yaml @@ -0,0 +1,10 @@ +--- +global: + tier: + - name: "web" + cpuRequest: 2 + memRequest: "6Gi" + cpuLimit: 3 + memLimit: "6Gi" + ephemeralStorageRequest: "25Gi" + ephemeralStorageLimit: "25Gi" diff --git a/terratest/src/test/pega/pega-deployment-resource-settings_test.go b/terratest/src/test/pega/pega-deployment-resource-settings_test.go new file mode 100644 index 000000000..9e863a848 --- /dev/null +++ b/terratest/src/test/pega/pega-deployment-resource-settings_test.go @@ -0,0 +1,135 @@ +package pega + +import ( + "path/filepath" + "strings" + "testing" + + "github.com/gruntwork-io/terratest/modules/helm" + "github.com/stretchr/testify/require" + appsv1 "k8s.io/api/apps/v1" +) + +func TestDefaultsLatestResourceConfiguration(t *testing.T) { + helmChartPath, err := filepath.Abs(PegaHelmChartPath) + require.NoError(t, err) + + var options = &helm.Options{ + //ValuesFiles: []string{"data/values_new_resource_configuration.yaml"}, + SetValues: map[string]string{ + "global.deployment.name": "resource-settings-1", + "global.provider": "k8s", + "global.actions.execute": "deploy", + }, + } + + var depObj appsv1.Deployment + + yamlContent := RenderTemplate(t, options, helmChartPath, []string{"templates/pega-tier-deployment.yaml"}) + yamlSplit := strings.Split(yamlContent, "---") + UnmarshalK8SYaml(t, yamlSplit[1], &depObj) + + resources := &depObj.Spec.Template.Spec.Containers[0].Resources + + require.Equal(t, "4", resources.Limits.Cpu().String()) + require.Equal(t, "12Gi", resources.Limits.Memory().String()) + require.Equal(t, "0", resources.Limits.StorageEphemeral().String()) + + require.Equal(t, "3", resources.Requests.Cpu().String()) + require.Equal(t, "12Gi", resources.Requests.Memory().String()) + require.Equal(t, "0", resources.Requests.StorageEphemeral().String()) + +} + +func TestLegacyResouceConfiguration(t *testing.T) { + + helmChartPath, err := filepath.Abs(PegaHelmChartPath) + require.NoError(t, err) + + var options = &helm.Options{ + ValuesFiles: []string{"data/values_legacy_resource_configuration.yaml"}, + SetValues: map[string]string{ + "global.deployment.name": "resource-settings-1", + "global.provider": "k8s", + "global.actions.execute": "deploy", + }, + } + + var depObj appsv1.Deployment + + yamlContent := RenderTemplate(t, options, helmChartPath, []string{"templates/pega-tier-deployment.yaml"}) + yamlSplit := strings.Split(yamlContent, "---") + UnmarshalK8SYaml(t, yamlSplit[1], &depObj) + + resources := &depObj.Spec.Template.Spec.Containers[0].Resources + + require.Equal(t, "3", resources.Limits.Cpu().String()) + require.Equal(t, "6Gi", resources.Limits.Memory().String()) + require.Equal(t, "25Gi", resources.Limits.StorageEphemeral().String()) + require.Equal(t, "2", resources.Requests.Cpu().String()) + require.Equal(t, "6Gi", resources.Requests.Memory().String()) + require.Equal(t, "25Gi", resources.Requests.StorageEphemeral().String()) +} + +func TestCPULimitNull(t *testing.T) { + + helmChartPath, err := filepath.Abs(PegaHelmChartPath) + require.NoError(t, err) + + var options = &helm.Options{ + SetValues: map[string]string{ + "global.deployment.name": "resource-settings-1", + "global.provider": "k8s", + "global.actions.execute": "deploy", + "global.tier[0].name": "web", + "global.tier[0].resources.requests.cpu": "2", + "global.tier[0].resources.requests.memory": "6Gi", + "global.tier[0].resources.limits.memory": "6Gi", + }, + } + + var depObj appsv1.Deployment + + yamlContent := RenderTemplate(t, options, helmChartPath, []string{"templates/pega-tier-deployment.yaml"}) + yamlSplit := strings.Split(yamlContent, "---") + UnmarshalK8SYaml(t, yamlSplit[1], &depObj) + + resources := &depObj.Spec.Template.Spec.Containers[0].Resources + + require.Equal(t, "0", resources.Limits.Cpu().String()) + require.Equal(t, "6Gi", resources.Limits.Memory().String()) + require.Equal(t, "2", resources.Requests.Cpu().String()) + require.Equal(t, "6Gi", resources.Requests.Memory().String()) +} + +func TestResourceDefaultsWithLegacyValues(t *testing.T) { + helmChartPath, err := filepath.Abs(PegaHelmChartPath) + require.NoError(t, err) + + var options = &helm.Options{ + SetValues: map[string]string{ + "global.deployment.name": "resource-settings-1", + "global.provider": "k8s", + "global.actions.execute": "deploy", + // default values.yaml configuration is replaced with below for tier[0]. Hence neither resourcse nor deprecated + // resource configuration is set. In the deployment values are set with defaults from code + "global.tier[0].name": "web", + }, + } + + var depObj appsv1.Deployment + + yamlContent := RenderTemplate(t, options, helmChartPath, []string{"templates/pega-tier-deployment.yaml"}) + yamlSplit := strings.Split(yamlContent, "---") + UnmarshalK8SYaml(t, yamlSplit[1], &depObj) + + resources := &depObj.Spec.Template.Spec.Containers[0].Resources + + require.Equal(t, "4", resources.Limits.Cpu().String()) + require.Equal(t, "12Gi", resources.Limits.Memory().String()) + require.Equal(t, "0", resources.Limits.StorageEphemeral().String()) + + require.Equal(t, "3", resources.Requests.Cpu().String()) + require.Equal(t, "12Gi", resources.Requests.Memory().String()) + require.Equal(t, "0", resources.Requests.StorageEphemeral().String()) +} diff --git a/terratest/src/test/pega/pega-tier-deployment-tolerations_test.go b/terratest/src/test/pega/pega-tier-deployment-tolerations_test.go new file mode 100644 index 000000000..f1909b684 --- /dev/null +++ b/terratest/src/test/pega/pega-tier-deployment-tolerations_test.go @@ -0,0 +1,114 @@ +package pega + +import ( + "github.com/gruntwork-io/terratest/modules/helm" + "github.com/stretchr/testify/require" + appsv1 "k8s.io/api/apps/v1" + "path/filepath" + "strings" + "testing" +) + +func TestPegaTierDeploymentWithTolerations(t *testing.T) { + var supportedVendors = []string{"k8s", "openshift", "eks", "gke", "aks", "pks"} + var supportedOperations = []string{"deploy", "install-deploy"} + var deploymentNames = []string{"pega", "myapp-dev"} + helmChartPath, err := filepath.Abs(PegaHelmChartPath) + require.NoError(t, err) + var depObj appsv1.Deployment + for _, vendor := range supportedVendors { + for _, operation := range supportedOperations { + for _, deploymentName := range deploymentNames { + var options = &helm.Options{ + SetValues: map[string]string{ + "global.provider": vendor, + "global.actions.execute": operation, + "global.deployment.name": deploymentName, + "global.tier[0].name": "web", + "global.tier[0].tolerations[0].key": "availability-zone", + "global.tier[0].tolerations[0].value": "us-east-1", + "global.tier[0].tolerations[0].operator": "Equal", + "global.tier[0].tolerations[0].effect": "NotSchedule", + }, + } + yamlContent := RenderTemplate(t, options, helmChartPath, []string{"templates/pega-tier-deployment.yaml"}) + yamlSplit := strings.Split(yamlContent, "---") + UnmarshalK8SYaml(t, yamlSplit[1], &depObj) + constraints := depObj.Spec.Template.Spec.Tolerations + require.Equal(t, "availability-zone", constraints[0].Key) + require.Equal(t, "us-east-1", constraints[0].Value) + require.Equal(t, "Equal", string(constraints[0].Operator)) + require.Equal(t, "NotSchedule", string(constraints[0].Effect)) + } + } + } +} + +func TestPegaTierDeploymentWithMultipleTolerations(t *testing.T) { + var supportedVendors = []string{"k8s", "openshift", "eks", "gke", "aks", "pks"} + var supportedOperations = []string{"deploy", "install-deploy"} + var deploymentNames = []string{"pega", "myapp-dev"} + helmChartPath, err := filepath.Abs(PegaHelmChartPath) + require.NoError(t, err) + var depObj appsv1.Deployment + for _, vendor := range supportedVendors { + for _, operation := range supportedOperations { + for _, deploymentName := range deploymentNames { + var options = &helm.Options{ + SetValues: map[string]string{ + "global.provider": vendor, + "global.actions.execute": operation, + "global.deployment.name": deploymentName, + "global.tier[0].name": "web", + "global.tier[0].tolerations[0].key": "availability-zone", + "global.tier[0].tolerations[0].value": "us-east-1", + "global.tier[0].tolerations[0].operator": "Equal", + "global.tier[0].tolerations[0].effect": "NotSchedule", + "global.tier[0].tolerations[1].key": "availability-zone", + "global.tier[0].tolerations[1].operator": "Exists", + "global.tier[0].tolerations[1].effect": "NoExecute", + }, + } + yamlContent := RenderTemplate(t, options, helmChartPath, []string{"templates/pega-tier-deployment.yaml"}) + yamlSplit := strings.Split(yamlContent, "---") + UnmarshalK8SYaml(t, yamlSplit[1], &depObj) + constraints := depObj.Spec.Template.Spec.Tolerations + require.Equal(t, "availability-zone", constraints[0].Key) + require.Equal(t, "us-east-1", constraints[0].Value) + require.Equal(t, "Equal", string(constraints[0].Operator)) + require.Equal(t, "NotSchedule", string(constraints[0].Effect)) + require.Equal(t, "availability-zone", constraints[1].Key) + require.Equal(t, "Exists", string(constraints[1].Operator)) + require.Equal(t, "NoExecute", string(constraints[1].Effect)) + } + } + } +} + +func TestPegaTierDeploymentWithoutTolerations(t *testing.T) { + var supportedVendors = []string{"k8s", "openshift", "eks", "gke", "aks", "pks"} + var supportedOperations = []string{"deploy", "install-deploy"} + var deploymentNames = []string{"pega", "myapp-dev"} + helmChartPath, err := filepath.Abs(PegaHelmChartPath) + require.NoError(t, err) + var depObj appsv1.Deployment + for _, vendor := range supportedVendors { + for _, operation := range supportedOperations { + for _, deploymentName := range deploymentNames { + var options = &helm.Options{ + SetValues: map[string]string{ + "global.provider": vendor, + "global.actions.execute": operation, + "global.deployment.name": deploymentName, + "global.tier[0].name": "web", + }, + } + yamlContent := RenderTemplate(t, options, helmChartPath, []string{"templates/pega-tier-deployment.yaml"}) + yamlSplit := strings.Split(yamlContent, "---") + UnmarshalK8SYaml(t, yamlSplit[1], &depObj) + constraints := depObj.Spec.Template.Spec.Tolerations + require.Empty(t, constraints) + } + } + } +}