-
Notifications
You must be signed in to change notification settings - Fork 112
[OSPRH-16305] Introduce OpenStackLightspeed #1495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
openshift-merge-bot
merged 1 commit into
openstack-k8s-operators:main
from
lpiwowar:lpiwowar/lightspeed-cr
Aug 15, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
apis/bases/lightspeed.openstack.org_openstacklightspeeds.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| --- | ||
| apiVersion: apiextensions.k8s.io/v1 | ||
| kind: CustomResourceDefinition | ||
| metadata: | ||
| annotations: | ||
| controller-gen.kubebuilder.io/version: v0.14.0 | ||
| name: openstacklightspeeds.lightspeed.openstack.org | ||
| spec: | ||
| group: lightspeed.openstack.org | ||
| names: | ||
| kind: OpenStackLightspeed | ||
| listKind: OpenStackLightspeedList | ||
| plural: openstacklightspeeds | ||
| singular: openstacklightspeed | ||
| scope: Namespaced | ||
| versions: | ||
| - additionalPrinterColumns: | ||
| - description: Status | ||
| jsonPath: .status.conditions[0].status | ||
| name: Status | ||
| type: string | ||
| - description: Message | ||
| jsonPath: .status.conditions[0].message | ||
| name: Message | ||
| type: string | ||
| name: v1beta1 | ||
| schema: | ||
| openAPIV3Schema: | ||
| properties: | ||
| apiVersion: | ||
| type: string | ||
| kind: | ||
| type: string | ||
| metadata: | ||
| type: object | ||
| spec: | ||
| properties: | ||
| llmCredentials: | ||
| type: string | ||
| llmEndpoint: | ||
| type: string | ||
| llmEndpointType: | ||
| enum: | ||
| - azure_openai | ||
| - bam | ||
| - openai | ||
| - watsonx | ||
| - rhoai_vllm | ||
| - rhelai_vllm | ||
| - fake_provider | ||
| type: string | ||
| modelName: | ||
| type: string | ||
| ragImage: | ||
| type: string | ||
| tlsCACertBundle: | ||
| type: string | ||
| required: | ||
| - llmCredentials | ||
| - llmEndpoint | ||
| - llmEndpointType | ||
| - modelName | ||
| type: object | ||
| status: | ||
| properties: | ||
| conditions: | ||
| items: | ||
| properties: | ||
| lastTransitionTime: | ||
| format: date-time | ||
| type: string | ||
| message: | ||
| type: string | ||
| reason: | ||
| type: string | ||
| severity: | ||
| type: string | ||
| status: | ||
| type: string | ||
| type: | ||
| type: string | ||
| required: | ||
| - lastTransitionTime | ||
| - status | ||
| - type | ||
| type: object | ||
| type: array | ||
| observedGeneration: | ||
| format: int64 | ||
| type: integer | ||
| type: object | ||
| type: object | ||
| served: true | ||
| storage: true | ||
| subresources: | ||
| status: {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| /* | ||
| Copyright 2025. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package v1beta1 | ||
|
|
||
| import ( | ||
| condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition" | ||
| ) | ||
|
|
||
| // OpenStackLightspeed Condition Types used by API objects. | ||
| const ( | ||
| // OpenStackLightspeedReadyCondition Status=True condition which indicates if OpenStackLightspeedReadyCondition | ||
| // is configured and operational | ||
| OpenStackLightspeedReadyCondition condition.Type = "OpenStackLightspeedReady" | ||
| ) | ||
|
|
||
| // Common Messages used by API objects. | ||
| const ( | ||
| // OpenStackLightspeedReadyInitMessage | ||
| OpenStackLightspeedReadyInitMessage = "OpenStack Lightspeed not started" | ||
|
|
||
| // OpenStackLightspeedReadyMessage | ||
| OpenStackLightspeedReadyMessage = "OpenStack Lightspeed created" | ||
|
|
||
| // OpenStackLightspeedWaitingVectorDBMessage | ||
| OpenStackLightspeedWaitingVectorDBMessage = "Waiting for OpenStackLightspeed vector DB pod to become ready" | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /* | ||
| Copyright 2025. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| // Package v1beta1 contains API Schema definitions for the lightspeed v1beta1 API group | ||
| // +kubebuilder:object:generate=true | ||
| // +groupName=lightspeed.openstack.org | ||
| package v1beta1 | ||
|
|
||
| import ( | ||
| "k8s.io/apimachinery/pkg/runtime/schema" | ||
| "sigs.k8s.io/controller-runtime/pkg/scheme" | ||
| ) | ||
|
|
||
| var ( | ||
| // GroupVersion is group version used to register these objects | ||
| GroupVersion = schema.GroupVersion{Group: "lightspeed.openstack.org", Version: "v1beta1"} | ||
|
|
||
| // SchemeBuilder is used to add go types to the GroupVersionKind scheme | ||
| SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} | ||
|
|
||
| // AddToScheme adds the types in this group-version to the given scheme. | ||
| AddToScheme = SchemeBuilder.AddToScheme | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| /* | ||
| Copyright 2025. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package v1beta1 | ||
|
|
||
| import ( | ||
| "github.com/openstack-k8s-operators/lib-common/modules/common/condition" | ||
| "github.com/openstack-k8s-operators/lib-common/modules/common/util" | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| ) | ||
|
|
||
| const ( | ||
| // Container image fall-back defaults | ||
|
|
||
| // OpenStackLightspeedContainerImage is the fall-back container image for OpenStackLightspeed | ||
| OpenStackLightspeedContainerImage = "quay.io/openstack-lightspeed/rag-content:os-docs-2024.2" | ||
| ) | ||
|
|
||
| // OpenStackLightspeedSpec defines the desired state of OpenStackLightspeed | ||
| type OpenStackLightspeedSpec struct { | ||
| OpenStackLightspeedCore `json:",inline"` | ||
|
|
||
| // +kubebuilder:validation:Optional | ||
| // ContainerImage for the Openstack Lightspeed RAG container (will be set to environmental default if empty) | ||
| RAGImage string `json:"ragImage"` | ||
| } | ||
|
|
||
| // OpenStackLightspeedCore defines the desired state of OpenStackLightspeed | ||
| type OpenStackLightspeedCore struct { | ||
| // +kubebuilder:validation:Required | ||
| // URL pointing to the LLM | ||
| LLMEndpoint string `json:"llmEndpoint"` | ||
|
|
||
| // +kubebuilder:validation:Required | ||
| // +kubebuilder:validation:Enum=azure_openai;bam;openai;watsonx;rhoai_vllm;rhelai_vllm;fake_provider | ||
| // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Provider Type" | ||
| // Type of the provider serving the LLM | ||
| LLMEndpointType string `json:"llmEndpointType"` | ||
|
|
||
| // +kubebuilder:validation:Required | ||
| // Name of the model to use at the API endpoint provided in LLMEndpoint | ||
| ModelName string `json:"modelName"` | ||
|
|
||
| // +kubebuilder:validation:Required | ||
| // Secret name containing API token for the LLMEndpoint. The key for the field | ||
| // in the secret that holds the token should be "apitoken". | ||
| LLMCredentials string `json:"llmCredentials"` | ||
|
|
||
| // +kubebuilder:validation:Optional | ||
| // Configmap name containing a CA Certificates bundle | ||
| TLSCACertBundle string `json:"tlsCACertBundle"` | ||
| } | ||
|
|
||
| // OpenStackLightspeedStatus defines the observed state of OpenStackLightspeed | ||
| type OpenStackLightspeedStatus struct { | ||
| // Conditions | ||
| Conditions condition.Conditions `json:"conditions,omitempty" optional:"true"` | ||
|
|
||
| // ObservedGeneration - the most recent generation observed for this object. | ||
| ObservedGeneration int64 `json:"observedGeneration,omitempty"` | ||
| } | ||
|
|
||
| // +kubebuilder:object:root=true | ||
| // +kubebuilder:subresource:status | ||
| // +operator-sdk:csv:customresourcedefinitions:displayName="OpenStack Lightspeed" | ||
| // +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[0].status",description="Status" | ||
| // +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[0].message",description="Message" | ||
|
|
||
| // OpenStackLightspeed is the Schema for the openstacklightspeeds API | ||
| type OpenStackLightspeed struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
|
||
| Spec OpenStackLightspeedSpec `json:"spec,omitempty"` | ||
| Status OpenStackLightspeedStatus `json:"status,omitempty"` | ||
| } | ||
|
|
||
| //+kubebuilder:object:root=true | ||
|
|
||
| // OpenStackLightspeedList contains a list of OpenStackLightspeed | ||
| type OpenStackLightspeedList struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ListMeta `json:"metadata,omitempty"` | ||
| Items []OpenStackLightspeed `json:"items"` | ||
| } | ||
|
|
||
| func init() { | ||
| SchemeBuilder.Register(&OpenStackLightspeed{}, &OpenStackLightspeedList{}) | ||
| } | ||
|
|
||
| // IsReady - returns true if OpenStackLightspeed is reconciled successfully | ||
| func (instance OpenStackLightspeed) IsReady() bool { | ||
| return instance.Status.Conditions.IsTrue(OpenStackLightspeedReadyCondition) | ||
| } | ||
|
|
||
| type OpenStackLightspeedDefaults struct { | ||
| RAGImageURL string | ||
| } | ||
|
|
||
| var OpenStackLightspeedDefaultValues OpenStackLightspeedDefaults | ||
|
|
||
| // SetupDefaults - initializes OpenStackLightspeedDefaultValues with default values from env vars | ||
| func SetupDefaults() { | ||
| // Acquire environmental defaults and initialize OpenStackLightspeed defaults with them | ||
| openStackLightspeedDefaults := OpenStackLightspeedDefaults{ | ||
| RAGImageURL: util.GetEnvVar( | ||
| "RELATED_IMAGE_OPENSTACK_LIGHTSPEED_IMAGE_URL_DEFAULT", OpenStackLightspeedContainerImage), | ||
| } | ||
|
|
||
| OpenStackLightspeedDefaultValues = openStackLightspeedDefaults | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /* | ||
| Copyright 2025. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package v1beta1 | ||
|
|
||
| import ( | ||
| . "github.com/onsi/ginkgo/v2" | ||
| . "github.com/onsi/gomega" | ||
| "testing" | ||
| ) | ||
|
|
||
| func TestAPIs(t *testing.T) { | ||
| RegisterFailHandler(Fail) | ||
| RunSpecs(t, "LightSpeed v1beta1 Suite") | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.