@@ -31,6 +31,7 @@ import (
3131 "github.com/percona/percona-postgresql-operator/internal/pgaudit"
3232 "github.com/percona/percona-postgresql-operator/internal/pgstatmonitor"
3333 "github.com/percona/percona-postgresql-operator/internal/pgstatstatements"
34+ "github.com/percona/percona-postgresql-operator/internal/pgvector"
3435 "github.com/percona/percona-postgresql-operator/internal/postgis"
3536 "github.com/percona/percona-postgresql-operator/internal/postgres"
3637 pgpassword "github.com/percona/percona-postgresql-operator/internal/postgres/password"
@@ -234,7 +235,7 @@ func (r *Reconciler) reconcilePostgresDatabases(
234235 // Calculate a hash of the SQL that should be executed in PostgreSQL.
235236
236237 // K8SPG-375, K8SPG-577
237- var pgAuditOK, pgStatMonitorOK, pgStatStatementsOK, postgisInstallOK bool
238+ var pgAuditOK, pgStatMonitorOK, pgStatStatementsOK, pgvectorOK, postgisInstallOK bool
238239 create := func(ctx context.Context, exec postgres.Executor) error {
239240 if cluster.Spec.Extensions.PGStatMonitor {
240241 if pgStatMonitorOK = pgstatmonitor.EnableInPostgreSQL(ctx, exec) == nil; !pgStatMonitorOK {
@@ -280,6 +281,18 @@ func (r *Reconciler) reconcilePostgresDatabases(
280281 }
281282 }
282283
284+ if cluster.Spec.Extensions.PGVector {
285+ if pgvectorOK = pgvector.EnableInPostgreSQL(ctx, exec) == nil; !pgvectorOK {
286+ r.Recorder.Event(cluster, corev1.EventTypeWarning, "pgvectorDisabled",
287+ "Unable to install pgvector")
288+ }
289+ } else {
290+ if pgvectorOK = pgvector.DisableInPostgreSQL(ctx, exec) == nil; !pgvectorOK {
291+ r.Recorder.Event(cluster, corev1.EventTypeWarning, "pgvectorEnabled",
292+ "Unable to disable pgvector")
293+ }
294+ }
295+
283296 // Enabling PostGIS extensions is a one-way operation
284297 // e.g., you can take a PostgresCluster and turn it into a PostGISCluster,
285298 // but you cannot reverse the process, as that would potentially remove an extension
0 commit comments