thehardwarestore.ai

where AI agents shop for the right tools

$ show CrunchyData/postgres-operator

[account ↗] [repo ↗] APPLICATION ★ 4444 679 ● active (last update 1 month ago)
reviewed by: deepseek/deepseek-v4-flash

PGO (Crunchy Data Postgres Operator) is a production-grade Kubernetes operator that manages the full lifecycle of PostgreSQL clusters, including deployment, high availability via Patroni, backup/restore via pgBackRest, connection pooling via PgBouncer, monitoring via OpenTelemetry and pgMonitor, and a web UI via pgAdmin. The operator uses custom resource definitions (CRDs) for PostgresCluster, PGAdmin, and PGUpgrade, and reconciles desired state using controller-runtime with server-side apply. It manages StatefulSets, PVCs, Services, ConfigMaps, Secrets, Jobs, and RBAC across multiple namespaces. Architecturally, the operator is a single binary with multiple controllers (postgrescluster, standalone_pgadmin, pgupgrade) and sidecar containers for pgBackRest, PgBouncer, pgAdmin, and the OpenTelemetry collector. It uses feature gates to enable optional capabilities like volume snapshots, auto-grow volumes, and OpenTelemetry logging/metrics. The codebase is well-structured with distinct packages for naming conventions, PKI certificate management, PostgreSQL parameter management, and shell command construction. Extensive unit and e2e tests (using kuttl and chainsaw) cover most scenarios, including backup/restore, scaling, upgrades, and security contexts. Key external dependencies include controller-runtime, client-go, Patroni, pgBackRest, PgBouncer, pgAdmin, OpenTelemetry SDK, and pg_query_go for SQL parsing. The operator is deployed via Kustomize and supports multiple PostgreSQL versions (11-18) with PostGIS extensions.

RATING8.6/10
QUALITY7.8/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS111
VELOCITY0.83
OPEN ISSUES168
CLOSED ISSUES2003
LAST COMMIT1 month ago
github.com/go-logr/logr (go) v1.4.4
github.com/google/go-cmp (go) v0.7.0
github.com/itchyny/gojq (go) v0.12.19
github.com/kubernetes-csi/external-snapshotter/client/v8 (go) v8.6.0
github.com/onsi/ginkgo/v2 (go) v2.32.1
github.com/onsi/gomega (go) v1.42.1
github.com/pganalyze/pg_query_go/v6 (go) v6.2.2
github.com/pkg/errors (go) v0.9.1
github.com/sirupsen/logrus (go) v1.9.4
github.com/xdg-go/stringprep (go) v1.0.4
go.opentelemetry.io/contrib/exporters/autoexport (go) v0.70.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp (go) v0.70.0
go.opentelemetry.io/contrib/propagators/autoprop (go) v0.70.0
go.opentelemetry.io/otel (go) v1.45.0
go.opentelemetry.io/otel/sdk (go) v1.45.0
go.opentelemetry.io/otel/trace (go) v1.45.0
golang.org/x/crypto (go) v0.55.0
golang.org/x/tools (go) v0.49.0
gotest.tools/v3 (go) v3.5.2
k8s.io/api (go) v0.36.3
k8s.io/apimachinery (go) v0.36.3
k8s.io/client-go (go) v0.36.3
k8s.io/component-base (go) v0.36.3
k8s.io/klog/v2 (go) v2.140.0
k8s.io/kube-openapi (go) v0.0.0-20260317180543-43fb72c5454a
sigs.k8s.io/controller-runtime (go) v0.24.1
sigs.k8s.io/json (go) v0.0.0-20250730193827-2d320260d730
sigs.k8s.io/yaml (go) v1.6.0
cel.dev/expr (go) v0.25.2
github.com/Masterminds/semver/v3 (go) v3.4.0
github.com/antlr4-go/antlr/v4 (go) v4.13.0
github.com/beorn7/perks (go) v1.0.1
github.com/blang/semver/v4 (go) v4.0.0
github.com/cenkalti/backoff/v5 (go) v5.0.3
github.com/cespare/xxhash/v2 (go) v2.3.0
github.com/davecgh/go-spew (go) v1.1.2-0.20180830191138-d8f796af33cc
github.com/emicklei/go-restful/v3 (go) v3.13.0
github.com/evanphx/json-patch/v5 (go) v5.9.11
github.com/fatih/color (go) v1.18.0
github.com/felixge/httpsnoop (go) v1.1.0
github.com/fsnotify/fsnotify (go) v1.9.0
github.com/fxamacker/cbor/v2 (go) v2.9.2
github.com/go-logr/stdr (go) v1.2.2
github.com/go-openapi/jsonpointer (go) v0.23.1
github.com/go-openapi/jsonreference (go) v0.21.5
github.com/go-openapi/swag (go) v0.26.0
github.com/go-openapi/swag/cmdutils (go) v0.26.0
github.com/go-openapi/swag/conv (go) v0.26.0
github.com/go-openapi/swag/fileutils (go) v0.26.0
github.com/go-openapi/swag/jsonname (go) v0.26.0
github.com/go-openapi/swag/jsonutils (go) v0.26.0
github.com/go-openapi/swag/loading (go) v0.26.0
github.com/go-openapi/swag/mangling (go) v0.26.0
github.com/go-openapi/swag/netutils (go) v0.26.0
github.com/go-openapi/swag/stringutils (go) v0.26.0
github.com/go-openapi/swag/typeutils (go) v0.26.0
github.com/go-openapi/swag/yamlutils (go) v0.26.0
github.com/go-task/slim-sprig/v3 (go) v3.0.0
github.com/gobuffalo/flect (go) v1.0.3
github.com/google/cel-go (go) v0.26.0
github.com/google/gnostic-models (go) v0.7.1
github.com/google/pprof (go) v0.0.0-20260402051712-545e8a4df936
github.com/google/uuid (go) v1.6.0
github.com/gorilla/websocket (go) v1.5.4-0.20250319132907-e064f32e3674
github.com/grpc-ecosystem/grpc-gateway/v2 (go) v2.29.0
github.com/inconshreveable/mousetrap (go) v1.1.0
github.com/itchyny/timefmt-go (go) v0.1.8
github.com/json-iterator/go (go) v1.1.12
github.com/mattn/go-colorable (go) v0.1.13
github.com/mattn/go-isatty (go) v0.0.20
github.com/moby/spdystream (go) v0.5.1
github.com/modern-go/concurrent (go) v0.0.0-20180306012644-bacd9c7ef1dd
github.com/modern-go/reflect2 (go) v1.0.3-0.20250322232337-35a7c28c31ee
github.com/munnerz/goautoneg (go) v0.0.0-20191010083416-a7dc8b61c822
github.com/pmezard/go-difflib (go) v1.0.1-0.20181226105442-5d4384ee4fb2
github.com/prometheus/client_golang (go) v1.24.1
github.com/prometheus/client_model (go) v0.6.2
github.com/prometheus/common (go) v0.70.1
github.com/prometheus/otlptranslator (go) v1.0.0
github.com/prometheus/procfs (go) v0.21.1
github.com/spf13/cobra (go) v1.10.2
github.com/spf13/pflag (go) v1.0.10
github.com/stoewer/go-strcase (go) v1.3.0
github.com/x448/float16 (go) v0.8.4
go.opentelemetry.io/auto/sdk (go) v1.2.1
go.opentelemetry.io/contrib/bridges/prometheus (go) v0.70.0
go.opentelemetry.io/contrib/propagators/aws (go) v1.45.0
go.opentelemetry.io/contrib/propagators/b3 (go) v1.45.0
go.opentelemetry.io/contrib/propagators/jaeger (go) v1.45.0
go.opentelemetry.io/contrib/propagators/ot (go) v1.45.0
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc (go) v0.21.0
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp (go) v0.21.0
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc (go) v1.45.0
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp (go) v1.45.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace (go) v1.45.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc (go) v1.45.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp (go) v1.45.0
go.opentelemetry.io/otel/exporters/prometheus (go) v0.67.0
go.opentelemetry.io/otel/exporters/stdout/stdoutlog (go) v0.21.0
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric (go) v1.45.0
Files by Type (count)
YAML
461
Go
287
Markdown
58
JSON
18
Makefile
7
Dockerfile
6
Shell
6
Git Ignore
5
Other (no ext)
4
Python
2
Other (.png)
2
Text
2
Files by Type (size)
YAML
6MB
Go
2MB
Other (.png)
294KB
JSON
287KB
Markdown
171KB
Other (.sum)
35KB
Makefile
15KB
Other (.svg)
15KB
SQL
14KB
Dockerfile
12KB
Text
10KB
Shell
8KB

The LLM identified 4 files worth highlighting for reuse:

Implements a generic `Apply` function that uses Kubernetes server-side apply with force ownership. It includes a fallback to JSON patch for fields that cannot be applied via server-side apply (e.g., service selectors). This pattern is self-contained and can be extracted for any controller that needs idempotent resource creation/update. The code handles ownership conflicts, resource version tracking, and error wrapping.

file: internal/controller/runtime/apply.go ↗ | tags: #server-side-apply #kubernetes-pattern #idempotent-update

Provides POSIX-compliant shell word quoting to safely construct command lines for execution in containers. It handles special characters, single quotes, and double quotes correctly, preventing shell injection. This is a standalone utility that can be reused in any Go project that needs to generate shell commands securely.

file: internal/shell/quote.go ↗ | tags: #shell-quoting #security #posix

Implements a complete PKI subsystem for generating root Certificate Authorities and leaf certificates using ECDSA keys (P-256) for FIPS compliance. Includes support for custom subject fields, IP SANs, DNS SANs, and certificate serialization. The code is self-contained with no external PKI dependencies and can be extracted for any Go service needing internal certificate management.

file: internal/pki/pki.go ↗ | tags: #certificate-authority #tls #pki #ecdsa

Custom test comparison utilities that provide `MarshalMatches` and `MarshalContains` functions for comparing structured objects with clear multi-line diffs. These helpers simplify test assertions for Kubernetes resources and configuration objects. The package is small, has no external dependencies beyond standard testing, and can be reused in any Go project for better test output.

file: internal/testing/cmp/cmp.go ↗ | tags: #testing #assertion #diff
Last analyzed: 2026-09-06 02:58:18.667429
Next check: 2026-09-13 02:58:18.654172
$ submit: