Skip to content

Commit ff50c80

Browse files
committed
Generic Provider Config for LCore supported providers.
1 parent ad8ebf3 commit ff50c80

File tree

9 files changed

+1090
-62
lines changed

9 files changed

+1090
-62
lines changed

api/v1alpha1/olsconfig_types.go

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
corev1 "k8s.io/api/core/v1"
2222
resource "k8s.io/apimachinery/pkg/api/resource"
2323
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
24+
runtime "k8s.io/apimachinery/pkg/runtime"
2425
)
2526

2627
// OLSConfigSpec defines the desired state of OLSConfig
@@ -443,6 +444,11 @@ type ModelSpec struct {
443444
// ProviderSpec defines the desired state of LLM provider.
444445
// +kubebuilder:validation:XValidation:message="'deploymentName' must be specified for 'azure_openai' provider",rule="self.type != \"azure_openai\" || self.deploymentName != \"\""
445446
// +kubebuilder:validation:XValidation:message="'projectID' must be specified for 'watsonx' provider",rule="self.type != \"watsonx\" || self.projectID != \"\""
447+
// +kubebuilder:validation:XValidation:message="'providerType' and 'config' must be used together in llamaStackGeneric mode",rule="!has(self.providerType) || has(self.config)"
448+
// +kubebuilder:validation:XValidation:message="'config' requires 'providerType' to be set",rule="!has(self.config) || has(self.providerType)"
449+
// +kubebuilder:validation:XValidation:message="Llama Stack Generic mode (providerType set) requires type='llamaStackGeneric'",rule="!has(self.providerType) || self.type == \"llamaStackGeneric\""
450+
// +kubebuilder:validation:XValidation:message="Llama Stack Generic mode cannot use legacy provider-specific fields",rule="self.type != \"llamaStackGeneric\" || (!has(self.deploymentName) && !has(self.projectID))"
451+
// +kubebuilder:validation:XValidation:message="credentialKey must not be empty string",rule="!has(self.credentialKey) || self.credentialKey != \"\""
446452
type ProviderSpec struct {
447453
// Provider name
448454
// +kubebuilder:validation:Required
@@ -466,7 +472,7 @@ type ProviderSpec struct {
466472
// Provider type
467473
// +kubebuilder:validation:Required
468474
// +required
469-
// +kubebuilder:validation:Enum=azure_openai;bam;openai;watsonx;rhoai_vllm;rhelai_vllm;fake_provider
475+
// +kubebuilder:validation:Enum=azure_openai;bam;openai;watsonx;rhoai_vllm;rhelai_vllm;fake_provider;llamaStackGeneric
470476
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Provider Type"
471477
Type string `json:"type"`
472478
// Azure OpenAI deployment name
@@ -485,6 +491,25 @@ type ProviderSpec struct {
485491
// +kubebuilder:validation:Optional
486492
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="TLS Security Profile",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:advanced"}
487493
TLSSecurityProfile *configv1.TLSSecurityProfile `json:"tlsSecurityProfile,omitempty"`
494+
// Llama Stack Generic provider type for provider configuration (e.g., "remote::openai", "inline::sentence-transformers")
495+
// When set, this provider uses Llama Stack Generic mode instead of legacy mode.
496+
// Must follow pattern: (inline|remote)::<provider-name>
497+
// +kubebuilder:validation:Pattern=`^(inline|remote)::[a-z0-9][a-z0-9_-]*$`
498+
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Llama Stack Provider Type"
499+
ProviderType string `json:"providerType,omitempty"`
500+
// Arbitrary configuration for the provider (Llama Stack Generic mode only)
501+
// This map is passed directly to Llama Stack provider configuration.
502+
// Credentials are automatically injected as environment variable substitutions.
503+
// Example: {"url": "https://...", "custom_field": "value"}
504+
// +kubebuilder:pruning:PreserveUnknownFields
505+
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Llama Stack Provider Config"
506+
Config *runtime.RawExtension `json:"config,omitempty"`
507+
// Secret key name for provider credentials (default: "apitoken")
508+
// Specifies which key in credentialsSecretRef contains the API token.
509+
// The operator creates an environment variable named {PROVIDER_NAME}_API_KEY.
510+
// +kubebuilder:default:="apitoken"
511+
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Credential Key Name"
512+
CredentialKey string `json:"credentialKey,omitempty"`
488513
}
489514

490515
// UserDataCollectionSpec defines how we collect user data.

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/manifests/ols.openshift.io_olsconfigs.yaml

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,21 @@ spec:
6161
apiVersion:
6262
description: API Version for Azure OpenAI provider
6363
type: string
64+
config:
65+
description: |-
66+
Arbitrary configuration for the provider (generic mode only)
67+
This map is passed directly to Llama Stack provider configuration.
68+
Credentials are automatically injected as environment variable substitutions.
69+
Example: {"url": "https://...", "custom_field": "value"}
70+
type: object
71+
x-kubernetes-preserve-unknown-fields: true
72+
credentialKey:
73+
default: apitoken
74+
description: |-
75+
Secret key name for provider credentials (default: "apitoken")
76+
Specifies which key in credentialsSecretRef contains the API token.
77+
The operator creates an environment variable named {PROVIDER_NAME}_API_KEY.
78+
type: string
6479
credentialsSecretRef:
6580
description: The name of the secret object that stores API
6681
provider credentials
@@ -118,6 +133,13 @@ spec:
118133
projectID:
119134
description: Watsonx Project ID
120135
type: string
136+
providerType:
137+
description: |-
138+
Generic provider type for Llama Stack (e.g., "remote::openai", "inline::sentence-transformers")
139+
When set, this provider uses generic mode instead of legacy mode.
140+
Must follow pattern: (inline|remote)::<provider-name>
141+
pattern: ^(inline|remote)::[a-z0-9][a-z0-9_-]*$
142+
type: string
121143
tlsSecurityProfile:
122144
description: TLS Security Profile used by connection to
123145
provider
@@ -259,6 +281,7 @@ spec:
259281
- rhoai_vllm
260282
- rhelai_vllm
261283
- fake_provider
284+
- llamaStackGeneric
262285
type: string
263286
url:
264287
description: Provider API URL
@@ -278,6 +301,19 @@ spec:
278301
- message: '''projectID'' must be specified for ''watsonx''
279302
provider'
280303
rule: self.type != "watsonx" || self.projectID != ""
304+
- message: '''providerType'' and ''config'' must be used together
305+
in llamaStackGeneric mode'
306+
rule: '!has(self.providerType) || has(self.config)'
307+
- message: '''config'' requires ''providerType'' to be set'
308+
rule: '!has(self.config) || has(self.providerType)'
309+
- message: Llama Stack Generic mode (providerType set) requires type='llamaStackGeneric'
310+
rule: '!has(self.providerType) || self.type == "llamaStackGeneric"'
311+
- message: Llama Stack Generic mode cannot use legacy provider-specific
312+
fields
313+
rule: self.type != "llamaStackGeneric" || (!has(self.deploymentName)
314+
&& !has(self.projectID))
315+
- message: credentialKey must not be empty string
316+
rule: '!has(self.credentialKey) || self.credentialKey != ""'
281317
type: array
282318
required:
283319
- providers
@@ -4855,9 +4891,3 @@ spec:
48554891
storage: true
48564892
subresources:
48574893
status: {}
4858-
status:
4859-
acceptedNames:
4860-
kind: ""
4861-
plural: ""
4862-
conditions: null
4863-
storedVersions: null

config/crd/bases/ols.openshift.io_olsconfigs.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,21 @@ spec:
6161
apiVersion:
6262
description: API Version for Azure OpenAI provider
6363
type: string
64+
config:
65+
description: |-
66+
Arbitrary configuration for the provider (generic mode only)
67+
This map is passed directly to Llama Stack provider configuration.
68+
Credentials are automatically injected as environment variable substitutions.
69+
Example: {"url": "https://...", "custom_field": "value"}
70+
type: object
71+
x-kubernetes-preserve-unknown-fields: true
72+
credentialKey:
73+
default: apitoken
74+
description: |-
75+
Secret key name for provider credentials (default: "apitoken")
76+
Specifies which key in credentialsSecretRef contains the API token.
77+
The operator creates an environment variable named {PROVIDER_NAME}_API_KEY.
78+
type: string
6479
credentialsSecretRef:
6580
description: The name of the secret object that stores API
6681
provider credentials
@@ -118,6 +133,13 @@ spec:
118133
projectID:
119134
description: Watsonx Project ID
120135
type: string
136+
providerType:
137+
description: |-
138+
Generic provider type for Llama Stack (e.g., "remote::openai", "inline::sentence-transformers")
139+
When set, this provider uses generic mode instead of legacy mode.
140+
Must follow pattern: (inline|remote)::<provider-name>
141+
pattern: ^(inline|remote)::[a-z0-9][a-z0-9_-]*$
142+
type: string
121143
tlsSecurityProfile:
122144
description: TLS Security Profile used by connection to
123145
provider
@@ -259,6 +281,7 @@ spec:
259281
- rhoai_vllm
260282
- rhelai_vllm
261283
- fake_provider
284+
- llamaStackGeneric
262285
type: string
263286
url:
264287
description: Provider API URL
@@ -278,6 +301,19 @@ spec:
278301
- message: '''projectID'' must be specified for ''watsonx''
279302
provider'
280303
rule: self.type != "watsonx" || self.projectID != ""
304+
- message: '''providerType'' and ''config'' must be used together
305+
in llamaStackGeneric mode'
306+
rule: '!has(self.providerType) || has(self.config)'
307+
- message: '''config'' requires ''providerType'' to be set'
308+
rule: '!has(self.config) || has(self.providerType)'
309+
- message: Llama Stack Generic mode (providerType set) requires type='llamaStackGeneric'
310+
rule: '!has(self.providerType) || self.type == "llamaStackGeneric"'
311+
- message: Llama Stack Generic mode cannot use legacy provider-specific
312+
fields
313+
rule: self.type != "llamaStackGeneric" || (!has(self.deploymentName)
314+
&& !has(self.projectID))
315+
- message: credentialKey must not be empty string
316+
rule: '!has(self.credentialKey) || self.credentialKey != ""'
281317
type: array
282318
required:
283319
- providers

0 commit comments

Comments
 (0)