controller

package
v0.0.0-...-9ef58f6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2025 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
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"
	// 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"
	// 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"

	// 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"

	/*** 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"
	// 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 ***/
	WatcherAnnotationKey = "ols.openshift.io/watcher"

	/*** 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:6d2cab6cb6366b26fcf4591fe22aa5e8212a3836c34c896bb65977a8e50d658b"
	// 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 is the share buffers value for Postgres cache
	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
)
View Source
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"
	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"
	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"
	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"
	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"
)

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"`
	MCPServers              []MCPServerConfig       `json:"mcp_servers,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: "postgres"
	Type string `json:"type" default:"postgres"`
	// Postgres cache configuration
	Postgres PostgresCacheConfig `json:"postgres,omitempty"`
}

type DeleteFunc

type DeleteFunc func(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 LoggingConfig struct {
	// Application log level
	AppLogLevel string `json:"app_log_level" default:"info"`
	// Library log level
	LibLogLevel string `json:"lib_log_level" default:"warning"`
	// Uvicorn log level
	UvicornLogLevel string `json:"uvicorn_log_level" default:"info"`
}

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 *SSETransportConfig `json:"sse,omitempty"`
}

type MCPTransport

type MCPTransport string
const (
	SSE   MCPTransport = "sse"
	Stdio MCPTransport = "stdio"
)

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 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

func (r *OLSConfigReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

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 OLSConfigReconcilerOptions

type OLSConfigReconcilerOptions struct {
	LightspeedServiceImage         string
	LightspeedServicePostgresImage string
	ConsoleUIImage                 string
	Namespace                      string
	ReconcileInterval              time.Duration
}

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"`
}

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 ProxyConfig

type ProxyConfig struct {
	// Proxy URL
	ProxyURL string `json:"proxy_url,omitempty"`
	// ProxyCACertPath is the path to the CA certificate for the proxy server
	ProxyCACertPath string `json:"proxy_ca_cert_path,omitempty"`
}

type QueryFilters

type QueryFilters struct {
	// Filter name.
	Name string `json:"name,omitempty"`
	// Filter pattern.
	Pattern string `json:"pattern,omitempty"`
	// Replacement for the matched pattern.
	ReplaceWith string `json:"replace_with,omitempty"`
}

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(context.Context, *olsv1alpha1.OLSConfig) error

** controller internal **

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"`
}

type SSETransportConfig

type SSETransportConfig 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"`
}

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 TLSConfig

type TLSConfig struct {
	TLSCertificatePath string `json:"tls_certificate_path,omitempty"`
	TLSKeyPath         string `json:"tls_key_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"`
}

type UserDataCollectorConfig

type UserDataCollectorConfig struct {
	// Path to dir where ols user data (feedback and transcripts) are stored
	DataStorage string `json:"data_storage,omitempty"`
	// Collector logging level
	LogLevel string `json:"log_level,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL