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
21 changes: 9 additions & 12 deletions api/v4/postgrescluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,14 @@ type ManagedRole struct {
// +kubebuilder:validation:MaxLength=63
Name string `json:"name"`

// PasswordSecretRef references a Secret containing the password for this role.
// The Secret should have a key "password" with the password value.
// PasswordSecretRef references a Secret and the key within it containing the password for this role.
// +optional
PasswordSecretRef *corev1.LocalObjectReference `json:"passwordSecretRef,omitempty"`
PasswordSecretRef *corev1.SecretKeySelector `json:"passwordSecretRef,omitempty"`

// Ensure controls whether the role should exist (present) or not (absent).
// +kubebuilder:validation:Enum=present;absent
// +kubebuilder:default=present
Ensure string `json:"ensure,omitempty"`
// Exists controls whether the role should be present (true) or absent (false) in PostgreSQL.
// +kubebuilder:default=true
// +optional
Exists bool `json:"exists,omitempty"`
}

// PostgresClusterSpec defines the desired state of PostgresCluster.
Expand Down Expand Up @@ -113,7 +112,7 @@ type PostgresClusterSpec struct {
// +kubebuilder:validation:Enum=Delete;Retain
// +kubebuilder:default=Retain
// +optional
ClusterDeletionPolicy string `json:"clusterDeletionPolicy,omitempty"`
ClusterDeletionPolicy *string `json:"clusterDeletionPolicy,omitempty"`
}

// PostgresClusterResources defines references to Kubernetes resources related to the PostgresCluster, such as ConfigMaps and Secrets.
Expand All @@ -123,18 +122,16 @@ type PostgresClusterResources struct {
// +optional
ConfigMapRef *corev1.LocalObjectReference `json:"configMapRef,omitempty"`

// SecretRef references the Secret with superuser credentials.
// Contains: passwords for superuser
// +optional
SecretRef *corev1.LocalObjectReference `json:"secretRef,omitempty"`
SuperUserSecretRef *corev1.SecretKeySelector `json:"secretRef,omitempty"`
}

// PostgresClusterStatus defines the observed state of PostgresCluster.
type PostgresClusterStatus struct {
// Phase represents the current phase of the PostgresCluster.
// Values: "Pending", "Provisioning", "Failed", "Ready", "Deleting"
// +optional
Phase string `json:"phase,omitempty"`
Phase *string `json:"phase,omitempty"`

// Conditions represent the latest available observations of the PostgresCluster's state.
// +optional
Expand Down
11 changes: 6 additions & 5 deletions api/v4/postgresclusterclass_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// +kubebuilder:validation:XValidation:rule="!has(self.cnpg) || self.provisioner == 'postgresql.cnpg.io'",message="cnpg config can only be set when provisioner is postgresql.cnpg.io"
// +kubebuilder:validation:XValidation:rule="!has(self.config) || !has(self.config.connectionPoolerEnabled) || !self.config.connectionPoolerEnabled || (has(self.cnpg) && has(self.cnpg.connectionPooler))",message="cnpg.connectionPooler must be set when config.connectionPoolerEnabled is true"
// PostgresClusterClassSpec defines the desired state of PostgresClusterClass.
// PostgresClusterClass is immutable after creation - it serves as a template for Cluster CRs.
Expand All @@ -37,7 +38,7 @@ type PostgresClusterClassSpec struct {
// Can be overridden in PostgresCluster CR.
// +kubebuilder:default={}
// +optional
Config PosgresClusterClassConfig `json:"config,omitempty"`
Config *PostgresClusterClassConfig `json:"config,omitempty"`

// CNPG contains CloudNativePG-specific configuration and policies.
// Only used when Provisioner is "postgresql.cnpg.io"
Expand All @@ -46,9 +47,9 @@ type PostgresClusterClassSpec struct {
CNPG *CNPGConfig `json:"cnpg,omitempty"`
}

// PosgresClusterClassConfig contains provider-agnostic cluster configuration.
// PostgresClusterClassConfig contains provider-agnostic cluster configuration.
// These fields define PostgresCluster infrastructure and can be overridden in PostgresCluster CR.
type PosgresClusterClassConfig struct {
type PostgresClusterClassConfig struct {
// Instances is the number of database instances (1 primary + N replicas).
// Single instance (1) is suitable for development.
// High availability requires at least 3 instances (1 primary + 2 replicas).
Expand Down Expand Up @@ -149,7 +150,7 @@ type CNPGConfig struct {
// +kubebuilder:validation:Enum=restart;switchover
// +kubebuilder:default=switchover
// +optional
PrimaryUpdateMethod string `json:"primaryUpdateMethod,omitempty"`
PrimaryUpdateMethod *string `json:"primaryUpdateMethod,omitempty"`

// ConnectionPooler contains PgBouncer connection pooler configuration.
// When enabled, creates RW and RO pooler deployments for clusters using this class.
Expand All @@ -166,7 +167,7 @@ type PostgresClusterClassStatus struct {
// Phase represents the current phase of the PostgresClusterClass.
// Valid phases: "Ready", "Invalid"
// +optional
Phase string `json:"phase,omitempty"`
Phase *string `json:"phase,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
9 changes: 5 additions & 4 deletions api/v4/postgresdatabase_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
// PostgresDatabaseSpec defines the desired state of PostgresDatabase.
// +kubebuilder:validation:XValidation:rule="self.clusterRef == oldSelf.clusterRef",message="clusterRef is immutable"
type PostgresDatabaseSpec struct {
// Reference to Postgres Cluster managed by postgresCluster controller
// +kubebuilder:validation:Required
ClusterRef corev1.LocalObjectReference `json:"clusterRef"`

Expand All @@ -48,22 +49,22 @@ type DatabaseInfo struct {
Name string `json:"name"`
Ready bool `json:"ready"`
DatabaseRef *corev1.LocalObjectReference `json:"databaseRef,omitempty"`
AdminUserSecretRef *corev1.LocalObjectReference `json:"adminUserSecretRef,omitempty"`
RWUserSecretRef *corev1.LocalObjectReference `json:"rwUserSecretRef,omitempty"`
AdminUserSecretRef *corev1.SecretKeySelector `json:"adminUserSecretRef,omitempty"`
RWUserSecretRef *corev1.SecretKeySelector `json:"rwUserSecretRef,omitempty"`
ConfigMapRef *corev1.LocalObjectReference `json:"configMap,omitempty"`
}

// PostgresDatabaseStatus defines the observed state of PostgresDatabase.
type PostgresDatabaseStatus struct {
// +optional
Phase string `json:"phase,omitempty"`
Phase *string `json:"phase,omitempty"`
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`
// +optional
Databases []DatabaseInfo `json:"databases,omitempty"`
// ObservedGeneration represents the .metadata.generation that the status was set based upon.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
ObservedGeneration *int64 `json:"observedGeneration,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
160 changes: 97 additions & 63 deletions api/v4/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions bundle.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=splunk-operator
LABEL operators.operatorframework.io.bundle.channels.v1=stable
LABEL operators.operatorframework.io.bundle.channel.default.v1: stable
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.39.0
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.42.0
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v4

Expand Down
Loading
Loading