Skip to content

Commit 2b255f2

Browse files
Merge pull request #94 from lpiwowar/lpiwowar/lcore
Introduce basic reconciliation loop for `lightspeed-stack` based deployment
2 parents 55ffb15 + 0fb51dd commit 2b255f2

67 files changed

Lines changed: 4011 additions & 1395 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-and-push.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
- lcore-migration
78
workflow_dispatch: {}
89

910
env:
@@ -32,7 +33,13 @@ jobs:
3233
BUNDLE_IMAGE=${IMAGE_TAG_BASE}-bundle:v${VERSION}
3334
CATALOG_IMAGE=${IMAGE_TAG_BASE}-catalog:v${VERSION}
3435
35-
LATEST_TAG=latest
36+
# `main` branch -> `latest` tag
37+
# any other branch -> `[branch-name]-latest` tag
38+
if [[ "${{ github.ref_name }}" == "main" ]]; then
39+
LATEST_TAG=latest
40+
else
41+
LATEST_TAG=${{ github.ref_name }}-latest
42+
fi
3643
OPERATOR_IMAGE_LATEST=${IMAGE_TAG_BASE}:${LATEST_TAG}
3744
BUNDLE_IMAGE_LATEST=${IMAGE_TAG_BASE}-bundle:${LATEST_TAG}
3845
CATALOG_IMAGE_LATEST=${IMAGE_TAG_BASE}-catalog:${LATEST_TAG}

Makefile

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ endif
6262
OPERATOR_SDK_VERSION ?= v1.38.0-ocp
6363
# Image URL to use all building/pushing image targets
6464
IMG ?= $(IMAGE_TAG_BASE):latest
65-
# OPENSHIFT_LIGHTSPEED_OPERATOR_VERSION defines the version injected into the operator (OLS operator version)
66-
OPENSHIFT_LIGHTSPEED_OPERATOR_VERSION ?= latest
6765
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
6866
ENVTEST_K8S_VERSION = 1.30.0
6967

@@ -203,17 +201,6 @@ deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in
203201
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
204202
$(KUSTOMIZE) build config/default | $(KUBECTL) apply -f -
205203

206-
.PHONY: ols-deploy
207-
ols-deploy: export OUTPUT_DIR = out
208-
ols-deploy: ## Deploy OpenShift Lightspeed Operator
209-
bash scripts/gen-ols.sh
210-
oc apply -f $(OUTPUT_DIR)/ols
211-
212-
.PHONY: ols-undeploy
213-
ols-undeploy: export OUTPUT_DIR = out
214-
ols-undeploy: ## Deploy OpenShift Lightspeed Operator
215-
find $(OUTPUT_DIR)/ols -name "*.yaml" -printf " -f %p" | xargs oc delete --ignore-not-found=$(ignore-not-found)
216-
217204
.PHONY: undeploy
218205
undeploy: kustomize ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
219206
$(KUSTOMIZE) build config/default | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
@@ -329,7 +316,6 @@ endif
329316
bundle: manifests kustomize operator-sdk ## Generate bundle manifests and metadata, then validate generated files.
330317
$(OPERATOR_SDK) generate kustomize manifests -q
331318
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
332-
cd config/manager && $(KUSTOMIZE) edit add patch --kind Deployment --name controller-manager --patch "[{\"op\": \"replace\", \"path\": \"/spec/template/spec/containers/0/env/0/value\", \"value\": \"$(OPENSHIFT_LIGHTSPEED_OPERATOR_VERSION)\"}]"
333319
$(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle $(BUNDLE_GEN_FLAGS)
334320
$(OPERATOR_SDK) bundle validate ./bundle
335321

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,5 @@ make kuttl-test-run
238238
```
239239

240240
**Important Notes:**
241-
- The tests use the `openshift-lightspeed` namespace to test in the exact namespace
242-
where the OLS operator is expected to operate.
243-
- The correct behavior of the OLS operator is not guaranteed outside of the
244-
`openshift-lightspeed` namespace.
245241
- Ensure the namespace is clean before running tests to avoid resource conflicts
246242
or test failures.

api/v1beta1/conditions.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,10 @@ const (
6363

6464
// OCPRAGOverrideInvalidMessage
6565
OCPRAGOverrideInvalidMessage = "Invalid OCP RAG version override"
66+
67+
// DeploymentCheckFailedMessage
68+
DeploymentCheckFailedMessage = "Failed to check deployment status: %s"
69+
70+
// DeploymentsNotReadyMessage
71+
DeploymentsNotReadyMessage = "Waiting for deployments to be ready: %s"
6672
)

api/v1beta1/openstacklightspeed_types.go

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,20 @@ import (
2323
)
2424

2525
const (
26-
// Container image fall-back defaults
27-
2826
// OpenStackLightspeedContainerImage is the fall-back container image for OpenStackLightspeed
2927
OpenStackLightspeedContainerImage = "quay.io/openstack-lightspeed/rag-content:os-docs-2025.2"
30-
MaxTokensForResponseDefault = 2048
28+
29+
// LCoreContainerImage is the fall-back container image for LCore
30+
LCoreContainerImage = "quay.io/lightspeed-core/lightspeed-stack:latest"
31+
32+
// ExporterContainerImage is the fall-back container image for the Dataverse Exporter
33+
ExporterContainerImage = "quay.io/lightspeed-core/lightspeed-to-dataverse-exporter:latest"
34+
35+
// PostgresContainerImage is the fall-back container image for PostgreSQL
36+
PostgresContainerImage = "registry.redhat.io/rhel9/postgresql-16:latest"
37+
38+
// MaxTokensForResponseDefault is the default maximum number of tokens that should be used for response
39+
MaxTokensForResponseDefault = 2048
3140
)
3241

3342
// OpenStackLightspeedSpec defines the desired state of OpenStackLightspeed
@@ -82,16 +91,6 @@ type OpenStackLightspeedCore struct {
8291
// MaxTokensForResponse defines the maximum number of tokens to be used for the response generation
8392
MaxTokensForResponse int `json:"maxTokensForResponse,omitempty"`
8493

85-
// +kubebuilder:validation:Optional
86-
// +kubebuilder:default="openshift-marketplace"
87-
// Namespace where the CatalogSource containing the OLS operator is located
88-
CatalogSourceNamespace string `json:"catalogSourceNamespace"`
89-
90-
// +kubebuilder:validation:Optional
91-
// +kubebuilder:default="redhat-operators"
92-
// Name of the CatalogSource that contains the OLS Operator
93-
CatalogSourceName string `json:"catalogSourceName"`
94-
9594
// +kubebuilder:validation:Optional
9695
// Project ID for LLM providers that require it (e.g., WatsonX)
9796
LLMProjectID string `json:"llmProjectID,omitempty"`
@@ -131,10 +130,26 @@ type OpenStackLightspeedStatus struct {
131130
// +kubebuilder:subresource:status
132131
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[0].status",description="Status"
133132
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[0].message",description="Message"
134-
// +operator-sdk:csv:customresourcedefinitions:resources={{OLSConfig,v1alpha1,cluster}}
133+
// +operator-sdk:csv:customresourcedefinitions:resources={{Deployment,v1,lightspeed-stack-deployment}}
134+
// +operator-sdk:csv:customresourcedefinitions:resources={{Deployment,v1,lightspeed-postgres-server}}
135+
// +operator-sdk:csv:customresourcedefinitions:resources={{Service,v1,lightspeed-app-server}}
136+
// +operator-sdk:csv:customresourcedefinitions:resources={{Service,v1,lightspeed-postgres-server}}
137+
// +operator-sdk:csv:customresourcedefinitions:resources={{ConfigMap,v1,llama-stack-config}}
138+
// +operator-sdk:csv:customresourcedefinitions:resources={{ConfigMap,v1,lightspeed-stack-config}}
139+
// +operator-sdk:csv:customresourcedefinitions:resources={{ConfigMap,v1,lightspeed-postgres-conf}}
140+
// +operator-sdk:csv:customresourcedefinitions:resources={{Secret,v1,lightspeed-postgres-secret}}
141+
// +operator-sdk:csv:customresourcedefinitions:resources={{Secret,v1,lightspeed-postgres-bootstrap}}
142+
// +operator-sdk:csv:customresourcedefinitions:resources={{Secret,v1,metrics-reader-token}}
143+
// +operator-sdk:csv:customresourcedefinitions:resources={{Secret,v1,lightspeed-tls}}
144+
// +operator-sdk:csv:customresourcedefinitions:resources={{Secret,v1,lightspeed-postgres-certs}}
145+
// +operator-sdk:csv:customresourcedefinitions:resources={{ServiceAccount,v1,lightspeed-app-server}}
146+
// +operator-sdk:csv:customresourcedefinitions:resources={{NetworkPolicy,v1,lightspeed-app-server}}
147+
// +operator-sdk:csv:customresourcedefinitions:resources={{NetworkPolicy,v1,lightspeed-postgres-server}}
148+
// +operator-sdk:csv:customresourcedefinitions:resources={{ClusterRole,v1,lightspeed-app-server-sar-role}}
149+
// +operator-sdk:csv:customresourcedefinitions:resources={{ClusterRoleBinding,v1,lightspeed-app-server-sar-role-binding}}
135150
// +operator-sdk:csv:customresourcedefinitions:resources={{Subscription,v1alpha1}}
136151
// +operator-sdk:csv:customresourcedefinitions:resources={{ClusterServiceVersion,v1alpha1}}
137-
// +operator-sdk:csv:customresourcedefinitions:resources={{InstallPlan,v1alpha}}
152+
// +operator-sdk:csv:customresourcedefinitions:resources={{InstallPlan,v1alpha1}}
138153

139154
// OpenStackLightspeed is the Schema for the openstacklightspeeds API
140155
type OpenStackLightspeed struct {
@@ -165,6 +180,9 @@ func (instance OpenStackLightspeed) IsReady() bool {
165180

166181
type OpenStackLightspeedDefaults struct {
167182
RAGImageURL string
183+
LCoreImageURL string
184+
ExporterImageURL string
185+
PostgresImageURL string
168186
MaxTokensForResponse int
169187
}
170188

@@ -176,6 +194,12 @@ func SetupDefaults() {
176194
openStackLightspeedDefaults := OpenStackLightspeedDefaults{
177195
RAGImageURL: util.GetEnvVar(
178196
"RELATED_IMAGE_OPENSTACK_LIGHTSPEED_IMAGE_URL_DEFAULT", OpenStackLightspeedContainerImage),
197+
LCoreImageURL: util.GetEnvVar(
198+
"RELATED_IMAGE_LCORE_IMAGE_URL_DEFAULT", LCoreContainerImage),
199+
ExporterImageURL: util.GetEnvVar(
200+
"RELATED_IMAGE_EXPORTER_IMAGE_URL_DEFAULT", ExporterContainerImage),
201+
PostgresImageURL: util.GetEnvVar(
202+
"RELATED_IMAGE_POSTGRES_IMAGE_URL_DEFAULT", PostgresContainerImage),
179203
MaxTokensForResponse: MaxTokensForResponseDefault,
180204
}
181205

bundle/manifests/lightspeed.openstack.org_openstacklightspeeds.yaml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,6 @@ spec:
4949
spec:
5050
description: OpenStackLightspeedSpec defines the desired state of OpenStackLightspeed
5151
properties:
52-
catalogSourceName:
53-
default: redhat-operators
54-
description: Name of the CatalogSource that contains the OLS Operator
55-
type: string
56-
catalogSourceNamespace:
57-
default: openshift-marketplace
58-
description: Namespace where the CatalogSource containing the OLS
59-
operator is located
60-
type: string
6152
enableOCPRAG:
6253
default: false
6354
description: Enables automatic OCP documentation based on cluster
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: RoleBinding
3+
metadata:
4+
creationTimestamp: null
5+
labels:
6+
app.kubernetes.io/managed-by: kustomize
7+
app.kubernetes.io/name: openstack-lightspeed-operator
8+
name: openstack-lightspeed-operator-manager-rolebinding
9+
roleRef:
10+
apiGroup: rbac.authorization.k8s.io
11+
kind: Role
12+
name: manager-role
13+
subjects:
14+
- kind: ServiceAccount
15+
name: openstack-lightspeed-operator-controller-manager
16+
namespace: openstack-lightspeed-operator-system

0 commit comments

Comments
 (0)