Documentation ¶
Index ¶
- Constants
- func SetDefaults_Deployment(obj *appsv1.Deployment)
- type AppSrvConfigFile
- type AzureOpenAIConfig
- type ConversationCacheConfig
- type DeleteFunc
- type DeleteTask
- type LoggingConfig
- type MemoryCacheConfig
- type ModelConfig
- type ModelParameters
- type OLSConfig
- type OLSConfigReconciler
- type OLSConfigReconcilerOptions
- type ProviderConfig
- type QueryFilters
- type ReconcileFunc
- type ReconcileTask
- type RedisCacheConfig
- type ReferenceContent
- type TLSConfig
- type UserDataCollectionConfig
- type UserDataCollectorConfig
Constants ¶
const ( /*** Operator Settings ***/ // OLSConfigName is the name of the OLSConfig Custom Resource OLSConfigName = "cluster" // DefaultReconcileInterval is the default interval for reconciliation DefaultReconcileInterval = 120 // OperatorCertDirDefault is the default directory for storing the operator certificate OperatorCertDirDefault = "/etc/tls/private" // OperatorCertNameDefault is the default name of the operator certificate OperatorCertNameDefault = "tls.crt" // OperatorKeyNameDefault is the default name of the operator key OperatorKeyNameDefault = "tls.key" // OperatorCACertPathDefault is the default path to the CA certificate OperatorCACertPathDefault = "/etc/tls/private/ca.crt" // ClientCACmName is the name of the client CA configmap ClientCACmName = "metrics-client-ca" // ClientCACmNamespace is the namespace of the client CA configmap ClientCACmNamespace = "openshift-monitoring" // ClientCACertKey is the key of the client CA certificate in the configmap ClientCACertKey = "client-ca.crt" // ResourceCreationTimeout is the maximum time in seconds operator waiting for creating resources ResourceCreationTimeout = 60 * time.Second /*** application server configuration file ***/ // OLSConfigName is the name of the OLSConfig configmap OLSConfigCmName = "olsconfig" // OLSNamespaceDefault is the default namespace for OLS OLSNamespaceDefault = "openshift-lightspeed" // OLSAppServerServiceAccountName is the name of service account running the application server OLSAppServerServiceAccountName = "lightspeed-app-server" // OLSAppServerSARRoleName is the name of the SAR role for the service account running the application server OLSAppServerSARRoleName = OLSAppServerServiceAccountName + "-sar-role" // OLSAppServerSARRoleBindingName is the name of the SAR role binding for the service account running the application server OLSAppServerSARRoleBindingName = OLSAppServerSARRoleName + "-binding" // OLSAppServerDeploymentName is the name of the OLS application server deployment OLSAppServerDeploymentName = "lightspeed-app-server" // APIKeyMountRoot is the directory hosting the API key file in the container APIKeyMountRoot = "/etc/apikeys" // #nosec G101 // CredentialsMountRoot is the directory hosting the credential files in the container CredentialsMountRoot = "/etc/credentials" // OLSAppCertsMountRoot is the directory hosting the cert files in the container OLSAppCertsMountRoot = "/etc/certs" // OLSComponentPasswordFileName is the generic name of the password file for each of its components OLSComponentPasswordFileName = "password" // OLSConfigFilename is the name of the application server configuration file OLSConfigFilename = "olsconfig.yaml" // Image of the OLS application server // todo: image vesion should synchronize with the release version of the lightspeed-service-api image. OLSAppServerImageDefault = "quay.io/openshift-lightspeed/lightspeed-service-api:latest" // AppServerServiceMonitorName is the name of the service monitor for the OLS application server AppServerServiceMonitorName = "lightspeed-app-server-monitor" // AppServerPrometheusRuleName is the name of the prometheus rules for the OLS application server AppServerPrometheusRuleName = "lightspeed-app-server-prometheus-rule" // AppServerMetricsPath is the path of the metrics endpoint of the OLS application server AppServerMetricsPath = "/metrics" // AppAdditionalCACertDir is the directory for storing additional CA certificates in the app server container under OLSAppCertsMountRoot AppAdditionalCACertDir = "ols-additional-ca" // AdditionalCAVolumeName is the name of the volume for additional CA certificates provided by the user AdditionalCAVolumeName = "additional-ca" // CertBundleVolumeName is the name of the volume for the certificate bundle CertBundleVolumeName = "cert-bundle" // CertBundleDir is the path of the volume for the certificate bundle CertBundleDir = "cert-bundle" // Image of the OLS application redis server // OLSConfigHashKey is the key of the hash value of the OLSConfig configmap OLSConfigHashKey = "hash/olsconfig" // LLMProviderHashKey is the key of the hash value of OLS LLM provider credentials consolidated // #nosec G101 LLMProviderHashKey = "hash/llmprovider" // OLSAppTLSHashKey is the key of the hash value of the OLS App TLS certificates OLSAppTLSHashKey = "hash/olstls" // OLSConsoleTLSHashKey is the key of the hash value of the OLS Console TLS certificates OLSConsoleTLSHashKey = "hash/olsconsoletls" // AdditionalCAHashKey is the key of the hash value of the additional CA certificates in the deployment annotations AdditionalCAHashKey = "hash/additionalca" // OLSAppServerContainerPort is the port number of the lightspeed-service-api container exposes OLSAppServerContainerPort = 8443 // OLSAppServerServicePort is the port number for OLS application server service. OLSAppServerServicePort = 8443 // OLSAppServerServiceName is the name of the OLS application server service OLSAppServerServiceName = "lightspeed-app-server" // OLSCertsSecretName is the name of the TLS secret for OLS. OLSCertsSecretName = "lightspeed-tls" // #nosec G101 // Annotation key for serving certificate secret name // #nosec G101 ServingCertSecretAnnotationKey = "service.beta.openshift.io/serving-cert-secret-name" /*** state cache keys ***/ // OLSAppTLSHashStateCacheKey is the key of the hash value of the OLS App TLS certificates OLSAppTLSHashStateCacheKey = "olsapptls-hash" // OLSConfigHashStateCacheKey is the key of the hash value of the OLSConfig configmap OLSConfigHashStateCacheKey = "olsconfigmap-hash" // OLSConsoleTLSHashStateCacheKey is the key of the hash value of the OLS Console TLS certificates OLSConsoleTLSHashStateCacheKey = "olsconsoletls-hash" // LLMProviderHashStateCacheKey is the key of the hash value of OLS LLM provider credentials consolidated LLMProviderHashStateCacheKey = "llmprovider-hash" // AzureOpenAIType is the name of the Azure OpenAI provider type AzureOpenAIType = "azure_openai" // AdditionalCAHashStateCacheKey is the key of the hash value of the additional CA certificates in the state cache AdditionalCAHashStateCacheKey = "additionalca-hash" /*** console UI plugin ***/ // ConsoleUIConfigMapName is the name of the console UI nginx configmap ConsoleUIConfigMapName = "lightspeed-console-plugin" // ConsoleUIServiceCertSecretName is the name of the console UI service certificate secret ConsoleUIServiceCertSecretName = "lightspeed-console-plugin-cert" // ConsoleUIServiceName is the name of the console UI service ConsoleUIServiceName = "lightspeed-console-plugin" // ConsoleUIDeploymentName is the name of the console UI deployment ConsoleUIDeploymentName = "lightspeed-console-plugin" // ConsoleUIImage is the image of the console UI plugin ConsoleUIImageDefault = "quay.io/openshift-lightspeed/lightspeed-console-plugin:latest" // ConsoleUIHTTPSPort is the port number of the console UI service ConsoleUIHTTPSPort = 9443 // ConsoleUIPluginName is the name of the console UI plugin ConsoleUIPluginName = "lightspeed-console-plugin" // ConsoleUIPluginDisplayName is the display name of the console UI plugin ConsoleUIPluginDisplayName = "Lightspeed Console" // ConsoleCRName is the name of the console custom resource ConsoleCRName = "cluster" // ConsoleProxyAlias is the alias of the console proxy // The console backend exposes following proxy endpoint: /api/proxy/plugin/<plugin-name>/<proxy-alias>/<request-path>?<optional-query-parameters> ConsoleProxyAlias = "ols" /*** watchers ***/ WatcherAnnotationKey = "ols.openshift.io/watcher" // TelemetryPullSecretNamespace "openshift-config" contains the telemetry pull secret to determine the enablement of telemetry // #nosec G101 TelemetryPullSecretNamespace = "openshift-config" // TelemetryPullSecretName is the name of the secret containing the telemetry pull secret TelemetryPullSecretName = "pull-secret" )
const ( ErrCreateAdditionalCACM = "failed to create additional CA configmap" ErrCreateAPIConfigmap = "failed to create OLS configmap" ErrCreateAPIDeployment = "failed to create OLS deployment" ErrCreateAPIService = "failed to create OLS service" ErrCreateAPIServiceAccount = "failed to create OLS service account" ErrCreateConsolePlugin = "failed to create Console Plugin" ErrCreateConsolePluginConfigMap = "failed to create Console Plugin configmap" ErrCreateConsolePluginDeployment = "failed to create Console Plugin deployment" ErrCreateConsolePluginService = "failed to create Console Plugin service" ErrCreateSARClusterRole = "failed to create SAR cluster role" ErrCreateSARClusterRoleBinding = "failed to create SAR cluster role binding" ErrCreateServiceMonitor = "failed to create ServiceMonitor" ErrCreatePrometheusRule = "failed to create PrometheusRule" ErrDeleteConsolePlugin = "failed to delete Console Plugin" ErrDeleteAdditionalCACM = "failed to delete additional CA configmap" ErrGenerateAdditionalCACM = "failed to generate additional CA configmap" ErrGenerateAPIConfigmap = "failed to generate OLS configmap" ErrGenerateAPIDeployment = "failed to generate OLS deployment" ErrGenerateAPIService = "failed to generate OLS service" ErrGenerateAPIServiceAccount = "failed to generate OLS service account" ErrGenerateConsolePlugin = "failed to generate Console Plugin" ErrGenerateConsolePluginConfigMap = "failed to generate Console Plugin configmap" ErrGenerateConsolePluginDeployment = "failed to generate Console Plugin deployment" ErrGenerateConsolePluginService = "failed to generate Console Plugin service" ErrGenerateHash = "failed to generate hash for the existing OLS configmap" ErrGenerateSARClusterRole = "failed to generate SAR cluster role" ErrGenerateSARClusterRoleBinding = "failed to generate SAR cluster role binding" ErrGenerateServiceMonitor = "failed to generate ServiceMonitor" ErrGeneratePrometheusRule = "failed to generate PrometheusRule" ErrGetAdditionalCACM = "failed to get additional CA configmap" ErrGetAPIConfigmap = "failed to get OLS configmap" ErrGetAPIDeployment = "failed to get OLS deployment" ErrGetAPIService = "failed to get OLS service" ErrGetAPIServiceAccount = "failed to get OLS service account" ErrGetConsole = "failed to get Console" ErrGetConsolePlugin = "failed to get Console Plugin" ErrGetConsolePluginConfigMap = "failed to get Console Plugin configmap" ErrGetConsolePluginDeployment = "failed to get Console Plugin deployment" ErrGetConsolePluginService = "failed to get Console Plugin service" ErrGetLLMSecret = "failed to get LLM provider secret" // #nosec G101 ErrGetTLSSecret = "failed to get TLS secret" // #nosec G101 ErrGetSARClusterRole = "failed to get SAR cluster role" ErrGetSARClusterRoleBinding = "failed to get SAR cluster role binding" ErrGetServiceMonitor = "failed to get ServiceMonitor" ErrGetPrometheusRule = "failed to get PrometheusRule" ErrUpdateAPIConfigmap = "failed to update OLS configmap" ErrUpdateAPIDeployment = "failed to update OLS deployment" ErrUpdateAPIService = "failed to update OLS service" ErrUpdateAdditionalCACM = "failed to update additional CA configmap" ErrUpdateConsole = "failed to update Console" ErrUpdateConsolePlugin = "failed to update Console Plugin" ErrUpdateConsolePluginConfigMap = "failed to update Console Plugin configmap" ErrUpdateConsolePluginDeployment = "failed to update Console Plugin deployment" ErrUpdateConsolePluginService = "failed to update Console Plugin service" ErrUpdateCRStatusCondition = "failed to update OLSConfig CR status condition" ErrUpdateServiceMonitor = "failed to update ServiceMonitor" ErrUpdatePrometheusRule = "failed to update PrometheusRule" )
Variables ¶
This section is empty.
Functions ¶
func SetDefaults_Deployment ¶
func SetDefaults_Deployment(obj *appsv1.Deployment)
This is copied from https://github.com/kubernetes/kubernetes/blob/v1.29.2/pkg/apis/apps/v1/defaults.go#L38 to avoid importing the whole k8s.io/kubernetes package. SetDefaults_Deployment sets additional defaults compared to its counterpart in extensions. These addons are: - MaxUnavailable during rolling update set to 25% (1 in extensions) - MaxSurge value during rolling update set to 25% (1 in extensions) - RevisionHistoryLimit set to 10 (not set in extensions) - ProgressDeadlineSeconds set to 600s (not set in extensions)
Types ¶
type AppSrvConfigFile ¶
type AppSrvConfigFile struct { LLMProviders []ProviderConfig `json:"llm_providers"` OLSConfig OLSConfig `json:"ols_config,omitempty"` UserDataCollectorConfig UserDataCollectorConfig `json:"user_data_collector_config,omitempty"` }
** application server configuration file ** root of the app server configuration file
type AzureOpenAIConfig ¶
type AzureOpenAIConfig struct { // Azure OpenAI API URL URL string `json:"url,omitempty"` // Path where Azure OpenAI accesstoken or credentials are stored CredentialsPath string `json:"credentials_path"` // Azure deployment name AzureDeploymentName string `json:"deployment_name,omitempty"` // API Version for Azure OpenAI provider APIVersion string `json:"api_version,omitempty"` }
type ConversationCacheConfig ¶
type ConversationCacheConfig struct { // Type of cache to use. Default: "redis" Type string `json:"type" default:"redis"` // TODO: Update DB // Redis cache configuration //Redis RedisCacheConfig `json:"redis,omitempty"` // Memory cache configuration Memory MemoryCacheConfig `json:"memory,omitempty"` }
type DeleteFunc ¶
type DeleteTask ¶
type DeleteTask struct { Name string Task DeleteFunc }
type LoggingConfig ¶
type MemoryCacheConfig ¶
type MemoryCacheConfig struct { // Maximum number of cache entries. Default: "1000" MaxEntries int `json:"max_entries,omitempty" default:"1000"` }
type ModelConfig ¶
type ModelConfig struct { // Model name Name string `json:"name"` // Model API URL URL string `json:"url,omitempty"` // Model context window size ContextWindowSize uint `json:"context_window_size,omitempty"` // Model parameters Parameters ModelParameters `json:"parameters,omitempty"` }
ModelSpec defines the desired state of in-memory cache.
type ModelParameters ¶
type ModelParameters struct { // Maximum number of tokens for the input text. Default: 1024 MaxTokensForResponse int `json:"max_tokens_for_response,omitempty"` }
ModelParameters defines the parameters for a model.
type OLSConfig ¶
type OLSConfig struct { // Default model for usage DefaultModel string `json:"default_model,omitempty"` // Default provider for usage DefaultProvider string `json:"default_provider,omitempty"` // Logging config Logging LoggingConfig `json:"logging_config,omitempty"` // Conversation cache ConversationCache ConversationCacheConfig `json:"conversation_cache,omitempty"` // TLS configuration TLSConfig TLSConfig `json:"tls_config,omitempty"` // Query filters QueryFilters []QueryFilters `json:"query_filters,omitempty"` // Reference content for RAG ReferenceContent ReferenceContent `json:"reference_content,omitempty"` // User data collection configuration UserDataCollection UserDataCollectionConfig `json:"user_data_collection,omitempty"` // List of Paths to files containing additional CA certificates in the app server container. ExtraCAs []string `json:"extra_ca,omitempty"` // Path to the directory containing the certificates bundle in the app server container. CertificateDirectory string `json:"certificate_directory,omitempty"` }
type OLSConfigReconciler ¶
type OLSConfigReconciler struct { client.Client Scheme *runtime.Scheme Options OLSConfigReconcilerOptions NextReconcileTime time.Time // contains filtered or unexported fields }
OLSConfigReconciler reconciles a OLSConfig object
func (*OLSConfigReconciler) Reconcile ¶
For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.17.3/pkg/reconcile
func (*OLSConfigReconciler) SetupWithManager ¶
func (r *OLSConfigReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type ProviderConfig ¶
type ProviderConfig struct { // Provider name Name string `json:"name"` // Provider API URL URL string `json:"url,omitempty"` // Path to the file containing API provider credentials in the app server container. // default to "bam_api_key.txt" CredentialsPath string `json:"credentials_path,omitempty" default:"bam_api_key.txt"` // List of models from the provider Models []ModelConfig `json:"models,omitempty"` // Provider type Type string `json:"type,omitempty"` // Watsonx Project ID WatsonProjectID string `json:"project_id,omitempty"` // Azure OpenAI Config AzureOpenAIConfig *AzureOpenAIConfig `json:"azure_openai_config,omitempty"` }
type QueryFilters ¶
type ReconcileFunc ¶
type ReconcileFunc func(context.Context, *olsv1alpha1.OLSConfig) error
** controller inernal **
type ReconcileTask ¶
type ReconcileTask struct { Name string Task ReconcileFunc }
type RedisCacheConfig ¶
type RedisCacheConfig struct { // Redis host Host string `json:"host,omitempty" default:"lightspeed-redis-server.openshift-lightspeed.svc"` // Redis port Port int `json:"port,omitempty" default:"6379"` // Redis maxmemory MaxMemory *intstr.IntOrString `json:"max_memory,omitempty" default:"1024mb"` // Redis maxmemory policy MaxMemoryPolicy string `json:"max_memory_policy,omitempty" default:"allkeys-lru"` // Path to the file containing redis credentials in the app server container. PasswordPath string `json:"password_path,omitempty"` // Redis CA certificate path CACertPath string `json:"ca_cert_path,omitempty"` }
type ReferenceContent ¶
type ReferenceContent struct { // Path to the file containing the product docs index in the app server container. ProductDocsIndexPath string `json:"product_docs_index_path,omitempty"` // Name of the index to load. ProductDocsIndexId string `json:"product_docs_index_id,omitempty"` // Path to the file containing the product docs embeddings model in the app server container. EmbeddingsModelPath string `json:"embeddings_model_path,omitempty"` }
type UserDataCollectionConfig ¶
type UserDataCollectionConfig struct { FeedbackDisabled bool `json:"feedback_disabled" default:"false"` FeedbackStorage string `json:"feedback_storage,omitempty"` TranscriptsDisabled bool `json:"transcripts_disabled" default:"false"` TranscriptsStorage string `json:"transcripts_storage,omitempty"` }