Skip to content

Conversation

@keitwb
Copy link
Collaborator

@keitwb keitwb commented Aug 5, 2025

I checked to make sure it corresponds to the existing lightspeed-stack.template.yaml in terms of values.

Local overrides can be added by creating a
.template-params.override.yaml file in the project root.

Summary by CodeRabbit

  • Chores
    • Added a new override pattern to the ignore list so local override files aren’t tracked.
    • Removed an obsolete deployment configuration to streamline setup.
    • Added a new environment config for simpler runtime parameter management.
    • Updated the deployment template to support parameterized paths and feature toggles for more flexible deployments.
    • Enhanced the config-generation script to apply optional override parameters when present.

@openshift-ci openshift-ci bot requested review from eranco74 and jhernand August 5, 2025 17:37
@coderabbitai
Copy link

coderabbitai bot commented Aug 5, 2025

Walkthrough

This change deletes lightspeed-stack.template.yaml, parameterizes and annotates template.yaml as an OpenShift Template, adds template-params.dev.env, updates scripts/generate.sh to use an optional override env file, and adds .template-params.override.env to .gitignore.

Changes

Cohort / File(s) Change Summary
Template Parameterization & Metadata
template.yaml
Converted the file into an OpenShift Template (apiVersion: template.openshift.io/v1, kind: Template), added parameters SYSTEM_PROMPT_PATH, LLAMA_CLIENT_CONFIG_PATH, DISABLE_QUERY_SYSTEM_PROMPT, and replaced hardcoded ConfigMap values with parameter references.
Removed Config File
lightspeed-stack.template.yaml
Deleted the file and all contained lightspeed-stack service/client configuration.
Generation Script
scripts/generate.sh
Updated script to detect an optional .template-params.override.env, pass it to oc process alongside template-params.dev.env, and extract lightspeed-stack.yaml from the processed Template using yq (instead of copying a static file).
Dev Parameter Defaults
template-params.dev.env
Added a new dev environment parameter file with keys: IMAGE_TAG, SYSTEM_PROMPT_PATH, LLAMA_CLIENT_CONFIG_PATH, LIGHTSPEED_TRANSCRIPTS_DISABLED, LIGHTSPEED_FEEDBACK_DISABLED, DISABLE_QUERY_SYSTEM_PROMPT.
Gitignore Update
.gitignore
Added entry: .template-params.override.env to ignore local override parameter files.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant Script as scripts/generate.sh
    participant FS as Filesystem
    participant OC as oc process
    participant YQ as yq

    Dev->>Script: Run generate.sh
    Script->>FS: Check for .template-params.override.env
    alt Override file exists
        Script->>OC: oc process template.yaml with override + template-params.dev.env
    else No override file
        Script->>OC: oc process template.yaml with template-params.dev.env
    end
    OC-->>Script: Processed template (stdout)
    Script->>YQ: Extract lightspeed-stack.yaml from ConfigMap item
    YQ-->>FS: Write config/lightspeed-stack.yaml
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Possibly related PRs

Suggested labels

lgtm

Suggested reviewers

  • eranco74
  • jhernand
  • omertuc
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@openshift-ci
Copy link

openshift-ci bot commented Aug 5, 2025

Hi @keitwb. Thanks for your PR.

I'm waiting for a rh-ecosystem-edge member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 kubernetes-sigs/prow repository.

@keitwb
Copy link
Collaborator Author

keitwb commented Aug 5, 2025

I split this out to its own PR since it isn't a hard dependency of the exporter stuff and that stuff is blocked pending approvals from other teams.

Copy link

@coderabbitai coderabbitai bot left a comment

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)
.gitignore (1)

11-11: Missing ignore rule for the YAML-based override file mentioned in the PR description

The PR text states that users can create a .template-params.override.yaml, but only the .env variant is ignored. Either add the YAML entry or update the docs/PR text to avoid confusion and accidental commits.

 .template-params.override.env
+.template-params.override.yaml
scripts/generate.sh (1)

28-30: Quote the override path to avoid word-splitting

If $PROJECT_ROOT ever contains spaces the current expansion will break.

-OVERRIDE_FILE=$PROJECT_ROOT/.template-params.override.env
+OVERRIDE_FILE="$PROJECT_ROOT/.template-params.override.env"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 90e6160 and 6827e7c.

📒 Files selected for processing (5)
  • .gitignore (1 hunks)
  • lightspeed-stack.template.yaml (0 hunks)
  • scripts/generate.sh (2 hunks)
  • template-params.dev.env (1 hunks)
  • template.yaml (4 hunks)
💤 Files with no reviewable changes (1)
  • lightspeed-stack.template.yaml
🔇 Additional comments (1)
template.yaml (1)

103-112: Template parameters and dev env file out of sync

The newly added parameters are correct, but keep in mind the mismatch flagged in template-params.dev.env; until that file is fixed, users will not be able to override these values successfully.

Comment on lines +28 to +36
if [[ -f $OVERRIDE_FILE ]]; then
OVERRIDE_PARAMS="--param-file=$OVERRIDE_FILE"
fi

oc process --local \
-f $PROJECT_ROOT/template.yaml \
${OVERRIDE_PARAMS-} \
--param-file=$PROJECT_ROOT/template-params.dev.env | \
yq '.items[] | select(.kind == "ConfigMap" and .metadata.name == "lightspeed-stack-config").data."lightspeed-stack.yaml"' -r \
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Override file loses precedence due to parameter-file order

oc process applies later --param-file arguments last, overriding earlier ones.
Placing ${OVERRIDE_PARAMS-} before template-params.dev.env means dev defaults will overwrite local overrides.

Swap the order (or add a dedicated -p per-param flag) so overrides truly win.

-  ${OVERRIDE_PARAMS-} \
-  --param-file=$PROJECT_ROOT/template-params.dev.env | \
+  --param-file=$PROJECT_ROOT/template-params.dev.env \
+  ${OVERRIDE_PARAMS-} | \
🤖 Prompt for AI Agents
In scripts/generate.sh around lines 28 to 36, the override parameter file is
specified before the default dev environment parameter file, causing the
defaults to overwrite the overrides. To fix this, reorder the `oc process`
command arguments so that `${OVERRIDE_PARAMS-}` comes after
`--param-file=$PROJECT_ROOT/template-params.dev.env`, ensuring the override
parameters take precedence as intended.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, that is the opposite of how it actually works.

@keitwb keitwb force-pushed the config-from-template branch from 6827e7c to 6d25d25 Compare August 5, 2025 18:52
@eranco74
Copy link
Collaborator

eranco74 commented Aug 6, 2025

/ok-to-test
/lgtm

@eranco74
Copy link
Collaborator

eranco74 commented Aug 7, 2025

/approve

@openshift-ci
Copy link

openshift-ci bot commented Aug 7, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: eranco74, keitwb

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

The pull request process is described here

Needs approval from an approver in each of these files:

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

@eranco74
Copy link
Collaborator

eranco74 commented Aug 7, 2025

/ok-to-test

I checked to make sure it corresponds to the existing
lightspeed-stack.template.yaml in terms of values.

Local overrides can be added by creating a
.template-params.override.yaml file in the project root.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
scripts/generate.sh (1)

32-37: Param precedence: verify which --param-file wins; also add quoting and explicit -o yaml

There’s prior discussion about which param-file takes precedence. Many CLIs apply “last wins,” but please verify oc process behavior to ensure local overrides truly win. Meanwhile, quoting improves robustness, and -o yaml makes output format explicit.

Verification (docs/web):

In `oc process`, when multiple `--param-file` flags are provided, which one takes precedence if the same key appears in both? Does the "last provided" override earlier values?

If “last wins,” consider this reordering and quoting:

-oc process  --local \
-  -f $PROJECT_ROOT/template.yaml \
-  ${OVERRIDE_PARAMS-} \
-  --param-file=$PROJECT_ROOT/template-params.dev.env | \
+oc process --local -o yaml \
+  -f "$PROJECT_ROOT/template.yaml" \
+  --param-file="$PROJECT_ROOT/template-params.dev.env" \
+  ${OVERRIDE_PARAMS+"${OVERRIDE_PARAMS[@]}"} | \
   yq '.items[] | select(.kind == "ConfigMap" and .metadata.name == "lightspeed-stack-config").data."lightspeed-stack.yaml"' -r \
-  > $PROJECT_ROOT/config/lightspeed-stack.yaml
+  > "$PROJECT_ROOT/config/lightspeed-stack.yaml"

If “first wins,” keep current order but still apply quoting and -o yaml:

-oc process  --local \
-  -f $PROJECT_ROOT/template.yaml \
-  ${OVERRIDE_PARAMS-} \
-  --param-file=$PROJECT_ROOT/template-params.dev.env | \
+oc process --local -o yaml \
+  -f "$PROJECT_ROOT/template.yaml" \
+  ${OVERRIDE_PARAMS+"${OVERRIDE_PARAMS[@]}"} \
+  --param-file="$PROJECT_ROOT/template-params.dev.env" | \
   yq '.items[] | select(.kind == "ConfigMap" and .metadata.name == "lightspeed-stack-config").data."lightspeed-stack.yaml"' -r \
-  > $PROJECT_ROOT/config/lightspeed-stack.yaml
+  > "$PROJECT_ROOT/config/lightspeed-stack.yaml"
🧹 Nitpick comments (1)
scripts/generate.sh (1)

28-31: Quote OVERRIDE_FILE and avoid word-splitting; consider args array

Use quotes in the -f test and build OVERRIDE_PARAMS as an array to safely handle paths with spaces and avoid accidental word-splitting.

-if [[ -f $OVERRIDE_FILE ]]; then
-  OVERRIDE_PARAMS="--param-file=$OVERRIDE_FILE"
-fi
+OVERRIDE_PARAMS=()
+if [[ -f "$OVERRIDE_FILE" ]]; then
+  OVERRIDE_PARAMS+=(--param-file "$OVERRIDE_FILE")
+fi
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c192719 and 0225e12.

📒 Files selected for processing (5)
  • .gitignore (1 hunks)
  • lightspeed-stack.template.yaml (0 hunks)
  • scripts/generate.sh (2 hunks)
  • template-params.dev.env (1 hunks)
  • template.yaml (4 hunks)
💤 Files with no reviewable changes (1)
  • lightspeed-stack.template.yaml
✅ Files skipped from review due to trivial changes (2)
  • .gitignore
  • template-params.dev.env
🚧 Files skipped from review as they are similar to previous changes (1)
  • template.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Red Hat Konflux / assisted-chat-saas-main-on-pull-request
🔇 Additional comments (1)
scripts/generate.sh (1)

8-9: Good: clear, single source for local overrides

Centralizing the override path in OVERRIDE_FILE is clean and aligns with the PR goal.

@eranco74
Copy link
Collaborator

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Aug 11, 2025
@openshift-merge-bot openshift-merge-bot bot merged commit d2e8433 into rh-ecosystem-edge:main Aug 11, 2025
5 checks passed
@keitwb keitwb deleted the config-from-template branch August 11, 2025 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants