Skip to content

Commit e80ba4c

Browse files
committed
feat: add PostgREST image registry and schema/role preflight
- Pin postgrest image to ghcr.io/pgedge/postgrest:14.5 - Extend version pattern to accept two-part versions (e.g. 14.5) - Add ValidatePostgRESTPrereqs activity with Patroni primary discovery and reachable-instance fallback - Fail fast on invalid PostgREST config before plan step - All config fields optional: db_schemas defaults to "public", db_anon_role to "pgedge_application_read_only" PLAT-499, PLAT-500
1 parent 389adf9 commit e80ba4c

File tree

13 files changed

+88
-93
lines changed

13 files changed

+88
-93
lines changed

api/apiv1/design/database.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const (
99
cpuPattern = `^[0-9]+(\.[0-9]{1,3}|m)?$`
1010
postgresVersionPattern = `^\d{2}\.\d{1,2}$`
1111
spockVersionPattern = `^\d{1}$`
12-
serviceVersionPattern = `^(\d+\.\d+\.\d+|latest)$`
12+
serviceVersionPattern = `^(\d+\.\d+(\.\d+)?|latest)$`
1313
)
1414

1515
var HostIDs = g.ArrayOf(Identifier, func() {
@@ -143,10 +143,10 @@ var ServiceSpec = g.Type("ServiceSpec", func() {
143143
g.Meta("struct:tag:json", "service_type")
144144
})
145145
g.Attribute("version", g.String, func() {
146-
g.Description("The version of the service in semver format (e.g., '1.0.0') or the literal 'latest'.")
146+
g.Description("The version of the service (e.g., '1.0.0', '14.5') or the literal 'latest'.")
147147
g.Pattern(serviceVersionPattern)
148148
g.Example("1.0.0")
149-
g.Example("1.2.3")
149+
g.Example("14.5")
150150
g.Example("latest")
151151
g.Meta("struct:tag:json", "version")
152152
})

api/apiv1/gen/control_plane/service.go

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/apiv1/gen/http/control_plane/client/types.go

Lines changed: 5 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/apiv1/gen/http/control_plane/server/types.go

Lines changed: 5 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/apiv1/gen/http/openapi.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/apiv1/gen/http/openapi.yaml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/apiv1/gen/http/openapi3.json

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/apiv1/gen/http/openapi3.yaml

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/internal/api/apiv1/validate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ func validateS3RepoProperties(props repoProperties, path []string) []error {
521521
}
522522

523523
var pgBackRestOptionPattern = regexp.MustCompile(`^[a-z0-9-]+$`)
524-
var semverPattern = regexp.MustCompile(`^\d+\.\d+\.\d+$`)
524+
var semverPattern = regexp.MustCompile(`^\d+\.\d+(\.\d+)?$`)
525525

526526
// reservedLabelPrefix is the label key prefix reserved for system use.
527527
const reservedLabelPrefix = "pgedge."

server/internal/api/apiv1/validate_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,16 @@ func TestValidateServiceSpec(t *testing.T) {
803803
},
804804
},
805805
},
806+
{
807+
name: "valid PostgREST service with two-part version",
808+
svc: &api.ServiceSpec{
809+
ServiceID: "postgrest",
810+
ServiceType: "postgrest",
811+
Version: "14.5",
812+
HostIds: []api.Identifier{"host-1"},
813+
Config: map[string]any{},
814+
},
815+
},
806816
{
807817
name: "valid MCP service with 'latest' version",
808818
svc: &api.ServiceSpec{

0 commit comments

Comments
 (0)