Skip to content

Commit 9e62a69

Browse files
authored
feat: support sas-bases/overlays kustomization injections (PSKD-1385)
Provide support to inject sas-bases/overlays entries into the base kustomization.yaml.
2 parents e827b8d + 22b08eb commit 9e62a69

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ The SAS Viya platform customizations that are managed by viya4-deployment are lo
185185

186186
#### Base kustomization.yaml ConfigMap and Secret Generators
187187

188-
In some scenarios, a README or the deployment documentation instructs you to add a `configMapGenerator` or `secretGenerator` entry to the base `kustomization.yaml` (also known as `$deploy/kustomization.yaml`). For example:
188+
In some scenarios, a README or the deployment documentation instructs you to add a `configMapGenerator` or `secretGenerator` entry to the base `kustomization.yaml` (`$deploy/kustomization.yaml`). For example:
189189

190190
```yaml
191191
configMapGenerator:
@@ -221,6 +221,26 @@ envs:
221221
- site-config/sas-risk-cirrus-rcc/configuration.env
222222
```
223223
224+
#### Base kustomization.yaml additions from sas-bases/overlays
225+
226+
In some scenarios, a README or the deployment documentation instructs you to add an entry to the base `kustomization.yaml` (`$deploy/kustomization.yaml`). For example:
227+
228+
```yaml
229+
transformers:
230+
...
231+
- sas-bases/overlays/backup/sas-scheduled-backup-incr-job-enable.yaml
232+
...
233+
```
234+
235+
In that scenario, create an `inject-sas-bases-overlays.yaml` file in a subdirectory under site-config. In the file, create the necessary category and add the entry to it:
236+
237+
```yaml
238+
transformers:
239+
- sas-bases/overlays/backup/sas-scheduled-backup-incr-job-enable.yaml
240+
```
241+
242+
Supported categories are `resources`, `components`, `transformers`, `generators`, and `configurations`. Multiple categories may appear in the file, and multiple entries may appear for each category.
243+
224244
#### OpenLDAP Customizations
225245

226246
The OpenLDAP setup that is described here is a temporary solution that enables you to add users and groups and to start using SAS Viya platform applications. The OpenLDAP server that is created using these instructions does not persist. It is created and destroyed within the SAS Viya platform namespace where it is created. To add users or groups that persist, follow the SAS documentation that describes how to [Configure an LDAP Identity Provider](https://documentation.sas.com/?cdcId=sasadmincdc&cdcVersion=default&docsetId=calids&docsetTarget=n1aw4xnkvwcddnn1mv8lxr2e4tu7.htm#p0spae4p1qoto3n1qpuzafcecxhh).

roles/vdm/library/siteconfig_info.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright © 2020-2024, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
2+
# Copyright © 2020-2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
33
# SPDX-License-Identifier: Apache-2.0
44
#
55
from ansible.module_utils.basic import *
@@ -55,8 +55,30 @@ def addResource(self, yamlfile):
5555
elif "nameReference" in yamlblocks[0]:
5656
self.add_overlays(Overlay.CONFIGURATION, yamlfile)
5757

58+
def processSasBasesOverlays(self, folder):
59+
sasBasesOverlaysPath = os.path.join(folder, "inject-sas-bases-overlays.yaml")
60+
if os.path.exists(sasBasesOverlaysPath):
61+
with open(sasBasesOverlaysPath) as file:
62+
try:
63+
yamlblock = yaml.safe_load(file)
64+
for blockName, entries in yamlblock.items():
65+
if isinstance(entries, list):
66+
try:
67+
overlay = Overlay(blockName)
68+
except ValueError:
69+
continue
70+
requiredPrefix = "sas-bases/overlays/"
71+
for entry in entries:
72+
if entry.startswith(requiredPrefix):
73+
self.add_overlays(overlay, entry)
74+
else:
75+
raise ValueError(f"Invalid {blockName} entry in {sasBasesOverlaysPath}: '{entry}'. Valid entries must start with '{requiredPrefix}'")
76+
except yaml.YAMLError as exc:
77+
raise RuntimeError(f"Error parsing {sasBasesOverlaysPath} as yaml") from exc
5878

5979
def traverse(self, folder):
80+
self.processSasBasesOverlays(folder)
81+
6082
if os.path.exists(os.path.join(folder, "kustomization.yaml")) or os.path.exists(os.path.join(folder, "kustomization.yml")):
6183
kustomizefile = "kustomization.yaml" if os.path.exists(os.path.join(folder, "kustomization.yaml")) else "kustomization.yml"
6284
kustomizefilefullpath = os.path.join(folder, kustomizefile)

0 commit comments

Comments
 (0)