Skip to content

Commit

Permalink
Add Keycloak provisioning
Browse files Browse the repository at this point in the history
With this commit it's now possible to provision a fairly default
Keycloak instance backed by our PostgreSQL implementation.
  • Loading branch information
Kidswiss committed Jan 30, 2024
1 parent 720bcbe commit e5f0405
Show file tree
Hide file tree
Showing 35 changed files with 12,279 additions and 137 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ generate-stackgres-crds:
go run github.com/deepmap/oapi-codegen/cmd/oapi-codegen --package=v1 -generate=types -o apis/stackgres/v1/sgcluster.gen.go apis/stackgres/v1/sgcluster.yaml
perl -i -0pe 's/\*struct\s\{\n\s\sAdditionalProperties\smap\[string\]string\s`json:"-"`\n\s}/map\[string\]string/gms' apis/stackgres/v1/sgcluster.gen.go

# curl ${STACKGRES_CRD_URL}/SGPoolingConfig.yaml?inline=false -o apis/stackgres/v1/sgpoolconfigs_crd.yaml
# yq -i e apis/stackgres/v1/sgpoolconfigs.yaml --expression ".components.schemas.SGPoolingConfigSpec=load(\"apis/stackgres/v1/sgpoolconfigs_crd.yaml\").spec.versions[0].schema.openAPIV3Schema.properties.spec"
# yq -i e apis/stackgres/v1/sgpoolconfigs.yaml --expression ".components.schemas.SGPoolingConfigStatus=load(\"apis/stackgres/v1/sgpoolconfigs_crd.yaml\").spec.versions[0].schema.openAPIV3Schema.properties.status"
# go run github.com/deepmap/oapi-codegen/cmd/oapi-codegen --package=v1 -generate=types -o apis/stackgres/v1/sgpoolconfigs.gen.go apis/stackgres/v1/sgpoolconfigs.yaml
# perl -i -0pe 's/\*struct\s\{\n\s\sAdditionalProperties\smap\[string\]string\s`json:"-"`\n\s}/map\[string\]string/gms' apis/stackgres/v1/sgpoolconfigs.gen.go

go run sigs.k8s.io/controller-tools/cmd/controller-gen object paths=./apis/stackgres/v1/...
rm apis/stackgres/v1/*_crd.yaml

Expand Down
2 changes: 2 additions & 0 deletions apis/stackgres/v1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,7 @@ func init() {
&SGClusterList{},
&SGPostgresConfig{},
&SGPostgesConfigList{},
&SGPoolingConfigList{},
&SGPoolingConfig{},
)
}
28 changes: 28 additions & 0 deletions apis/stackgres/v1/sgpoolconfigs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package v1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// +kubebuilder:object:root=true

// SGPoolingConfig is the API for creating pgbouncer configs clusters.
type SGPoolingConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

// Spec defines the desired state of a VSHNPostgreSQL.
Spec SGPoolingConfigSpec `json:"spec"`

// Status reflects the observed state of a VSHNPostgreSQL.
Status SGPoolingConfigStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

type SGPoolingConfigList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`

Items []SGPoolingConfig `json:"items"`
}
75 changes: 75 additions & 0 deletions apis/stackgres/v1/sgpoolconfigs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
openapi: "3.0.2"
paths:
"/spec":
get:
responses:
"200":
content:
"application/json":
schema:
"$ref": "#/components/schemas/SGPoolingConfigSpec"
"/status":
get:
responses:
"200":
content:
"application/json":
schema:
"$ref": "#/components/schemas/SGPoolingConfigStatus"
components:
schemas:
SGPoolingConfigSpec:
type: object
properties:
pgBouncer:
type: object
description: |
Connection pooling configuration based on PgBouncer.
properties:
pgbouncer.ini:
type: object
description: |
The `pgbouncer.ini` parameters the configuration contains, represented as an object where the keys are valid names for the `pgbouncer.ini` configuration file parameters.
Check [pgbouncer configuration](https://www.pgbouncer.org/config.html#generic-settings) for more information about supported parameters.
properties:
pgbouncer:
type: object
additionalProperties: true
description: |
The `pgbouncer.ini` (Section [pgbouncer]) parameters the configuration contains, represented as an object where the keys are valid names for the `pgbouncer.ini` configuration file parameters.
Check [pgbouncer configuration](https://www.pgbouncer.org/config.html#generic-settings) for more information about supported parameters
databases:
type: object
additionalProperties:
type: object
additionalProperties: true
description: |
The `pgbouncer.ini` (Section [databases]) parameters the configuration contains, represented as an object where the keys are valid names for the `pgbouncer.ini` configuration file parameters.
Check [pgbouncer configuration](https://www.pgbouncer.org/config.html#section-databases) for more information about supported parameters.
users:
type: object
additionalProperties:
type: object
additionalProperties: true
description: |
The `pgbouncer.ini` (Section [users]) parameters the configuration contains, represented as an object where the keys are valid names for the `pgbouncer.ini` configuration file parameters.
Check [pgbouncer configuration](https://www.pgbouncer.org/config.html#section-users) for more information about supported parameters.
SGPoolingConfigStatus:
type: object
properties:
pgBouncer:
type: object
description: |
Connection pooling configuration status based on PgBouncer.
properties:
defaultParameters:
type: object
additionalProperties:
type: string
description: |
The `pgbouncer.ini` default parameters parameters which are used if not set.
required: ["defaultParameters"]
50 changes: 50 additions & 0 deletions apis/stackgres/v1/sgpoolconfigs_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

155 changes: 154 additions & 1 deletion apis/stackgres/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e5f0405

Please sign in to comment.