Default cluster cr creation failed
Summary
Default resources creation derived from a stackgres cluster are not validating that a resoure already exists
Environment
-
StackGres version: 0.8 alpha2
-
Kubernetes version (use
kubectl version
): 1.12.10 -
Cloud provider or hardware configuration: kind
Steps to reproduce
Create a namespace "demo"
kubectl create namespace demo
Create a pgBouncer configuration with the following yaml
apiVersion: stackgres.io/v1alpha1
kind: StackGresConnectionPoolingConfig
metadata:
name: defaultpgbouncer
namespace: demo
spec:
pgbouncer.ini:
admin_users: postgres
user: postgres
Create a cluster with the following yaml:
apiVersion: stackgres.io/v1alpha1
kind: StackGresCluster
metadata:
name: stackgres
namespace: demo
spec:
instances: 2
pgVersion: "11.6"
sidecars:
- connection-pooling
- postgres-util
- prometheus-postgres-exporter
volumeSize: 5Gi
Relevant logs and/or screenshots
Error from server (InternalError): error when creating "STDIN": Internal error occurred: admission webhook "sgcluster.stackgres-operator.stackgres" denied the request: Failure executing: POST at: https://10.96.0.1/apis/stackgres.io/v1alpha1/namespaces/emptycluster/sgconnectionpoolingconfigs. Message: sgconnectionpoolingconfigs.stackgres.io "defaultpgbouncer" already exists. Received status: Status(apiVersion=v1, code=409, details=StatusDetails(causes=[], group=stackgres.io, kind=sgconnectionpoolingconfigs, name=defaultpgbouncer, retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=sgconnectionpoolingconfigs.stackgres.io "defaultpgbouncer" already exists, metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=AlreadyExists, status=Failure, additionalProperties={}).
Edited by Matteo Melli