Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Database abstraction and README update #39

Merged
merged 15 commits into from
Oct 31, 2022
Merged

Conversation

ytsarev
Copy link
Member

@ytsarev ytsarev commented Oct 25, 2022

Description of your changes

Fixes #26

I have:

  • Read and followed Upbound's contribution process.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR, as appropriate.

How has this code been tested

k apply -f examples/cluster-claim.yaml
k apply -f examples/postgres-claim.yaml

 k get claim
NAME                                                                READY   CONNECTION-SECRET          AGE
postgresqlinstance.gcp.platformref.upbound.io/platform-ref-gcp-db   True    platform-ref-gcp-db-conn   129m

NAME                                                          READY   CONNECTION-SECRET   AGE
cluster.gcp.platformref.upbound.io/platform-ref-gcp-cluster   True    cluster-conn        130m

 k view-secret platform-ref-gcp-db-conn
Multiple sub keys found. Specify another argument, one of:
-> privateIP
-> serverCACertificateCert

To test the cluster-database private connectivity end-to-end.

#On the target gke cluster

cat no-sidecar-psql.yaml
apiVersion: v1
kind: Pod
metadata:
  name: see-db
  namespace: default
spec:
  containers:
  - name: see-db
    image: postgres:12
    command: ['psql']
    args: ['-c', 'SELECT current_database();']
    env:
    - name: PGDATABASE
      value: postgres
    - name: PGHOST
      value: 10.100.0.3
    - name: PGUSER
      value: platform-ref-gcp-db-r26cb-5qjrf
    - name: PGPASSWORD
      value: <password

k apply -f no-sidecar-psql.yaml

k logs -f see-db
 current_database
------------------
 postgres
(1 row)

Signed-off-by: Yury Tsarev <yury@upbound.io>
…uster

* Avoid the need for cloud sql proxy sidecar for workload deployments

Signed-off-by: Yury Tsarev <yury@upbound.io>
Signed-off-by: Yury Tsarev <yury@upbound.io>
Signed-off-by: Yury Tsarev <yury@upbound.io>
@ytsarev
Copy link
Member Author

ytsarev commented Oct 25, 2022

@stevendborrelli please use upbound/platform-ref-gcp-staging:v0.3.0 for the testing.

@ytsarev
Copy link
Member Author

ytsarev commented Oct 25, 2022

/test-e2e

1 similar comment
@ytsarev
Copy link
Member Author

ytsarev commented Oct 25, 2022

/test-e2e

Signed-off-by: Yury Tsarev <yury@upbound.io>
@ytsarev
Copy link
Member Author

ytsarev commented Oct 25, 2022

/test-e2e

Signed-off-by: Yury Tsarev <yury@upbound.io>
@ytsarev
Copy link
Member Author

ytsarev commented Oct 25, 2022

/test-e2e

1 similar comment
@ytsarev
Copy link
Member Author

ytsarev commented Oct 26, 2022

/test-e2e

Signed-off-by: Yury Tsarev <yury@upbound.io>
* Use new `pre-delete` hooks
* Explicitly specify namespace for the database claim

Signed-off-by: Yury Tsarev <yury@upbound.io>
Signed-off-by: Yury Tsarev <yury@upbound.io>
@ytsarev
Copy link
Member Author

ytsarev commented Oct 26, 2022

/test-e2e

Signed-off-by: Yury Tsarev <yury@upbound.io>
@ytsarev
Copy link
Member Author

ytsarev commented Oct 26, 2022

/test-e2e

Signed-off-by: Yury Tsarev <yury@upbound.io>
@ytsarev
Copy link
Member Author

ytsarev commented Oct 27, 2022

/test-e2e

1 similar comment
@ytsarev
Copy link
Member Author

ytsarev commented Oct 27, 2022

/test-e2e

Signed-off-by: Yury Tsarev <yury@upbound.io>
@ytsarev
Copy link
Member Author

ytsarev commented Oct 27, 2022

/test-e2e

* This way DatabaseInstance deletion is not dependend on Cluster and we
  need no complex ordering
* Drawback: stable network name in Cluster composition
* GKE tweaks to spare some resources
* Isolated simple test-hooks

Signed-off-by: Yury Tsarev <yury@upbound.io>
@ytsarev
Copy link
Member Author

ytsarev commented Oct 27, 2022

/test-e2e

Signed-off-by: Yury Tsarev <yury@upbound.io>
@ytsarev
Copy link
Member Author

ytsarev commented Oct 27, 2022

/test-e2e

1 similar comment
@ytsarev
Copy link
Member Author

ytsarev commented Oct 27, 2022

/test-e2e

Copy link
Member

@stevendborrelli stevendborrelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

All claims became ready:

kubectl get claim,composite        
NAME                                                          READY   CONNECTION-SECRET   AGE
cluster.gcp.platformref.upbound.io/platform-ref-gcp-cluster   True    cluster-conn        82m

NAME                                                                READY   CONNECTION-SECRET          AGE
postgresqlinstance.gcp.platformref.upbound.io/platform-ref-gcp-db   True    platform-ref-gcp-db-conn   80m

NAME                                                                   READY   COMPOSITION                       AGE
xgke.gcp.platformref.upbound.io/platform-ref-gcp-cluster-xftvn-cp6lf   True    xgke.gcp.platformref.upbound.io   81m

NAME                                                                       READY   COMPOSITION                            AGE
xnetwork.gcp.platformref.upbound.io/platform-ref-gcp-cluster-xftvn-tng6l   True    xnetworks.gcp.platformref.upbound.io   81m

NAME                                                                 READY   COMPOSITION                            AGE
xcluster.gcp.platformref.upbound.io/platform-ref-gcp-cluster-xftvn   True    xclusters.gcp.platformref.upbound.io   81m

NAME                                                                       READY   COMPOSITION                                       AGE
xpostgresqlinstance.gcp.platformref.upbound.io/platform-ref-gcp-db-mf49v   True    xpostgresqlinstances.gcp.platformref.upbound.io   80m

NAME                                                                        READY   COMPOSITION                            AGE
xservices.gcp.platformref.upbound.io/platform-ref-gcp-cluster-xftvn-8qg2l   True    xservices.gcp.platformref.upbound.io   81m

examples/postgres-claim.yaml Show resolved Hide resolved
examples/configuration.yaml Show resolved Hide resolved

```console
kubectl -n upbound-system get cluster
kubectl delete -f examples/cluster-claim.yaml,examples/postgres-claim.yaml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got caught with hanging resources that required manual deletion (the helm release and SQL user). Perhaps we should document the scripts.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I've added note on ordered delete 69bb0f7

Signed-off-by: Yury Tsarev <yury@upbound.io>
@ytsarev ytsarev merged commit bba9e81 into upbound:main Oct 31, 2022
@ytsarev ytsarev deleted the database branch October 31, 2022 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Database abstraction to GCP reference platform
2 participants