Skip to content

Enable OKP support#110

Open
umago wants to merge 2 commits into
openstack-lightspeed:lcore-migrationfrom
umago:okp
Open

Enable OKP support#110
umago wants to merge 2 commits into
openstack-lightspeed:lcore-migrationfrom
umago:okp

Conversation

@umago
Copy link
Copy Markdown
Contributor

@umago umago commented Jun 8, 2026

Enable OKP support

This commit adds the first step in supporting OKP for OpenStack Lightspeed.

Two new configuration sections were added: "okp" and "dev". The "okp" section holds configurations that are more final to the deployment where the "dev" is an easy to way for developers to test the feature while tests/developing it.

The options available in "okp" section are:

  • offline: Whether OKP should be in "offline" mode or not.
  • accessKey: The OKP access key to decrypt the paid content in the image

The options available in the "dev" section are:

  • featureFlags: This is a list of features that operator wants to expose to be enabled. The value "okp" in the list will deploy OKP.
  • okpChunkFilterQuery: This is where we can tweak the OKP filter to filter by product, version etc...

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for Offline Knowledge Portal (OKP) as an inline Retrieval-Augmented Generation source, enabling organizations to leverage knowledge repositories in their environments.
    • Introduced OKP configuration options including access key management and offline/online mode selection.
    • Operator now automatically deploys and manages OKP services alongside core infrastructure.
  • Tests

    • Added comprehensive test coverage for OKP enablement, configuration, and cleanup workflows.

@openshift-ci openshift-ci Bot requested review from Akrog and lpiwowar June 8, 2026 10:28
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Jun 8, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: umago

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:

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

@openshift-ci openshift-ci Bot added the approved label Jun 8, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 8, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 08c0d120-478f-4c27-9895-169e64817dc8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ 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.

@umago
Copy link
Copy Markdown
Contributor Author

umago commented Jun 8, 2026

/test openstack-lightspeed-kuttl-4-18

Copy link
Copy Markdown

@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

Caution

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

⚠️ Outside diff range comments (1)
internal/controller/openstacklightspeed_controller.go (1)

170-178: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Gate overall Ready condition on OKP deployment when feature is enabled.

Line 173 reconciles OKP, but reconcileStatus does not include OKPDeploymentName; the CR can become Ready while OKP is down.

Suggested fix
--- a/internal/controller/openstacklightspeed_controller.go
+++ b/internal/controller/openstacklightspeed_controller.go
@@
 func (r *OpenStackLightspeedReconciler) reconcileStatus(
 	ctx context.Context,
 	helper *common_helper.Helper,
 	instance *apiv1beta1.OpenStackLightspeed,
 ) (ctrl.Result, error) {
 	deployments := []string{
 		PostgresDeploymentName,
 		LCoreDeploymentName,
 		ConsoleUIDeploymentName,
 	}
+	if isOKPEnabled(instance) {
+		deployments = append(deployments, OKPDeploymentName)
+	}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/controller/openstacklightspeed_controller.go` around lines 170 -
178, reconcileStatus currently doesn't include OKPDeploymentName, so the CR can
report Ready while OKP is down; update the reconciliation to include the OKP
deployment in status gating: when the OKP feature is enabled, add
OKPDeploymentName to the list of components checked by reconcileStatus (or add a
corresponding ReconcileTask entry referencing ReconcileOKPDeployment in the
reconcileTasks array) so the overall Ready condition is only set once
OKPDeployment is reported healthy; reference the reconcileTasks slice,
ReconcileOKPDeployment, OKPDeploymentName and reconcileStatus to locate where to
add this check.
🧹 Nitpick comments (1)
test/kuttl/tests/okp-configuration/03-assert-okp-instance.yaml (1)

75-85: ⚡ Quick win

Assert HF_HOME for lightspeed-service-api as well.

Given the stated OKP env-injection contract, this assertion currently validates RH_SERVER_OKP but not HF_HOME on lightspeed-service-api. Please add the HF_HOME env assertion here to prevent silent regressions in that container path.

Suggested assertion addition
         - name: lightspeed-service-api
           env:
             - name: LIGHTSPEED_STACK_LOG_LEVEL
               value: WARNING
             - name: POSTGRES_PASSWORD
               valueFrom:
                 secretKeyRef:
                   key: password
                   name: lightspeed-postgres-secret
             - name: RH_SERVER_OKP
               value: http://lightspeed-okp-server.openstack-lightspeed.svc:8080
+            - name: HF_HOME
+              value: /tmp/huggingface
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/kuttl/tests/okp-configuration/03-assert-okp-instance.yaml` around lines
75 - 85, The test currently checks env vars for the container named
"lightspeed-service-api" but only asserts RH_SERVER_OKP; add an assertion entry
to verify the HF_HOME environment variable for that same container. Locate the
container block for lightspeed-service-api in the test and add an env assertion
that matches name: HF_HOME and either a specific value or presence (consistent
with other assertions), ensuring it uses the same assertion style as the
RH_SERVER_OKP check so the HF_HOME key cannot regress silently.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@api/v1beta1/openstacklightspeed_types.go`:
- Around line 57-60: The FeatureFlags slice currently allows any string;
restrict each item to the supported value by adding a kubebuilder per-item enum
marker. Above the FeatureFlags field (the slice named FeatureFlags []string) add
a comment like "+kubebuilder:validation:Enum=okp" so the generated CRD enforces
each array element must be "okp" (optionally also add
"+kubebuilder:validation:MaxItems=1" or "+listType=set" if you want to prevent
duplicates). This ensures dev.featureFlags is validated to only accept "okp".

In `@internal/controller/okp_reconciler.go`:
- Around line 55-63: The OKP cleanup calls h.GetClient().Delete for Deployments
and Services (see ErrDeleteOKPDeployment/ErrDeleteOKPService in
okp_reconciler.go) but the controller's kubebuilder RBAC markers do not include
the "delete" verb for those resources; update the controller's kubebuilder RBAC
markers to grant delete on deployments.apps and services (core) — e.g. add
"verbs=delete" (or include delete in the existing verbs list such as
get,list,watch,create,update,patch,delete) for resources deployments.apps and
services in the controller's RBAC annotations so the Delete calls succeed.

---

Outside diff comments:
In `@internal/controller/openstacklightspeed_controller.go`:
- Around line 170-178: reconcileStatus currently doesn't include
OKPDeploymentName, so the CR can report Ready while OKP is down; update the
reconciliation to include the OKP deployment in status gating: when the OKP
feature is enabled, add OKPDeploymentName to the list of components checked by
reconcileStatus (or add a corresponding ReconcileTask entry referencing
ReconcileOKPDeployment in the reconcileTasks array) so the overall Ready
condition is only set once OKPDeployment is reported healthy; reference the
reconcileTasks slice, ReconcileOKPDeployment, OKPDeploymentName and
reconcileStatus to locate where to add this check.

---

Nitpick comments:
In `@test/kuttl/tests/okp-configuration/03-assert-okp-instance.yaml`:
- Around line 75-85: The test currently checks env vars for the container named
"lightspeed-service-api" but only asserts RH_SERVER_OKP; add an assertion entry
to verify the HF_HOME environment variable for that same container. Locate the
container block for lightspeed-service-api in the test and add an env assertion
that matches name: HF_HOME and either a specific value or presence (consistent
with other assertions), ensuring it uses the same assertion style as the
RH_SERVER_OKP check so the HF_HOME key cannot regress silently.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 995f0a4d-4a92-4357-af77-ad287b78d72d

📥 Commits

Reviewing files that changed from the base of the PR and between 34d4f23 and f3a1b16.

📒 Files selected for processing (31)
  • api/v1beta1/openstacklightspeed_types.go
  • api/v1beta1/zz_generated.deepcopy.go
  • bundle/manifests/lightspeed.openstack.org_openstacklightspeeds.yaml
  • bundle/manifests/openstack-lightspeed-operator.clusterserviceversion.yaml
  • config/crd/bases/lightspeed.openstack.org_openstacklightspeeds.yaml
  • config/manager/manager.yaml
  • config/samples/api_v1beta1_openstacklightspeed.yaml
  • hack/env.sh
  • internal/controller/common.go
  • internal/controller/constants.go
  • internal/controller/errors.go
  • internal/controller/lcore_config.go
  • internal/controller/lcore_deployment.go
  • internal/controller/llama_stack_config.go
  • internal/controller/okp_reconciler.go
  • internal/controller/openstacklightspeed_controller.go
  • test/kuttl/common/expected-configs/lightspeed-stack-okp.yaml
  • test/kuttl/common/expected-configs/ogx_config-okp.yaml
  • test/kuttl/tests/okp-configuration/00-mock-resources.yaml
  • test/kuttl/tests/okp-configuration/01-assert-mock-objects-created.yaml
  • test/kuttl/tests/okp-configuration/02-create-okp-resources.yaml
  • test/kuttl/tests/okp-configuration/03-assert-okp-instance.yaml
  • test/kuttl/tests/okp-configuration/04-assert-lightspeed-stack-config.yaml
  • test/kuttl/tests/okp-configuration/05-assert-llama-stack-config.yaml
  • test/kuttl/tests/okp-configuration/06-disable-okp.yaml
  • test/kuttl/tests/okp-configuration/07-assert-okp-cleanup.yaml
  • test/kuttl/tests/okp-configuration/07-errors-okp-cleanup.yaml
  • test/kuttl/tests/okp-configuration/08-cleanup-openstack-lightspeed-instance.yaml
  • test/kuttl/tests/okp-configuration/09-errors-openstack-lightspeed-instance.yaml
  • test/kuttl/tests/okp-configuration/10-cleanup-mock-objects.yaml
  • test/kuttl/tests/okp-configuration/11-errors-mock-objects.yaml

Comment thread api/v1beta1/openstacklightspeed_types.go
Comment thread internal/controller/okp_reconciler.go
This commit adds the first step in supporting OKP for OpenStack
Lightspeed.

Two new configuration sections were added: "okp" and "dev". The "okp"
section holds configurations that are more final to the deployment where
the "dev" is an easy to way for developers to test the feature while
tests/developing it.

The options available in "okp" section are:

- offline: Whether OKP should be in "offline" mode or not.
- accessKey: The OKP access key to decrypt the paid content in the image

The options available in the "dev" section are:

- featureFlags: This is a list of features that operator wants to expose
  to be enabled. The value "okp" in the list will deploy OKP.
- okpChunkFilterQuery: This is where we can tweak the OKP filter to
  filter by product, version etc...

Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
This commit adds Kuttl tests related to the OKP deployment support.

Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Jun 8, 2026

@umago: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/openstack-lightspeed-kuttl-4-18 ba33b9e link true /test openstack-lightspeed-kuttl-4-18

Full PR test history. Your PR dashboard.

Details

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. I understand the commands that are listed here.

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.

1 participant