Documentation
¶
Overview ¶
Package utils provides shared utility functions, types, and constants used across the OpenShift Lightspeed operator components.
This package contains:
- Constants for resource names, labels, and annotations
- Error constants for consistent error handling
- Hash computation functions for change detection
- Helper functions for Kubernetes resource operations
- Status condition utilities
- TLS certificate validation
- OpenShift version detection
- Configuration data structures for OLS components
The utilities in this package are designed to be reusable across all operator components (appserver, postgres, console) and promote consistency in resource naming, labeling, and error handling throughout the codebase.
Index ¶
- Constants
- func AnnotateConfigMapWatcher(cm *corev1.ConfigMap)
- func AnnotateSecretWatcher(secret *corev1.Secret)
- func BuildDefaultStorageClass() *storagev1.StorageClass
- func ContainerSpecEqual(a, b *corev1.Container) bool
- func ContainersEqual(a, b []corev1.Container) bool
- func CreateMCPHeaderSecret(ctx context.Context, k8sClient client.Client, name string, ...)
- func CreateTelemetryPullSecret(ctx context.Context, k8sClient client.Client, withToken bool)
- func DeleteTelemetryPullSecret(ctx context.Context, k8sClient client.Client)
- func DeploymentSpecEqual(a, b *appsv1.DeploymentSpec) bool
- func GenerateAppServerSelectorLabels() map[string]string
- func GeneratePostgresSelectorLabels() map[string]string
- func GenerateRandomConfigMap() (*corev1.ConfigMap, error)
- func GenerateRandomSecret() (*corev1.Secret, error)
- func GenerateRandomTLSSecret() (*corev1.Secret, error)
- func GetAllSecretContent(rclient client.Client, secretName string, namespace string, ...) (map[string]string, error)
- func GetContainerIndex(deployment *appsv1.Deployment, containerName string) (int, error)
- func GetDefaultOLSConfigCR() *olsv1alpha1.OLSConfig
- func GetEmptyOLSConfigCR() *olsv1alpha1.OLSConfig
- func GetNoCacheCR() *olsv1alpha1.OLSConfig
- func GetOLSConfigWithCacheCR() *olsv1alpha1.OLSConfig
- func GetOpenshiftVersion(k8sClient client.Client, ctx context.Context) (string, string, error)
- func GetProxyEnvVars() []corev1.EnvVar
- func GetSecretContent(rclient client.Client, secretName string, namespace string, ...) (map[string]string, error)
- func HashBytes(sourceStr []byte) (string, error)
- func IsPrometheusOperatorAvailable(ctx context.Context, c client.Client) bool
- func NetworkPolicyEqual(a *networkingv1.NetworkPolicy, b *networkingv1.NetworkPolicy) bool
- func PodVolumeEqual(a, b []corev1.Volume) bool
- func ProbeEqual(a, b *corev1.Probe) bool
- func PrometheusRuleEqual(a *monv1.PrometheusRule, b *monv1.PrometheusRule) bool
- func ProviderNameToEnvVarName(providerName string) string
- func ServiceEqual(a *corev1.Service, b *corev1.Service) bool
- func ServiceMonitorEqual(a *monv1.ServiceMonitor, b *monv1.ServiceMonitor) bool
- func SetDefaults_Deployment(obj *appsv1.Deployment)
- func SetDeploymentContainerEnvs(deployment *appsv1.Deployment, desiredEnvs []corev1.EnvVar, ...) (bool, error)
- func SetDeploymentContainerResources(deployment *appsv1.Deployment, resources *corev1.ResourceRequirements, ...) (bool, error)
- func SetDeploymentContainerVolumeMounts(deployment *appsv1.Deployment, containerName string, ...) (bool, error)
- func SetDeploymentReplicas(deployment *appsv1.Deployment, replicas int32) bool
- func SetNodeSelector(deployment *appsv1.Deployment, nodeSelector map[string]string) bool
- func SetTolerations(deployment *appsv1.Deployment, tolerations []corev1.Toleration) bool
- func SetVolumeMounts(deployment *appsv1.Deployment, desiredVolumeMounts []corev1.VolumeMount, ...) (bool, error)
- func SetVolumes(deployment *appsv1.Deployment, desiredVolumes []corev1.Volume) bool
- func StatusHasCondition(status olsv1alpha1.OLSConfigStatus, condition metav1.Condition) bool
- func UpdateDeploymentAnnotations(deployment *appsv1.Deployment, annotations map[string]string)
- func UpdateDeploymentTemplateAnnotations(deployment *appsv1.Deployment, annotations map[string]string)
- func ValidateCertificateFormat(cert []byte) error
- func WithAzureOpenAIProvider(cr *olsv1alpha1.OLSConfig) *olsv1alpha1.OLSConfig
- func WithProviderType(cr *olsv1alpha1.OLSConfig, name, providerType string) *olsv1alpha1.OLSConfig
- func WithQueryFilters(cr *olsv1alpha1.OLSConfig) *olsv1alpha1.OLSConfig
- func WithQuotaLimiters(cr *olsv1alpha1.OLSConfig) *olsv1alpha1.OLSConfig
- func WithRHELAIProvider(cr *olsv1alpha1.OLSConfig) *olsv1alpha1.OLSConfig
- func WithRHOAIProvider(cr *olsv1alpha1.OLSConfig) *olsv1alpha1.OLSConfig
- func WithWatsonxProvider(cr *olsv1alpha1.OLSConfig) *olsv1alpha1.OLSConfig
- type AppSrvConfigFile
- type AzureOpenAIConfig
- type ConversationCacheConfig
- type DeleteFunc
- type DeleteTask
- type LimiterConfig
- type LoggingConfig
- type MCPServerConfig
- type MCPTransport
- type MemoryCacheConfig
- type ModelConfig
- type ModelParameters
- type OLSConfig
- type OLSConfigReconcilerOptions
- type OperatorReconcileFuncs
- type PostgresCacheConfig
- type ProviderConfig
- type ProxyConfig
- type QueryFilters
- type QuotaHandlersConfig
- type ReconcileFunc
- type ReconcileSteps
- type ReconcileTask
- type ReferenceContent
- type ReferenceIndex
- type SchedulerConfig
- type StdioTransportConfig
- type StreamableHTTPTransportConfig
- type TLSConfig
- type TestReconciler
- func (r *TestReconciler) GetAppServerImage() string
- func (r *TestReconciler) GetConsoleUIImage() string
- func (r *TestReconciler) GetDataverseExporterImage() string
- func (r *TestReconciler) GetLCoreImage() string
- func (r *TestReconciler) GetLogger() logr.Logger
- func (r *TestReconciler) GetNamespace() string
- func (r *TestReconciler) GetOpenShiftMCPServerImage() string
- func (r *TestReconciler) GetOpenShiftMajor() string
- func (r *TestReconciler) GetOpenshiftMinor() string
- func (r *TestReconciler) GetPostgresImage() string
- func (r *TestReconciler) GetScheme() *runtime.Scheme
- func (r *TestReconciler) GetStateCache() map[string]string
- func (r *TestReconciler) IsPrometheusAvailable() bool
- 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" // OLSCAConfigMap is the name of the OLS TLS ca certificate configmap OLSCAConfigMap = "openshift-service-ca.crt" // 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" // UserCACertDir is the directory for storing additional CA certificates in the app server container under OLSAppCertsMountRoot UserCACertDir = "ols-user-ca" // OpenShiftCAVolumeName is the name of the volume for OpenShift CA certificates OpenShiftCAVolumeName = "openshift-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" // ProxyCACertFileName is the name of the proxy CA certificate file ProxyCACertFileName = "proxy-ca.crt" // ProxyCACertVolumeName is the name of the volume for the proxy CA certificate ProxyCACertVolumeName = "proxy-ca" // RAGVolumeName is the name of the volume hosting customized RAG content RAGVolumeName = "rag" // RAGVolumeMountPath is the path of the volume hosting customized RAG content RAGVolumeMountPath = "/rag-data" // OLSAppServerNetworkPolicyName is the name of the network policy for the OLS application server OLSAppServerNetworkPolicyName = "lightspeed-app-server" // FeatureGateMCPServer is the feature gate flag activating the MCP server FeatureGateMCPServer = "MCPServer" // 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 ***/ OLSConfigHashStateCacheKey = "olsconfigmap-hash" 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" // DeploymentInProgress message DeploymentInProgress = "In Progress" /*** 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" // ConsoleUIImage is the image of the console UI plugin ConsoleUIImagePF5Default = "quay.io/openshift-lightspeed/lightspeed-console-plugin-pf5: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" // OLSConsoleTLSHashStateCacheKey is the key of the hash value of the OLS Console TLS certificates OLSConsoleTLSHashStateCacheKey = "olsconsoletls-hash" // ConsoleUINetworkPolicyName is the name of the network policy for the console UI plugin ConsoleUINetworkPolicyName = "lightspeed-console-plugin" /*** watchers ***/ // Watcher Annotation key WatcherAnnotationKey = "ols.openshift.io/watcher" // ConfigMap with default openshift certificates DefaultOpenShiftCerts = "kube-root-ca.crt" // Force reload annotation key ForceReloadAnnotationKey = "ols.openshift.io/force-reload" /*** Postgres Constants ***/ // PostgresCAVolume is the name of the OLS Postgres TLS ca certificate volume name PostgresCAVolume = "cm-olspostgresca" // PostgresDeploymentName is the name of OLS application Postgres deployment PostgresDeploymentName = "lightspeed-postgres-server" // PostgresSecretKeyName is the name of the key holding Postgres server secret PostgresSecretKeyName = "password" // Image of the OLS application postgres server PostgresServerImageDefault = "registry.redhat.io/rhel9/postgresql-16@sha256:42f385ac3c9b8913426da7c57e70bc6617cd237aaf697c667f6385a8c0b0118b" // PostgresDefaultUser is the default user name for postgres PostgresDefaultUser = "postgres" // PostgresDefaultDbName is the default db name for Postgres PostgresDefaultDbName = "postgres" // PostgresConfigHashKey is the key of the hash value of the OLS's Postgres config PostgresConfigHashKey = "hash/olspostgresconfig" // PostgresSecretHashKey is the key of the hash value of OLS Postgres secret // #nosec G101 PostgresSecretHashKey = "hash/postgres-secret" // PostgresServiceName is the name of OLS application Postgres server service PostgresServiceName = "lightspeed-postgres-server" // PostgresSecretName is the name of OLS application Postgres secret PostgresSecretName = "lightspeed-postgres-secret" // PostgresCertsSecretName is the name of the Postgres certs secret PostgresCertsSecretName = "lightspeed-postgres-certs" // PostgresBootstrapSecretName is the name of the Postgres bootstrap secret // #nosec G101 PostgresBootstrapSecretName = "lightspeed-postgres-bootstrap" // PostgresBootstrapVolumeMountPath is the path of bootstrap volume mount PostgresBootstrapVolumeMountPath = "/usr/share/container-scripts/postgresql/start/create-extensions.sh" // PostgresExtensionScript is the name of the Postgres extensions script PostgresExtensionScript = "create-extensions.sh" // PostgresConfigMap is the name of the Postgres config map PostgresConfigMap = "lightspeed-postgres-conf" // PostgresConfigVolumeMountPath is the path of Postgres configuration volume mount PostgresConfigVolumeMountPath = "/usr/share/pgsql/postgresql.conf.sample" // PostgresConfig is the name of Postgres configuration used to start the server PostgresConfig = "postgresql.conf.sample" // PostgresDataVolume is the name of Postgres data volume PostgresDataVolume = "postgres-data" // PostgresDataVolumeMountPath is the path of Postgres data volume mount PostgresDataVolumeMountPath = "/var/lib/pgsql" // PostgreVarRunVolumeName is the data volume name for the /var/run/postgresql writable mount PostgresVarRunVolumeName = "lightspeed-postgres-var-run" // PostgresVarRunVolumeMountPath is the path of Postgres data volume mount PostgresVarRunVolumeMountPath = "/var/run/postgresql" // PostgresServicePort is the port number of the OLS Postgres server service PostgresServicePort = 5432 PostgresSharedBuffers = "256MB" // PostgresMaxConnections is the max connections values for Postgres cache PostgresMaxConnections = 2000 // PostgresDefaultSSLMode is the default ssl mode for postgres PostgresDefaultSSLMode = "require" // PostgresBootStrapScriptContent is the postgres's bootstrap script content PostgresBootStrapScriptContent = `` /* 259-byte string literal not displayed */ // PostgresConfigMapContent is the postgres's config content PostgresConfigMapContent = `` /* 159-byte string literal not displayed */ // PostgresNetworkPolicyName is the name of the network policy for the OLS postgres server PostgresNetworkPolicyName = "lightspeed-postgres-server" // PostgresPVCName is the name of the PVC for the OLS Postgres server PostgresPVCName = "lightspeed-postgres-pvc" // PostgresDefaultPVCSize is the default size of the PVC for the OLS Postgres server PostgresDefaultPVCSize = "1Gi" // TmpVolume is the data volume name for the /tmp writable mount TmpVolumeName = "tmp-writable-volume" // TmpVolumeMountPath is the path of the /tmp writable mount TmpVolumeMountPath = "/tmp" /*** 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 // 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" /*** operator resources ***/ // OperatorServiceMonitorName is the name of the service monitor for scraping the operator metrics OperatorServiceMonitorName = "controller-manager-metrics-monitor" // OperatorDeploymentName is the name of the operator deployment OperatorDeploymentName = "lightspeed-operator-controller-manager" OLSDefaultCacheType = "postgres" PostgresConfigHashStateCacheKey = "olspostgresconfig-hash" // #nosec G101 PostgresSecretHashStateCacheKey = "olspostgressecret-hash" // OperatorNetworkPolicyName is the name of the network policy for the operator OperatorNetworkPolicyName = "lightspeed-operator" // OperatorMetricsPort is the port number of the operator metrics endpoint OperatorMetricsPort = 8443 // MetricsReaderServiceAccountTokenSecretName is the name of the secret containing the service account token for the metrics reader MetricsReaderServiceAccountTokenSecretName = "metrics-reader-token" // #nosec G101 // MetricsReaderServiceAccountName is the name of the service account for the metrics reader MetricsReaderServiceAccountName = "lightspeed-operator-metrics-reader" // MCP server image OpenShiftMCPServerImageDefault = "" /* 151-byte string literal not displayed */ // MCP server URL OpenShiftMCPServerURL = "http://localhost:%d/mcp" // MCP server port OpenShiftMCPServerPort = 8080 // MCP server timeout, sec OpenShiftMCPServerTimeout = 60 // MCP server SSE read timeout, sec OpenShiftMCPServerHTTPReadTimeout = 30 // Authorization header for OpenShift MCP server K8S_AUTH_HEADER = "Authorization" // Constant, defining usage of kubernetes token KUBERNETES_PLACEHOLDER = "kubernetes" // MCPHeadersMountRoot is the directory hosting MCP headers in the container MCPHeadersMountRoot = "/etc/mcp/headers" // Header Secret Data Path MCPSECRETDATAPATH = "header" // OCP RAG image OcpRagImageDefault = "" /* 157-byte string literal not displayed */ /*** Data Exporter Constants ***/ // Dataverse exporter image DataverseExporterImageDefault = "" /* 163-byte string literal not displayed */ // ExporterConfigCmName is the name of the exporter configmap ExporterConfigCmName = "lightspeed-exporter-config" // ExporterConfigVolumeName is the name of the volume for exporter configuration ExporterConfigVolumeName = "exporter-config" // ExporterConfigMountPath is the path where exporter config is mounted ExporterConfigMountPath = "/etc/config" // ExporterConfigFilename is the name of the exporter configuration file ExporterConfigFilename = "config.yaml" // OLSUserDataMountPath is the path where user data is mounted in the app server container OLSUserDataMountPath = "/app-root/ols-user-data" /*** Container Names (used for testing) ***/ // OLSAppServerContainerName is the name of the OLS application server container OLSAppServerContainerName = "lightspeed-service-api" // DataverseExporterContainerName is the name of the dataverse exporter container DataverseExporterContainerName = "lightspeed-to-dataverse-exporter" // ConsoleUIContainerName is the name of the console UI container ConsoleUIContainerName = "lightspeed-console-plugin" // PostgresContainerName is the name of the postgres container PostgresContainerName = "lightspeed-postgres-server" // OpenShiftMCPServerContainerName is the name of the OpenShift MCP server container OpenShiftMCPServerContainerName = "openshift-mcp-server" /*** Log Levels (used for testing) ***/ // LogLevelInfo is the INFO log level LogLevelInfo = "INFO" // LogLevelDebug is the DEBUG log level LogLevelDebug = "DEBUG" // LogLevelWarning is the WARNING log level LogLevelWarning = "WARNING" // LogLevelError is the ERROR log level LogLevelError = "ERROR" /*** LCore specific Settings ***/ // LlamaStackConfigCmName name for the Llama stack config map LlamaStackConfigCmName = "llama-stack-config" // LCoreConfigCmName name for the LCore config map LCoreConfigCmName = "lightspeed-stack-config" // LlamaStackImageDefault default image for Llama Stack LlamaStackImageDefault = "quay.io/lightspeed-core/lightspeed-stack:dev-latest" // LlamaStackConfigHashKey is the key of the hash value of the Llama Stack configmap LlamaStackConfigHashKey = "hash/llamastackconfig" // LCoreDeploymentName is the name of the LCore deployment (used for testing) LCoreDeploymentName = "lightspeed-stack-deployment" // LCoreAppLabel is the app label for LCore resources (used for testing) LCoreAppLabel = "lightspeed-stack" // LlamaStackContainerName is the name of the Llama Stack container (used for testing) LlamaStackContainerName = "llama-stack" // LCoreContainerName is the name of the LCore container (used for testing) LCoreContainerName = "lightspeed-stack" // LlamaStackContainerPort is the port for the Llama Stack container (used for testing) LlamaStackContainerPort = 8321 // LlamaCacheVolumeName is the name of the Llama cache volume (used for testing) LlamaCacheVolumeName = "llama-cache" // LlamaStackConfigFilename is the filename for Llama Stack config (used for testing) LlamaStackConfigFilename = "run.yaml" // LCoreConfigFilename is the filename for LCore config (used for testing) LCoreConfigFilename = "lightspeed-stack.yaml" // KubeRootCAMountPath is the mount path for kube-root-ca.crt (used for testing) KubeRootCAMountPath = "/etc/pki/ca-trust/extracted/pem" // AdditionalCAMountPath is the mount path for additional CA certificates (used for testing) AdditionalCAMountPath = "/etc/pki/ca-trust/source/anchors" // LlamaStackHealthPath is the health check path for Llama Stack (used for testing) LlamaStackHealthPath = "/v1/health" )
const ( ErrCheckLLMCredentials = "failed to validate LLM provider credential settings" 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" ErrCreateAppServerNetworkPolicy = "failed to create AppServer network policy" 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" ErrCreateConsolePluginNetworkPolicy = "failed to create Console Plugin network policy" ErrCreateSARClusterRole = "failed to create SAR cluster role" ErrCreateSARClusterRoleBinding = "failed to create SAR cluster role binding" ErrCreateServiceMonitor = "failed to create ServiceMonitor" ErrCreateMetricsReaderSecret = "failed to create metrics reader secret" ErrCreateOperatorNetworkPolicy = "failed to create operator network policy" ErrCreatePrometheusRule = "failed to create PrometheusRule" ErrCreatePostgresSecret = "failed to create OLS Postgres secret" ErrCreatePostgresBootstrapSecret = "failed to create OLS Postgres bootstrap secret" ErrCreatePostgresConfigMap = "failed to create OLS Postgres configmap" ErrCreatePostgresService = "failed to create OLS Postgres service" ErrCreatePostgresPVC = "failed to create OLS Postgres PVC" ErrCreatePostgresDeployment = "failed to create OLS Postgres deployment" ErrCreatePostgresNetworkPolicy = "failed to create OLS Postgres network policy" 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" ErrGenerateAppServerNetworkPolicy = "failed to generate AppServer network policy" ErrGenerateConsolePlugin = "failed to generate Console Plugin" ErrGenerateConsolePluginConfigMap = "failed to generate Console Plugin configmap" ErrGenerateConsolePluginDeployment = "failed to generate Console Plugin deployment" ErrGenerateConsolePluginNetworkPolicy = "failed to generate Console Plugin network policy" ErrGenerateConsolePluginService = "failed to generate Console Plugin service" ErrGenerateHash = "failed to generate hash for the existing OLS configmap" ErrGenerateOperatorNetworkPolicy = "failed to generate operator network policy" ErrGenerateProviderCredentialsHash = "failed to generate OLS provider credentials hash" ErrGenerateSARClusterRole = "failed to generate SAR cluster role" ErrGenerateSARClusterRoleBinding = "failed to generate SAR cluster role binding" ErrGenerateServiceMonitor = "failed to generate ServiceMonitor" ErrGenerateMetricsReaderSecret = "failed to generate metrics reader secret" ErrGeneratePrometheusRule = "failed to generate PrometheusRule" ErrGetAdditionalCACM = "failed to get additional CA configmap" ErrGetProxyCACM = "failed to get proxy CA configmap" ErrGeneratePostgresSecret = "failed to generate OLS Postgres secret" ErrGeneratePostgresBootstrapSecret = "failed to generate OLS Postgres bootstrap secret" ErrGeneratePostgresConfigMap = "failed to generate OLS Postgres configmap" ErrGeneratePostgresPVC = "failed to generate OLS Postgres PVC" ErrGeneratePostgresService = "failed to generate OLS Postgres service" ErrGeneratePostgresSecretHash = "failed to generate hash for the existing OLS postgres secret" ErrGeneratePostgresDeployment = "failed to generate OLS Postgres deployment" ErrGeneratePostgresNetworkPolicy = "failed to generate OLS Postgres network policy" 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" ErrGetAppServerNetworkPolicy = "failed to get AppServer network policy" 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" ErrGetConsolePluginNetworkPolicy = "failed to get Console Plugin network policy" ErrGetConsolePluginService = "failed to get Console Plugin service" ErrGetLLMSecret = "failed to get LLM provider secret" // #nosec G101 ErrGetOperatorNetworkPolicy = "failed to get operator network policy" ErrGetPostgresNetworkPolicy = "failed to get OLS Postgres network policy" 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" ErrGetMetricsReaderSecret = "failed to get metrics reader secret" ErrGetPrometheusRule = "failed to get PrometheusRule" ErrUpdateAPIConfigmap = "failed to update OLS configmap" ErrUpdateAPIDeployment = "failed to update OLS deployment" ErrUpdateAPIService = "failed to update OLS service" ErrUpdateAppServerNetworkPolicy = "failed to update AppServer network policy" 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" ErrUpdateConsolePluginNetworkPolicy = "failed to update Console Plugin network policy" ErrUpdateConsolePluginService = "failed to update Console Plugin service" ErrUpdateCRStatusCondition = "failed to update OLSConfig CR status condition" ErrUpdateOperatorNetworkPolicy = "failed to update operator network policy" ErrUpdatePostgresNetworkPolicy = "failed to update OLS Postgres network policy" ErrUpdateServiceMonitor = "failed to update ServiceMonitor" ErrUpdateMetricsReaderSecret = "failed to update metrics reader secret" ErrUpdatePrometheusRule = "failed to update PrometheusRule" ErrUpdateProxyCACM = "failed to update proxy CA configmap" // #nosec G101 ErrGetPostgresSecret = "failed to get OLS Postgres secret" // #nosec G101 ErrGetPostgresBootstrapSecret = "failed to get OLS Postgres bootstrap secret" ErrGetPostgresConfigMap = "failed to get OLS Postgres configmap" ErrGetPostgresService = "failed to get OLS Postgres service" ErrGetPostgresPVC = "failed to get OLS Postgres PVC" ErrGetPostgresDeployment = "failed to get OLS Postgres deployment" ErrUpdateProviderSecret = "failed to update provider secret" ErrUpdatePostgresSecret = "failed to update OLS Postgres secret" ErrUpdatePostgresDeployment = "failed to update OLS Postgres deployment" ErrListOldPostgresSecrets = "failed to list old OLS Postgres secrets" ErrDeleteOldPostgresSecrets = "failed to delete old OLS Postgres secret" // Llama Stack specific errors ErrCreateLlamaStackConfigMap = "failed to create Llama Stack configmap" ErrGenerateLlamaStackConfigMap = "failed to generate Llama Stack configmap" ErrGetLlamaStackConfigMap = "failed to get Llama Stack configmap" ErrUpdateLlamaStackConfigMap = "failed to update Llama Stack configmap" )
const ( TypeApiReady = "ApiReady" TypeCacheReady = "CacheReady" TypeConsolePluginReady = "ConsolePluginReady" TypeCRReconciled = "Reconciled" )
Definitions to manage status conditions
const TestCACert = `` /* 1513-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func AnnotateConfigMapWatcher ¶
AnnotateConfigMapWatcher adds the watcher annotation to a configmap
func AnnotateSecretWatcher ¶
AnnotateSecretWatcher adds the watcher annotation to a secret
func BuildDefaultStorageClass ¶
func BuildDefaultStorageClass() *storagev1.StorageClass
BuildDefaultStorageClass creates a test StorageClass with standard configuration. This is useful for testing PVC-related functionality.
func ContainerSpecEqual ¶
containerSpecEqual compares two corev1.Container and returns true if they are equal. checks performed on limited fields
func ContainersEqual ¶
containerEqual compares two container arrays and returns true if they are equal.
func CreateMCPHeaderSecret ¶
func CreateMCPHeaderSecret(ctx context.Context, k8sClient client.Client, name string, withValidHeader bool)
CreateMCPHeaderSecret creates a secret for MCP server header configuration. If withValidHeader is true, creates a secret with the correct header key. If withValidHeader is false, creates a secret with incorrect/garbage key (for negative tests). This function is idempotent - ignores "already exists" errors.
func CreateTelemetryPullSecret ¶
CreateTelemetryPullSecret creates a pull-secret in openshift-config namespace for testing telemetry/data collection features. If withToken is true, creates a secret with cloud.openshift.com auth. If withToken is false, creates a secret without telemetry token (for negative tests). This function is idempotent - ignores "already exists" errors.
func DeleteTelemetryPullSecret ¶
DeleteTelemetryPullSecret removes the pull-secret from openshift-config namespace. This function is idempotent - ignores "not found" errors.
func DeploymentSpecEqual ¶
func DeploymentSpecEqual(a, b *appsv1.DeploymentSpec) bool
deploymentSpecEqual compares two appsv1.DeploymentSpec and returns true if they are equal.
func GenerateAppServerSelectorLabels ¶
GenerateAppServerSelectorLabels returns selector labels for Application Server components
func GeneratePostgresSelectorLabels ¶
GeneratePostgresSelectorLabels returns selector labels for Postgres components
func GenerateRandomConfigMap ¶
GenerateRandomConfigMap creates a test ConfigMap with sample data. This is useful for testing ConfigMap-dependent functionality without collision.
func GenerateRandomSecret ¶
GenerateRandomSecret creates a test secret with a random API token. This is useful for testing secret-dependent functionality without collision.
func GenerateRandomTLSSecret ¶
GenerateRandomTLSSecret creates a test TLS secret with random key and cert. This is useful for testing TLS-dependent functionality without collision.
func GetAllSecretContent ¶
func GetContainerIndex ¶
func GetContainerIndex(deployment *appsv1.Deployment, containerName string) (int, error)
getContainerIndex returns the index of the container with the specified name in a given deployment.
func GetDefaultOLSConfigCR ¶
func GetDefaultOLSConfigCR() *olsv1alpha1.OLSConfig
GetDefaultOLSConfigCR creates an OLSConfig CR with fully configured specs. This is the most commonly used fixture for testing full functionality.
func GetEmptyOLSConfigCR ¶
func GetEmptyOLSConfigCR() *olsv1alpha1.OLSConfig
GetEmptyOLSConfigCR creates an OLSConfig CR with no fields set in its specs. This is useful for testing default values and validation.
func GetNoCacheCR ¶
func GetNoCacheCR() *olsv1alpha1.OLSConfig
GetNoCacheCR creates an OLSConfig CR with no cache configuration. This is useful for testing in-memory cache scenarios.
func GetOLSConfigWithCacheCR ¶
func GetOLSConfigWithCacheCR() *olsv1alpha1.OLSConfig
GetOLSConfigWithCacheCR creates an OLSConfig CR with only cache configuration. This is useful for testing cache-specific functionality.
func GetOpenshiftVersion ¶
Get Openshift version
func GetProxyEnvVars ¶
func GetSecretContent ¶
func IsPrometheusOperatorAvailable ¶
IsPrometheusOperatorAvailable checks if Prometheus Operator CRDs are available on the cluster. It attempts to list ServiceMonitor and PrometheusRule resources to determine availability. Returns true if both CRDs are present, false otherwise.
func NetworkPolicyEqual ¶
func NetworkPolicyEqual(a *networkingv1.NetworkPolicy, b *networkingv1.NetworkPolicy) bool
networkPolicyEqual compares two networkingv1.NetworkPolicy and returns true if they are equal.
func PodVolumeEqual ¶
podVolumEqual compares two slices of corev1.Volume and returns true if they are equal. covers 3 volume types: Secret, ConfigMap, EmptyDir
func ProbeEqual ¶
func PrometheusRuleEqual ¶
func PrometheusRuleEqual(a *monv1.PrometheusRule, b *monv1.PrometheusRule) bool
prometheusRuleEqual compares two monv1.PrometheusRule and returns true if they are equal.
func ProviderNameToEnvVarName ¶
ProviderNameToEnvVarName converts a provider name to a valid environment variable name. Kubernetes resource names typically use hyphens (DNS-1123), but environment variable names cannot contain hyphens. This function replaces hyphens with underscores and converts to uppercase for consistency with environment variable naming conventions.
Example: "my-provider" -> "MY_PROVIDER"
func ServiceEqual ¶
serviceEqual compares two v1.Service and returns true if they are equal.
func ServiceMonitorEqual ¶
func ServiceMonitorEqual(a *monv1.ServiceMonitor, b *monv1.ServiceMonitor) bool
serviceMonitorEqual compares two monv1.ServiceMonitor and returns true if they are equal.
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)
func SetDeploymentContainerEnvs ¶
func SetDeploymentContainerEnvs(deployment *appsv1.Deployment, desiredEnvs []corev1.EnvVar, containerName string) (bool, error)
setDeploymentContainerEnvs sets the envs for a specific container in a given deployment.
func SetDeploymentContainerResources ¶
func SetDeploymentContainerResources(deployment *appsv1.Deployment, resources *corev1.ResourceRequirements, containerName string) (bool, error)
setDeploymentContainerResources sets the resource requirements for a specific container in a given deployment.
func SetDeploymentContainerVolumeMounts ¶
func SetDeploymentContainerVolumeMounts(deployment *appsv1.Deployment, containerName string, volumeMounts []corev1.VolumeMount) (bool, error)
setDeploymentContainerVolumeMounts sets the volume mounts for a specific container in a given deployment.
func SetDeploymentReplicas ¶
func SetDeploymentReplicas(deployment *appsv1.Deployment, replicas int32) bool
setDeploymentReplicas sets the number of replicas in a given deployment.
func SetNodeSelector ¶
func SetNodeSelector(deployment *appsv1.Deployment, nodeSelector map[string]string) bool
func SetTolerations ¶
func SetTolerations(deployment *appsv1.Deployment, tolerations []corev1.Toleration) bool
func SetVolumeMounts ¶
func SetVolumeMounts(deployment *appsv1.Deployment, desiredVolumeMounts []corev1.VolumeMount, containerName string) (bool, error)
setVolumeMounts sets the volumes mounts for a specific container in a given deployment.
func SetVolumes ¶
func SetVolumes(deployment *appsv1.Deployment, desiredVolumes []corev1.Volume) bool
setVolumes sets the volumes for a given deployment.
func StatusHasCondition ¶
func StatusHasCondition(status olsv1alpha1.OLSConfigStatus, condition metav1.Condition) bool
StatusHasCondition checks if an OLSConfig status contains a specific condition. It ignores ObservedGeneration and LastTransitionTime when comparing.
func UpdateDeploymentAnnotations ¶
func UpdateDeploymentAnnotations(deployment *appsv1.Deployment, annotations map[string]string)
updateDeploymentAnnotations updates the annotations in a given deployment.
func UpdateDeploymentTemplateAnnotations ¶
func UpdateDeploymentTemplateAnnotations(deployment *appsv1.Deployment, annotations map[string]string)
func ValidateCertificateFormat ¶
validate the x509 certificate syntax
func WithAzureOpenAIProvider ¶
func WithAzureOpenAIProvider(cr *olsv1alpha1.OLSConfig) *olsv1alpha1.OLSConfig
WithAzureOpenAIProvider configures the first LLM provider as Azure OpenAI. This modifies the CR in place and returns it for chaining. Requires that Providers[0] already exists.
func WithProviderType ¶
func WithProviderType(cr *olsv1alpha1.OLSConfig, name, providerType string) *olsv1alpha1.OLSConfig
WithProviderType is a generic helper to configure the first LLM provider with a specific type. This is useful when you need to test custom provider configurations. This modifies the CR in place and returns it for chaining. Requires that Providers[0] already exists.
Example:
cr = utils.WithProviderType(cr, "custom_provider", "custom")
func WithQueryFilters ¶
func WithQueryFilters(cr *olsv1alpha1.OLSConfig) *olsv1alpha1.OLSConfig
WithQueryFilters adds test query filters to an OLSConfig CR. This modifies the CR in place and returns it for chaining.
func WithQuotaLimiters ¶
func WithQuotaLimiters(cr *olsv1alpha1.OLSConfig) *olsv1alpha1.OLSConfig
WithQuotaLimiters adds test quota limiters to an OLSConfig CR. This modifies the CR in place and returns it for chaining.
func WithRHELAIProvider ¶
func WithRHELAIProvider(cr *olsv1alpha1.OLSConfig) *olsv1alpha1.OLSConfig
WithRHELAIProvider configures the first LLM provider as RHELAI vLLM. This modifies the CR in place and returns it for chaining. Requires that Providers[0] already exists.
func WithRHOAIProvider ¶
func WithRHOAIProvider(cr *olsv1alpha1.OLSConfig) *olsv1alpha1.OLSConfig
WithRHOAIProvider configures the first LLM provider as RHOAI vLLM. This modifies the CR in place and returns it for chaining. Requires that Providers[0] already exists.
func WithWatsonxProvider ¶
func WithWatsonxProvider(cr *olsv1alpha1.OLSConfig) *olsv1alpha1.OLSConfig
WithWatsonxProvider configures the first LLM provider as IBM Watsonx. This modifies the CR in place and returns it for chaining. Requires that Providers[0] already exists.
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"`
MCPServers []MCPServerConfig `json:"mcp_servers,omitempty"`
}
** application server configuration file ** root of the app server configuration file
type AzureOpenAIConfig ¶
type ConversationCacheConfig ¶
type ConversationCacheConfig struct {
// Type of cache to use. Default: "postgres"
Type string `json:"type" default:"postgres"`
// Postgres cache configuration
Postgres PostgresCacheConfig `json:"postgres,omitempty"`
}
type DeleteFunc ¶
type DeleteFunc func(reconciler.Reconciler, context.Context) error
type DeleteTask ¶
type DeleteTask struct {
Name string
Task DeleteFunc
}
type LimiterConfig ¶
type LimiterConfig struct {
// Name of the limiter
Name string `json:"name"`
// Type of the limiter
Type string `json:"type"`
// Initial value of the token quota
InitialQuota int `json:"initial_quota"`
// Token quota increase step
QuotaIncrease int `json:"quota_increase"`
// Period of time the token quota is for
Period string `json:"period"`
}
LimiterConfig defines settings for a token quota limiter
type LoggingConfig ¶
type MCPServerConfig ¶
type MCPServerConfig struct {
// MCP server name
Name string `json:"name"`
// MCP server transport - stdio or sse
Transport MCPTransport `json:"transport"`
// Transport settings if the transport is stdio
Stdio *StdioTransportConfig `json:"stdio,omitempty"`
// Transport settings if the transport is sse
SSE *StreamableHTTPTransportConfig `json:"sse,omitempty"`
// Transport settings if the transport is streamable_http
StreamableHTTP *StreamableHTTPTransportConfig `json:"streamable_http,omitempty"`
}
type MCPTransport ¶
type MCPTransport string
const ( SSE MCPTransport = "sse" Stdio MCPTransport = "stdio" StreamableHTTP MCPTransport = "streamable_http" )
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"`
// Proxy settings
ProxyConfig *ProxyConfig `json:"proxy_config,omitempty"`
// LLM Token Quota Configuration
QuotaHandlersConfig *QuotaHandlersConfig `json:"quota_handlers,omitempty"`
}
type OLSConfigReconcilerOptions ¶
type OLSConfigReconcilerOptions struct {
OpenShiftMajor string
OpenshiftMinor string
LightspeedServiceImage string
LightspeedServicePostgresImage string
ConsoleUIImage string
DataverseExporterImage string
OpenShiftMCPServerImage string
LightspeedCoreImage string
UseLCore bool
Namespace string
ReconcileInterval time.Duration
PrometheusAvailable bool
}
type OperatorReconcileFuncs ¶
type PostgresCacheConfig ¶
type PostgresCacheConfig struct {
// Postgres host
Host string `json:"host,omitempty" default:"lightspeed-postgres-server.openshift-lightspeed.svc"`
// Postgres port
Port int `json:"port,omitempty" default:"5432"`
// Postgres user
User string `json:"user,omitempty" default:"postgres"`
// Postgres dbname
DbName string `json:"dbname,omitempty" default:"postgres"`
// Path to the file containing postgres credentials in the app server container
PasswordPath string `json:"password_path,omitempty"`
// SSLMode is the preferred ssl mode to connect with postgres
SSLMode string `json:"ssl_mode,omitempty" default:"require"`
// Postgres CA certificate path
CACertPath string `json:"ca_cert_path,omitempty"`
}
func GetTestPostgresCacheConfig ¶
func GetTestPostgresCacheConfig() PostgresCacheConfig
GetTestPostgresCacheConfig creates a PostgresCacheConfig with default test values. This is useful for creating test OLSConfig CRs with Postgres conversation cache.
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"`
// API Version for Azure OpenAI provider
APIVersion string `json:"api_version,omitempty"`
// Azure OpenAI Config
AzureOpenAIConfig *AzureOpenAIConfig `json:"azure_openai_config,omitempty"`
}
type ProxyConfig ¶
type QueryFilters ¶
type QuotaHandlersConfig ¶
type QuotaHandlersConfig struct {
// Postgres connection details
Storage PostgresCacheConfig `json:"storage,omitempty"`
// Quota scheduler settings
Scheduler SchedulerConfig `json:"scheduler,omitempty"`
// Token quota limiters
LimitersConfig []LimiterConfig `json:"limiters,omitempty"`
// Enable token history
EnableTokenHistory bool `json:"enable_token_history,omitempty"`
}
QuotaHandlersConfig defines the token quota configuration
type ReconcileFunc ¶
type ReconcileFunc func(reconciler.Reconciler, context.Context, *olsv1alpha1.OLSConfig) error
** controller internal **
type ReconcileSteps ¶
type ReconcileTask ¶
type ReconcileTask struct {
Name string
Task ReconcileFunc
}
type ReferenceContent ¶
type ReferenceContent struct {
// Path to the file containing the product docs embeddings model in the app server container.
EmbeddingsModelPath string `json:"embeddings_model_path,omitempty"`
// List of reference indexes.
Indexes []ReferenceIndex `json:"indexes,omitempty"`
}
type ReferenceIndex ¶
type ReferenceIndex 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"`
// Where the database was copied from, i.e. BYOK image name.
ProductDocsOrigin string `json:"product_docs_origin,omitempty"`
}
type SchedulerConfig ¶
type SchedulerConfig struct {
// How often token quota is checked, sec
Period int `json:"period,omitempty"`
}
Scheduler configuration
type StdioTransportConfig ¶
type StdioTransportConfig struct {
// Command to run
Command string `json:"command,omitempty"`
// Command-line parameters for the command
Args []string `json:"args,omitempty"`
// Environment variables for the command
Env map[string]string `json:"env,omitempty"`
// The working directory for the command
Cwd string `json:"cwd,omitempty"`
// Encoding for the text exchanged with the command
Encoding string `json:"encoding,omitempty"`
}
type StreamableHTTPTransportConfig ¶
type StreamableHTTPTransportConfig struct {
// URL of the MCP server
URL string `json:"url,omitempty"`
// Overall timeout for the MCP server
Timeout int `json:"timeout,omitempty"`
// SSE read timeout for the MCP server
SSEReadTimeout int `json:"sse_read_timeout,omitempty"`
// Headers to send to the MCP server
Headers map[string]string `json:"headers,omitempty"`
}
type TestReconciler ¶
type TestReconciler struct {
client.Client
StateCache map[string]string
PostgresImage string
ConsoleImage string
AppServerImage string
McpServerImage string
DataverseExporter string
LCoreImage string
PrometheusAvailable bool
// contains filtered or unexported fields
}
TestReconciler is a test implementation of the reconciler.Reconciler interface used across controller test suites
func NewTestReconciler ¶
func NewTestReconciler( client client.Client, logger logr.Logger, scheme *runtime.Scheme, namespace string, ) *TestReconciler
NewTestReconciler creates a new TestReconciler instance with the provided parameters
func (*TestReconciler) GetAppServerImage ¶
func (r *TestReconciler) GetAppServerImage() string
func (*TestReconciler) GetConsoleUIImage ¶
func (r *TestReconciler) GetConsoleUIImage() string
func (*TestReconciler) GetDataverseExporterImage ¶
func (r *TestReconciler) GetDataverseExporterImage() string
func (*TestReconciler) GetLCoreImage ¶
func (r *TestReconciler) GetLCoreImage() string
func (*TestReconciler) GetLogger ¶
func (r *TestReconciler) GetLogger() logr.Logger
func (*TestReconciler) GetNamespace ¶
func (r *TestReconciler) GetNamespace() string
func (*TestReconciler) GetOpenShiftMCPServerImage ¶
func (r *TestReconciler) GetOpenShiftMCPServerImage() string
func (*TestReconciler) GetOpenShiftMajor ¶
func (r *TestReconciler) GetOpenShiftMajor() string
func (*TestReconciler) GetOpenshiftMinor ¶
func (r *TestReconciler) GetOpenshiftMinor() string
func (*TestReconciler) GetPostgresImage ¶
func (r *TestReconciler) GetPostgresImage() string
func (*TestReconciler) GetScheme ¶
func (r *TestReconciler) GetScheme() *runtime.Scheme
func (*TestReconciler) GetStateCache ¶
func (r *TestReconciler) GetStateCache() map[string]string
func (*TestReconciler) IsPrometheusAvailable ¶
func (r *TestReconciler) IsPrometheusAvailable() bool
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"`
}