Documentation
¶
Overview ¶
Package postgres provides reconciliation logic for the PostgreSQL database component used by OpenShift Lightspeed for conversation cache storage.
This package manages:
- PostgreSQL deployment and pod lifecycle
- Database initialization and bootstrap secrets
- PersistentVolumeClaim for data persistence
- Service configuration for database access
- ConfigMap for PostgreSQL configuration
- Network policies for database security
- CA certificate management for secure connections
The PostgreSQL instance is used to cache conversation history and maintain session state for the OLS application server. The main entry point is ReconcilePostgres, which ensures all PostgreSQL resources are properly configured.
Index ¶
- func GeneratePostgresBootstrapSecret(r reconciler.Reconciler, cr *olsv1alpha1.OLSConfig) (*corev1.Secret, error)
- func GeneratePostgresConfigMap(r reconciler.Reconciler, cr *olsv1alpha1.OLSConfig) (*corev1.ConfigMap, error)
- func GeneratePostgresDeployment(r reconciler.Reconciler, ctx context.Context, cr *olsv1alpha1.OLSConfig) (*appsv1.Deployment, error)
- func GeneratePostgresNetworkPolicy(r reconciler.Reconciler, cr *olsv1alpha1.OLSConfig) (*networkingv1.NetworkPolicy, error)
- func GeneratePostgresPVC(r reconciler.Reconciler, cr *olsv1alpha1.OLSConfig) (*corev1.PersistentVolumeClaim, error)
- func GeneratePostgresSecret(r reconciler.Reconciler, cr *olsv1alpha1.OLSConfig) (*corev1.Secret, error)
- func GeneratePostgresService(r reconciler.Reconciler, cr *olsv1alpha1.OLSConfig) (*corev1.Service, error)
- func GetPostgresCAConfigVolume() corev1.Volume
- func GetPostgresCAVolumeMount(mountPath string) corev1.VolumeMount
- func ReconcilePostgres(r reconciler.Reconciler, ctx context.Context, olsconfig *olsv1alpha1.OLSConfig) error
- func ReconcilePostgresDeployment(r reconciler.Reconciler, ctx context.Context, olsconfig *olsv1alpha1.OLSConfig) error
- func ReconcilePostgresResources(r reconciler.Reconciler, ctx context.Context, olsconfig *olsv1alpha1.OLSConfig) error
- func RestartPostgres(r reconciler.Reconciler, ctx context.Context, deployment ...*appsv1.Deployment) error
- func UpdatePostgresDeployment(r reconciler.Reconciler, ctx context.Context, cr *olsv1alpha1.OLSConfig, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GeneratePostgresBootstrapSecret ¶
func GeneratePostgresBootstrapSecret(r reconciler.Reconciler, cr *olsv1alpha1.OLSConfig) (*corev1.Secret, error)
func GeneratePostgresConfigMap ¶
func GeneratePostgresConfigMap(r reconciler.Reconciler, cr *olsv1alpha1.OLSConfig) (*corev1.ConfigMap, error)
func GeneratePostgresDeployment ¶
func GeneratePostgresDeployment(r reconciler.Reconciler, ctx context.Context, cr *olsv1alpha1.OLSConfig) (*appsv1.Deployment, error)
func GeneratePostgresNetworkPolicy ¶
func GeneratePostgresNetworkPolicy(r reconciler.Reconciler, cr *olsv1alpha1.OLSConfig) (*networkingv1.NetworkPolicy, error)
func GeneratePostgresPVC ¶
func GeneratePostgresPVC(r reconciler.Reconciler, cr *olsv1alpha1.OLSConfig) (*corev1.PersistentVolumeClaim, error)
func GeneratePostgresSecret ¶
func GeneratePostgresSecret(r reconciler.Reconciler, cr *olsv1alpha1.OLSConfig) (*corev1.Secret, error)
func GeneratePostgresService ¶
func GeneratePostgresService(r reconciler.Reconciler, cr *olsv1alpha1.OLSConfig) (*corev1.Service, error)
func GetPostgresCAVolumeMount ¶
func GetPostgresCAVolumeMount(mountPath string) corev1.VolumeMount
func ReconcilePostgres ¶
func ReconcilePostgres(r reconciler.Reconciler, ctx context.Context, olsconfig *olsv1alpha1.OLSConfig) error
ReconcilePostgres reconciles all Postgres resources in the original order. This function is maintained for backward compatibility with existing tests. New code should call ReconcilePostgresResources and ReconcilePostgresDeployment separately.
func ReconcilePostgresDeployment ¶
func ReconcilePostgresDeployment(r reconciler.Reconciler, ctx context.Context, olsconfig *olsv1alpha1.OLSConfig) error
ReconcilePostgresDeployment reconciles the deployment and related resources (Phase 2)
func ReconcilePostgresResources ¶
func ReconcilePostgresResources(r reconciler.Reconciler, ctx context.Context, olsconfig *olsv1alpha1.OLSConfig) error
ReconcilePostgresResources reconciles all resources except the deployment (Phase 1) Uses continue-on-error pattern since these resources are independent
func RestartPostgres ¶
func RestartPostgres(r reconciler.Reconciler, ctx context.Context, deployment ...*appsv1.Deployment) error
RestartPostgres triggers a rolling restart of the Postgres deployment by updating its pod template annotation. This is useful when configuration changes require a pod restart (e.g., ConfigMap or Secret updates).
func UpdatePostgresDeployment ¶
func UpdatePostgresDeployment(r reconciler.Reconciler, ctx context.Context, cr *olsv1alpha1.OLSConfig, existingDeployment, desiredDeployment *appsv1.Deployment) error
updatePostgresDeployment updates the deployment based on CustomResource configuration.
Types ¶
This section is empty.