Skip to content

Conversation

@omertuc
Copy link
Member

@omertuc omertuc commented Aug 13, 2025

See commit message

Summary by CodeRabbit

  • New Features

    • Default assisted-chat model set to gemini/gemini-2.0-flash; default provider updated to Gemini/Vertex integration.
    • New configurable parameters: ASSISTED_CHAT_DEFAULT_MODEL, VERTEX_API_SECRET_NAME, USER_ID_CLAIM, USERNAME_CLAIM, LIGHTSSPEED_STACK_POSTGRES_SSL_MODE, LLAMA_STACK_POSTGRES_SSL_MODE.
  • Chores

    • Switch inference to Vertex credentials and mount service account for deployments; remove legacy exporter and direct Gemini secret wiring.
    • Improved interactive credential setup with prompts and overwrite protection.
    • Added CI/local deploy targets and streamlined deploy flow with secret handling and readiness checks.
  • Tests

    • CI test runner and test templates updated; some storage layouts switched to SQLite and Gemini env/params removed.

@openshift-ci
Copy link

openshift-ci bot commented Aug 13, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci
Copy link

openshift-ci bot commented Aug 13, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: omertuc

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

@coderabbitai
Copy link

coderabbitai bot commented Aug 13, 2025

Walkthrough

Replaces Gemini/Llama direct wiring with Vertex credential plumbing and a default ASSISTED_CHAT_DEFAULT_MODEL; parameterizes JWT claims and DB SSL modes; mounts Vertex service-account secret into the deployment; updates generator and deploy scripts to handle Vertex credentials and in-cluster secret creation; moves many test stores to SQLite.

Changes

Cohort / File(s) Summary of changes
Dev env params
template-params.dev.env
Added ASSISTED_CHAT_DEFAULT_MODEL=gemini/gemini-2.0-flash.
Top-level template & ConfigMaps
template.yaml, templates/.../lightspeed-stack-config, templates/.../llama-stack-client-config
Removed Gemini/LLAMA-specific params; added VERTEX_API_SECRET_NAME, ASSISTED_CHAT_DEFAULT_MODEL, USER_ID_CLAIM, USERNAME_CLAIM, LIGHTSSPEED_STACK_POSTGRES_SSL_MODE, LLAMA_STACK_POSTGRES_SSL_MODE; lightspeed default_model → ${ASSISTED_CHAT_DEFAULT_MODEL}, default_provider → gemini; llama-stack-client-config provider → gemini/remote::gemini with dummy api_key; models list emptied; jwt_config claims parameterized.
Deployment env, volumes & containers
template.yaml, templates/.../deployment
Removed GEMINI_API_KEY secret wiring and lightspeed-to-dataverse-exporter container; added GOOGLE_APPLICATION_CREDENTIALS=/app-root/google-vertex-service-account.json; added google-vertex-service-account secret volume (secretName: ${VERTEX_API_SECRET_NAME}) and volumeMount (subPath: service_account).
Interactive generator
scripts/generate.sh
Added Vertex credential prompts and overwrite confirmation; Gemini path writes dummy Vertex creds if missing; Vertex path copies provided creds after confirmation; sets dummy GEMINI_API_KEY when Vertex creds used; updated user messages.
CI/local deploy & helpers
scripts/deploy_template.sh, Makefile
deploy_template.sh: added SECRETS_BASE_PATH default, quoted ASSISTED_CHAT_IMG, secrets inventory, creates in-cluster secrets if missing (vertex service account, insights-ingress token, llama-stack-db, postgres-secret), optional Postgres deployment/service, uses oc process --local with new params, filters Route resources, waits on deployment availability. Makefile: added deploy-template, ci-test, deploy-template-local targets and updated .PHONY; deploy-template-local prepares /tmp/secrets/vertex and invokes deploy script with NAMESPACE/SECRETS_BASE_PATH/ASSISTED_CHAT_IMG.
Prow / tests and patches
test/prow/template.yaml, test/prow/template_patch.diff, test/prow/entrypoint.sh, scripts/ci_test.sh
Removed GEMINI_API_KEY env and GEMINI_API_SECRET_NAME/KEY params from prow template; template_patch.diff migrates stores from Postgres to SQLite and removes lightspeed-to-dataverse-exporter and related volumes/config; entrypoint.sh fixes token write quoting and trailing newline; added scripts/ci_test.sh CI test runner that creates secrets, applies prow template, polls test pod, and reports results.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Lightspeed as LightspeedStack
  participant Llama as LlamaStackClient
  participant Vertex as VertexAI
  Note over Lightspeed,Llama: Config defaults to ASSISTED_CHAT_DEFAULT_MODEL\nand default_provider="gemini"
  User->>Lightspeed: send chat request
  Lightspeed->>Llama: forward inference request
  rect rgb(232,245,233)
    Note right of Llama: LlamaStack uses mounted\nGOOGLE_APPLICATION_CREDENTIALS (service-account JSON)
  end
  Llama->>Vertex: authenticated inference call (via service account)
  Vertex-->>Llama: inference response
  Llama-->>Lightspeed: result
  Lightspeed-->>User: reply
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

lgtm

Suggested reviewers

  • keitwb
  • jhernand
  • eranco74
✨ 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.
  • 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 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/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@omertuc omertuc marked this pull request as ready for review August 13, 2025 16:36
@openshift-ci openshift-ci bot requested review from jhernand and keitwb August 13, 2025 16:36
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: 3

🔭 Outside diff range comments (1)
template.yaml (1)

274-279: Broken template references: undefined provider_id/provider_type parameters

These lines still reference ${LLAMA_STACK_INFERENCE_PROVIDER} and ${LLAMA_STACK_INFERENCE_PROVIDER_TYPE}, but those parameters were removed. This will leave unresolved placeholders in the rendered ConfigMap and likely break startup.

Replace the inference providers block with an empty list to match the “auto-discovery” intent:

       providers:
-        inference:
-        - provider_id: ${LLAMA_STACK_INFERENCE_PROVIDER}
-          provider_type: ${LLAMA_STACK_INFERENCE_PROVIDER_TYPE}
-          config:
-            api_key: dummy-to-stop-llama-stack-from-complaining-even-though-we-use-vertex-and-not-gemini-directly
+        inference: []

If you still need an explicit provider, hard-code the correct provider_id/provider_type instead of param references, or reintroduce those parameters.

🧹 Nitpick comments (1)
template.yaml (1)

110-112: Quote the default model value for consistency and YAML safety

Minor consistency nit. Most string parameter values are quoted; quoting here avoids accidental type coercion by YAML parsers.

Apply this diff:

-  value: gemini-2.0-flash
+  value: "gemini-2.0-flash"
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between cdb608e and 3382b98.

📒 Files selected for processing (2)
  • template-params.dev.env (1 hunks)
  • template.yaml (8 hunks)
🔇 Additional comments (4)
template-params.dev.env (1)

7-7: Verify model ID format consistency between dev and cluster configs

Dev uses "gemini/gemini-2.0-flash" while template default uses "gemini-2.0-flash". Confirm that Lightspeed accepts both with default_provider=gemini (no duplication or mismatch), or standardize to one format across environments.

template.yaml (3)

47-49: Confirm Vertex service-account secret content and key naming

Good addition. Ensure the secret contains a single JSON key for the service account and that its filename matches the mount/subPath you intend to use below (see comments on Lines 440-442 and 499-501). Otherwise, the SDK won’t find creds via GOOGLE_APPLICATION_CREDENTIALS.


158-160: Validate provider/model alignment with Vertex-backed Gemini

You’re hard-coding default_provider: gemini and letting models be auto-discovered. That’s fine if Lightspeed treats Vertex-backed Gemini as provider “gemini.” Please confirm that:

  • “gemini” is the correct provider id for Vertex, and
  • default_model accepts both “gemini-2.0-flash” and “gemini/gemini-2.0-flash” when default_provider is set.

333-333: Models list emptied as intended

Setting models: [] aligns with the goal to let Lightspeed/Llama auto-discover Vertex AI models.

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

🔭 Outside diff range comments (1)
template.yaml (1)

391-397: Remove unused GEMINI_API_KEY env and rely solely on Vertex credentials
The env var still references a secret that may not exist anymore, contradicting the PR goal and potentially breaking deployment. The dummy key in the client config suffices.

Apply this diff:

-          - name: GEMINI_API_KEY
-            valueFrom:
-              secretKeyRef:
-                name: ${GEMINI_API_SECRET_NAME}
-                key: api_key
           - name: GOOGLE_APPLICATION_CREDENTIALS
             value: /app-root/google-vertex-service-account.json
♻️ Duplicate comments (2)
template.yaml (2)

452-455: Mount the secret as a single file with predictable name and read-only
Current subPath is “service_account”, which assumes the secret key is named exactly that. Pin the filename and mark the mount read-only.

Apply this diff (adjust key name if your secret uses a different one):

           - name: google-vertex-service-account
-            mountPath: /app-root/google-vertex-service-account.json
-            subPath: service_account
+            mountPath: /app-root/google-vertex-service-account.json
+            subPath: google-vertex-service-account.json
+            readOnly: true

512-515: Define secret items to ensure the expected filename exists inside the volume
Without items, subPath must match an existing secret key name. Map the secret key to the desired filename to make this robust.

Apply this diff (replace the key if your actual secret uses a different one):

         - name: google-vertex-service-account
           secret:
             secretName: ${VERTEX_API_SECRET_NAME}
+            items:
+            - key: google-vertex-service-account.json
+              path: google-vertex-service-account.json
🧹 Nitpick comments (1)
template.yaml (1)

50-52: Document the expected secret key name for the Vertex SA JSON

Please clarify in the parameter description which key name the secret must contain (so volumes/subPath work predictably). Suggest mentioning the exact filename you intend to mount (see related mount comments below).

Proposed description tweak:

-  description: "Name of the Kubernetes secret containing the Vertex service account credentials"
+  description: "Name of the Kubernetes secret containing the Vertex service account credentials (must include key: google-vertex-service-account.json)"
📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these settings in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3382b98 and 2146ad4.

📒 Files selected for processing (2)
  • template-params.dev.env (1 hunks)
  • template.yaml (8 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • template-params.dev.env
🔇 Additional comments (3)
template.yaml (3)

161-163: Confirm default_model matches a declared model_id
After updating the parameter above, this will correctly resolve to a declared model_id. If you intentionally want to allow unqualified names, confirm lightspeed-stack resolves them at runtime.


278-282: Using a dummy Gemini API key in client config is acceptable here
This aligns with the plan to rely on Vertex while satisfying llama-stack’s provider validation.


337-340: Models list correctly uses provider-qualified ID
The model entry is consistent with the chosen provider and expected format.

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: 1

🔭 Outside diff range comments (1)
template.yaml (1)

391-395: Remove legacy GEMINI_API_KEY env and secret param from all files (multiple references remain)

rg found live references — removing only template.yaml is not enough. Clean or replace these occurrences to avoid stale secret dependencies.

  • template.yaml (lines shown by rg: 47, 391–395): remove the GEMINI_API_KEY env block and the GEMINI_API_SECRET_NAME parameter.
  • test/prow/template.yaml (lines ~36, 40, 76): remove the GEMINI_API_KEY env block and the GEMINI_API_SECRET_NAME parameter.
  • assisted-chat-pod.yaml (lines 10–11 and 80–81): remove GEMINI_API_KEY env entries (value: ${GEMINI_API_KEY}) or switch to Vertex creds.
  • scripts/generate.sh (lines ~19–20, ~39): stop prompting for/writing GEMINI_API_KEY to .env and remove the dummy fallback.
  • config/llama_stack_client_config.yaml (line ~19): remove or replace api_key: ${env.GEMINI_API_KEY:=} to use Vertex configuration or make optional.
  • test/evals/README.md (line ~14): update docs that mention GEMINI_API_KEY.

Apply this diff to template.yaml (at the snippet in the original comment):

-          - name: GEMINI_API_KEY
-            valueFrom:
-              secretKeyRef:
-                name: ${GEMINI_API_SECRET_NAME}
-                key: api_key

After making changes, re-run:
rg -n --no-heading $'GEMINI_API_KEY|GEMINI_API_SECRET_NAME'

♻️ Duplicate comments (3)
template.yaml (3)

47-49: Remove obsolete GEMINI_API_SECRET_NAME parameter

This parameter is no longer used per the PR objectives and leaves dead/confusing surface in the template.

Apply this diff to drop it:

- - name: GEMINI_API_SECRET_NAME
-   value: "assisted-chat-gemini-secret"
-   description: "Name of the Kubernetes secret containing the Gemini API key"

113-115: Fully-qualify ASSISTED_CHAT_DEFAULT_MODEL to prevent lookup mismatch

Configured models and provider selection expect a provider-qualified model id. Use gemini/gemini-2.0-flash.

Apply this diff:

- - name: ASSISTED_CHAT_DEFAULT_MODEL
-   value: gemini-2.0-flash
+ - name: ASSISTED_CHAT_DEFAULT_MODEL
+   value: "gemini/gemini-2.0-flash"

396-397: Align secret mount with GOOGLE_APPLICATION_CREDENTIALS; make mount read-only and pin filename

GOOGLE_APPLICATION_CREDENTIALS points to /app-root/google-vertex-service-account.json (template.yaml:397), but the volumeMount uses subPath: service_account and the secret has no pinned items. Update the mount and secret so the file exists at the exact path and is read-only.

Files to update:

  • template.yaml:397 (env var)
  • template.yaml:452-454 (volumeMount)
  • template.yaml:512-514 (secret)

Apply these diffs:

  1. Make the single-file mount read-only and use a stable subPath that matches the mounted filename:
           - name: google-vertex-service-account
             mountPath: /app-root/google-vertex-service-account.json
-            subPath: service_account
+            subPath: google-vertex-service-account.json
+            readOnly: true
  1. Pin the secret key to the expected filename via items (replace the key if your secret uses a different key name):
         - name: google-vertex-service-account
           secret:
             secretName: ${VERTEX_API_SECRET_NAME}
+            items:
+            - key: service_account
+              path: google-vertex-service-account.json

Quick verification: confirm the actual key name inside the secret before applying (e.g. kubectl -n get secret ${VERTEX_API_SECRET_NAME} -o yaml) and replace "service_account" if needed.

📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these settings in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2146ad4 and dd5d860.

📒 Files selected for processing (2)
  • template-params.dev.env (1 hunks)
  • template.yaml (8 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • template-params.dev.env
🔇 Additional comments (3)
template.yaml (3)

50-52: LGTM: Vertex credentials parameter added

VERTEX_API_SECRET_NAME addition and description look correct and aligned with the PR goal.


161-163: LGTM: default provider/model wiring into lightspeed config

default_model via parameter and default_provider: gemini are consistent with the Vertex switch. Will be correct after the parameter is fully qualified.


278-282: LGTM: Provider set to gemini with dummy api_key

Matches the intent to route via Vertex while satisfying llama-stack validation.

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

🔭 Outside diff range comments (1)
template.yaml (1)

399-403: Remove obsolete GEMINI_API_KEY env (prevents deployment failures if secret is absent)

This deployment still requires the Gemini secret even though the PR switches to Vertex and the client config uses a dummy key. If the secret isn’t present in the cluster, the pod will fail to schedule. Remove this env block.

-          - name: GEMINI_API_KEY
-            valueFrom:
-              secretKeyRef:
-                name: ${GEMINI_API_SECRET_NAME}
-                key: api_key
♻️ Duplicate comments (3)
template.yaml (3)

113-115: Fully-qualify the default model to match model IDs used elsewhere

To avoid lookup mismatches with the models list and provider, set the default to a fully-qualified model ID and quote it.

- name: ASSISTED_CHAT_DEFAULT_MODEL
-  value: gemini-2.0-flash
+ name: ASSISTED_CHAT_DEFAULT_MODEL
+  value: "gemini/gemini-2.0-flash"

345-348: Remove hard-coded model; rely on auto-discovery

Per PR objectives, models should be discovered automatically by lightspeed-stack. Keeping a hard-coded model risks drift and conflicts.

-      models:
-      - model_id: gemini/gemini-2.0-flash
-        provider_id: gemini
-        provider_model_id: gemini/gemini-2.0-flash
-        model_type: llm
+      models: []

47-49: Remove obsolete GEMINI_API_SECRET_NAME parameter

This parameter is no longer used with the Vertex switch and retaining it is misleading.

- - name: GEMINI_API_SECRET_NAME
-   value: "assisted-chat-gemini-secret"
-   description: "Name of the Kubernetes secret containing the Gemini API key"
🧹 Nitpick comments (1)
template.yaml (1)

404-406: Ensure mounted secret key name matches subPath and mark mount read-only

The env var points to a file path which is fine with subPath. However, the subPath refers to "service_account" and the volume lacks items. Unless the secret actually has a key named "service_account", the mount will fail. Also, secret mounts should be read-only.

  • Verify the secret’s data key is "service_account" (or update subPath/items accordingly).
  • Mark the mount read-only.
  • Pin the secret key-to-filename mapping via items for predictability.

Apply:

           - name: google-vertex-service-account
             mountPath: /app-root/google-vertex-service-account.json
-            subPath: service_account
+            subPath: service_account
+            readOnly: true

And:

         - name: google-vertex-service-account
           secret:
             secretName: ${VERTEX_API_SECRET_NAME}
+            items:
+            - key: service_account
+              path: service_account

If your actual secret uses a different key (e.g., "google-vertex-service-account.json"), change both items.key and the volumeMount subPath to that exact key.

Also applies to: 460-463, 520-522

📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between dd5d860 and 5797c6e.

📒 Files selected for processing (2)
  • template-params.dev.env (1 hunks)
  • template.yaml (8 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • template-params.dev.env
🔇 Additional comments (3)
template.yaml (3)

50-52: Vertex secret parameter addition looks good

Parameter aligns with PR goals and description is clear.


161-163: Inference defaults align with the Vertex/Gemini switch

Referencing ${ASSISTED_CHAT_DEFAULT_MODEL} and setting default_provider to gemini is consistent with the new setup.


286-290: Intentional dummy API key is acceptable given Vertex usage

Using a dummy api_key to satisfy llama-stack while actually using Vertex credentials matches the PR rationale.

Copy link
Collaborator

@eranco74 eranco74 left a comment

Choose a reason for hiding this comment

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

/lgtm

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

🔭 Outside diff range comments (1)
scripts/generate.sh (1)

56-66: Harden secret handling: set strict file permissions after copy

After copying the service account JSON, explicitly set its permissions to 600 to avoid accidental exposure if the source file had permissive bits.

             cp "$VERTEX_AI_SERVICE_ACCOUNT_CREDENTIALS_PATH" "$PROJECT_ROOT/config/vertex-credentials.json"
+            chmod 600 "$PROJECT_ROOT/config/vertex-credentials.json"
 
             # We must set the GEMINI_API_KEY to a dummy value, as
             # lightspeed-stack wrongly expects it to be set for all Gemini
             # providers, even if we are using Vertex AI service account
             # authentication.
             echo GEMINI_API_KEY="dummy" >"$PROJECT_ROOT/.env"
             chmod 600 "$PROJECT_ROOT/.env"
 
             echo "Vertex credentials successfully configured."

Optional alternative (copies with desired mode in a single step):

-            cp "$VERTEX_AI_SERVICE_ACCOUNT_CREDENTIALS_PATH" "$PROJECT_ROOT/config/vertex-credentials.json"
-            chmod 600 "$PROJECT_ROOT/config/vertex-credentials.json"
+            install -m 600 "$VERTEX_AI_SERVICE_ACCOUNT_CREDENTIALS_PATH" "$PROJECT_ROOT/config/vertex-credentials.json"
🧹 Nitpick comments (1)
scripts/generate.sh (1)

27-27: Nit: fix wording in the user-facing message

Minor grammar polish.

-                echo 'Also creating a dummy Vertex AI service account credentials file at config/vertex-credentials.json. If you want to use to be able to use both, modify config/vertex-credentials.json manually.'
+                echo 'Also creating a dummy Vertex AI service account credentials file at config/vertex-credentials.json. If you want to be able to use both, modify config/vertex-credentials.json manually.'
📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5797c6e and ded5432.

📒 Files selected for processing (3)
  • scripts/generate.sh (3 hunks)
  • template-params.dev.env (1 hunks)
  • template.yaml (8 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • template-params.dev.env
  • template.yaml

@omertuc
Copy link
Member Author

omertuc commented Aug 15, 2025

/hold wait for eval-test results

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 (2)
template.yaml (2)

453-456: Mount secret as a single file and mark read-only

Add readOnly: true and align subPath to a deterministic filename that exists in the secret. Right now subPath: service_account requires the secret key to be named “service_account”.

Apply this diff (matches the volumes items suggestion in the next comment):

-          - name: google-vertex-service-account
-            mountPath: /app-root/google-vertex-service-account.json
-            subPath: service_account
+          - name: google-vertex-service-account
+            mountPath: /app-root/google-vertex-service-account.json
+            subPath: google-vertex-service-account.json
+            readOnly: true

486-489: Pin secret filename using items to match GOOGLE_APPLICATION_CREDENTIALS

Without items, the file name depends on the secret key name. Pin it to a stable filename and match the volumeMount subPath.

If your secret key is “service_account”, map it like this:

         - name: google-vertex-service-account
           secret:
             secretName: ${VERTEX_API_SECRET_NAME}
+            items:
+            - key: service_account
+              path: google-vertex-service-account.json

If the actual key name differs, change key: accordingly, keeping path: google-vertex-service-account.json to match the subPath and env path.

🧹 Nitpick comments (4)
template.yaml (4)

110-112: Default model likely mismatched (unqualified ID)

Your models list is empty and provider IDs elsewhere are “gemini/...”. An unqualified default like “gemini-2.0-flash” may not resolve.

Consider fully-qualifying to match provider naming or update to whatever the runtime expects.

Apply one of the following diffs (pick the one that matches your runtime):

-  value: gemini-2.0-flash
+  value: "gemini/gemini-2.0-flash"

or, if you intend to use Vertex-qualified IDs:

-  value: gemini-2.0-flash
+  value: "vertex/gemini-2.0-flash"

118-120: Typo in parameter name: LIGHTSSPEED_...

Parameter name has an extra “S” (LIGHTSSPEED). This propagates everywhere it’s referenced.

If you want this fixed for clarity (and to avoid future drift), rename consistently in the template and in any scripts that render it.

Proposed local changes (remember to update scripts/deploy_template.sh, template-params.dev.env, and test/prow/template.yaml accordingly):

- name: LIGHTSSPEED_STACK_POSTGRES_SSL_MODE
+ name: LIGHTSPEED_STACK_POSTGRES_SSL_MODE
   value: "verify-full"
   description: "SSL mode for the PostgreSQL database connection used by lightspeed-stack"

and later (Line 176):

-          ssl_mode: ${LIGHTSSPEED_STACK_POSTGRES_SSL_MODE}
+          ssl_mode: ${LIGHTSPEED_STACK_POSTGRES_SSL_MODE}

167-169: Confirm default_provider vs. “Switch to Vertex” intention

default_provider is set to “gemini” while the PR title states a switch to Vertex. If the plan is to route via Vertex using the Gemini provider wiring (and GOOGLE_APPLICATION_CREDENTIALS), that’s fine, but please confirm this is intentional to avoid confusion.

If you expect a Vertex-named provider, align provider IDs across lightspeed-stack and llama client config.

Would you like me to propose a follow-up patch that documents this in a comment next to default_provider to make intent explicit?


294-298: Remote Gemini provider with dummy API key — ensure it’s never used at runtime

If llama-stack ever routes inference to this provider, the dummy key will cause runtime failures. If this is only to satisfy config validation, consider:

  • gating usage via a non-default provider_id, or
  • adding a clarifying comment,
  • or using an “inline::noop”/disabled flag if supported.

Want me to check llama-stack docs and suggest a provider config that validates without needing a dummy API key?

📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between eaae143 and d515509.

📒 Files selected for processing (7)
  • Makefile (2 hunks)
  • scripts/deploy_template.sh (1 hunks)
  • scripts/generate.sh (3 hunks)
  • template-params.dev.env (1 hunks)
  • template.yaml (9 hunks)
  • test/prow/template.yaml (0 hunks)
  • test/prow/template_patch.diff (0 hunks)
💤 Files with no reviewable changes (2)
  • test/prow/template.yaml
  • test/prow/template_patch.diff
🚧 Files skipped from review as they are similar to previous changes (4)
  • template-params.dev.env
  • scripts/generate.sh
  • Makefile
  • scripts/deploy_template.sh
⏰ 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 (5)
template.yaml (5)

47-49: Good addition: Vertex credentials parameter introduced

Parameterizing the Vertex service-account secret name is the right direction for different envs (dev/CI/prod). No functional concerns here.


150-151: JWT claim parameterization LGTM

Binding user_id_claim and username_claim to parameters improves flexibility for different IdPs. Looks correct.


176-176: verify-full requires a CA (or system trust) — double-check deployment

With ssl_mode=verify-full and db-ca-cert optional, TLS will fail unless the DB cert chains to a trusted CA available in /etc/pki/ca-trust (or you provide db.ca_cert). Either:

  • make db.ca_cert non-optional, or
  • document reliance on cluster trust bundle.

I can provide a small guard to switch ssl_mode to “require” when db.ca_cert is absent if desired.


352-352: Models discovery: empty list looks good

Leaving models empty to rely on discovery/remote provider config avoids drift. Good call.


403-405: GOOGLE_APPLICATION_CREDENTIALS path is fine — ensure the mount exposes a single file at that path

This aligns with the mount path below. See next comments to make the mount read-only and to pin the filename via items/subPath to avoid accidental directory mounts.

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: 1

♻️ Duplicate comments (2)
template.yaml (2)

110-112: Default model should be fully qualified to match model IDs

Your models are provider-qualified (e.g., gemini/...). Keep the default the same format to avoid mismatches at lookup time.

-  value: gemini-2.0-flash
+  value: "gemini/gemini-2.0-flash"

495-497: Pin secret items to match subPath and fix potential key mismatch

Without items, the file name inside the mount is whatever the secret key name is. Pin it to service_account so it matches the subPath. Also align the deploy script to create the secret with key service_account.

         - name: google-vertex-service-account
           secret:
             secretName: ${VERTEX_API_SECRET_NAME}
+            items:
+            - key: service_account
+              path: service_account

Follow-up required in scripts/deploy_template.sh:

  • Create the secret with --from-file=service_account="$SECRETS_BASE_PATH/vertex/service_account" (underscore) to match this key.
  • Ensure the file path exists (see my Makefile comment).

I can provide the exact script diff to standardize the key/path.

🧹 Nitpick comments (1)
template.yaml (1)

462-465: Mount Vertex secret as read-only and ensure key/subPath exist

Minor hardening: mark the secret mount read-only. Also, this subPath requires a secret key named service_account — add items on the secret volume (see below).

           - name: google-vertex-service-account
             mountPath: /app-root/google-vertex-service-account.json
             subPath: service_account
+            readOnly: true
📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between bebf4a8 and a4fe4cf.

📒 Files selected for processing (7)
  • Makefile (2 hunks)
  • scripts/deploy_template.sh (1 hunks)
  • scripts/generate.sh (3 hunks)
  • template-params.dev.env (1 hunks)
  • template.yaml (11 hunks)
  • test/prow/template.yaml (0 hunks)
  • test/prow/template_patch.diff (0 hunks)
💤 Files with no reviewable changes (2)
  • test/prow/template.yaml
  • test/prow/template_patch.diff
🚧 Files skipped from review as they are similar to previous changes (3)
  • template-params.dev.env
  • scripts/generate.sh
  • scripts/deploy_template.sh
🔇 Additional comments (12)
Makefile (3)

8-8: PHONY list updated correctly

New targets are properly added to .PHONY. No issues.


10-10: AI summary inconsistency: all target doesn’t include new targets

The summary claims the new targets are prerequisites of all, but all still only shows help. If that was intended, ignore this. If not, wire them up.

Would you like all to run any of these targets (e.g., deploy-template)? If so, I can propose the exact Makefile wiring.


36-37: CI deploy target is fine

Target reads well and delegates to the script as expected.

template.yaml (9)

47-49: Vertex secret parameter looks good

Clear parameterization of the secret name; aligns with the new volume in the Deployment.


153-155: JWT claim parameterization looks correct

Good move making claims configurable; matches the auth module expectations.


170-172: Default provider set to gemini — confirm intended with Vertex-backed flow

Given the Vertex credentials, keeping default_provider as gemini is fine if llama-stack routes via a gemini remote provider. Just confirm this is the path you expect in production.

Would you like me to scan the config to ensure no direct Gemini API key usage paths are still live?


179-179: SSL mode wired to template param — OK, but ensure the same param naming is used everywhere

This references LIGHTSSPEED_STACK_POSTGRES_SSL_MODE; ensure deploy scripts and dev overrides pass the same spelling (see earlier comment).

I can generate a quick check against scripts/deploy_template.sh if helpful.


297-301: Gemini provider with dummy key — safe placeholder

Using a dummy key avoids startup errors without exposing secrets. Looks good.


315-316: Postgres SSL mode parameterization is consistent

These sections correctly reference LLAMA_STACK_POSTGRES_SSL_MODE; no issues.

Also applies to: 324-325, 359-360


361-361: Models list empty — aligns with discovery approach

Keeping models: [] fits the intent to avoid hard-coded entries.


412-414: GOOGLE_APPLICATION_CREDENTIALS env set — ensure the mounted file path exists

Path matches the volumeMount. Once the secret key/subPath alignment is fixed (see below), this will work.


118-123: LIGHTSSPEED_STACK_POSTGRES_SSL_MODE spelling is consistent across the repo
All occurrences of this parameter use the “LIGHTSSPEED” spelling, and the expected “LIGHTSPEED_STACK_POSTGRES_SSL_MODE” variant does not appear in any files. To avoid breaking existing deployment tooling, leave the name as-is in this PR. If you’d like to standardize the spelling, please open a follow-up to rename the parameter in template.yaml, scripts/deploy_template.sh, and any downstream consumers.

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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
template.yaml (1)

393-393: Fix OpenShift template parameter syntax (${{...}} → ${...})

OpenShift templates require ${PARAM}. Using ${{...}} prevents substitution, likely producing invalid manifests (e.g., non-integer port/replica values).

Apply this diff:

-    replicas: ${{REPLICAS_COUNT}}
+    replicas: ${REPLICAS_COUNT}
@@
-            containerPort: ${{SERVICE_PORT}}
+            containerPort: ${SERVICE_PORT}
@@
-              port: ${{SERVICE_PORT}}
+              port: ${SERVICE_PORT}
@@
-              port: ${{SERVICE_PORT}}
+              port: ${SERVICE_PORT}
@@
-      port: ${{SERVICE_PORT}}
-      targetPort: ${{SERVICE_PORT}}
+      port: ${SERVICE_PORT}
+      targetPort: ${SERVICE_PORT}

Also applies to: 409-409, 473-473, 481-481, 518-519

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

18-21: Secret key now matches template subPath (good)

Key name service_account aligns with the template’s subPath: service_account. This unblocks GOOGLE_APPLICATION_CREDENTIALS resolution.

🧹 Nitpick comments (2)
template.yaml (2)

462-465: Mount credentials read-only and keep subPath stable

Recommend marking the mounted credentials file read-only. The subPath already matches the secret key; keep that stable.

Apply this diff:

           - name: google-vertex-service-account
             mountPath: /app-root/google-vertex-service-account.json
             subPath: service_account
+            readOnly: true

495-498: Pin secret item key to ensure predictable filename in the volume

Without items, the mounted file depends on the secret’s keys. Pin the expected key (service_account) to avoid surprises.

Apply this diff:

         - name: google-vertex-service-account
           secret:
             secretName: ${VERTEX_API_SECRET_NAME}
+            items:
+            - key: service_account
+              path: service_account
📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a4fe4cf and ff5cba5.

📒 Files selected for processing (7)
  • Makefile (2 hunks)
  • scripts/deploy_template.sh (1 hunks)
  • scripts/generate.sh (3 hunks)
  • template-params.dev.env (1 hunks)
  • template.yaml (11 hunks)
  • test/prow/template.yaml (0 hunks)
  • test/prow/template_patch.diff (0 hunks)
💤 Files with no reviewable changes (2)
  • test/prow/template_patch.diff
  • test/prow/template.yaml
🚧 Files skipped from review as they are similar to previous changes (3)
  • template-params.dev.env
  • Makefile
  • scripts/generate.sh
🔇 Additional comments (3)
scripts/deploy_template.sh (1)

73-75: Good: LLAMA Postgres SSL mode explicitly disabled for local dev

This complements the LIGHTSSPEED override and avoids connection failures against the local plaintext Postgres.

template.yaml (2)

110-117: Confirm default model identifier format

Default provider is set to gemini, but default model is unqualified (gemini-2.0-flash). If your code expects fully-qualified IDs, this may cause lookup mismatches.

If a qualified ID is required, update:

-  value: gemini-2.0-flash
+  value: "gemini/gemini-2.0-flash"

If unqualified names are supported alongside default_provider, keep as-is.


170-172: Verify provider choice vs. Vertex objective

default_provider: gemini is set while the PR objective is to switch to Vertex AI. If lightspeed handles Vertex directly and Llama’s gemini entry is a placeholder, this is fine; otherwise, you may be routing inference to gemini inadvertently.

Please confirm the runtime path for inference:

  • Lightspeed uses Vertex via GOOGLE_APPLICATION_CREDENTIALS, ignoring Llama’s gemini provider, or
  • Llama’s provider is actually used (and should be Vertex-aligned).

Comment on lines +15 to +16
IMAGE=$(echo "$ASSISTED_CHAT_IMG" | cut -d ":" -f1)
TAG=$(echo "$ASSISTED_CHAT_IMG" | cut -d ":" -f2)
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Make image parsing robust for registries with ports and digest references

Splitting on the first colon breaks when the registry includes a port (e.g., quay.io:443/…), and it’s unnecessary for digest references. Split on the last colon instead.

Apply this diff:

-IMAGE=$(echo "$ASSISTED_CHAT_IMG" | cut -d ":" -f1)
-TAG=$(echo "$ASSISTED_CHAT_IMG" | cut -d ":" -f2)
+IMAGE="${ASSISTED_CHAT_IMG%:*}"
+TAG="${ASSISTED_CHAT_IMG##*:}"
📝 Committable suggestion

‼️ 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.

Suggested change
IMAGE=$(echo "$ASSISTED_CHAT_IMG" | cut -d ":" -f1)
TAG=$(echo "$ASSISTED_CHAT_IMG" | cut -d ":" -f2)
IMAGE="${ASSISTED_CHAT_IMG%:*}"
TAG="${ASSISTED_CHAT_IMG##*:}"
🤖 Prompt for AI Agents
In scripts/deploy_template.sh around lines 15-16, the current split on the first
colon breaks for registries with ports and digest references; update the parsing
to split on the last colon and handle digest (@) cases: if the image string
contains an '@' treat it as a digest and set IMAGE to the substring before '@'
and TAG empty; otherwise obtain TAG as the substring after the last colon and
IMAGE as the substring before that last colon (use bash parameter expansion or
equivalent to extract the last-colon split rather than cut -d ":" -f1/f2).

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/generate.sh (1)

56-66: Harden permissions of copied Vertex credentials

After copying the credentials, set restrictive permissions on the destination file to avoid accidental group/world read.

Apply this diff:

             cp "$VERTEX_AI_SERVICE_ACCOUNT_CREDENTIALS_PATH" "$PROJECT_ROOT/config/vertex-credentials.json"
+            chmod 600 "$PROJECT_ROOT/config/vertex-credentials.json"
@@
-            echo "Vertex credentials successfully configured."
+            echo "Vertex credentials successfully configured."
♻️ Duplicate comments (5)
scripts/generate.sh (2)

25-31: Create config directory before writing dummy Vertex credentials (and fix grammar)

On a clean checkout, config/ may not exist; writing the dummy credentials will fail. Also minor grammar nit in the message.

Apply this diff:

             # Create a dummy Vertex AI service account credentials file
             if [[ ! -f "$PROJECT_ROOT/config/vertex-credentials.json" ]]; then
-                echo 'Also creating a dummy Vertex AI service account credentials file at config/vertex-credentials.json. If you want to use to be able to use both, modify config/vertex-credentials.json manually.'
+                # Ensure target directory exists
+                mkdir -p "$PROJECT_ROOT/config"
+                echo 'Also creating a dummy Vertex AI service account credentials file at config/vertex-credentials.json. If you want to be able to use both, modify config/vertex-credentials.json manually.'
                 echo '{}' >"$PROJECT_ROOT/config/vertex-credentials.json"
                 chmod 600 "$PROJECT_ROOT/config/vertex-credentials.json"
             fi

40-47: Ensure config directory exists before overwrite check/copy path

The overwrite prompt/copy will fail if config/ doesn’t exist on a fresh workspace.

Apply this diff:

-            if [[ -f "$PROJECT_ROOT/config/vertex-credentials.json" ]]; then
+            # Ensure target directory exists
+            mkdir -p "$PROJECT_ROOT/config"
+            if [[ -f "$PROJECT_ROOT/config/vertex-credentials.json" ]]; then
                 echo "File $PROJECT_ROOT/config/vertex-credentials.json already exists. Do you want to overwrite it? (y/n)"
                 read -r overwrite
                 if [[ "$overwrite" != "y" && "$overwrite" != "Y" ]]; then
                     echo "Exiting without copying."
                     exit 1
                 fi
             fi
template.yaml (3)

110-112: Default model should be fully-qualified to match models list format

Value is currently unqualified and may not resolve. Align with provider-qualified IDs (e.g., gemini/gemini-2.0-flash).

Apply this diff:

 - name: ASSISTED_CHAT_DEFAULT_MODEL
-  value: gemini-2.0-flash
+  value: "gemini/gemini-2.0-flash"

462-465: Mount secret as a single file (keep read-only) to match GOOGLE_APPLICATION_CREDENTIALS

Add readOnly for the mount. SubPath is fine provided the secret key matches (see next comment).

Apply this diff:

         - name: google-vertex-service-account
           mountPath: /app-root/google-vertex-service-account.json
           subPath: service_account
+          readOnly: true

495-498: Pin secret item key to ensure subPath works predictably

Without items, filenames depend on secret keys. Pin the key so subPath: service_account resolves consistently.

Apply this diff:

         - name: google-vertex-service-account
           secret:
             secretName: ${VERTEX_API_SECRET_NAME}
+            items:
+            - key: service_account
+              path: service_account
🧹 Nitpick comments (2)
scripts/generate.sh (1)

5-6: Improve portability: avoid readlink -f (not available on macOS)

Use a POSIX-compatible approach to resolve SCRIPT_DIR/PROJECT_ROOT.

Apply this diff:

-SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
-PROJECT_ROOT=$(dirname "$SCRIPT_DIR")
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
template.yaml (1)

118-121: Rename parameter for consistency: use LIGHTSPEED_STACK_POSTGRES_SSL_MODE

The parameter name currently uses “LIGHTSSPEED” (double “S”), which doesn’t match the “lightspeed” spelling elsewhere and can confuse operators or automation.

Please update all occurrences:

  • In template.yaml

    • Line 118:
      ­­- name: LIGHTSSPEED_STACK_POSTGRES_SSL_MODE- name: LIGHTSPEED_STACK_POSTGRES_SSL_MODE
    • Line 179:
      ­­ssl_mode: ${LIGHTSSPEED_STACK_POSTGRES_SSL_MODE}ssl_mode: ${LIGHTSPEED_STACK_POSTGRES_SSL_MODE}
  • In scripts/deploy_template.sh

    • Line 76:
      ­­-p LIGHTSSPEED_STACK_POSTGRES_SSL_MODE=disable-p LIGHTSPEED_STACK_POSTGRES_SSL_MODE=disable

Also update the description (if it mentions the old spelling) and ensure any downstream consumers (CI/CD, env files, docs) reference the new key—or provide an alias for backward compatibility if needed.

📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ff5cba5 and e36c488.

📒 Files selected for processing (7)
  • Makefile (2 hunks)
  • scripts/deploy_template.sh (1 hunks)
  • scripts/generate.sh (3 hunks)
  • template-params.dev.env (1 hunks)
  • template.yaml (11 hunks)
  • test/prow/template.yaml (0 hunks)
  • test/prow/template_patch.diff (0 hunks)
💤 Files with no reviewable changes (2)
  • test/prow/template.yaml
  • test/prow/template_patch.diff
🚧 Files skipped from review as they are similar to previous changes (3)
  • template-params.dev.env
  • scripts/deploy_template.sh
  • Makefile

omertuc added a commit to omertuc/release that referenced this pull request Aug 19, 2025
Having it in openshift/release is inconvenient, as it often needs to be
modifies. It should just rely on the Makefile target like the install
step. For now that target doesn't exist, but it will be added in.
Doesn't matter because the CI doesn't work anyway.

rh-ecosystem-edge/assisted-chat#126
@eranco74
Copy link
Collaborator

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Aug 19, 2025
openshift-merge-bot bot pushed a commit to openshift/release that referenced this pull request Aug 19, 2025
Having it in openshift/release is inconvenient, as it often needs to be
modifies. It should just rely on the Makefile target like the install
step. For now that target doesn't exist, but it will be added in.
Doesn't matter because the CI doesn't work anyway.

rh-ecosystem-edge/assisted-chat#126
We're moving all of our environments from Gemini to Gemini on Vertex AI.
This commit updates the assisted-chat template to use Vertex AI instead
of Gemini.

- Changed template default default model to `gemini-2.0-flash`, which is the Vertex AI Gemini model
- `ASSISTED_CHAT_DEFAULT_MODEL` controls the template's default model,
  which will default to `gemini/gemini-2.0-flash` for the local dev env,
  which is the normal Gemini model.
- Removed `GEMINI_API_SECRET_NAME` and replaced it with `VERTEX_API_SECRET_NAME`,
  which is the name of the Kubernetes secret containing the Vertex service account credentials.
- Removed all hard-coded models from the llama-stack config, along with
  their associated parameters. Vertex AI models are automatically
  discovered by lightspeed-stack
- Removed GEMINI_API_KEY and hardcoded it to a dummy value in the
  llama-stack config, since without it llama-stack will complain about
  not having a Gemini API key, even though we are using Vertex AI and
  not Gemini
- Modified scripts/deploy_template.sh to work well with minikube (for
  local experimentation), to use Vertex AI secret and use its own
  instance of postgres, to remove the need for a template patch to
  remove postgres. Also removed sed hacks and used USER_ID_CLAIM vars in
  the template instead.
- Added `deploy-template-local` target to the Makefile, which deploys
  the template on whatever cluster `oc` is currently logged in to
@openshift-ci
Copy link

openshift-ci bot commented Aug 19, 2025

New changes are detected. LGTM label has been removed.

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: 3

♻️ Duplicate comments (4)
template.yaml (3)

462-465: Mount secret file with readOnly and ensure subPath matches secret key

You’re correctly using subPath: service_account. Mark the mount read-only.

-          - name: google-vertex-service-account
-            mountPath: /app-root/google-vertex-service-account.json
-            subPath: service_account
+          - name: google-vertex-service-account
+            mountPath: /app-root/google-vertex-service-account.json
+            subPath: service_account
+            readOnly: true

495-497: Pin secret item key-to-filename mapping for predictable mount

Without items, key name must match service_account. Pin it explicitly to avoid drift or misalignment with secret creation.

         - name: google-vertex-service-account
           secret:
             secretName: ${VERTEX_API_SECRET_NAME}
+            items:
+            - key: service_account
+              path: service_account

110-116: Default model should be fully-qualified to match provider IDs

Using an unqualified gemini-2.0-flash can cause mismatches when providers expect fully-qualified IDs.

- - name: ASSISTED_CHAT_DEFAULT_MODEL
-   value: gemini-2.0-flash
+ - name: ASSISTED_CHAT_DEFAULT_MODEL
+   value: "gemini/gemini-2.0-flash"
scripts/deploy_template.sh (1)

14-16: Make image parsing robust (ports, multiple colons, and digests)

Splitting on the first colon mis-parses registries with ports and digest references. Prefer last-colon split and handle @digest form.

-echo "$ASSISTED_CHAT_IMG"
-IMAGE=$(echo "$ASSISTED_CHAT_IMG" | cut -d ":" -f1)
-TAG=$(echo "$ASSISTED_CHAT_IMG" | cut -d ":" -f2)
+echo "$ASSISTED_CHAT_IMG"
+if [[ "$ASSISTED_CHAT_IMG" == *"@"* ]]; then
+  # repo/image@sha256:<digest> — template expects IMAGE and IMAGE_TAG; consider updating template to accept full image.
+  IMAGE="${ASSISTED_CHAT_IMG%@*}"   # repo/image
+  TAG="${ASSISTED_CHAT_IMG##*:}"    # <digest>
+else
+  IMAGE="${ASSISTED_CHAT_IMG%:*}"   # before last colon
+  TAG="${ASSISTED_CHAT_IMG##*:}"    # after last colon
+fi

Until the template supports digests directly, verify the resolved image fields render a valid pull spec in the manifest:

#!/bin/bash
set -euo pipefail
echo "IMAGE=$IMAGE"
echo "TAG=$TAG"
rg -nPA3 'image:\s*\$\{IMAGE\}:\$\{IMAGE_TAG\}' template.yaml || true
🧹 Nitpick comments (5)
test/prow/entrypoint.sh (1)

18-18: Consider enabling the eval runner or removing the dead code

The eval runner is commented out. If this is intentional for prow, add a short comment explaining why; otherwise, enable it.

scripts/ci_test.sh (1)

30-39: “Completed” is redundant; check Succeeded only (or use Ready for running tests)

Pod phase is typically “Succeeded” for a completed run. “Completed” isn’t a pod phase. You can drop that branch.

-    if [[ "$CURRENT_STATUS" == "Completed" ]]; then
-        echo "Pod ${POD_NAME} is successfully completed, exiting"
-        oc logs -n "$NAMESPACE" "$POD_NAME"
-        exit 0
-    fi

Alternatively, if this is a Job, consider watching the Job condition instead of the Pod phase.

template.yaml (1)

118-123: Typo/inconsistency: LIGHTSSPEED vs LIGHTSPEED

Parameter/refs use LIGHTSSPEED_* (double “SS”), which is inconsistent with other LIGHTSPEED names and easy to mistype in scripts.

If possible, standardize to LIGHTSPEED_STACK_POSTGRES_SSL_MODE across template and scripts (deploy/CI) to reduce confusion. I can provide a follow-up diff if you want to do this renaming consistently.

Also applies to: 179-181, 315-316, 324-325, 359-360

scripts/deploy_template.sh (2)

69-80: Handle clusters without Route API more defensively

The jq filter assumes oc process returns a Template/List with items. If it doesn’t, the filter will fail. Consider guarding for both cases.

-oc process \
+oc process \
     -p IMAGE="$IMAGE" \
     -p IMAGE_TAG="$TAG" \
     -p VERTEX_API_SECRET_NAME=vertex-service-account \
     -p ASSISTED_CHAT_DB_SECRET_NAME=llama-stack-db \
     -p USER_ID_CLAIM=client_id \
     -p USERNAME_CLAIM=clientHost \
     -p LIGHTSSPEED_STACK_POSTGRES_SSL_MODE=disable \
     -p LLAMA_STACK_POSTGRES_SSL_MODE=disable \
     -f template.yaml --local |
-    jq '. as $root | $root.items = [$root.items[] | '"$FILTER"']' |
+    jq 'if has("items") then .items = [.items[] | '"$FILTER"'] else . end' |
     oc apply -n "$NAMESPACE" -f -

21-24: Pin secret volume items in template.yaml

To prevent unintended keys from being mounted, explicitly map the service_account key in your secret volume:

• File: template.yaml (around lines 495–498)

   - name: google-vertex-service-account
     secret:
       secretName: ${VERTEX_API_SECRET_NAME}
+        items:
+          - key: service_account
+            path: service_account

This ensures the volume only exposes the service_account file, matching the subPath in your deploy script.

📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e36c488 and a14100a.

📒 Files selected for processing (9)
  • Makefile (2 hunks)
  • scripts/ci_test.sh (1 hunks)
  • scripts/deploy_template.sh (1 hunks)
  • scripts/generate.sh (3 hunks)
  • template-params.dev.env (1 hunks)
  • template.yaml (11 hunks)
  • test/prow/entrypoint.sh (1 hunks)
  • test/prow/template.yaml (0 hunks)
  • test/prow/template_patch.diff (0 hunks)
💤 Files with no reviewable changes (2)
  • test/prow/template_patch.diff
  • test/prow/template.yaml
🚧 Files skipped from review as they are similar to previous changes (3)
  • scripts/generate.sh
  • template-params.dev.env
  • Makefile
🔇 Additional comments (1)
test/prow/entrypoint.sh (1)

14-14: Ensure raw token is written to file

The current invocation on line 12 uses jq '.access_token', which emits a JSON-quoted string. As a result,
echo "$OCM_TOKEN" > test/evals/ocm_token.txt will write surrounding " characters and can break downstream consumers.

Apply one of the following:

• Minimal patch (strip quotes at write time):

--- a/test/prow/entrypoint.sh
+++ b/test/prow/entrypoint.sh
@@ -14,1 +14,1 @@
-echo "$OCM_TOKEN" > test/evals/ocm_token.txt
+echo "$OCM_TOKEN" | tr -d '"' > test/evals/ocm_token.txt

• Preferred fix (emit a raw token at source):

--- a/test/prow/entrypoint.sh
+++ b/test/prow/entrypoint.sh
@@ -10,1 +10,1 @@
-  -d "client_secret=$CLIENT_SECRET" | jq '.access_token')
+  -d "client_secret=$CLIENT_SECRET" | jq -r '.access_token')

Please manually verify after running the entrypoint that test/evals/ocm_token.txt contains no leading or trailing quotes:

set -euo pipefail
test/prow/entrypoint.sh
if grep -q '^"' test/evals/ocm_token.txt; then
  echo "⚠️ Found surrounding quotes in token file" >&2
  exit 1
fi
echo "✅ Token file looks unquoted"

Comment on lines +9 to +11
oc create secret generic -n "$NAMESPACE" assisted-chat-ssl-ci --from-file=client_id=/var/run/secrets/sso-ci/client_id \
--from-file=client_secret=/var/run/secrets/sso-ci/client_secret

Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Make secret creation idempotent and use SECRETS_BASE_PATH consistently

  • Re-running this script will fail because oc create secret is unconditional.
  • You introduced SECRETS_BASE_PATH but hardcoded /var/run/secrets/....

Use apply-style creation and the base path:

-oc create secret generic -n "$NAMESPACE" assisted-chat-ssl-ci --from-file=client_id=/var/run/secrets/sso-ci/client_id \
-    --from-file=client_secret=/var/run/secrets/sso-ci/client_secret
+oc create secret generic -n "$NAMESPACE" assisted-chat-ssl-ci \
+  --from-file=client_id="${SECRETS_BASE_PATH}/sso-ci/client_id" \
+  --from-file=client_secret="${SECRETS_BASE_PATH}/sso-ci/client_secret" \
+  2>/dev/null || oc -n "$NAMESPACE" create secret generic assisted-chat-ssl-ci --dry-run=client -o yaml \
+    --from-file=client_id="${SECRETS_BASE_PATH}/sso-ci/client_id" \
+    --from-file=client_secret="${SECRETS_BASE_PATH}/sso-ci/client_secret" | oc apply -f -
📝 Committable suggestion

‼️ 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.

Suggested change
oc create secret generic -n "$NAMESPACE" assisted-chat-ssl-ci --from-file=client_id=/var/run/secrets/sso-ci/client_id \
--from-file=client_secret=/var/run/secrets/sso-ci/client_secret
oc create secret generic -n "$NAMESPACE" assisted-chat-ssl-ci \
--from-file=client_id="${SECRETS_BASE_PATH}/sso-ci/client_id" \
--from-file=client_secret="${SECRETS_BASE_PATH}/sso-ci/client_secret" \
2>/dev/null || oc -n "$NAMESPACE" create secret generic assisted-chat-ssl-ci --dry-run=client -o yaml \
--from-file=client_id="${SECRETS_BASE_PATH}/sso-ci/client_id" \
--from-file=client_secret="${SECRETS_BASE_PATH}/sso-ci/client_secret" | oc apply -f -
🤖 Prompt for AI Agents
In scripts/ci_test.sh around lines 9 to 11, the script uses `oc create secret`
unconditionally and hardcodes `/var/run/secrets/...`, which fails on reruns and
ignores the new SECRETS_BASE_PATH; change the secret creation to an idempotent
apply-style pattern (generate the secret YAML via `oc create secret ...
--dry-run=client -o yaml` and pipe to `oc apply -f -`) and replace hardcoded
paths with "$SECRETS_BASE_PATH/client_id" and "$SECRETS_BASE_PATH/client_secret"
so the command is safe to re-run and respects the configured base path.


sleep 5
oc get pods -n "$NAMESPACE"
POD_NAME=$(oc get pods | tr -s ' ' | cut -d ' ' -f1 | grep assisted-chat-eval-tes)
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Bug: querying pods without namespace and brittle parsing

oc get pods here omits -n "$NAMESPACE", potentially selecting from the default namespace. The parsing is also fragile and can return multiple pods.

Use -n, -o name, and pick a single match deterministically:

-POD_NAME=$(oc get pods | tr -s ' ' | cut -d ' ' -f1 | grep assisted-chat-eval-tes)
+POD_NAME=$(oc get pods -n "$NAMESPACE" -o name | grep -m1 '^pod/assisted-chat-eval-tes' | cut -d/ -f2)
+if [[ -z "${POD_NAME:-}" ]]; then
+  echo "Pod matching prefix 'assisted-chat-eval-tes' not found in namespace ${NAMESPACE}" >&2
+  oc get pods -n "$NAMESPACE"
+  exit 1
+fi
🤖 Prompt for AI Agents
In scripts/ci_test.sh around line 16 the pod lookup uses a bare `oc get pods`
with fragile whitespace parsing and no namespace, which can return multiple
results; change the command to query the intended namespace with `-n
"$NAMESPACE"`, request machine-readable output with `-o name` so results are
like "pod/NAME", filter deterministically (e.g. use grep -m1 or head -n1 or a
precise selector) to pick a single pod, and avoid brittle tr/split/cut parsing
so the script reliably selects one pod from the specified namespace.

Comment on lines +21 to +29
while [ $ELAPSED -lt $TIMEOUT ]; do
# Check if the pod's status is "Running"
CURRENT_STATUS=$(oc get pod "$POD_NAME" -n "$NAMESPACE" -o=jsonpath='{.status.phase}')
CURRENT_RESTARTS=$(oc get pod "$POD_NAME" -n "$NAMESPACE" -o=jsonpath='{.status.containerStatuses[0].restartCount}')
if [[ $CURRENT_RESTARTS -gt 0 ]]; then
echo "Pod ${POD_NAME} was restarted, so the tests should run at least once, exiting"
oc logs -n "$NAMESPACE" "$POD_NAME"
exit "$(oc get pod "$POD_NAME" -n "$NAMESPACE" -o=jsonpath='{.status.containerStatuses[0].lastState.terminated.exitCode}')"
fi
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Guard against missing containerStatuses to avoid integer comparison errors

Immediately after pod creation, .status.containerStatuses[0] may be absent, causing [[ $CURRENT_RESTARTS -gt 0 ]] to error. Default to 0 and use arithmetic comparison.

-    CURRENT_RESTARTS=$(oc get pod "$POD_NAME" -n "$NAMESPACE" -o=jsonpath='{.status.containerStatuses[0].restartCount}')
-    if [[ $CURRENT_RESTARTS -gt 0 ]]; then
+    CURRENT_RESTARTS=$(oc get pod "$POD_NAME" -n "$NAMESPACE" -o=jsonpath='{.status.containerStatuses[0].restartCount}')
+    CURRENT_RESTARTS=${CURRENT_RESTARTS:-0}
+    if (( CURRENT_RESTARTS > 0 )); then
         echo "Pod ${POD_NAME} was restarted, so the tests should run at least once, exiting"
         oc logs -n "$NAMESPACE" "$POD_NAME"
         exit "$(oc get pod "$POD_NAME" -n "$NAMESPACE" -o=jsonpath='{.status.containerStatuses[0].lastState.terminated.exitCode}')"
     fi
📝 Committable suggestion

‼️ 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.

Suggested change
while [ $ELAPSED -lt $TIMEOUT ]; do
# Check if the pod's status is "Running"
CURRENT_STATUS=$(oc get pod "$POD_NAME" -n "$NAMESPACE" -o=jsonpath='{.status.phase}')
CURRENT_RESTARTS=$(oc get pod "$POD_NAME" -n "$NAMESPACE" -o=jsonpath='{.status.containerStatuses[0].restartCount}')
if [[ $CURRENT_RESTARTS -gt 0 ]]; then
echo "Pod ${POD_NAME} was restarted, so the tests should run at least once, exiting"
oc logs -n "$NAMESPACE" "$POD_NAME"
exit "$(oc get pod "$POD_NAME" -n "$NAMESPACE" -o=jsonpath='{.status.containerStatuses[0].lastState.terminated.exitCode}')"
fi
while [ $ELAPSED -lt $TIMEOUT ]; do
# Check if the pod's status is "Running"
CURRENT_STATUS=$(oc get pod "$POD_NAME" -n "$NAMESPACE" -o=jsonpath='{.status.phase}')
CURRENT_RESTARTS=$(oc get pod "$POD_NAME" -n "$NAMESPACE" -o=jsonpath='{.status.containerStatuses[0].restartCount}')
CURRENT_RESTARTS=${CURRENT_RESTARTS:-0}
if (( CURRENT_RESTARTS > 0 )); then
echo "Pod ${POD_NAME} was restarted, so the tests should run at least once, exiting"
oc logs -n "$NAMESPACE" "$POD_NAME"
exit "$(oc get pod "$POD_NAME" -n "$NAMESPACE" -o=jsonpath='{.status.containerStatuses[0].lastState.terminated.exitCode}')"
fi
🤖 Prompt for AI Agents
In scripts/ci_test.sh around lines 21 to 29, the code reads
.status.containerStatuses[0] which can be absent and causes integer comparison
errors; update CURRENT_RESTARTS to default to 0 when the jsonpath returns empty
(e.g. capture the oc output and set CURRENT_RESTARTS=${CURRENT_RESTARTS:-0}) and
replace the string comparison with an arithmetic comparison like if ((
CURRENT_RESTARTS > 0 )); then, and when exiting, guard the lastState exitCode
lookup similarly by defaulting to a safe exit code if the jsonpath is empty.

@omertuc
Copy link
Member Author

omertuc commented Aug 19, 2025

/unhold

@omertuc omertuc merged commit 9235619 into rh-ecosystem-edge:main Aug 19, 2025
5 of 6 checks passed
JslYoon pushed a commit to JslYoon/openshift-release that referenced this pull request Aug 25, 2025
Having it in openshift/release is inconvenient, as it often needs to be
modifies. It should just rely on the Makefile target like the install
step. For now that target doesn't exist, but it will be added in.
Doesn't matter because the CI doesn't work anyway.

rh-ecosystem-edge/assisted-chat#126
tbuskey pushed a commit to tbuskey/release that referenced this pull request Aug 26, 2025
Having it in openshift/release is inconvenient, as it often needs to be
modifies. It should just rely on the Makefile target like the install
step. For now that target doesn't exist, but it will be added in.
Doesn't matter because the CI doesn't work anyway.

rh-ecosystem-edge/assisted-chat#126
etmurasaki pushed a commit to etmurasaki/release that referenced this pull request Sep 3, 2025
Having it in openshift/release is inconvenient, as it often needs to be
modifies. It should just rely on the Makefile target like the install
step. For now that target doesn't exist, but it will be added in.
Doesn't matter because the CI doesn't work anyway.

rh-ecosystem-edge/assisted-chat#126
xiaojiey pushed a commit to xiaojiey/release that referenced this pull request Sep 9, 2025
Having it in openshift/release is inconvenient, as it often needs to be
modifies. It should just rely on the Makefile target like the install
step. For now that target doesn't exist, but it will be added in.
Doesn't matter because the CI doesn't work anyway.

rh-ecosystem-edge/assisted-chat#126
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants