-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15160 from agarwalnit/master
Added cloud-spanner emulator add-on.
- Loading branch information
Showing
8 changed files
with
139 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: cloud-spanner-emulator | ||
labels: | ||
app: cloud-spanner-emulator | ||
gcp-auth-skip-secret: "true" | ||
kubernetes.io/minikube-addons-endpoint: cloud-spanner | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: cloud-spanner-emulator | ||
template: | ||
metadata: | ||
labels: | ||
app: cloud-spanner-emulator | ||
spec: | ||
containers: | ||
- name: cloud-spanner-emulator | ||
image: gcr.io/cloud-spanner-emulator/emulator:latest | ||
imagePullPolicy: IfNotPresent | ||
ports: | ||
- containerPort: 9020 | ||
name: http | ||
- containerPort: 9010 | ||
name: grpc | ||
|
||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: cloud-spanner-emulator | ||
labels: | ||
app: cloud-spanner-emulator | ||
spec: | ||
type: NodePort | ||
ports: | ||
- port: 9020 | ||
name: http | ||
- port: 9010 | ||
name: grpc | ||
selector: | ||
app: cloud-spanner-emulator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
title: "Using Cloud Spanner Addon" | ||
linkTitle: "Cloud Spanner" | ||
weight: 1 | ||
date: 2022-10-14 | ||
--- | ||
|
||
## Cloud Spanner Addon | ||
|
||
[Cloud Spanner](https://cloud.google.com/spanner) is a fully managed relational database. The Cloud Spanner addon provides a local emulator to test your local application without incurring the cost of an actual spanner instance. | ||
|
||
### Enable Cloud Spanner on minikube | ||
|
||
To enable this addon, simply run: | ||
```shell script | ||
minikube addons enable cloud-spanner | ||
``` | ||
|
||
### Cloud Spanner Endpoints | ||
Cloud Spanner provides two different ports, HTTP and GRPC. List Cloud Spanner emulator urls by running: | ||
``` shell | ||
minikube service cloud-spanner-emulator | ||
|
||
####################Sample Output######################### | ||
|-----------|------------------------|-------------|---------------------------| | ||
| NAMESPACE | NAME | TARGET PORT | URL | | ||
|-----------|------------------------|-------------|---------------------------| | ||
| default | cloud-spanner-emulator | http/9020 | http://192.168.49.2:30233 | | ||
| | | grpc/9010 | http://192.168.49.2:30556 | | ||
|-----------|------------------------|-------------|---------------------------| | ||
[default cloud-spanner-emulator http/9020 | ||
grpc/9010 http://192.168.49.2:30233 | ||
http://192.168.49.2:30556] | ||
``` | ||
|
||
### Using Cloud Spanner within a cluster | ||
Cloud Spanner emulator can be used via endpoint `cloud-spanner-emulator:9020` for http clients and `cloud-spanner-emulator:9010` for grpc clients respectively. If you're using the standard client library for Cloud Spanner then set `SPANNER_EMULATOR_HOST` to the GRPC endpoint `cloud-spanner-emulator:9010`. | ||
|
||
### Testing installation | ||
|
||
```shell script | ||
kubectl get pods -n cloud-spanner-emulator | ||
``` | ||
|
||
If everything went well, there should be no errors about Cloud Spanner's installation in your minikube cluster. | ||
|
||
### Disable Cloud Spanner | ||
|
||
To disable this addon, simply run: | ||
|
||
```shell script | ||
minikube addons disable cloud-spanner | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters