Skip to content

Commit

Permalink
Merge branch 'main' into dev/5957
Browse files Browse the repository at this point in the history
Signed-off-by: Jaime Silvela <[email protected]>
  • Loading branch information
jsilvela authored Oct 24, 2024
2 parents 848a03c + 2e90e9d commit fc95ea4
Show file tree
Hide file tree
Showing 64 changed files with 2,604 additions and 2,292 deletions.
4 changes: 2 additions & 2 deletions .github/aks_versions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[
"1.30.4",
"1.29.8",
"1.30.5",
"1.29.9",
"1.28.9"
]
2 changes: 1 addition & 1 deletion .github/pg_versions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"17": [
"17.0",
"17.0-15"
"17.0-20"
],
"16": [
"16.4",
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,13 @@ test: generate fmt vet manifests envtest ## Run tests.
source <(${ENVTEST} use -p env --bin-dir ${ENVTEST_ASSETS_DIR} ${ENVTEST_K8S_VERSION}) ;\
export KUBEBUILDER_CONTROLPLANE_STOP_TIMEOUT=60s ;\
export KUBEBUILDER_CONTROLPLANE_START_TIMEOUT=60s ;\
go test -coverpkg=./... --count=1 -coverprofile=cover.out ./api/... ./cmd/... ./internal/... ./pkg/... ./tests/utils ;
go test -coverpkg=./... -coverprofile=cover.out ./api/... ./cmd/... ./internal/... ./pkg/... ./tests/utils

test-race: generate fmt vet manifests envtest ## Run tests enabling race detection.
mkdir -p ${ENVTEST_ASSETS_DIR} ;\
source <(${ENVTEST} use -p env --bin-dir ${ENVTEST_ASSETS_DIR} ${ENVTEST_K8S_VERSION}) ;\
go run github.com/onsi/ginkgo/v2/ginkgo -r -p --skip-package=e2e \
--race --keep-going --fail-on-empty --randomize-all --randomize-suites

e2e-test-kind: ## Run e2e tests locally using kind.
hack/e2e/run-e2e-kind.sh
Expand Down
4 changes: 4 additions & 0 deletions api/v1/backup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ type BackupSnapshotElementStatus struct {

// TablespaceName is the name of the snapshotted tablespace. Only set
// when type is PG_TABLESPACE
// +optional
TablespaceName string `json:"tablespaceName,omitempty"`
}

Expand Down Expand Up @@ -285,9 +286,11 @@ type BackupStatus struct {
Method BackupMethod `json:"method,omitempty"`

// Whether the backup was online/hot (`true`) or offline/cold (`false`)
// +optional
Online *bool `json:"online,omitempty"`

// A map containing the plugin metadata
// +optional
PluginMetadata map[string]string `json:"pluginMetadata,omitempty"`
}

Expand Down Expand Up @@ -333,6 +336,7 @@ type BackupList struct {
metav1.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
// List of backups
Items []Backup `json:"items"`
Expand Down
6 changes: 5 additions & 1 deletion api/v1/cluster_funcs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ var _ = Describe("external cluster list", func() {
})
})

var _ = Describe("look up for secrets", func() {
var _ = Describe("look up for secrets", Ordered, func() {
cluster := Cluster{
ObjectMeta: metav1.ObjectMeta{
Name: "clustername",
Expand All @@ -479,15 +479,19 @@ var _ = Describe("look up for secrets", func() {
It("retrieves client CA secret name", func() {
Expect(cluster.GetClientCASecretName()).To(Equal("clustername-ca"))
})

It("retrieves server CA secret name", func() {
Expect(cluster.GetServerCASecretName()).To(Equal("clustername-ca"))
})

It("retrieves replication secret name", func() {
Expect(cluster.GetReplicationSecretName()).To(Equal("clustername-replication"))
})

It("retrieves replication secret name", func() {
Expect(cluster.GetReplicationSecretName()).To(Equal("clustername-replication"))
})

It("retrieves all names needed to build a server CA certificate", func() {
names := cluster.GetClusterAltDNSNames()
Expect(names).To(HaveLen(12))
Expand Down
20 changes: 20 additions & 0 deletions api/v1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ type ClusterSpec struct {

// EphemeralVolumesSizeLimit allows the user to set the limits for the ephemeral
// volumes
// +optional
EphemeralVolumesSizeLimit *EphemeralVolumesSizeLimitConfiguration `json:"ephemeralVolumesSizeLimit,omitempty"`

// Name of the priority class which will be used in every generated Pod, if the PriorityClass
Expand Down Expand Up @@ -473,6 +474,7 @@ type ClusterSpec struct {

// The plugins configuration, containing
// any plugin to be loaded with the corresponding configuration
// +optional
Plugins PluginConfigurationList `json:"plugins,omitempty"`
}

Expand Down Expand Up @@ -547,9 +549,11 @@ const (
// storage
type EphemeralVolumesSizeLimitConfiguration struct {
// Shm is the size limit of the shared memory volume
// +optional
Shm *resource.Quantity `json:"shm,omitempty"`

// TemporaryData is the size limit of the temporary data volume
// +optional
TemporaryData *resource.Quantity `json:"temporaryData,omitempty"`
}

Expand Down Expand Up @@ -712,6 +716,7 @@ type ClusterStatus struct {

// LastPromotionToken is the last verified promotion token that
// was used to promote a replica cluster
// +optional
LastPromotionToken string `json:"lastPromotionToken,omitempty"`

// How many PVCs have been created by this cluster
Expand Down Expand Up @@ -849,6 +854,7 @@ type ClusterStatus struct {
Image string `json:"image,omitempty"`

// PluginStatus is the status of the loaded plugins
// +optional
PluginStatus []PluginStatus `json:"pluginStatus,omitempty"`

// SwitchReplicaClusterStatus is the status of the switch to replica cluster
Expand Down Expand Up @@ -967,10 +973,12 @@ type PgBouncerIntegrationStatus struct {
type ReplicaClusterConfiguration struct {
// Self defines the name of this cluster. It is used to determine if this is a primary
// or a replica cluster, comparing it with `primary`
// +optional
Self string `json:"self,omitempty"`

// Primary defines which Cluster is defined to be the primary in the distributed PostgreSQL cluster, based on the
// topology specified in externalClusters
// +optional
Primary string `json:"primary,omitempty"`

// The name of the external cluster which is the replication origin
Expand All @@ -981,17 +989,20 @@ type ReplicaClusterConfiguration struct {
// existing cluster. Replica cluster can be created from a recovery
// object store or via streaming through pg_basebackup.
// Refer to the Replica clusters page of the documentation for more information.
// +optional
Enabled *bool `json:"enabled,omitempty"`

// A demotion token generated by an external cluster used to
// check if the promotion requirements are met.
// +optional
PromotionToken string `json:"promotionToken,omitempty"`

// When replica mode is enabled, this parameter allows you to replay
// transactions only when the system time is at least the configured
// time past the commit time. This provides an opportunity to correct
// data loss errors. Note that when this parameter is set, a promotion
// token cannot be used.
// +optional
MinApplyDelay *metav1.Duration `json:"minApplyDelay,omitempty"`
}

Expand Down Expand Up @@ -2005,6 +2016,7 @@ type ManagedServices struct {
// +optional
DisabledDefaultServices []ServiceSelectorType `json:"disabledDefaultServices,omitempty"`
// Additional is a list of additional managed services specified by the user.
// +optional
Additional []ManagedService `json:"additional,omitempty"`
}

Expand All @@ -2018,6 +2030,7 @@ type ManagedService struct {

// UpdateStrategy describes how the service differences should be reconciled
// +kubebuilder:default:="patch"
// +optional
UpdateStrategy ServiceUpdateStrategy `json:"updateStrategy,omitempty"`

// ServiceTemplate is the template specification for the service.
Expand Down Expand Up @@ -2047,6 +2060,7 @@ type PluginConfiguration struct {
Enabled *bool `json:"enabled,omitempty"`

// Parameters is the configuration of the plugin
// +optional
Parameters map[string]string `json:"parameters,omitempty"`
}

Expand All @@ -2061,21 +2075,26 @@ type PluginStatus struct {

// Capabilities are the list of capabilities of the
// plugin
// +optional
Capabilities []string `json:"capabilities,omitempty"`

// OperatorCapabilities are the list of capabilities of the
// plugin regarding the reconciler
// +optional
OperatorCapabilities []string `json:"operatorCapabilities,omitempty"`

// WALCapabilities are the list of capabilities of the
// plugin regarding the WAL management
// +optional
WALCapabilities []string `json:"walCapabilities,omitempty"`

// BackupCapabilities are the list of capabilities of the
// plugin regarding the Backup management
// +optional
BackupCapabilities []string `json:"backupCapabilities,omitempty"`

// Status contain the status reported by the plugin through the SetStatusInCluster interface
// +optional
Status string `json:"status,omitempty"`
}

Expand Down Expand Up @@ -2204,6 +2223,7 @@ type ClusterList struct {
metav1.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
// List of clusters
Items []Cluster `json:"items"`
Expand Down
1 change: 1 addition & 0 deletions api/v1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const VolumeSnapshotKind = "VolumeSnapshot"
// not using the core data types.
type Metadata struct {
// The name of the resource. Only supported for certain types
// +optional
Name string `json:"name,omitempty"`

// Map of string keys and values that can be used to organize and categorize
Expand Down
4 changes: 4 additions & 0 deletions api/v1/database_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,17 @@ type DatabaseStatus struct {
ObservedGeneration int64 `json:"observedGeneration,omitempty"`

// Ready is true if the database was reconciled correctly
// +optional
Ready bool `json:"ready,omitempty"`

// Error is the reconciliation error message
// +optional
Error string `json:"error,omitempty"`
}

// +genclient
// +kubebuilder:object:root=true
// +kubebuilder:storageversion
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".spec.cluster.name"
Expand Down
1 change: 1 addition & 0 deletions api/v1/pooler_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ type Pooler struct {
// PoolerList contains a list of Pooler
type PoolerList struct {
metav1.TypeMeta `json:",inline"`
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
Items []Pooler `json:"items"`
}
Expand Down
6 changes: 5 additions & 1 deletion api/v1/scheduledbackup_funcs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ import (
)

var _ = Describe("Scheduled backup", func() {
scheduledBackup := &ScheduledBackup{}
var scheduledBackup *ScheduledBackup
backupName := "test"

BeforeEach(func() {
scheduledBackup = &ScheduledBackup{}
})

It("properly creates a backup with no annotations", func() {
backup := scheduledBackup.CreateBackup("test")
Expect(backup).ToNot(BeNil())
Expand Down
1 change: 1 addition & 0 deletions api/v1/scheduledbackup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ type ScheduledBackupList struct {
metav1.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
// List of clusters
Items []ScheduledBackup `json:"items"`
Expand Down
10 changes: 9 additions & 1 deletion docs/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
hiddenMemberFields:
- "TypeMeta"
- "synchronizeReplicasCache"

externalPackages:
- match: ^github\.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1\.RelabelConfig$
Expand Down Expand Up @@ -31,7 +32,14 @@ externalPackages:

hideTypePatterns:
- "ParseError$"
- "List$"
# We cannot exclude all `List$` because we declare PluginConfigurationList
- "BackupList$"
- "ClusterList$"
- "ClusterImageCatalogList$"
- "DatabaseList$"
- "ImageCatalogList$"
- "PoolerList$"
- "ScheduledBackupList$"

markdownDisabled: false

Expand Down
8 changes: 4 additions & 4 deletions docs/src/backup_barmanobjectstore.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ algorithms via `barman-cloud-backup` (for backups) and
* snappy

The compression settings for backups and WALs are independent. See the
[DataBackupConfiguration](cloudnative-pg.v1.md#postgresql-cnpg-io-v1-DataBackupConfiguration) and
[WALBackupConfiguration](cloudnative-pg.v1.md#postgresql-cnpg-io-v1-WalBackupConfiguration) sections in
the API reference.
[DataBackupConfiguration](https://pkg.go.dev/github.com/cloudnative-pg/barman-cloud/pkg/api#DataBackupConfiguration) and
[WALBackupConfiguration](https://pkg.go.dev/github.com/cloudnative-pg/barman-cloud/pkg/api#WalBackupConfiguration) sections in
the barman-cloud API reference.

It is important to note that archival time, restore time, and size change
between the algorithms, so the compression algorithm should be chosen according
Expand Down Expand Up @@ -198,4 +198,4 @@ spec:
additionalCommandArgs:
- "--max-concurrency=1"
- "--read-timeout=60"
```
```
Loading

0 comments on commit fc95ea4

Please sign in to comment.