Enable OKP support#110
Conversation
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
/test openstack-lightspeed-kuttl-4-18 |
There was a problem hiding this comment.
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 winGate overall Ready condition on OKP deployment when feature is enabled.
Line 173 reconciles OKP, but
reconcileStatusdoes not includeOKPDeploymentName; 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 winAssert
HF_HOMEforlightspeed-service-apias well.Given the stated OKP env-injection contract, this assertion currently validates
RH_SERVER_OKPbut notHF_HOMEonlightspeed-service-api. Please add theHF_HOMEenv 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
📒 Files selected for processing (31)
api/v1beta1/openstacklightspeed_types.goapi/v1beta1/zz_generated.deepcopy.gobundle/manifests/lightspeed.openstack.org_openstacklightspeeds.yamlbundle/manifests/openstack-lightspeed-operator.clusterserviceversion.yamlconfig/crd/bases/lightspeed.openstack.org_openstacklightspeeds.yamlconfig/manager/manager.yamlconfig/samples/api_v1beta1_openstacklightspeed.yamlhack/env.shinternal/controller/common.gointernal/controller/constants.gointernal/controller/errors.gointernal/controller/lcore_config.gointernal/controller/lcore_deployment.gointernal/controller/llama_stack_config.gointernal/controller/okp_reconciler.gointernal/controller/openstacklightspeed_controller.gotest/kuttl/common/expected-configs/lightspeed-stack-okp.yamltest/kuttl/common/expected-configs/ogx_config-okp.yamltest/kuttl/tests/okp-configuration/00-mock-resources.yamltest/kuttl/tests/okp-configuration/01-assert-mock-objects-created.yamltest/kuttl/tests/okp-configuration/02-create-okp-resources.yamltest/kuttl/tests/okp-configuration/03-assert-okp-instance.yamltest/kuttl/tests/okp-configuration/04-assert-lightspeed-stack-config.yamltest/kuttl/tests/okp-configuration/05-assert-llama-stack-config.yamltest/kuttl/tests/okp-configuration/06-disable-okp.yamltest/kuttl/tests/okp-configuration/07-assert-okp-cleanup.yamltest/kuttl/tests/okp-configuration/07-errors-okp-cleanup.yamltest/kuttl/tests/okp-configuration/08-cleanup-openstack-lightspeed-instance.yamltest/kuttl/tests/okp-configuration/09-errors-openstack-lightspeed-instance.yamltest/kuttl/tests/okp-configuration/10-cleanup-mock-objects.yamltest/kuttl/tests/okp-configuration/11-errors-mock-objects.yaml
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>
|
@umago: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
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:
The options available in the "dev" section are:
Summary by CodeRabbit
Release Notes
New Features
Tests