pegasystems / pega-helm-charts

Orchestrate a Pega Platform™ deployment by using Docker, Kubernetes, and Helm to take advantage of Pega Platform Cloud Choice flexibility.
https://community.pega.com/knowledgebase/articles/cloud-choice
Apache License 2.0
124 stars 198 forks source link

Custom Volumes and Volumemount in Pega-Deployment #740

Closed gueney-suembuel closed 2 months ago

gueney-suembuel commented 4 months ago

Describe the bug Due to the use of Azure Keyvault, i need to define a volumes and volumemount, which refers to the secretproviderclass, which then grabs the defined credentials from Azure Keyvault. There is a allowance to extend the deployment with custom volumes and custom volumemounts. So far so good. But defining a custom volume and volumemount for the pega-deployment didn't work at all which led to an error (More below).

To Reproduce Deploy pega with an custom volume and volumemounts like it's mentioned [here]. (https://github.com/pegasystems/pega-helm-charts/tree/master/charts/pega#custom-volumes) If you doing that, you should get following Error: "Error: INSTALLATION FAILED: YAML parse error on pega/templates/pega-tier-deployment.yaml: error converting YAML to JSON: yaml: line 69: did not find expected key"

Expected behavior A Pega-deployment with additional Volumes.

Chart version 3.17.1

Server (if applicable, please complete the following information):

Additional context I investigated and found a solution. Changing in the template here the following 4 lines (96, 98, 250 and 252) from {{- if .custom.volumes }} to {{- if .root.Values.custom.volumes }} and also the same for {{- if .custom.volumeMounts }} to {{- if root.Values.custom.volumeMounts }}, you are able to use custom in the value.yaml for pega deployment like the follwing directly into root level of the value.yaml.

    custom:
      volumeMounts:
        - name: my-volume
          mountPath: /path/to/mount
      volumes:
        - name: my-volume
          configMap:
            name: my-configmap

I reused the same method like here on line 57 and 58, also on line 133 and 134, that allowed me to use custom-volumes. Sure this approach of my may be not the intendet use of the custom-volume but this worked for me properly. Let me know, if you need additional informations.

misterdorito commented 3 months ago

@gueney-suembuel can you provide your values.yaml file (sanitizing any sensitive info)?

gueney-suembuel commented 2 months ago

Hi @misterdorito I put it into a pega value.yaml example. Visible from line 399 to 409. If you need more Informations just let me know. values.zip BR

misterdorito commented 2 months ago

So looking at your values.yaml file:

      ...
      pdb:
        enabled: false
        minAvailable: 1
        # maxUnavailable: "50%"

      resources:
        requests:
          memory: "12Gi"
          cpu: 3
        limits:
          memory: "12Gi"
          cpu: 4
custom:
  volumeMounts:
  - name: secrets-store
    mountPath: "/opt/pega/store"
  volumes:
  - name: secrets-store
    csi:
      driver: secrets-store.csi.k8s.io
      readOnly: true
      volumeAttributes:
        secretProviderClass: "SPC_NAME"
...

You have the custom node as a top level element -- it should be part of a tier element (it should be a peer to pdb and resources. All of the custom configuration is tier specific.

misterdorito commented 2 months ago

@gueney-suembuel let me know if this addresses your question.

misterdorito commented 2 months ago

@gueney-suembuel I am going to close this issue as I am fairly confident that my previous response should address the problem you encountered.