Skip to content

Commit 6e607da

Browse files
committed
Use local OKP embeddings from rag-content
The rag-content image now ships the OKP embedding model in it and we no longer need for OGX to download it at runtime via HF. Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
1 parent 9d3fd08 commit 6e607da

14 files changed

Lines changed: 82 additions & 47 deletions

api/v1beta1/openstacklightspeed_types.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@ import (
2525
)
2626

2727
const (
28-
// TODO(lpiwowar): Replace this with a stable (non-alpha) image version once
29-
// the automated pipeline for building OGX-compatible vector database images
30-
// is ready.
3128
// OpenStackLightspeedContainerImage is the fall-back container image for OpenStackLightspeed
32-
OpenStackLightspeedContainerImage = "quay.io/openstack-lightspeed/rag-content:alpha-ogx-os-docs-2025.2"
29+
OpenStackLightspeedContainerImage = "quay.io/openstack-lightspeed/rag-content:os-docs-2026.1-ogx"
3330

3431
// LCoreContainerImage is the fall-back container image for LCore
3532
LCoreContainerImage = "quay.io/lightspeed-core/lightspeed-stack:dev-latest"

bundle/manifests/openstack-lightspeed-operator.clusterserviceversion.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ spec:
292292
fieldRef:
293293
fieldPath: metadata.annotations['olm.targetNamespaces']
294294
- name: RELATED_IMAGE_OPENSTACK_LIGHTSPEED_IMAGE_URL_DEFAULT
295-
value: quay.io/openstack-lightspeed/rag-content:alpha-ogx-os-docs-2025.2
295+
value: quay.io/openstack-lightspeed/rag-content:os-docs-2026.1-ogx
296296
- name: RELATED_IMAGE_LCORE_IMAGE_URL_DEFAULT
297297
value: quay.io/lightspeed-core/lightspeed-stack:dev-latest
298298
- name: RELATED_IMAGE_EXPORTER_IMAGE_URL_DEFAULT
@@ -478,7 +478,7 @@ spec:
478478
name: Red Hat
479479
url: https://github.com/openstack-lightspeed/operator
480480
relatedImages:
481-
- image: quay.io/openstack-lightspeed/rag-content:alpha-ogx-os-docs-2025.2
481+
- image: quay.io/openstack-lightspeed/rag-content:os-docs-2026.1-ogx
482482
name: openstack-lightspeed-image-url-default
483483
- image: quay.io/lightspeed-core/lightspeed-stack:dev-latest
484484
name: lcore-image-url-default

config/manager/manager.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ spec:
7474
# the automated pipeline for building OGX-compatible vector database images
7575
# is ready.
7676
- name: RELATED_IMAGE_OPENSTACK_LIGHTSPEED_IMAGE_URL_DEFAULT
77-
value: quay.io/openstack-lightspeed/rag-content:alpha-ogx-os-docs-2025.2
77+
value: quay.io/openstack-lightspeed/rag-content:os-docs-2026.1-ogx
7878
- name: RELATED_IMAGE_LCORE_IMAGE_URL_DEFAULT
7979
value: quay.io/lightspeed-core/lightspeed-stack:dev-latest
8080
- name: RELATED_IMAGE_EXPORTER_IMAGE_URL_DEFAULT

config/manifests/bases/openstack-lightspeed-operator.clusterserviceversion.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,6 @@ spec:
171171
relatedImages:
172172
- image: quay.io/openstack-lightspeed/operator:latest
173173
name: operator
174-
- image: quay.io/openstack-lightspeed/rag-content:os-docs-2025.2
174+
- image: quay.io/openstack-lightspeed/rag-content:os-docs-2026.1-ogx
175175
name: rag-content
176176
version: 0.0.0

hack/env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export RELATED_IMAGE_POSTGRES_IMAGE_URL_DEFAULT="registry.redhat.io/rhel9/postgr
55
# TODO(lpiwowar): Replace this with a stable (non-alpha) image version once
66
# the automated pipeline for building OGX-compatible vector database images
77
# is ready.
8-
export RELATED_IMAGE_OPENSTACK_LIGHTSPEED_IMAGE_URL_DEFAULT="quay.io/openstack-lightspeed/rag-content:alpha-ogx-os-docs-2025.2"
8+
export RELATED_IMAGE_OPENSTACK_LIGHTSPEED_IMAGE_URL_DEFAULT="quay.io/openstack-lightspeed/rag-content:os-docs-2026.1-ogx"
99
export RELATED_IMAGE_OKP_IMAGE_URL_DEFAULT="registry.redhat.io/offline-knowledge-portal/rhokp-rhel9:latest"
1010
export RELATED_IMAGE_CONSOLE_IMAGE_URL_DEFAULT="registry.redhat.io/openshift-lightspeed/lightspeed-console-plugin-rhel9:1.0.12"
1111
export RELATED_IMAGE_CONSOLE_PF5_IMAGE_URL_DEFAULT="registry.redhat.io/openshift-lightspeed/lightspeed-console-plugin-pf5-rhel9:1.0.12"

internal/controller/assets/vector_database_collect.sh

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,28 @@
3838
# │ └── ocp_latest/
3939
# │ ├── faiss_store.db
4040
# │ └── llama-stack.yaml
41-
# └── embeddings_model/
41+
# ├── embeddings_model/
42+
# │ └── <model_files>
43+
# └── okp_embeddings_model/
4244
# └── <model_files>
4345
#
4446
# Output Structure:
4547
# <target-path>/ (specified via --vector-db-path)
46-
# └── <random-tmp-dir>/
47-
# ├── vector_db/
48-
# │ ├── vector-db-data-1/
49-
# │ ├── vector-db-data-N/
50-
# │ └── ocp_X.YZ/ (if --enable-ocp-rag true and --ocp-version X.YZ)
51-
# └── embeddings_model/
52-
# └── <model_files>
48+
# ├── <random-tmp-dir>/
49+
# │ ├── vector_db/
50+
# │ │ ├── vector-db-data-1/
51+
# │ │ ├── vector-db-data-N/
52+
# │ │ └── ocp_X.YZ/ (if --enable-ocp-rag true and --ocp-version X.YZ)
53+
# │ └── embeddings_model/
54+
# │ └── <model_files>
55+
# └── okp_embeddings_model/ (if --enable-okp true)
56+
# └── <model_files>
5357
#
5458
# Arguments:
5559
# --vector-db-path PATH Target directory for collected data (required)
5660
# --enable-ocp-rag BOOL Enable OCP vector DB collection: true/false (required)
5761
# --ocp-version VERSION OCP version to collect, e.g., "X.YZ" (required)
62+
# --enable-okp Enable OKP embedding model collection (flag, default: disabled)
5863

5964
set -eu
6065

@@ -74,6 +79,11 @@ ENABLE_OCP_RAG=""
7479
# the vector database image -> ${OCP_VECTOR_DB_DIR}/ocp_${OCP_VERSION}. Populated
7580
# via parse_arguments_and_init.
7681
OCP_VERSION=""
82+
83+
# ENABLE_OKP specifies whether this script should collect the OKP embedding
84+
# model (expected to be found under OKP_EMBEDDING_MODEL_SRC). Defaults to
85+
# "false"; set to "true" via --enable-okp to enable collection.
86+
ENABLE_OKP="false"
7787
# ----------------------------------------------------------------------------
7888

7989
# -- Global vars -------------------------------------------------------------
@@ -110,6 +120,10 @@ VECTOR_DB_DIR="/rag/vector_db"
110120
# where embeddings model must reside.
111121
EMBEDDINGS_MODEL_DIR="/rag/embeddings_model"
112122

123+
# OKP_EMBEDDING_MODEL_SRC specifies the directory within the vector DB container
124+
# image where the OKP embedding model must reside.
125+
OKP_EMBEDDING_MODEL_SRC="/rag/okp_embeddings_model"
126+
113127
# OGX_CONFIG_FILE_NAME is the name of the OGX config file associated with a
114128
# single vector database.
115129
OGX_CONFIG_FILE_NAME="llama-stack.yaml"
@@ -134,13 +148,18 @@ parse_arguments_and_init() {
134148
OCP_VERSION="$2"
135149
shift 2
136150
;;
151+
--enable-okp)
152+
ENABLE_OKP="true"
153+
shift 1
154+
;;
137155
-h|--help)
138-
echo "Usage: $0 --vector-db-path PATH --enable-ocp-rag BOOL --ocp-version VERSION"
156+
echo "Usage: $0 --vector-db-path PATH --enable-ocp-rag BOOL --ocp-version VERSION [--enable-okp]"
139157
echo ""
140158
echo "Arguments:"
141159
echo " --vector-db-path Target path for vector DB data collection"
142160
echo " --enable-ocp-rag Enable OCP RAG collection (true/false)"
143161
echo " --ocp-version OCP version to collect (e.g., 4.16)"
162+
echo " --enable-okp Enable OKP embedding model collection (default: disabled)"
144163
echo " -h, --help Show this help message"
145164
exit 0
146165
;;
@@ -246,13 +265,32 @@ collect_embeddings_model() {
246265
echo "Discovered and collected embeddings model data from ${EMBEDDINGS_MODEL_DIR}"
247266
}
248267

268+
collect_okp_embeddings_model() {
269+
if [ "${ENABLE_OKP}" != "true" ]; then
270+
echo "Collecting of OKP embedding model is DISABLED => Skipping"
271+
return
272+
fi
273+
274+
if [ ! -d "${OKP_EMBEDDING_MODEL_SRC}" ]; then
275+
echo "ERROR: OKP embedding model dir not found under ${OKP_EMBEDDING_MODEL_SRC}."
276+
exit 1
277+
fi
278+
279+
echo "Collecting OKP embedding model ..."
280+
rm -rf "${VECTOR_DB_VOLUME_MOUNT_PATH}/okp_embeddings_model"
281+
mkdir -p "${VECTOR_DB_VOLUME_MOUNT_PATH}/okp_embeddings_model"
282+
cp -rL "${OKP_EMBEDDING_MODEL_SRC}/." "${VECTOR_DB_VOLUME_MOUNT_PATH}/okp_embeddings_model"
283+
echo "Discovered and collected OKP embedding model from ${OKP_EMBEDDING_MODEL_SRC}"
284+
}
285+
249286
main() {
250287
# NOTE: parse_arguments_and_init must be called first to ensure all global
251288
# variables are initialized before proceeding.
252289
parse_arguments_and_init "$@"
253290
collect_vector_db_data
254291
collect_ocp_vector_db_data
255292
collect_embeddings_model
293+
collect_okp_embeddings_model
256294
}
257295

258296
main "$@"

internal/controller/constants.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ const (
134134
// init container responsible for assembling the final Lightspeed Stack config.
135135
VectorDBVolumeLightspeedStackConfigPath = VectorDBVolumeMountPath + "/lightspeed-stack.yaml"
136136

137+
// OKPEmbeddingModelMountPath specifies the path within the VectorDBVolumeName
138+
// volume where the OKP embedding model is stored after being extracted from the
139+
// rag-content image by the vector-database-collect init container.
140+
OKPEmbeddingModelMountPath = VectorDBVolumeMountPath + "/okp_embeddings_model"
141+
137142
// OGXConfigInitContainerMountPath specifies the path where the operator-generated
138143
// OGX config file is mounted in the init container responsible for assembling
139144
// the final OGX configuration, which includes information about RAG.

internal/controller/lcore_deployment.go

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,18 @@ func buildInitContainers(
245245
containers = append(containers, corev1.Container{
246246
Name: "vector-database-collect",
247247
Image: instance.Spec.RAGImage,
248-
Command: []string{
249-
"sh", VectorDBScriptsMountPath + "/" + VectorDBCollectScriptKey,
250-
"--vector-db-path", VectorDBVolumeMountPath,
251-
"--enable-ocp-rag", strconv.FormatBool(instance.Spec.EnableOCPRAG),
252-
"--ocp-version", ocp_version,
253-
},
248+
Command: func() []string {
249+
cmd := []string{
250+
"sh", VectorDBScriptsMountPath + "/" + VectorDBCollectScriptKey,
251+
"--vector-db-path", VectorDBVolumeMountPath,
252+
"--enable-ocp-rag", strconv.FormatBool(instance.Spec.EnableOCPRAG),
253+
"--ocp-version", ocp_version,
254+
}
255+
if isOKPEnabled(instance) {
256+
cmd = append(cmd, "--enable-okp")
257+
}
258+
return cmd
259+
}(),
254260
SecurityContext: securityContext,
255261
Resources: resourceRequirements,
256262
VolumeMounts: []corev1.VolumeMount{
@@ -570,13 +576,6 @@ func buildLlamaStackEnvVars(h *common_helper.Helper, ctx context.Context, instan
570576
Name: "RH_SERVER_OKP",
571577
Value: fmt.Sprintf("http://%s.%s.svc:%d", OKPServiceName, instance.GetNamespace(), OKPServicePort),
572578
})
573-
// FIXME(lucasagomes): Llama-Stack expects HF_HOME to be set when OKP is enabled because it uses the
574-
// Hugging Face Hub client to fetch the embedding model for OKP. Ideally we would include the model it
575-
// downloads in the container image to avoid this.
576-
envVars = append(envVars, corev1.EnvVar{
577-
Name: "HF_HOME",
578-
Value: "/tmp/huggingface",
579-
})
580579
}
581580

582581
return envVars, nil

internal/controller/llama_stack_config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ func buildOKPVectorIOProvider(instance *apiv1beta1.OpenStackLightspeed) map[stri
257257
"content_field": "${env.SOLR_CONTENT_FIELD:=chunk}",
258258
"vector_field": "${env.SOLR_VECTOR_FIELD:=chunk_vector}",
259259
"embedding_dimension": "${env.SOLR_EMBEDDING_DIM:=384}",
260-
"embedding_model": "${env.SOLR_EMBEDDING_MODEL:=sentence-transformers/ibm-granite/granite-embedding-30m-english}",
260+
"embedding_model": "sentence-transformers/" + OKPEmbeddingModelMountPath,
261261
"persistence": map[string]interface{}{
262262
"backend": "kv_default",
263263
"namespace": "portal-rag",
@@ -366,7 +366,7 @@ func buildLlamaStackModels(_ *common_helper.Helper, instance *apiv1beta1.OpenSta
366366
"model_id": "solr_embedding",
367367
"model_type": "embedding",
368368
"provider_id": "sentence-transformers",
369-
"provider_model_id": "${env.SOLR_EMBEDDING_MODEL:=ibm-granite/granite-embedding-30m-english}",
369+
"provider_model_id": OKPEmbeddingModelMountPath,
370370
"metadata": map[string]interface{}{
371371
"embedding_dimension": 384,
372372
},
@@ -383,7 +383,7 @@ func buildLlamaStackVectorStores(_ *common_helper.Helper, instance *apiv1beta1.O
383383
"vector_store_id": "portal-rag",
384384
"provider_id": "okp_solr",
385385
"embedding_dimension": 384,
386-
"embedding_model": "${env.SOLR_EMBEDDING_MODEL:=sentence-transformers/ibm-granite/granite-embedding-30m-english}",
386+
"embedding_model": "sentence-transformers/" + OKPEmbeddingModelMountPath,
387387
})
388388
}
389389
return stores

kuttl-test.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,3 @@ reportGranularity: test
66
namespace: openstack-lightspeed
77
timeout: 1380
88
parallel: 1
9-
suppress:
10-
- events

0 commit comments

Comments
 (0)