Skip to content

Commit

Permalink
Enable passing prlog4j file (#159)
Browse files Browse the repository at this point in the history
* Enable passing prlog4j file
* Update readme to reflect the new APIs for configuration file injection

Signed-off-by: Piotr Kala <[email protected]>
Co-authored-by: kalap <[email protected]>
Co-authored-by: casad <[email protected]>
Co-authored-by: Dave Casavant <[email protected]>
  • Loading branch information
4 people authored Jul 11, 2020
1 parent f1314f9 commit 2acdc13
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 43 deletions.
28 changes: 23 additions & 5 deletions charts/pega/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -429,12 +429,30 @@ tier:

### Pega configuration files

While default configuration files are included by default, the Helm charts provide extension points to override them with additional customizations. To change the configuration file, specify a relative path to a local implementation to be injected into a ConfigMap.
While Pega includes default configuration files in the Helm charts, the charts provide extension points to override the defaults with additional customizations. To change the configuration file, specify the replacement implementation to be injected into a ConfigMap.

Parameter | Description | Default value
--- | --- | ---
`prconfigPath` | The location of a [prconfig.xml](config/deploy/prconfig.xml) template. | `config/prconfig.xml`
`prlog4j2Path` | The location of a [prlog4j2.xml](config/deploy/prlog4j2.xml) template. | `config/prlog4j2.xml`
Parameter | Description | Default value
--- | --- | ---
`prconfig` | A complete prconfig.xml file to inject. | See [prconfig.xml](config/deploy/prconfig.xml).
`prlog4j2` | A complete prlog4j2.xml file to inject. | See [prlog4j2.xml](config/deploy/prlog4j2.xml).
`contextXML` | A complete context.xml template file to inject. | See [context.xml.tmpl](config/deploy/context.xml.tmpl).


Example:

```yaml
tier:
- name: my-tier
custom:
prconfig: |-
...
prlog4j2: |-
...
contextXML: |-
...
```

### Pega diagnostic user

Expand Down
57 changes: 19 additions & 38 deletions charts/pega/templates/_pega-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,51 +7,32 @@ metadata:
name: {{ .name }}
namespace: {{ .root.Release.Namespace }}
data:
{{- if eq $arg "deploy-config" }}
{{- $custom_config := .custom }}

# Start of Pega Deployment Configuration

{{ if eq $arg "deploy-config" }}

{{- $prconfigPath := "config/deploy/prconfig.xml" }}
{{- $contextXMLTemplate := "config/deploy/context.xml.tmpl" }}
{{- $prlog4j2Path := "config/deploy/prlog4j2.xml" }}

{{- if .custom }}
{{- if .custom.prconfig }}
# CUSTOM prconfig file to be used by {{ .name }}
prconfig.xml: |-
{{ .custom.prconfig | indent 6 }}
{{ else if $prconfig := .root.Files.Glob $prconfigPath }}
# prconfig file to be used by {{ .name }}
# Pega deployment prconfig.xml file
prconfig.xml: |-
{{ .root.Files.Get $prconfigPath | indent 6 }}
{{- end }}
{{ else if $prconfig := .root.Files.Glob $prconfigPath }}
# prconfig file to be used by {{ .name }}
prconfig.xml: |-
{{ .root.Files.Get $prconfigPath | indent 6 }}
{{- if $custom_config.prconfig }}
{{ $custom_config.prconfig | indent 6 }}
{{ else }}
{{ .root.Files.Get "config/deploy/prconfig.xml" | indent 6 }}
{{- end }}

{{ if $contextXML := .root.Files.Glob $contextXMLTemplate }}
# contextXMLTemplate to be used by {{ .name }}
context.xml.tmpl: |-
{{ .root.Files.Get $contextXMLTemplate | indent 6 }}
# Pega deployment prlog4j2.xml file
prlog4j2.xml: |-
{{- if $custom_config.prlog4j2 }}
{{ $custom_config.prlog4j2 | indent 6 }}
{{ else }}
{{ .root.Files.Get "config/deploy/prlog4j2.xml" | indent 6 }}
{{- end }}

{{- if .custom }}
{{- if .custom.context }}
# CUSTOM context file to be used by {{ .name }}
context.xml: |-
{{ .custom.context | indent 6 }}
# Pega deployment contextXML template file
context.xml.tmpl: |-
{{- if $custom_config.contextXML }}
{{ $custom_config.contextXML | indent 6 }}
{{ else }}
{{ .root.Files.Get "config/deploy/context.xml.tmpl" | indent 6 }}
{{- end }}
{{- end }}

# prlog4j2 file to be used by {{ .name }}
prlog4j2.xml: |-
{{ .root.Files.Get $prlog4j2Path | indent 6 }}

{{- end }}
# End of Pega Deployment Configuration
---
{{- end }}

0 comments on commit 2acdc13

Please sign in to comment.