Skip to content
This repository was archived by the owner on Sep 9, 2026. It is now read-only.

MGMT-24006: Add netris integration to the installation flow - #72

Merged
openshift-merge-bot[bot] merged 1 commit into
osac-project:mainfrom
danmanor:netris
Apr 28, 2026
Merged

openshift-merge-bot[bot] merged 1 commit into
osac-project:mainfrom
danmanor:netris

Conversation

@danmanor

@danmanor danmanor commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Add Netris network backend support to the OSAC installer. Users
configure the
AAP automation backend via env files in their overlay —
osac-aap-configuration.env
for non-sensitive settings and osac-aap-secrets.env for credentials
— making it
easy to switch between ESI and Netris without passing dozens of
environment
variables on the command line.

What changed

  • scripts/aap-configuration.sh (new): Reads
    osac-aap-configuration.env
    and, when present, osac-aap-secrets.env from the overlay's
    files/ directory,
    then patches the cluster-fulfillment-ig ConfigMap and Secret via
    oc patch --type=merge. Shell env vars override file values for CI
    use.

  • scripts/setup.sh: Calls aap-configuration.sh after oc apply -k,
    passing INSTALLER_NAMESPACE and INSTALLER_KUSTOMIZE_OVERLAY to
    the child
    script.

overlays/{development,caas-ci}/files/osac-aap-configuration.env
(new,
tracked): Non-sensitive settings pre-filled with Netris defaults for
the
development environment. Users edit to match their environment.

  • overlays/{development,caas-ci}/files/osac-aap-secrets.env.example (new,
    tracked): Template for sensitive credentials. Users copy to
    osac-aap-secrets.env (gitignored) and fill in their values.

  • overlays/{development,caas-ci,vmaas-ci}/kustomization.yaml:
    Added
    configMapGenerator for cluster-fulfillment-ig with ESI defaults.
    Comments
    note that the script may override these values.

  • docs/aap-configuration.md (new): Documents the env file
    mechanism,
    ConfigMap/Secret variable reference, plaintext secret requirement,
    and SSH key
    handling.

  • docs/network-backend.md (new): Documents Netris-specific
    variables and the
    NETRIS_RESOURCE_CLASS_MAP JSON format. Links back to the AAP
    configuration doc
    for the general setup.

  • README.md: Added separate AAP Configuration and Network
    Backend
    Configuration sections with links to the detailed docs. Updated
    prerequisites
    to list Netris as an alternative to ESI.

  • .gitignore: Added **/osac-aap-secrets.env.

How to use

  1. Edit overlays/<project>/files/osac-aap-configuration.env — set
    NETWORK_CLASS=netris and fill in connection details
  2. Copy osac-aap-secrets.env.example to osac-aap-secrets.env and add
    credentials (passwords, SSH keys, AWS keys)
  3. Run ./scripts/setup.sh

Existing ESI deployments are unaffected — without env files the script is a
no-op and the kustomize ESI defaults apply.

Summary by CodeRabbit

  • New Features

    • Added support for a Netris network backend alongside ESI and a runtime AAP configuration workflow that applies overlayed env-file settings.
    • Automated post-deploy application of AAP ConfigMap/Secret overrides.
  • Documentation

    • New and updated docs covering network backend selection, Netris configuration details, and AAP configuration workflow with examples.
  • Chores

    • Gitignore updated to exclude local secrets env files.

@openshift-ci-robot

openshift-ci-robot commented Apr 21, 2026

Copy link
Copy Markdown

@danmanor: This pull request references MGMT-24006 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

Add Netris network backend support to the OSAC installer, enabling CaaS
deployments with Netris-managed bare-metal networking as an alternative to
ESI.

What changed

  • Kustomize Component (components/netris/): A kind: Component that
    switches the network class from ESI to Netris via configMapGenerator
    merge. Overlays opt in by adding components: [../../components/netris]
    no other changes needed for the basic switch.

  • cluster-fulfillment-ig ConfigMap: Added configMapGenerator to
    development, caas-ci, and vmaas-ci overlays with ESI defaults
    (domains, HA policies, network class). This ConfigMap is consumed by AAP job
    pods via envFrom alongside the existing Secret.

  • scripts/configure-fulfillment-ig.sh: Standalone script that patches
    the cluster-fulfillment-ig ConfigMap and Secret from environment
    variables. Handles sensitive values (Netris password, SSH keys, AWS
    credentials) via oc patch --type=merge. Called automatically by
    setup.sh, also usable independently for manual deployments.

  • scripts/setup.sh: Calls configure-fulfillment-ig.sh after oc apply -k to apply any environment variable overrides before the AAP
    bootstrap job runs.

  • README.md: Documents the Netris component usage, environment-specific
    configuration (both Kustomize-native and script-based), and full variable
    reference tables for the ConfigMap and Secret.

How it works

Users have two complementary paths to configure Netris:

  1. Declarative (Kustomize): Add the components/netris component +
    behavior: merge literals in the overlay for connection details and
    secrets.
  2. Imperative (script): Set environment variables and run setup.sh or
    configure-fulfillment-ig.sh — the script patches the resources after
    they're created by Kustomize.

Existing ESI deployments are unaffected — overlays without the component
keep the default NETWORK_CLASS=esi.

Variable reference

ConfigMap (cluster-fulfillment-ig): NETWORK_CLASS,
NETWORK_STEPS_COLLECTION, EXTERNAL_ACCESS_BASE_DOMAIN,
HOSTED_CLUSTER_BASE_DOMAIN, NETRIS_CONTROLLER_URL, NETRIS_USERNAME,
NETRIS_SITE_ID, NETRIS_TENANT_ID, NETRIS_TENANT_NAME,
NETRIS_MGMT_VPC_ID, NETRIS_MGMT_VPC_NAME, NETRIS_RESOURCE_CLASS_MAP,
SERVER_SSH_BASTION_HOST, SERVER_SSH_BASTION_USER, SERVER_SSH_USER,
SERVER_MGMT_ROUTE_*

Secret (cluster-fulfillment-ig): NETRIS_PASSWORD, SERVER_SSH_KEY,
SERVER_SSH_BASTION_KEY, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Apr 21, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@danmanor has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 59 minutes and 25 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ea39b2d3-e2af-48ee-86ed-5278fd005253

📥 Commits

Reviewing files that changed from the base of the PR and between 13065c1 and 9a0e20f.

📒 Files selected for processing (12)
  • .gitignore
  • README.md
  • docs/aap-configuration.md
  • docs/network-backend.md
  • overlays/caas-ci/files/osac-aap-configuration.env
  • overlays/caas-ci/files/osac-aap-secrets.env.example
  • overlays/caas-ci/kustomization.yaml
  • overlays/development/files/osac-aap-configuration.env
  • overlays/development/files/osac-aap-secrets.env.example
  • overlays/development/kustomization.yaml
  • scripts/aap-configuration.sh
  • scripts/setup.sh

Walkthrough

Adds AAP runtime configuration support: ignores gitignored secrets, documents selectable network backends (ESI or Netris), adds network-backend and AAP-configuration docs, introduces overlay ConfigMap generators and example env/secret files for caas-ci and development, adds scripts/aap-configuration.sh to load env files and patch the cluster-fulfillment-ig ConfigMap and Secret, and updates scripts/setup.sh to invoke the new configuration script after oc apply -k.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • larsks
  • trewest
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding Netris network backend support to the OSAC installation flow, which aligns directly with the primary objective of the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@danmanor danmanor changed the title WIP: MGMT-24006: Add netris integration to the installation flow MGMT-24006: Add netris integration to the installation flow Apr 23, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🧹 Nitpick comments (1)
overlays/caas-ci/kustomization.yaml (1)

58-72: Kustomize literals intentionally ESI, but the companion files/configuration.env flips to Netris at runtime.

NETWORK_CLASS=esi here will be overwritten to netris by configure-fulfillment-ig.sh because the overlay's configuration.env sets it. That appears to be the design, but it means kustomize build overlays/caas-ci and the actual running state diverge — worth documenting (or setting the literal to netris to match the file shipped in the same overlay) to avoid confusion during troubleshooting.

Also: the PR description mentions a components/netris Kustomize Component that overrides these literals via behavior: merge. That component is not among the overlays here, so overlays currently rely solely on the runtime script to switch backends — consider clarifying the intended relationship between the component-based and script-based paths in docs.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@overlays/caas-ci/kustomization.yaml` around lines 58 - 72, The
configMapGenerator entry for name cluster-fulfillment-ig sets NETWORK_CLASS=esi
which is later overwritten at runtime by the overlay's files/configuration.env
and configure-fulfillment-ig.sh (so kustomize build and runtime differ); to fix,
either change the literal NETWORK_CLASS in the configMapGenerator to match the
intended runtime value (netris) or add documentation in the overlay explaining
that configure-fulfillment-ig.sh and files/configuration.env will flip
NETWORK_CLASS, and if the components/netris Kustomize component (behavior:
merge) is intended to control this, ensure that component is included in the
overlay or document the intended component-vs-script precedence.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/network-backend.md`:
- Around line 10-19: The doc currently implies both env files must exist; update
the text in docs/network-backend.md to mark secrets.env as optional by stating
that secrets.env is gitignored and may be absent in overlays, and note that
scripts/configure-fulfillment-ig.sh will skip missing secrets.env when patching
the cluster; keep configuration.env described as tracked and required while
clarifying that secrets.env contains sensitive credentials and is optional
per-overlay.
- Around line 72-80: Update the docs to explicitly state that values in
`secrets.env` must be plain-text (not base64-encoded) because the deployment
script base64-encodes these values when patching the Kubernetes Secret `data`;
if users pre-encode them they will end up double-encoded and unusable in the job
pods. Mention `secrets.env` by name, note the script behavior of base64-encoding
prior to writing to the Secret `data`, and add a short warning line advising
users to provide plaintext credentials (e.g., NETRIS_PASSWORD, SERVER_SSH_KEY,
AWS_*).
- Around line 32-40: Remove the leading shell prompt markers from the
command-only code blocks so they pass MD014; update the examples that reference
./scripts/setup.sh and ./scripts/configure-fulfillment-ig.sh to show raw
commands (e.g., replace "$ ./scripts/setup.sh" with "./scripts/setup.sh" and "$
INSTALLER_NAMESPACE=<project-name> ./scripts/configure-fulfillment-ig.sh" with
"INSTALLER_NAMESPACE=<project-name> ./scripts/configure-fulfillment-ig.sh")
while keeping the surrounding fenced code blocks intact.

In `@overlays/caas-ci/files/configuration.env`:
- Around line 1-44: The overlay contains hardcoded Netris identifiers
(NETRIS_CONTROLLER_URL, NETRIS_USERNAME, NETRIS_SITE_ID, NETRIS_TENANT_ID,
NETRIS_MGMT_VPC_ID, NETRIS_RESOURCE_CLASS_MAP, etc.) copied from dev — verify
and replace these with CI-appropriate identifiers or document they are
placeholders for CaaS CI; ensure NETRIS_RESOURCE_CLASS_MAP remains a
JSON-encoded string (since scripts/configure-fulfillment-ig.sh patches it into
the ConfigMap as a quoted string) and confirm any consumers (AAP templates or
external steps) parse it as JSON rather than expecting a pre-parsed object;
finally add a short header comment above the Netris block marking which keys are
CI-infrastructure IDs vs. editable environment settings so operators know which
values must be customized.

In `@overlays/development/files/configuration.env`:
- Around line 1-44: Replace the committed Netris defaults in
development/files/configuration.env with safe ESI defaults (e.g. set
NETWORK_CLASS=esi, NETWORK_STEPS_COLLECTION=esi.steps and clear
network/controller/SSH values like NETRIS_CONTROLLER_URL, NETRIS_USERNAME,
SERVER_SSH_BASTION_HOST, NETRIS_SITE_ID, NETRIS_TENANT_ID, NETRIS_MGMT_VPC_ID,
NETRIS_RESOURCE_CLASS_MAP), move the current Netris values into a new
development/files/configuration.env.example as an opt-in example, add
configuration.env to .gitignore, and update scripts/configure-fulfillment-ig.sh
(and scripts/setup.sh call site if needed) to no-op or skip configuration when
configuration.env is absent to avoid silently applying environment-specific
Netris settings.

In `@README.md`:
- Around line 283-299: The README claim that configuration.env "ships with ESI
defaults" is inconsistent with committed overlays that set NETWORK_CLASS=netris
and include live Netris values; update either the committed files or the docs:
either change overlays/development/files/configuration.env and
overlays/caas-ci/files/configuration.env to use ESI/default placeholder values
(e.g., remove live Netris controller entries and set NETWORK_CLASS to the
documented default) or revise README.md wording to state that the repository
ships overlays configured for Netris (mention NETWORK_CLASS=netris) and that
secrets must be supplied; also add or link the full variable list (from
docs/network-backend.md or the PR ConfigMap/Secret list) into this section so
the variable reference is immediately available.

In `@scripts/configure-fulfillment-ig.sh`:
- Around line 20-33: The load_env_file function currently splits on lines and
loses multiline secret values (e.g., SSH private keys) and elsewhere the script
uses echo -n and GNU-only base64 -w0 which corrupts values starting with '-' and
wrapped base64 output; update load_env_file to read the file line-by-line with
IFS= read -r line, skip blank/comments, split each line at the first '=' with
key="${line%%=*}" and value="${line#*=}" so value preserves embedded
newlines/characters, trim comments from key only, and export using export
"${key}=${value}"; change any use of echo -n to printf '%s' when emitting secret
content (references: SERVER_SSH_KEY, SERVER_SSH_BASTION_KEY), and replace base64
-w0 with a portable pipeline like base64 | tr -d '\n' (or use base64 -w0 when
available) to ensure no line-wrapping and avoid corrupting secrets.

In `@scripts/setup.sh`:
- Around line 215-216: The variables INSTALLER_NAMESPACE and
INSTALLER_KUSTOMIZE_OVERLAY are defined but not exported, so they are not
visible to the child script configure-fulfillment-ig.sh; update the parent
script to export INSTALLER_NAMESPACE and INSTALLER_KUSTOMIZE_OVERLAY (or export
them where first defined) before invoking ./scripts/configure-fulfillment-ig.sh
so the child receives the correct namespace and kustomize overlay instead of
falling back to its hardcoded defaults.

---

Nitpick comments:
In `@overlays/caas-ci/kustomization.yaml`:
- Around line 58-72: The configMapGenerator entry for name
cluster-fulfillment-ig sets NETWORK_CLASS=esi which is later overwritten at
runtime by the overlay's files/configuration.env and configure-fulfillment-ig.sh
(so kustomize build and runtime differ); to fix, either change the literal
NETWORK_CLASS in the configMapGenerator to match the intended runtime value
(netris) or add documentation in the overlay explaining that
configure-fulfillment-ig.sh and files/configuration.env will flip NETWORK_CLASS,
and if the components/netris Kustomize component (behavior: merge) is intended
to control this, ensure that component is included in the overlay or document
the intended component-vs-script precedence.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6ea98133-46bc-4dac-a17a-ab15d4274024

📥 Commits

Reviewing files that changed from the base of the PR and between 24e2781 and 4e2e15b.

📒 Files selected for processing (10)
  • .gitignore
  • README.md
  • docs/network-backend.md
  • overlays/caas-ci/files/configuration.env
  • overlays/caas-ci/kustomization.yaml
  • overlays/development/files/configuration.env
  • overlays/development/kustomization.yaml
  • overlays/vmaas-ci/kustomization.yaml
  • scripts/configure-fulfillment-ig.sh
  • scripts/setup.sh

Comment thread docs/network-backend.md Outdated
Comment on lines +10 to +19
Each overlay contains two env files under `files/`:

| File | Tracked in git | Purpose |
|------|---------------|---------|
| `configuration.env` | Yes | Non-sensitive settings (network class, domains, Netris connection) |
| `secrets.env` | No (gitignored) | Sensitive credentials (passwords, SSH keys, AWS keys) |

The `scripts/configure-fulfillment-ig.sh` script reads both files and patches the
`cluster-fulfillment-ig` ConfigMap and Secret on the cluster. The setup script
(`setup.sh`) calls this automatically.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Mark secrets.env as optional.

Line 10 says every overlay contains two env files, but scripts/configure-fulfillment-ig.sh skips missing files, and secrets.env is gitignored. This should not imply credentials files must exist in every overlay.

📝 Proposed wording
-Each overlay contains two env files under `files/`:
+Each overlay contains a tracked configuration file under `files/`; add a local
+`secrets.env` only when credential overrides are needed:

 | File | Tracked in git | Purpose |
 |------|---------------|---------|
 | `configuration.env` | Yes | Non-sensitive settings (network class, domains, Netris connection) |
-| `secrets.env` | No (gitignored) | Sensitive credentials (passwords, SSH keys, AWS keys) |
+| `secrets.env` | No (gitignored, optional) | Sensitive credentials (passwords, SSH keys, AWS keys) |

-The `scripts/configure-fulfillment-ig.sh` script reads both files and patches the
-`cluster-fulfillment-ig` ConfigMap and Secret on the cluster. The setup script
-(`setup.sh`) calls this automatically.
+The `scripts/configure-fulfillment-ig.sh` script reads `configuration.env` and,
+when present, `secrets.env`, then patches the `cluster-fulfillment-ig` ConfigMap
+and Secret on the cluster. The setup script (`setup.sh`) calls this automatically.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/network-backend.md` around lines 10 - 19, The doc currently implies both
env files must exist; update the text in docs/network-backend.md to mark
secrets.env as optional by stating that secrets.env is gitignored and may be
absent in overlays, and note that scripts/configure-fulfillment-ig.sh will skip
missing secrets.env when patching the cluster; keep configuration.env described
as tracked and required while clarifying that secrets.env contains sensitive
credentials and is optional per-overlay.

Comment thread docs/network-backend.md Outdated
Comment on lines +32 to +40
```bash
$ ./scripts/setup.sh
```

For manual deployments, run the configuration script standalone after applying
kustomize:

```bash
$ INSTALLER_NAMESPACE=<project-name> ./scripts/configure-fulfillment-ig.sh

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove prompt markers from command-only examples.

Lines 33 and 40 trigger markdownlint MD014 because the examples show $ prompts without command output.

🧹 Proposed lint fix
    ```bash
-   $ ./scripts/setup.sh
+   ./scripts/setup.sh
    ```
@@
 ```bash
-$ INSTALLER_NAMESPACE=<project-name> ./scripts/configure-fulfillment-ig.sh
+INSTALLER_NAMESPACE=<project-name> ./scripts/configure-fulfillment-ig.sh

</details>

<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

```suggestion

🧰 Tools
🪛 markdownlint-cli2 (0.22.0)

[warning] 33-33: Dollar signs used before commands without showing output

(MD014, commands-show-output)


[warning] 40-40: Dollar signs used before commands without showing output

(MD014, commands-show-output)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/network-backend.md` around lines 32 - 40, Remove the leading shell
prompt markers from the command-only code blocks so they pass MD014; update the
examples that reference ./scripts/setup.sh and
./scripts/configure-fulfillment-ig.sh to show raw commands (e.g., replace "$
./scripts/setup.sh" with "./scripts/setup.sh" and "$
INSTALLER_NAMESPACE=<project-name> ./scripts/configure-fulfillment-ig.sh" with
"INSTALLER_NAMESPACE=<project-name> ./scripts/configure-fulfillment-ig.sh")
while keeping the surrounding fenced code blocks intact.

Comment thread docs/network-backend.md Outdated
Comment thread overlays/caas-ci/files/osac-aap-configuration.env Outdated
Comment thread overlays/development/files/osac-aap-configuration.env Outdated
Comment thread README.md Outdated
Comment thread scripts/aap-configuration.sh
Comment thread scripts/setup.sh Outdated
@danmanor
danmanor force-pushed the netris branch 5 times, most recently from aeb4051 to ae04ec5 Compare April 23, 2026 18:02

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (1)
scripts/aap-configuration.sh (1)

20-34: ⚠️ Potential issue | 🟠 Major

Multiline SSH key values are still silently truncated.

The echo -n / base64 -w0 portability concerns from the prior review have been addressed (lines 86–86 now use printf '%s' ... | base64 | tr -d '\n'), but the line-oriented parser here still cannot represent multiline values. A plaintext SERVER_SSH_KEY / SERVER_SSH_BASTION_KEY spanning PEM lines in osac-aap-secrets.env will only capture the first line (-----BEGIN OPENSSH PRIVATE KEY-----), and the subsequent PEM body lines will be parsed as bogus KEY=VALUE pairs (or skipped), producing a corrupt/invalid Secret. Additionally, printf '%s' on line 86 omits the trailing newline that OpenSSH typically requires after the END marker.

Given the docs explicitly require plaintext secrets including SSH keys, this needs either a documented single-line encoding (e.g. \n-escaped, decoded here) or a real multiline-aware parser.

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@README.md`:
- Around line 300-308: The README currently says "By default the network backend
is ESI" which conflicts with earlier lines stating the development and caas-ci
overlays ship with Netris defaults; update the Network Backend Configuration
(CaaS) paragraph to clarify that the kustomize base defaults to ESI while the
development and caas-ci overlay env files override this to Netris, and show how
to switch by setting NETWORK_CLASS=esi or NETWORK_CLASS=netris in
osac-aap-configuration.env and by filling the Netris-specific variables
(referencing NETWORK_CLASS and NETRIS_RESOURCE_CLASS_MAP) so a new user
understands base vs overlay defaults.

In `@scripts/aap-configuration.sh`:
- Around line 11-12: The namespace extraction using
INSTALLER_NAMESPACE=${INSTALLER_NAMESPACE:-$(grep "^namespace:"
"overlays/${INSTALLER_KUSTOMIZE_OVERLAY}/kustomization.yaml" | awk '{print
$2}')} is fragile to CRLF, inline comments and quotes; update the assignment to
either use yq (e.g., yq eval '.namespace'
overlays/${INSTALLER_KUSTOMIZE_OVERLAY}/kustomization.yaml) when yq is
available, or if not available sanitize the file content first by stripping CRs,
removing inline “#” comments and surrounding quotes and trimming whitespace
before extracting the value (referencing INSTALLER_NAMESPACE and
overlays/${INSTALLER_KUSTOMIZE_OVERLAY}/kustomization.yaml to locate the code
path), and ensure the script still exits with error if the resulting
INSTALLER_NAMESPACE is empty.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5f5b4ab6-3524-4ffa-8114-f4f13091b659

📥 Commits

Reviewing files that changed from the base of the PR and between 4e2e15b and ae04ec5.

📒 Files selected for processing (15)
  • .gitignore
  • README.md
  • base/osac-aap
  • base/osac-fulfillment-service
  • base/osac-operator
  • docs/aap-configuration.md
  • docs/network-backend.md
  • overlays/caas-ci/files/osac-aap-configuration.env
  • overlays/caas-ci/files/osac-aap-secrets.env.example
  • overlays/caas-ci/kustomization.yaml
  • overlays/development/files/osac-aap-configuration.env
  • overlays/development/files/osac-aap-secrets.env.example
  • overlays/development/kustomization.yaml
  • scripts/aap-configuration.sh
  • scripts/setup.sh
💤 Files with no reviewable changes (3)
  • base/osac-fulfillment-service
  • base/osac-operator
  • base/osac-aap
✅ Files skipped from review due to trivial changes (8)
  • .gitignore
  • overlays/development/files/osac-aap-secrets.env.example
  • overlays/development/kustomization.yaml
  • overlays/caas-ci/files/osac-aap-secrets.env.example
  • docs/network-backend.md
  • overlays/caas-ci/files/osac-aap-configuration.env
  • overlays/development/files/osac-aap-configuration.env
  • docs/aap-configuration.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • scripts/setup.sh
  • overlays/caas-ci/kustomization.yaml

Comment thread README.md
Comment on lines +11 to +12
INSTALLER_NAMESPACE=${INSTALLER_NAMESPACE:-$(grep "^namespace:" "overlays/${INSTALLER_KUSTOMIZE_OVERLAY}/kustomization.yaml" | awk '{print $2}')}
[[ -z "${INSTALLER_NAMESPACE}" ]] && echo "ERROR: Could not determine namespace from overlays/${INSTALLER_KUSTOMIZE_OVERLAY}/kustomization.yaml" && exit 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Namespace extraction is fragile to formatting of kustomization.yaml.

grep "^namespace:" | awk '{print $2}' will break or return the wrong value if the field has a trailing \r (CRLF-edited file), an inline # comment, or is quoted (namespace: "osac-devel" keeps the quotes). Consider using yq if available, or at minimum stripping CR and trailing comments before assigning. Low likelihood in current overlays, but the error path (exit 1) only triggers on empty, not malformed.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/aap-configuration.sh` around lines 11 - 12, The namespace extraction
using INSTALLER_NAMESPACE=${INSTALLER_NAMESPACE:-$(grep "^namespace:"
"overlays/${INSTALLER_KUSTOMIZE_OVERLAY}/kustomization.yaml" | awk '{print
$2}')} is fragile to CRLF, inline comments and quotes; update the assignment to
either use yq (e.g., yq eval '.namespace'
overlays/${INSTALLER_KUSTOMIZE_OVERLAY}/kustomization.yaml) when yq is
available, or if not available sanitize the file content first by stripping CRs,
removing inline “#” comments and surrounding quotes and trimming whitespace
before extracting the value (referencing INSTALLER_NAMESPACE and
overlays/${INSTALLER_KUSTOMIZE_OVERLAY}/kustomization.yaml to locate the code
path), and ensure the script still exits with error if the resulting
INSTALLER_NAMESPACE is empty.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
scripts/aap-configuration.sh (1)

61-78: Optional: clean up patch_file via trap to avoid leaking under errexit.

If oc patch (line 75) fails, set -o errexit aborts before line 78 and the temp file is leaked in /tmp. Low impact, but a one-liner makes it robust:

♻️ Proposed refactor
 # --- ConfigMap overrides ---
 patch_file=$(mktemp)
+trap 'rm -f "${patch_file}"' EXIT
 has_cm_overrides=false
@@
 if [[ "${has_cm_overrides}" == "true" ]]; then
     echo "Applying cluster-fulfillment-ig configmap overrides..."
     oc patch configmap/cluster-fulfillment-ig -n "${INSTALLER_NAMESPACE}" \
         --patch-file="${patch_file}" --type=merge
 fi
-rm -f "${patch_file}"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/aap-configuration.sh` around lines 61 - 78, Add a safe cleanup trap
so the temporary file created in patch_file is always removed even if errexit
aborts (e.g., before the oc patch completes). After creating patch_file with
mktemp, register a trap that runs rm -f "${patch_file}" on EXIT (or ERR/EXIT)
and ensure the trap references the same patch_file variable; keep existing
explicit rm -f "${patch_file}" at the end or rely on the EXIT trap but do not
remove the trap registration prematurely. This change affects the patch_file
lifecycle around the mktemp/oc patch/has_cm_overrides block and prevents leaking
the temp file.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@scripts/aap-configuration.sh`:
- Around line 61-78: Add a safe cleanup trap so the temporary file created in
patch_file is always removed even if errexit aborts (e.g., before the oc patch
completes). After creating patch_file with mktemp, register a trap that runs rm
-f "${patch_file}" on EXIT (or ERR/EXIT) and ensure the trap references the same
patch_file variable; keep existing explicit rm -f "${patch_file}" at the end or
rely on the EXIT trap but do not remove the trap registration prematurely. This
change affects the patch_file lifecycle around the mktemp/oc
patch/has_cm_overrides block and prevents leaking the temp file.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cdc4351b-5431-4d5e-9a94-d3d973123918

📥 Commits

Reviewing files that changed from the base of the PR and between ae04ec5 and 77bd08a.

📒 Files selected for processing (12)
  • .gitignore
  • README.md
  • docs/aap-configuration.md
  • docs/network-backend.md
  • overlays/caas-ci/files/osac-aap-configuration.env
  • overlays/caas-ci/files/osac-aap-secrets.env.example
  • overlays/caas-ci/kustomization.yaml
  • overlays/development/files/osac-aap-configuration.env
  • overlays/development/files/osac-aap-secrets.env.example
  • overlays/development/kustomization.yaml
  • scripts/aap-configuration.sh
  • scripts/setup.sh
✅ Files skipped from review due to trivial changes (6)
  • .gitignore
  • overlays/development/files/osac-aap-secrets.env.example
  • overlays/caas-ci/files/osac-aap-secrets.env.example
  • overlays/development/files/osac-aap-configuration.env
  • docs/network-backend.md
  • docs/aap-configuration.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • overlays/development/kustomization.yaml
  • overlays/caas-ci/files/osac-aap-configuration.env
  • README.md

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
scripts/aap-configuration.sh (2)

61-78: Add a trap to guarantee the temp patch file is cleaned up.

With set -e, if oc patch fails on line 75, line 78's rm -f never runs and the temp file leaks (and may contain rendered config values). A one-line trap makes cleanup unconditional.

♻️ Proposed change
 # --- ConfigMap overrides ---
 patch_file=$(mktemp)
+trap 'rm -f "${patch_file}"' EXIT
 has_cm_overrides=false
@@
 if [[ "${has_cm_overrides}" == "true" ]]; then
     echo "Applying cluster-fulfillment-ig configmap overrides..."
     oc patch configmap/cluster-fulfillment-ig -n "${INSTALLER_NAMESPACE}" \
         --patch-file="${patch_file}" --type=merge
 fi
-rm -f "${patch_file}"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/aap-configuration.sh` around lines 61 - 78, The temporary patch file
created as patch_file can leak if oc patch fails because set -e causes early
exit before the final rm -f; add a one-line trap to always remove the temp file
(e.g., trap 'rm -f "${patch_file}"' EXIT) immediately after creating patch_file
so cleanup runs on exit/failure; ensure the trap references the same variable
name patch_file and leave the existing rm -f as a harmless final cleanup.

18-19: Stale comment: set -a is no longer used.

The comment refers to set -a semantics, but the implementation switched to a hand-rolled load_env_file() function that uses an explicit [[ -z "${!key:-}" ]] precedence check. Update the comment to reflect what actually happens, otherwise future readers will look for a set -a block that doesn't exist.

📝 Proposed comment update
-# Source env files. Shell environment variables take precedence (set -a exports
-# only new variables; existing ones are not overwritten by source).
+# Load env files. Pre-existing shell environment variables take precedence:
+# load_env_file() only exports a key if it is currently unset/empty.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/aap-configuration.sh` around lines 18 - 19, The existing comment
incorrectly references set -a; update it to describe the current hand-rolled
loader: explain that load_env_file() is used to parse env files and that shell
environment variables take precedence due to the explicit precedence check ([[
-z "${!key:-}" ]]) before exporting each key, so only unset variables from the
file are exported.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/aap-configuration.sh`:
- Around line 64-71: The current loop in the script writes CM_VARS values as
single-quoted YAML scalars which break on embedded newlines; update the loop
that writes to "${patch_file}" (the block referencing CM_VARS, escaped, and
has_cm_overrides) to detect multi-line values and either emit a YAML block
scalar (using a "|" followed by properly indented lines) or JSON-encode the
entire value (e.g., via jq -Rs .) and write the encoded value as the field
value; ensure you remove the current single-quote escaping (escaped) for
multi-line cases and set has_cm_overrides=true as before so oc patch
--patch-file receives valid YAML/JSON for multiline CM_VARS.
- Around line 27-29: The code currently strips inline comments only from the key
(variable key) but leaves trailing inline comments and leading spaces in the
value; update the value processing in scripts/aap-configuration.sh where key and
value are parsed so that after extracting value you first remove any inline “#”
comment (e.g., value = value before the first #) and then trim leading/trailing
whitespace from value before using it; reference the existing variables key and
value in your change (mirror the key handling: apply value="${value%%#*}" then
apply a trim routine) so ConfigMap entries don’t include the inline comment or
stray spaces.

---

Nitpick comments:
In `@scripts/aap-configuration.sh`:
- Around line 61-78: The temporary patch file created as patch_file can leak if
oc patch fails because set -e causes early exit before the final rm -f; add a
one-line trap to always remove the temp file (e.g., trap 'rm -f "${patch_file}"'
EXIT) immediately after creating patch_file so cleanup runs on exit/failure;
ensure the trap references the same variable name patch_file and leave the
existing rm -f as a harmless final cleanup.
- Around line 18-19: The existing comment incorrectly references set -a; update
it to describe the current hand-rolled loader: explain that load_env_file() is
used to parse env files and that shell environment variables take precedence due
to the explicit precedence check ([[ -z "${!key:-}" ]]) before exporting each
key, so only unset variables from the file are exported.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e50c9191-5af9-491f-94c0-a4d04bd09811

📥 Commits

Reviewing files that changed from the base of the PR and between 77bd08a and 13065c1.

📒 Files selected for processing (12)
  • .gitignore
  • README.md
  • docs/aap-configuration.md
  • docs/network-backend.md
  • overlays/caas-ci/files/osac-aap-configuration.env
  • overlays/caas-ci/files/osac-aap-secrets.env.example
  • overlays/caas-ci/kustomization.yaml
  • overlays/development/files/osac-aap-configuration.env
  • overlays/development/files/osac-aap-secrets.env.example
  • overlays/development/kustomization.yaml
  • scripts/aap-configuration.sh
  • scripts/setup.sh
✅ Files skipped from review due to trivial changes (7)
  • .gitignore
  • overlays/caas-ci/files/osac-aap-secrets.env.example
  • overlays/caas-ci/kustomization.yaml
  • docs/network-backend.md
  • overlays/caas-ci/files/osac-aap-configuration.env
  • docs/aap-configuration.md
  • overlays/development/files/osac-aap-configuration.env
🚧 Files skipped from review as they are similar to previous changes (3)
  • scripts/setup.sh
  • overlays/development/files/osac-aap-secrets.env.example
  • README.md

Comment on lines +27 to +29
key="${key%%#*}"
key="${key// /}"
[[ -z "${key}" ]] && continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Inline # comment is stripped from keys but kept in values.

Line 27 only strips # from the key portion. A line like NETRIS_USERNAME=admin # default will produce value=" admin # default" (with leading space), which then gets pushed into the ConfigMap verbatim. Either strip trailing inline comments from value as well, or document that inline comments aren't supported and only full-line # comments are.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/aap-configuration.sh` around lines 27 - 29, The code currently strips
inline comments only from the key (variable key) but leaves trailing inline
comments and leading spaces in the value; update the value processing in
scripts/aap-configuration.sh where key and value are parsed so that after
extracting value you first remove any inline “#” comment (e.g., value = value
before the first #) and then trim leading/trailing whitespace from value before
using it; reference the existing variables key and value in your change (mirror
the key handling: apply value="${value%%#*}" then apply a trim routine) so
ConfigMap entries don’t include the inline comment or stray spaces.

Comment on lines +64 to +71
echo "data:" > "${patch_file}"
for var in "${CM_VARS[@]}"; do
if [[ -n "${!var:-}" ]]; then
escaped="${!var//\'/\'\'}"
printf " %s: '%s'\n" "${var}" "${escaped}" >> "${patch_file}"
has_cm_overrides=true
fi
done

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Multiline CM_VARS values produce invalid YAML.

The patch file uses single-quoted YAML scalars: printf " %s: '%s'\n" "${var}" "${escaped}". YAML single-quoted scalars may not contain raw newlines on the same logical line, so any CM_VAR value containing a newline (e.g., a multi-line NETRIS_RESOURCE_CLASS_MAP JSON, or anything copy-pasted with embedded newlines) will produce a malformed patch and oc patch --patch-file will fail. Using YAML block scalars (|) or JSON encoding (jq -Rs .) for the value would be safer.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/aap-configuration.sh` around lines 64 - 71, The current loop in the
script writes CM_VARS values as single-quoted YAML scalars which break on
embedded newlines; update the loop that writes to "${patch_file}" (the block
referencing CM_VARS, escaped, and has_cm_overrides) to detect multi-line values
and either emit a YAML block scalar (using a "|" followed by properly indented
lines) or JSON-encode the entire value (e.g., via jq -Rs .) and write the
encoded value as the field value; ensure you remove the current single-quote
escaping (escaped) for multi-line cases and set has_cm_overrides=true as before
so oc patch --patch-file receives valid YAML/JSON for multiline CM_VARS.

Comment thread scripts/aap-configuration.sh
Comment thread README.md
@omer-vishlitzky

Copy link
Copy Markdown
Contributor

/lgtm
/approve

@openshift-ci

openshift-ci Bot commented Apr 28, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: danmanor, omer-vishlitzky

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [danmanor,omer-vishlitzky]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot
openshift-merge-bot Bot merged commit 42b13d6 into osac-project:main Apr 28, 2026
14 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants