Skip to content

Commit

Permalink
Set MaxItems=1 for sqlInstances and databases
Browse files Browse the repository at this point in the history
Also, remove incorrect default for sqlInstance.Tier
  • Loading branch information
mortenlj committed Oct 1, 2024
1 parent eefa9a2 commit 60ff560
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 21 deletions.
8 changes: 3 additions & 5 deletions charts/templates/nais.io_applications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@ spec:
required:
- name
type: object
maxItems: 1
type: array
diskAutoresize:
description: |-
Expand Down Expand Up @@ -722,11 +723,7 @@ spec:
minimum: 1
type: integer
type:
description: |-
PostgreSQL version.
About `POSTGRES_16`; if you are creating a *new* instance with this version, you will be enrolled with the [Enterprice Plus](https://cloud.google.com/sql/docs/postgres/editions-intro) edition.
This is a more expensive version than what previous version of Postgres was running on. As for now there is no way to change edition.
If you are upgrading from a previous version of Postgres, you will not be enrolled in the Enterprice Plus edition.
description: PostgreSQL version.
enum:
- POSTGRES_11
- POSTGRES_12
Expand All @@ -739,6 +736,7 @@ spec:
- tier
- type
type: object
maxItems: 1
type: array
type: object
idporten:
Expand Down
8 changes: 3 additions & 5 deletions charts/templates/nais.io_naisjobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ spec:
required:
- name
type: object
maxItems: 1
type: array
diskAutoresize:
description: |-
Expand Down Expand Up @@ -683,11 +684,7 @@ spec:
minimum: 1
type: integer
type:
description: |-
PostgreSQL version.
About `POSTGRES_16`; if you are creating a *new* instance with this version, you will be enrolled with the [Enterprice Plus](https://cloud.google.com/sql/docs/postgres/editions-intro) edition.
This is a more expensive version than what previous version of Postgres was running on. As for now there is no way to change edition.
If you are upgrading from a previous version of Postgres, you will not be enrolled in the Enterprice Plus edition.
description: PostgreSQL version.
enum:
- POSTGRES_11
- POSTGRES_12
Expand All @@ -700,6 +697,7 @@ spec:
- tier
- type
type: object
maxItems: 1
type: array
type: object
image:
Expand Down
8 changes: 3 additions & 5 deletions config/crd/bases/nais.io_applications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@ spec:
required:
- name
type: object
maxItems: 1
type: array
diskAutoresize:
description: |-
Expand Down Expand Up @@ -722,11 +723,7 @@ spec:
minimum: 1
type: integer
type:
description: |-
PostgreSQL version.
About `POSTGRES_16`; if you are creating a *new* instance with this version, you will be enrolled with the [Enterprice Plus](https://cloud.google.com/sql/docs/postgres/editions-intro) edition.
This is a more expensive version than what previous version of Postgres was running on. As for now there is no way to change edition.
If you are upgrading from a previous version of Postgres, you will not be enrolled in the Enterprice Plus edition.
description: PostgreSQL version.
enum:
- POSTGRES_11
- POSTGRES_12
Expand All @@ -739,6 +736,7 @@ spec:
- tier
- type
type: object
maxItems: 1
type: array
type: object
idporten:
Expand Down
8 changes: 3 additions & 5 deletions config/crd/bases/nais.io_naisjobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ spec:
required:
- name
type: object
maxItems: 1
type: array
diskAutoresize:
description: |-
Expand Down Expand Up @@ -683,11 +684,7 @@ spec:
minimum: 1
type: integer
type:
description: |-
PostgreSQL version.
About `POSTGRES_16`; if you are creating a *new* instance with this version, you will be enrolled with the [Enterprice Plus](https://cloud.google.com/sql/docs/postgres/editions-intro) edition.
This is a more expensive version than what previous version of Postgres was running on. As for now there is no way to change edition.
If you are upgrading from a previous version of Postgres, you will not be enrolled in the Enterprice Plus edition.
description: PostgreSQL version.
enum:
- POSTGRES_11
- POSTGRES_12
Expand All @@ -700,6 +697,7 @@ spec:
- tier
- type
type: object
maxItems: 1
type: array
type: object
image:
Expand Down
3 changes: 2 additions & 1 deletion pkg/apis/nais.io/v1/naiserator_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ type GCP struct {
// Provision database instances and connect them to your application.
// +nais:doc:Link="https://doc.nais.io/persistence/postgres/";"https://cloud.google.com/sql/docs/postgres/instance-settings#impact"
// +nais:doc:Availability=GCP
// +kubebuilder:validation:MaxItems=1
SqlInstances []CloudSqlInstance `json:"sqlInstances,omitempty"`
// List of _additional_ permissions that should be granted to your application for accessing external GCP resources that have not been provisioned through NAIS.
// +nais:doc:Availability=GCP
Expand Down Expand Up @@ -538,7 +539,6 @@ type CloudSqlInstance struct {
// The smallest possible instance is `db-f1-micro`, which is recommended only for development instances.
// For production workloads, please specify at least `db-custom-1-3840`.
// +kubebuilder:validation:Pattern="db-.+"
// +nais:doc:Default="db-f1-micro"
Tier string `json:"tier"`
// Disk type to use for storage in the database.
// +kubebuilder:validation:Enum=SSD;HDD
Expand Down Expand Up @@ -584,6 +584,7 @@ type CloudSqlInstance struct {
Maintenance *Maintenance `json:"maintenance,omitempty"`
// List of databases that should be created on this Postgres server.
// +kubebuilder:validation:Required
// +kubebuilder:validation:MaxItems=1
Databases []CloudSqlDatabase `json:"databases,omitempty"`
// Remove the entire Postgres server including all data when the Kubernetes resource is deleted.
// *THIS IS A DESTRUCTIVE OPERATION*! Set cascading delete only when you want to remove data forever.
Expand Down

0 comments on commit 60ff560

Please sign in to comment.