diff --git a/api/v1beta1/openstacklightspeed_types.go b/api/v1beta1/openstacklightspeed_types.go index dfe41280..fe8b6fe7 100644 --- a/api/v1beta1/openstacklightspeed_types.go +++ b/api/v1beta1/openstacklightspeed_types.go @@ -77,6 +77,18 @@ type OpenStackLightspeedCore struct { // +kubebuilder:default="redhat-operators" // Name of the CatalogSource that contains the OLS Operator CatalogSourceName string `json:"catalogSourceName"` + + // +kubebuilder:validation:Optional + // Project ID for LLM providers that require it (e.g., WatsonX) + LLMProjectID string `json:"llmProjectID,omitempty"` + + // +kubebuilder:validation:Optional + // Deployment name for LLM providers that require it (e.g., Microsoft Azure OpenAI) + LLMDeploymentName string `json:"llmDeploymentName,omitempty"` + + // +kubebuilder:validation:Optional + // LLM API Version for LLM providers that require it (e.g., Microsoft Azure OpenAI) + LLMAPIVersion string `json:"llmAPIVersion,omitempty"` } // OpenStackLightspeedStatus defines the observed state of OpenStackLightspeed diff --git a/bundle/manifests/lightspeed.openstack.org_openstacklightspeeds.yaml b/bundle/manifests/lightspeed.openstack.org_openstacklightspeeds.yaml index 63ee0c50..046f964b 100644 --- a/bundle/manifests/lightspeed.openstack.org_openstacklightspeeds.yaml +++ b/bundle/manifests/lightspeed.openstack.org_openstacklightspeeds.yaml @@ -58,11 +58,19 @@ spec: description: Namespace where the CatalogSource containing the OLS operator is located type: string + llmAPIVersion: + description: LLM API Version for LLM providers that require it (e.g., + Microsoft Azure OpenAI) + type: string llmCredentials: description: |- Secret name containing API token for the LLMEndpoint. The key for the field in the secret that holds the token should be "apitoken". type: string + llmDeploymentName: + description: Deployment name for LLM providers that require it (e.g., + Microsoft Azure OpenAI) + type: string llmEndpoint: description: URL pointing to the LLM type: string @@ -77,6 +85,9 @@ spec: - rhelai_vllm - fake_provider type: string + llmProjectID: + description: Project ID for LLM providers that require it (e.g., WatsonX) + type: string maxTokensForResponse: description: MaxTokensForResponse defines the maximum number of tokens to be used for the response generation diff --git a/bundle/manifests/openstack-lightspeed-operator.clusterserviceversion.yaml b/bundle/manifests/openstack-lightspeed-operator.clusterserviceversion.yaml index ebb320e9..0c723c87 100644 --- a/bundle/manifests/openstack-lightspeed-operator.clusterserviceversion.yaml +++ b/bundle/manifests/openstack-lightspeed-operator.clusterserviceversion.yaml @@ -24,7 +24,7 @@ metadata: } ] capabilities: Basic Install - createdAt: "2025-12-10T11:14:44Z" + createdAt: "2026-01-08T13:07:00Z" operatorframework.io/suggested-namespace: openshift-lightspeed operators.operatorframework.io/builder: operator-sdk-v1.38.0 operators.operatorframework.io/project_layout: go.kubebuilder.io/v4 diff --git a/config/crd/bases/lightspeed.openstack.org_openstacklightspeeds.yaml b/config/crd/bases/lightspeed.openstack.org_openstacklightspeeds.yaml index b4654487..08e90ee1 100644 --- a/config/crd/bases/lightspeed.openstack.org_openstacklightspeeds.yaml +++ b/config/crd/bases/lightspeed.openstack.org_openstacklightspeeds.yaml @@ -58,11 +58,19 @@ spec: description: Namespace where the CatalogSource containing the OLS operator is located type: string + llmAPIVersion: + description: LLM API Version for LLM providers that require it (e.g., + Microsoft Azure OpenAI) + type: string llmCredentials: description: |- Secret name containing API token for the LLMEndpoint. The key for the field in the secret that holds the token should be "apitoken". type: string + llmDeploymentName: + description: Deployment name for LLM providers that require it (e.g., + Microsoft Azure OpenAI) + type: string llmEndpoint: description: URL pointing to the LLM type: string @@ -77,6 +85,9 @@ spec: - rhelai_vllm - fake_provider type: string + llmProjectID: + description: Project ID for LLM providers that require it (e.g., WatsonX) + type: string maxTokensForResponse: description: MaxTokensForResponse defines the maximum number of tokens to be used for the response generation diff --git a/internal/controller/funcs.go b/internal/controller/funcs.go index 7c807bfa..31171720 100644 --- a/internal/controller/funcs.go +++ b/internal/controller/funcs.go @@ -150,6 +150,26 @@ func PatchOLSConfig( "url": instance.Spec.LLMEndpoint, }, } + + provider := providersPatch[0].(map[string]interface{}) + if instance.Spec.LLMProjectID != "" { + if err := uns.SetNestedField(provider, instance.Spec.LLMProjectID, "projectID"); err != nil { + return err + } + } + + if instance.Spec.LLMDeploymentName != "" { + if err := uns.SetNestedField(provider, instance.Spec.LLMDeploymentName, "deploymentName"); err != nil { + return err + } + } + + if instance.Spec.LLMAPIVersion != "" { + if err := uns.SetNestedField(provider, instance.Spec.LLMAPIVersion, "apiVersion"); err != nil { + return err + } + } + if err := uns.SetNestedSlice(olsConfig.Object, providersPatch, "spec", "llm", "providers"); err != nil { return err } diff --git a/test/kuttl/common/openstack-lightspeed-instance/assert-openstack-lightspeed-instance.yaml b/test/kuttl/common/openstack-lightspeed-instance/assert-openstack-lightspeed-instance.yaml index 7890c5c5..0437a6d9 100644 --- a/test/kuttl/common/openstack-lightspeed-instance/assert-openstack-lightspeed-instance.yaml +++ b/test/kuttl/common/openstack-lightspeed-instance/assert-openstack-lightspeed-instance.yaml @@ -15,6 +15,9 @@ spec: - name: ibm-granite/granite-3.1-8b-instruct parameters: maxTokensForResponse: 2048 + projectID: test-project-id + deploymentName: test-deployment-name + apiVersion: v1 ols: defaultProvider: openstack-lightspeed-provider defaultModel: ibm-granite/granite-3.1-8b-instruct @@ -54,6 +57,8 @@ spec: llmEndpointType: openai modelName: ibm-granite/granite-3.1-8b-instruct tlsCACertBundle: openstack-lightspeed-cert + llmProjectID: test-project-id + llmDeploymentName: test-deployment-name status: conditions: - type: Ready diff --git a/test/kuttl/common/openstack-lightspeed-instance/create-openstack-lightspeed-instance.yaml b/test/kuttl/common/openstack-lightspeed-instance/create-openstack-lightspeed-instance.yaml index 656e560e..17479b0b 100644 --- a/test/kuttl/common/openstack-lightspeed-instance/create-openstack-lightspeed-instance.yaml +++ b/test/kuttl/common/openstack-lightspeed-instance/create-openstack-lightspeed-instance.yaml @@ -10,4 +10,6 @@ spec: llmCredentials: openstack-lightspeed-apitoken modelName: ibm-granite/granite-3.1-8b-instruct tlsCACertBundle: openstack-lightspeed-cert - + llmProjectID: test-project-id + llmDeploymentName: test-deployment-name + llmAPIVersion: v1 diff --git a/test/kuttl/tests/update-openstacklightspeed/04-update-openstack-lightspeed-instance.yaml b/test/kuttl/tests/update-openstacklightspeed/04-update-openstack-lightspeed-instance.yaml index 4a12f566..a7a07532 100644 --- a/test/kuttl/tests/update-openstacklightspeed/04-update-openstack-lightspeed-instance.yaml +++ b/test/kuttl/tests/update-openstacklightspeed/04-update-openstack-lightspeed-instance.yaml @@ -10,3 +10,6 @@ spec: llmCredentials: openstack-lightspeed-apitoken-UPDATE modelName: ibm-granite/granite-3.1-8b-instruct-UPDATE tlsCACertBundle: openstack-lightspeed-cert-UPDATE + llmProjectID: test-project-id-UPDATE + llmDeploymentName: test-deployment-name-UPDATE + llmAPIVersion: v1.1 diff --git a/test/kuttl/tests/update-openstacklightspeed/05-assert-olsconfig-update.yaml b/test/kuttl/tests/update-openstacklightspeed/05-assert-olsconfig-update.yaml index fb8b3927..393fa025 100644 --- a/test/kuttl/tests/update-openstacklightspeed/05-assert-olsconfig-update.yaml +++ b/test/kuttl/tests/update-openstacklightspeed/05-assert-olsconfig-update.yaml @@ -15,6 +15,9 @@ spec: - name: ibm-granite/granite-3.1-8b-instruct-UPDATE parameters: maxTokensForResponse: 2048 + projectID: test-project-id-UPDATE + deploymentName: test-deployment-name-UPDATE + apiVersion: v1.1 ols: defaultProvider: openstack-lightspeed-provider defaultModel: ibm-granite/granite-3.1-8b-instruct-UPDATE