Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ jobs:
--env 'RELATED_IMAGE_POSTGRES_17=registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-17.2-2' \
--env 'RELATED_IMAGE_POSTGRES_17_GIS_3.4=registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-17.2-3.4-2' \
--env 'RELATED_IMAGE_STANDALONE_PGADMIN=registry.developers.crunchydata.com/crunchydata/crunchy-pgadmin4:ubi8-8.14-1' \
--env 'RELATED_IMAGE_COLLECTOR=ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.119.0' \
--env 'PGO_FEATURE_GATES=TablespaceVolumes=true' \
--name 'postgres-operator' ubuntu \
postgres-operator
Expand Down
2 changes: 2 additions & 0 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ spec:
value: "registry.developers.crunchydata.com/crunchydata/crunchy-upgrade:latest"
- name: RELATED_IMAGE_STANDALONE_PGADMIN
value: "registry.developers.crunchydata.com/crunchydata/crunchy-pgadmin4:ubi8-8.14-1"
- name: RELATED_IMAGE_COLLECTOR
value: "ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.119.0"
securityContext:
allowPrivilegeEscalation: false
capabilities: { drop: [ALL] }
Expand Down
3 changes: 2 additions & 1 deletion internal/collector/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

corev1 "k8s.io/api/core/v1"

"github.com/crunchydata/postgres-operator/internal/config"
"github.com/crunchydata/postgres-operator/internal/feature"
"github.com/crunchydata/postgres-operator/internal/initialize"
"github.com/crunchydata/postgres-operator/internal/naming"
Expand Down Expand Up @@ -72,7 +73,7 @@ func AddToPod(

container := corev1.Container{
Name: naming.ContainerCollector,
Image: "ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.117.0",
Image: config.CollectorContainerImage(spec),
ImagePullPolicy: pullPolicy,
Command: []string{"/otelcol-contrib", "--config", "/etc/otel-collector/config.yaml"},
Env: []corev1.EnvVar{
Expand Down
15 changes: 15 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,17 @@ func PGExporterContainerImage(cluster *v1beta1.PostgresCluster) string {
return defaultFromEnv(image, "RELATED_IMAGE_PGEXPORTER")
}

// CollectorContainerImage returns the container image to use for the
// collector container.
func CollectorContainerImage(instrumentation *v1beta1.InstrumentationSpec) string {
var image string
if instrumentation != nil {
image = instrumentation.Image
}

return defaultFromEnv(image, "RELATED_IMAGE_COLLECTOR")
}

// PostgresContainerImage returns the container image to use for PostgreSQL.
func PostgresContainerImage(cluster *v1beta1.PostgresCluster) string {
image := cluster.Spec.Image
Expand Down Expand Up @@ -143,6 +154,10 @@ func VerifyImageValues(cluster *v1beta1.PostgresCluster) error {
cluster.Spec.Monitoring.PGMonitor.Exporter != nil {
images = append(images, "crunchy-postgres-exporter")
}
if CollectorContainerImage(cluster.Spec.Instrumentation) == "" &&
cluster.Spec.Instrumentation != nil {
images = append(images, "crunchy-collector")
}
if PostgresContainerImage(cluster) == "" {
if cluster.Spec.PostGISVersion != "" {
images = append(images, "crunchy-postgres-gis")
Expand Down
Loading