reflect connectionPool validation in Go code and publish in manifests and chart

This commit is contained in:
Felix Kunde 2020-02-13 12:54:32 +01:00
parent b66b1633a1
commit f2c9905123
9 changed files with 187 additions and 38 deletions

View File

@ -321,24 +321,6 @@ spec:
connection_pool:
type: object
properties:
connection_pool_schema:
type: string
#default: "pooler"
connection_pool_user:
type: string
#default: "pooler"
connection_pool_instances_number:
type: integer
#default: 1
connection_pool_image:
type: string
#default: "pierone.stups.zalan.do/acid/pgbouncer:0.0.1"
connection_pool_mode:
type: string
enum:
- "session"
- "transaction"
#default: "transaction"
connection_pool_default_cpu_limit:
type: string
pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
@ -354,7 +336,25 @@ spec:
connection_pool_default_memory_request:
type: string
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
#default: "100m"
#default: "100Mi"
connection_pool_image:
type: string
#default: "pierone.stups.zalan.do/acid/pgbouncer:0.0.1"
connection_pool_instances_number:
type: integer
#default: 1
connection_pool_mode:
type: string
enum:
- "session"
- "transaction"
#default: "transaction"
connection_pool_schema:
type: string
#default: "pooler"
connection_pool_user:
type: string
#default: "pooler"
status:
type: object
additionalProperties:

View File

@ -20,4 +20,5 @@ data:
{{ toYaml .Values.configDebug | indent 2 }}
{{ toYaml .Values.configLoggingRestApi | indent 2 }}
{{ toYaml .Values.configTeamsApi | indent 2 }}
{{ toYaml .Values.configConnectionPool | indent 2 }}
{{- end }}

View File

@ -34,4 +34,6 @@ configuration:
{{ toYaml .Values.configLoggingRestApi | indent 4 }}
scalyr:
{{ toYaml .Values.configScalyr | indent 4 }}
connection_pool:
{{ toYaml .Values.configConnectionPool | indent 4 }}
{{- end }}

View File

@ -261,6 +261,17 @@ configScalyr:
# Memory request value for the Scalyr sidecar
scalyr_memory_request: 50Mi
configConnectionPool:
connection_pool_default_cpu_limit: "1"
connection_pool_default_cpu_request: "1"
connection_pool_default_memory_limit: 100m
connection_pool_default_memory_request: "100Mi"
# connection_pool_image: ""
connection_pool_instances_number: 1
connection_pool_mode: "transaction"
# connection_pool_schema: "pooler"
# connection_pool_user: "pooler"
rbac:
# Specifies whether RBAC resources should be created
create: true

View File

@ -237,6 +237,18 @@ configTeamsApi:
# URL of the Teams API service
# teams_api_url: http://fake-teams-api.default.svc.cluster.local
# configure connection pooler deployment created by the operator
configConnectionPool:
connection_pool_default_cpu_limit: "1"
connection_pool_default_cpu_request: "1"
connection_pool_default_memory_limit: 100m
connection_pool_default_memory_request: "100Mi"
# connection_pool_image: ""
connection_pool_instances_number: 1
connection_pool_mode: "transaction"
# connection_pool_schema: "pooler"
# connection_pool_user: "pooler"
rbac:
# Specifies whether RBAC resources should be created
create: true

View File

@ -11,6 +11,15 @@ data:
cluster_history_entries: "1000"
cluster_labels: application:spilo
cluster_name_label: version
# connection_pool_default_cpu_limit: "1"
# connection_pool_default_cpu_request: "1"
# connection_pool_default_memory_limit: 100m
# connection_pool_default_memory_request: "100Mi"
# connection_pool_image: ""
# connection_pool_instances_number: 1
# connection_pool_mode: "transaction"
# connection_pool_schema: "pooler"
# connection_pool_user: "pooler"
# custom_service_annotations: "keyx:valuez,keya:valuea"
# custom_pod_annotations: "keya:valuea,keyb:valueb"
db_hosted_zone: db.example.com

View File

@ -297,24 +297,6 @@ spec:
connection_pool:
type: object
properties:
connection_pool_schema:
type: string
#default: "pooler"
connection_pool_user:
type: string
#default: "pooler"
connection_pool_instances_number:
type: integer
#default: 1
connection_pool_image:
type: string
#default: "pierone.stups.zalan.do/acid/pgbouncer:0.0.1"
connection_pool_mode:
type: string
enum:
- "session"
- "transaction"
#default: "transaction"
connection_pool_default_cpu_limit:
type: string
pattern: '^(\d+m|\d+(\.\d{1,3})?)$'
@ -330,7 +312,25 @@ spec:
connection_pool_default_memory_request:
type: string
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
#default: "100m"
#default: "100Mi"
connection_pool_image:
type: string
#default: "pierone.stups.zalan.do/acid/pgbouncer:0.0.1"
connection_pool_instances_number:
type: integer
#default: 1
connection_pool_mode:
type: string
enum:
- "session"
- "transaction"
#default: "transaction"
connection_pool_schema:
type: string
#default: "pooler"
connection_pool_user:
type: string
#default: "pooler"
status:
type: object
additionalProperties:

View File

@ -121,3 +121,13 @@ configuration:
scalyr_memory_limit: 500Mi
scalyr_memory_request: 50Mi
# scalyr_server_url: ""
connection_pool:
connection_pool_default_cpu_limit: "1"
connection_pool_default_cpu_request: "1"
connection_pool_default_memory_limit: 100m
connection_pool_default_memory_request: "100Mi"
# connection_pool_image: ""
connection_pool_instances_number: 1
connection_pool_mode: "transaction"
# connection_pool_schema: "pooler"
# connection_pool_user: "pooler"

View File

@ -176,6 +176,65 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
},
},
},
"connectionPool": {
Type: "object",
Properties: map[string]apiextv1beta1.JSONSchemaProps{
"dockerImage": {
Type: "string",
},
"mode": {
Type: "string",
},
"numberOfInstances": {
Type: "integer",
Minimum: &min1,
},
"resources": {
Type: "object",
Required: []string{"requests", "limits"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{
"limits": {
Type: "object",
Required: []string{"cpu", "memory"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{
"cpu": {
Type: "string",
Description: "Decimal natural followed by m, or decimal natural followed by dot followed by up to three decimal digits (precision used by Kubernetes). Must be greater than 0",
Pattern: "^(\\d+m|\\d+(\\.\\d{1,3})?)$",
},
"memory": {
Type: "string",
Description: "Plain integer or fixed-point integer using one of these suffixes: E, P, T, G, M, k (with or without a tailing i). Must be greater than 0",
Pattern: "^(\\d+(e\\d+)?|\\d+(\\.\\d+)?(e\\d+)?[EPTGMK]i?)$",
},
},
},
"requests": {
Type: "object",
Required: []string{"cpu", "memory"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{
"cpu": {
Type: "string",
Description: "Decimal natural followed by m, or decimal natural followed by dot followed by up to three decimal digits (precision used by Kubernetes). Must be greater than 0",
Pattern: "^(\\d+m|\\d+(\\.\\d{1,3})?)$",
},
"memory": {
Type: "string",
Description: "Plain integer or fixed-point integer using one of these suffixes: E, P, T, G, M, k (with or without a tailing i). Must be greater than 0",
Pattern: "^(\\d+(e\\d+)?|\\d+(\\.\\d+)?(e\\d+)?[EPTGMK]i?)$",
},
},
},
},
},
"schema": {
Type: "string",
},
"user": {
Type: "string",
},
},
},
"databases": {
Type: "object",
AdditionalProperties: &apiextv1beta1.JSONSchemaPropsOrBool{
@ -1037,6 +1096,51 @@ var OperatorConfigCRDResourceValidation = apiextv1beta1.CustomResourceValidation
},
},
},
"connection_pool": {
Type: "object",
Properties: map[string]apiextv1beta1.JSONSchemaProps{
"connection_pool_default_cpu_limit": {
Type: "string",
Pattern: "^(\\d+m|\\d+(\\.\\d{1,3})?)$",
},
"connection_pool_default_cpu_request": {
Type: "string",
Pattern: "^(\\d+m|\\d+(\\.\\d{1,3})?)$",
},
"connection_pool_default_memory_limit": {
Type: "string",
Pattern: "^(\\d+(e\\d+)?|\\d+(\\.\\d+)?(e\\d+)?[EPTGMK]i?)$",
},
"connection_pool_default_memory_request": {
Type: "string",
Pattern: "^(\\d+(e\\d+)?|\\d+(\\.\\d+)?(e\\d+)?[EPTGMK]i?)$",
},
"connection_pool_image": {
Type: "string",
},
"connection_pool_instances_number": {
Type: "integer",
Minimum: &min1,
},
"connection_pool_mode": {
Type: "string",
Enum: []apiextv1beta1.JSON{
{
Raw: []byte(`"session"`),
},
{
Raw: []byte(`"transaction"`),
},
},
},
"connection_pool_schema": {
Type: "string",
},
"connection_pool_user": {
Type: "string",
},
},
},
},
},
"status": {