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
19 changes: 0 additions & 19 deletions charts/console-backend-rbac/templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,6 @@ rules:
- get
- create
- delete
- apiGroups:
- "nais.io"
resources:
- postgresbranches
verbs:
- get
- list
- watch
- create
- delete
- apiGroups:
- postgresql.cnpg.io
resources:
Expand Down Expand Up @@ -369,15 +359,6 @@ rules:
- get
- create
- delete
- apiGroups:
- "nais.io"
resources:
- postgresbranches
verbs:
- get
- list
- watch
- delete
- apiGroups:
- postgresql.cnpg.io
resources:
Expand Down
4 changes: 0 additions & 4 deletions data/k8s/dev/devteam/postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ metadata:
spec:
majorVersion: "18"
highAvailability: false
activeBranch: main
resources:
cpu: 100m
memory: 512Mi
diskSize: 10Gi
status:
activeBranch: main
clusterName: pg-postgres-1-main-7adae74b
reconcilePhase: Completed
observedGeneration: 0
Expand All @@ -36,13 +34,11 @@ metadata:
spec:
majorVersion: "17"
highAvailability: true
activeBranch: main
resources:
cpu: 200m
memory: 1Gi
diskSize: 20Gi
status:
activeBranch: main
clusterName: pg-postgres-2-main-41c0e281
reconcilePhase: Completed
observedGeneration: 0
Expand Down
12 changes: 0 additions & 12 deletions data/k8s/dev/postgres-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ spec:
- jsonPath: .spec.resources.memory
name: Memory
type: string
- jsonPath: .status.activeBranch
name: Active branch
type: string
- jsonPath: .status.reconcileTime
name: Last reconcile
type: string
Expand Down Expand Up @@ -70,11 +67,6 @@ spec:
spec:
description: spec defines the desired state of Postgres
properties:
activeBranch:
description: |-
ActiveBranch selects the local branch name within this Postgres for normal workloads.
When omitted, pgrator retains the current active branch.
type: string
extensions:
description: Extensions to enable in the Postgres database.
items:
Expand Down Expand Up @@ -137,10 +129,6 @@ spec:
status:
description: status defines the observed state of Postgres
properties:
activeBranch:
description: ActiveBranch is the local branch name currently selected
by pgrator.
type: string
conditions:
description: |-
conditions represent the current state of the controlled resource.
Expand Down
20 changes: 4 additions & 16 deletions integration_tests/create_postgres_access.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ Test.gql("Create personal postgres access rejects an unknown instance", function
t.check {
errors = {
{
extensions = { field = "branch" },
message = Contains("Could not find PostgresBranch"),
extensions = { field = "postgres" },
message = Contains("Could not find Postgres"),
path = { "createPostgresAccess" },
},
},
Expand All @@ -118,7 +118,7 @@ Test.gql("Create personal postgres access rejects a logical Postgres without a p
}) { name } }
]]
t.check {
errors = { { extensions = { field = "branch" }, message = Contains("is not available"), path = { "createPostgresAccess" } } },
errors = { { extensions = { field = "postgres" }, message = Contains("is not available"), path = { "createPostgresAccess" } } },
data = Null,
}
end)
Expand All @@ -143,7 +143,7 @@ Test.gql("Create personal postgres access rejects an unavailable instance", func
t.check {
errors = {
{
extensions = { field = "branch" },
extensions = { field = "postgres" },
message = Contains("is not available"),
path = { "createPostgresAccess" },
},
Expand Down Expand Up @@ -268,18 +268,6 @@ Test.gql("Changing access level revokes and recreates live access", function(t)
} } } } }
end)

Test.gql("Personal access rejects retired non-main selection", function(t)
t.addHeader("x-user-email", user:email())
t.query [[
mutation { createPostgresAccess(input: {
postgres: "foobar", branch: "recovered", environmentName: "dev",
teamSlug: "someteamname", accessLevel: READ,
reason: "Testing access to a recovered instance"
}) { name } }
]]
t.check { data = Null, errors = { { extensions = { code = "GRAPHQL_VALIDATION_FAILED" }, locations = NotNull(), message = Contains('Field "branch" is not defined') } } }
end)

Test.gql("PostgresAccess status is visible to authorized team members", function(t)
t.addHeader("x-user-email", otherMemberUser:email())
for _, test in ipairs({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
namespace: someteamname
uid: 11111111-1111-4111-8111-111111111111
spec:
postgresBranch: foobar-main-a4f04c0c
postgres: foobar
username: user@usersen.com
accessLevel: readwrite
expiresAt: "2099-09-17T12:00:00Z"
Expand All @@ -30,7 +30,7 @@ metadata:
namespace: someteamname
uid: 44444444-4444-4444-8444-444444444444
spec:
postgresBranch: foobar-main-a4f04c0c
postgres: foobar
username: user@usersen.com
accessLevel: read
expiresAt: "2099-09-17T12:00:00Z"
Expand All @@ -50,7 +50,7 @@ metadata:
name: recovered-access
namespace: someteamname
spec:
postgresBranch: foobar-recovered-b88d8360
postgres: foobar
username: user@usersen.com
accessLevel: read
expiresAt: "2099-09-17T12:00:00Z"
Expand All @@ -65,7 +65,7 @@ metadata:
name: pending-access
namespace: someteamname
spec:
postgresBranch: foobar-main-a4f04c0c
postgres: foobar
username: user@usersen.com
accessLevel: read
expiresAt: "2099-09-17T12:00:00Z"
Expand All @@ -80,7 +80,7 @@ metadata:
name: failed-access
namespace: someteamname
spec:
postgresBranch: foobar-main-a4f04c0c
postgres: foobar
username: user@usersen.com
accessLevel: readwritecreate
expiresAt: "2099-09-17T12:00:00Z"
Expand All @@ -97,7 +97,7 @@ metadata:
name: expired-access
namespace: someteamname
spec:
postgresBranch: foobar-main-a4f04c0c
postgres: foobar
username: user@usersen.com
accessLevel: read
expiresAt: "2000-01-01T00:00:00Z"
Expand All @@ -113,7 +113,7 @@ metadata:
namespace: someteamname
uid: 22222222-2222-4222-8222-222222222222
spec:
postgresBranch: foobar-main-a4f04c0c
postgres: foobar
username: user@usersen.com
accessLevel: read
expiresAt: "2099-09-17T12:00:00Z"
Expand All @@ -135,7 +135,7 @@ metadata:
namespace: someteamname
uid: 33333333-3333-4333-8333-333333333333
spec:
postgresBranch: foobar-main-a4f04c0c
postgres: foobar
username: stale@usersen.com
accessLevel: read
expiresAt: "2000-01-01T00:00:00Z"
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ metadata:
spec:
majorVersion: "17"
status:
activeBranch: main
clusterName: pg-foobar-main-a4f04c0c
reconcilePhase: Completed
conditions:
Expand All @@ -24,8 +23,6 @@ metadata:
namespace: someteamname
spec:
majorVersion: "17"
status:
activeBranch: main
---
apiVersion: nais.io/v1
kind: Postgres
Expand All @@ -35,57 +32,6 @@ metadata:
spec:
majorVersion: "17"
---
apiVersion: nais.io/v1
kind: PostgresBranch
metadata:
name: foobar-main-a4f04c0c
namespace: someteamname
spec:
postgres: foobar
branchName: main
status:
reconcilePhase: Completed
conditions:
- type: cluster.postgresql.cnpg.io/ObservedState
status: "True"
reason: Reconciled
message: "Cluster is in phase: Cluster in healthy state"
lastTransitionTime: "2026-09-17T00:00:00Z"
---
apiVersion: nais.io/v1
kind: PostgresBranch
metadata:
name: progressing-main-6cb99f88
namespace: someteamname
spec:
postgres: progressing
branchName: main
status:
reconcilePhase: Preparing
conditions:
- type: cluster.postgresql.cnpg.io/ObservedState
status: "False"
reason: Reconciling
message: "Cluster is in phase: "
lastTransitionTime: "2026-09-17T00:00:00Z"
---
apiVersion: nais.io/v1
kind: PostgresBranch
metadata:
name: foobar-recovered-b88d8360
namespace: someteamname
spec:
postgres: foobar
branchName: recovered
status:
reconcilePhase: Completed
conditions:
- type: cluster.postgresql.cnpg.io/ObservedState
status: "True"
reason: Reconciled
message: "Cluster is in phase: Cluster in healthy state"
lastTransitionTime: "2026-09-17T00:00:00Z"
---
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
Expand All @@ -101,19 +47,3 @@ status:
status: "True"
reason: ClusterReady
lastTransitionTime: "2026-09-17T00:00:00Z"
---
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: pg-foobar-recovered-b88d8360
namespace: someteamname
spec:
certificates:
serverCASecret: pg-foobar-ca
status:
phase: Cluster in healthy state
conditions:
- type: Ready
status: "True"
reason: ClusterReady
lastTransitionTime: "2026-09-17T00:00:00Z"
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ metadata:
spec:
majorVersion: "17"
status:
activeBranch: main
clusterName: pg-postgres-one-main-e58682b9
reconcilePhase: Completed
conditions:
Expand All @@ -30,7 +29,6 @@ metadata:
spec:
majorVersion: "17"
status:
activeBranch: main
clusterName: pg-postgres-two-main-935c2b2a
reconcilePhase: Completed
conditions:
Expand All @@ -50,7 +48,6 @@ metadata:
spec:
majorVersion: "17"
status:
activeBranch: main
clusterName: pg-postgres-three-main-1013cb94
reconcilePhase: Completed
conditions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ metadata:
spec:
majorVersion: "16"
status:
activeBranch: main
clusterName: pg-audit-enabled-main-74f70e60
reconcilePhase: Completed
conditions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,6 @@ spec:
memory: 512Mi
diskSize: 10Gi
---
apiVersion: nais.io/v1
kind: PostgresBranch
metadata:
name: existing-main-f68e5aa4
namespace: pg-crud-team
spec:
postgres: existing
branchName: main
status:
reconcilePhase: Completed
conditions:
- type: cluster.postgresql.cnpg.io/ObservedState
status: "True"
reason: Reconciled
message: "Cluster is in phase: Cluster in healthy state"
lastTransitionTime: "2026-09-17T00:00:00Z"
---
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: nais.io/v1
kind: Postgres
metadata:
name: branchless
name: awaiting-cluster
namespace: pg-crud-team
labels:
usecase: reporting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ metadata:
spec:
majorVersion: "17"
status:
activeBranch: main
clusterName: pg-foobar-main-a4f04c0c
configuration:
parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ metadata:
spec:
majorVersion: "16"
status:
activeBranch: main
clusterName: pg-another-db-main-72a85261
reconcilePhase: Completed
configuration:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ spec:
memory: 2Gi
diskSize: 2Gi
status:
activeBranch: main
clusterName: pg-foobar-main-a4f04c0c
configuration:
parameters:
Expand Down
Loading
Loading