Skip to content

Commit

Permalink
Merge pull request #126 from vshn/add/keycloak_bootstrap
Browse files Browse the repository at this point in the history
Add Keycloak provisioning
  • Loading branch information
Kidswiss committed Feb 2, 2024
2 parents ed692d6 + 98e8ed9 commit 345fd46
Show file tree
Hide file tree
Showing 41 changed files with 12,481 additions and 140 deletions.
15 changes: 12 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ 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

# The generator for the pool config CRD unfortunately produces a broken result. However if we ever need to regenerate it in the future, please uncomment this.
# 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 Expand Up @@ -191,7 +198,9 @@ get-crds:
./hack/get_crds.sh https://github.com/vshn/provider-minio provider-minio apis/minio/v1 apis/minio
./hack/get_crds.sh https://github.com/crossplane-contrib/provider-helm provider-helm apis/release apis/helm

# API bootstrapping
.PHONY: bootstrap
bootstrap:
.PHONY: api-bootstrap
api-bootstrap:
go run ./hack/bootstrap/template.go ${API_FILE}

.PHONY: bootstrap
bootstrap: api-bootstrap generate ## API bootstrapping, create a new claim/composite API ready to be used
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 contains the custom configurations for the pgbouncer.
Spec SGPoolingConfigSpec `json:"spec"`

// Status contains the default settings for the pgbouncer.
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 345fd46

Please sign in to comment.