kube_cluster 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/Gemfile.lock +1 -1
- data/flake.nix +1 -0
- data/lefthook.yml +5 -3
- data/lib/kube/cluster/standard/cloud_native_pg/cluster.rb +23 -11
- data/lib/kube/cluster/standard/cloud_native_pg/postgres_cluster.rb +128 -0
- data/lib/kube/cluster/version.rb +1 -1
- data/lib/kube/cluster.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '0768b58c75b80c58ddbe6bbae20aab3e57cad3a607058d7c2ebe64662d601f14'
|
|
4
|
+
data.tar.gz: b6260994b93ce8c91c897d6e44fb771fb2df82eebab158353485a8423ba9a61a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0d10e0cda8c7483ca5190dc2351cf12a4a9ea856a61498cc1b210c1ff431d0e20c1fbe1908520f05c799329e1304d10ec1cdb0dcc7a80cd550ad8d0fc1ea695d
|
|
7
|
+
data.tar.gz: ba7e0fcd06465f26a7d6197f41c4de71e713ebb06bde325433ac3dc41390ae7e95571e04cad35110f5cf4e17613262dae9189c8da3d35de4683b55537983ef7c
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,21 @@ All notable changes to this project are documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.3.0] - 2026-07-13
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- `Standard::CloudNativePg::PostgresCluster` — the standard single-node
|
|
12
|
+
PostgreSQL cluster (custom image, HA replication slots, logical WAL,
|
|
13
|
+
barman-cloud WAL archiving) preconfigured; deployment-specific spec (managed
|
|
14
|
+
roles, etc.) via the block.
|
|
15
|
+
|
|
16
|
+
## [1.2.1] - 2026-07-13
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
- `Standard::CloudNativePg::Cluster` — a thin CloudNativePG `Cluster` CR wrapper
|
|
20
|
+
(sets `metadata.name`/`metadata.namespace`; the large, deployment-specific spec
|
|
21
|
+
is supplied via the block).
|
|
22
|
+
|
|
8
23
|
## [1.1.0] - 2026-07-13
|
|
9
24
|
|
|
10
25
|
### Added
|
data/Gemfile.lock
CHANGED
data/flake.nix
CHANGED
data/lefthook.yml
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
# Git hooks (managed by lefthook). Install with `bundle exec lefthook install`.
|
|
2
2
|
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
# flake devshell, so bundler/scampi wouldn't otherwise be on PATH.
|
|
3
|
+
# pre-commit: scan for secrets (trufflehog) and run the test suite (bin/test).
|
|
4
|
+
# Both are wrapped in `nix develop --command` because the hook fires outside the
|
|
5
|
+
# flake devshell, so trufflehog / bundler / scampi wouldn't otherwise be on PATH.
|
|
6
6
|
pre-commit:
|
|
7
7
|
commands:
|
|
8
|
+
secrets:
|
|
9
|
+
run: nix develop --command trufflehog git file://. --since-commit HEAD --only-verified --fail
|
|
8
10
|
tests:
|
|
9
11
|
run: nix develop --command bin/test
|
|
@@ -7,8 +7,17 @@ module Kube
|
|
|
7
7
|
module Cluster
|
|
8
8
|
module Standard
|
|
9
9
|
module CloudNativePg
|
|
10
|
-
#
|
|
11
|
-
#
|
|
10
|
+
# A CloudNativePG Cluster CR. Thin wrapper: sets metadata, leaves the
|
|
11
|
+
# (large, deployment-specific) spec to the block.
|
|
12
|
+
class Cluster < Kube::Cluster["Cluster"]
|
|
13
|
+
def initialize(name: "postgres", namespace: nil, &block)
|
|
14
|
+
super() {
|
|
15
|
+
metadata.name = name
|
|
16
|
+
metadata.namespace = namespace if namespace
|
|
17
|
+
instance_exec(&block) if block
|
|
18
|
+
}
|
|
19
|
+
end
|
|
20
|
+
end
|
|
12
21
|
end
|
|
13
22
|
end
|
|
14
23
|
end
|
|
@@ -16,12 +25,15 @@ end
|
|
|
16
25
|
|
|
17
26
|
__END__
|
|
18
27
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
describe "CloudNativePg::Cluster" do
|
|
29
|
+
it "initializes without error" do
|
|
30
|
+
Kube::Cluster::Standard::CloudNativePg::Cluster
|
|
31
|
+
.new(name: "postgres", namespace: "cloudnative-pg") {
|
|
32
|
+
spec.instances = 1
|
|
33
|
+
spec.storage = { size: "1Gi" }
|
|
34
|
+
}
|
|
35
|
+
.to_yaml
|
|
36
|
+
.is_a?(String)
|
|
37
|
+
.should == true
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "kube/cluster"
|
|
5
|
+
require "kube/cluster/standard/cloud_native_pg/cluster"
|
|
6
|
+
|
|
7
|
+
module Kube
|
|
8
|
+
module Cluster
|
|
9
|
+
module Standard
|
|
10
|
+
module CloudNativePg
|
|
11
|
+
# The standard single-node PostgreSQL cluster: custom image, HA
|
|
12
|
+
# replication slots, logical WAL, and barman-cloud WAL archiving.
|
|
13
|
+
# Deployment-specific additions (managed roles, extra spec) come via the
|
|
14
|
+
# block; databases are separate Database CRs.
|
|
15
|
+
class PostgresCluster < Cluster
|
|
16
|
+
def initialize(name: "postgres", namespace: nil, &block)
|
|
17
|
+
super(name: name, namespace: namespace) {
|
|
18
|
+
spec.affinity = { podAntiAffinityType: "preferred" }
|
|
19
|
+
spec.bootstrap = {
|
|
20
|
+
initdb: {
|
|
21
|
+
database: "app",
|
|
22
|
+
encoding: "UTF8",
|
|
23
|
+
localeCType: "C",
|
|
24
|
+
localeCollate: "C",
|
|
25
|
+
owner: "app",
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
spec.enablePDB = true
|
|
29
|
+
spec.enableSuperuserAccess = false
|
|
30
|
+
spec.failoverDelay = 0
|
|
31
|
+
spec.imageName = "ghcr.io/general-intelligence-systems/postgresql:17-custom"
|
|
32
|
+
spec.imagePullPolicy = "Always"
|
|
33
|
+
spec.instances = 1
|
|
34
|
+
spec.plugins = [{
|
|
35
|
+
name: "barman-cloud.cloudnative-pg.io",
|
|
36
|
+
isWALArchiver: true,
|
|
37
|
+
parameters: { barmanObjectName: "cnpg-backups" },
|
|
38
|
+
}]
|
|
39
|
+
spec.logLevel = "info"
|
|
40
|
+
spec.maxSyncReplicas = 0
|
|
41
|
+
spec.minSyncReplicas = 0
|
|
42
|
+
spec.monitoring = {
|
|
43
|
+
disableDefaultQueries: false,
|
|
44
|
+
enablePodMonitor: false,
|
|
45
|
+
}
|
|
46
|
+
spec.postgresGID = 26
|
|
47
|
+
spec.postgresUID = 26
|
|
48
|
+
spec.postgresql = {
|
|
49
|
+
parameters: {
|
|
50
|
+
archive_mode: "on",
|
|
51
|
+
archive_timeout: "5min",
|
|
52
|
+
dynamic_shared_memory_type: "posix",
|
|
53
|
+
full_page_writes: "on",
|
|
54
|
+
log_destination: "csvlog",
|
|
55
|
+
log_directory: "/controller/log",
|
|
56
|
+
log_filename: "postgres",
|
|
57
|
+
log_rotation_age: "0",
|
|
58
|
+
log_rotation_size: "0",
|
|
59
|
+
log_truncate_on_rotation: "false",
|
|
60
|
+
logging_collector: "on",
|
|
61
|
+
max_parallel_workers: "32",
|
|
62
|
+
max_replication_slots: "32",
|
|
63
|
+
max_worker_processes: "32",
|
|
64
|
+
shared_memory_type: "mmap",
|
|
65
|
+
shared_preload_libraries: "",
|
|
66
|
+
ssl_max_protocol_version: "TLSv1.3",
|
|
67
|
+
ssl_min_protocol_version: "TLSv1.3",
|
|
68
|
+
wal_keep_size: "512MB",
|
|
69
|
+
wal_level: "logical",
|
|
70
|
+
wal_log_hints: "on",
|
|
71
|
+
wal_receiver_timeout: "5s",
|
|
72
|
+
wal_sender_timeout: "5s",
|
|
73
|
+
},
|
|
74
|
+
syncReplicaElectionConstraint: {
|
|
75
|
+
enabled: false,
|
|
76
|
+
},
|
|
77
|
+
}
|
|
78
|
+
spec.primaryUpdateMethod = "restart"
|
|
79
|
+
spec.primaryUpdateStrategy = "unsupervised"
|
|
80
|
+
spec.probes = {
|
|
81
|
+
liveness: {
|
|
82
|
+
isolationCheck: {
|
|
83
|
+
connectionTimeout: 1000,
|
|
84
|
+
enabled: true,
|
|
85
|
+
requestTimeout: 1000,
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
}
|
|
89
|
+
spec.replicationSlots = {
|
|
90
|
+
highAvailability: {
|
|
91
|
+
enabled: true,
|
|
92
|
+
slotPrefix: "_cnpg_",
|
|
93
|
+
},
|
|
94
|
+
synchronizeReplicas: {
|
|
95
|
+
enabled: true,
|
|
96
|
+
},
|
|
97
|
+
updateInterval: 30,
|
|
98
|
+
}
|
|
99
|
+
spec.resources = {}
|
|
100
|
+
spec.smartShutdownTimeout = 180
|
|
101
|
+
spec.startDelay = 3600
|
|
102
|
+
spec.stopDelay = 1800
|
|
103
|
+
spec.storage = {
|
|
104
|
+
resizeInUseVolumes: true,
|
|
105
|
+
size: "5Gi",
|
|
106
|
+
}
|
|
107
|
+
spec.switchoverDelay = 3600
|
|
108
|
+
|
|
109
|
+
instance_exec(&block) if block
|
|
110
|
+
}
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
__END__
|
|
119
|
+
|
|
120
|
+
describe "CloudNativePg::PostgresCluster" do
|
|
121
|
+
it "initializes without error" do
|
|
122
|
+
Kube::Cluster::Standard::CloudNativePg::PostgresCluster
|
|
123
|
+
.new(namespace: "cloudnative-pg")
|
|
124
|
+
.to_yaml
|
|
125
|
+
.is_a?(String)
|
|
126
|
+
.should == true
|
|
127
|
+
end
|
|
128
|
+
end
|
data/lib/kube/cluster/version.rb
CHANGED
data/lib/kube/cluster.rb
CHANGED
|
@@ -109,6 +109,7 @@ Kube::Cluster.config do
|
|
|
109
109
|
resolve "DecoratorController", to: "metacontroller.k8s.io/v1alpha1/DecoratorController"
|
|
110
110
|
|
|
111
111
|
# CloudNativePG.
|
|
112
|
+
resolve "Cluster", to: "postgresql.cnpg.io/v1/Cluster"
|
|
112
113
|
resolve "Database", to: "postgresql.cnpg.io/v1/Database"
|
|
113
114
|
|
|
114
115
|
# External Secrets Operator.
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kube_cluster
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nathan K
|
|
@@ -219,6 +219,7 @@ files:
|
|
|
219
219
|
- lib/kube/cluster/standard/cloud_native_pg/database_with_external_secret.rb
|
|
220
220
|
- lib/kube/cluster/standard/cloud_native_pg/external_secret.rb
|
|
221
221
|
- lib/kube/cluster/standard/cloud_native_pg/helm.rb
|
|
222
|
+
- lib/kube/cluster/standard/cloud_native_pg/postgres_cluster.rb
|
|
222
223
|
- lib/kube/cluster/standard/config_map.rb
|
|
223
224
|
- lib/kube/cluster/standard/cron_job.rb
|
|
224
225
|
- lib/kube/cluster/standard/cron_job_with_service_account.rb
|