From 2acdc13e07a68ee6f12477b370f19899ac7bb7b4 Mon Sep 17 00:00:00 2001 From: Piotr Kala Date: Fri, 10 Jul 2020 20:01:31 -0400 Subject: [PATCH] Enable passing prlog4j file (#159) * Enable passing prlog4j file * Update readme to reflect the new APIs for configuration file injection Signed-off-by: Piotr Kala Co-authored-by: kalap Co-authored-by: casad Co-authored-by: Dave Casavant --- charts/pega/README.md | 28 ++++++++++--- charts/pega/templates/_pega-config.tpl | 57 +++++++++----------------- 2 files changed, 42 insertions(+), 43 deletions(-) diff --git a/charts/pega/README.md b/charts/pega/README.md index cccbb4bc0..d9feb7d9b 100644 --- a/charts/pega/README.md +++ b/charts/pega/README.md @@ -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 diff --git a/charts/pega/templates/_pega-config.tpl b/charts/pega/templates/_pega-config.tpl index ddd3fc8d1..93909a98c 100644 --- a/charts/pega/templates/_pega-config.tpl +++ b/charts/pega/templates/_pega-config.tpl @@ -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 }} -