Skip to content
Draft
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
21 changes: 21 additions & 0 deletions api/v4/postgrescluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,27 @@ type PostgresClusterSpec struct {
// +kubebuilder:default=Retain
// +optional
ClusterDeletionPolicy *string `json:"clusterDeletionPolicy,omitempty"`

// Observability contains configuration for metrics exposure features.
// +optional
Observability *PostgresObservabilityOverride `json:"observability,omitempty"`
}

// PostgresObservabilityOverride overrides observability configuration options for PostgresClusterClass.
type PostgresObservabilityOverride struct {

// +optional
PostgreSQL *FeatureDisableOverride `json:"postgresql,omitempty"`

// +optional
PgBouncer *FeatureDisableOverride `json:"pgbouncer,omitempty"`
}

type FeatureDisableOverride struct {
// Disable set to true will disable the feature even if it's enabled in the class.
// +kubebuilder:default=false
// +optional
Disabled *bool `json:"disabled,omitempty"`
}

// PostgresClusterResources defines references to Kubernetes resources related to the PostgresCluster, such as ConfigMaps and Secrets.
Expand Down
21 changes: 21 additions & 0 deletions api/v4/postgresclusterclass_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ type PostgresClusterClassConfig struct {
// +kubebuilder:default=false
// +optional
ConnectionPoolerEnabled *bool `json:"connectionPoolerEnabled,omitempty"`

// Observability contains configuration for metrics exposure.
// When enabled, creates metrics resources for clusters using this class.
// Can be overridden in PostgresCluster CR.
// +kubebuilder:default={}
// +optional
Observability *PostgresObservabilityClassConfig `json:"observability,omitempty"`
}

// ConnectionPoolerMode defines the PgBouncer connection pooling strategy.
Expand Down Expand Up @@ -172,6 +179,20 @@ type PostgresClusterClassStatus struct {
Phase *string `json:"phase,omitempty"`
}

type PostgresObservabilityClassConfig struct {
// +optional
PostgreSQL *MetricsClassConfig `json:"postgresql,omitempty"`
// +optional
PgBouncer *MetricsClassConfig `json:"pgbouncer,omitempty"`
}

type MetricsClassConfig struct {
// Enabled controls whether metrics resources should be created for this target.
// +kubebuilder:default=false
// +optional
Enabled *bool `json:"enabled,omitempty"`
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster
Expand Down
2 changes: 2 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import (
"github.com/splunk/splunk-operator/internal/controller"

cnpgv1 "github.com/cloudnative-pg/cloudnative-pg/api/v1"
monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
//+kubebuilder:scaffold:imports
//extapi "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
)
Expand All @@ -69,6 +70,7 @@ func init() {
utilruntime.Must(enterpriseApi.AddToScheme(scheme))
utilruntime.Must(enterpriseApiV3.AddToScheme(scheme))
utilruntime.Must(cnpgv1.AddToScheme(scheme))
utilruntime.Must(monitoringv1.AddToScheme(scheme))
//+kubebuilder:scaffold:scheme
//utilruntime.Must(extapi.AddToScheme(scheme))
}
Expand Down
6 changes: 5 additions & 1 deletion config/samples/enterprise_v4_postgresclusterclass_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ spec:
cpu: "1"
memory: "2Gi"
connectionPoolerEnabled: true
observability:
postgresql:
enabled: true
pgbouncer:
enabled: true

cnpg:
# Restart method - tolerate downtime in dev
Expand All @@ -36,4 +41,3 @@ spec:
mode: transaction
config:
max_client_conn: "100"

Loading
Loading