-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable Druid to use GCS Emulator for local setup & to run e2e tests (#…
…741) * Enable Druid to use GCS Emulator for local setup & to run e2e tests * Create gcp secret to use emulator for druid local setup * Add documentation for usage of fake-gcs-server for e2e tests * Add documentation to setup etcd-druid locally using fake-gcs-server * Remove cluster.yaml file & instead embed the port-forward values in kind-up.sh
- Loading branch information
1 parent
77eb1d8
commit abcc0ba
Showing
16 changed files
with
336 additions
and
64 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
apiVersion: druid.gardener.cloud/v1alpha1 | ||
kind: Etcd | ||
metadata: | ||
name: etcd-test | ||
labels: | ||
app: etcd-statefulset | ||
gardener.cloud/role: controlplane | ||
role: test | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: etcd-statefulset | ||
gardener.cloud/role: controlplane | ||
role: test | ||
annotations: | ||
app: etcd-statefulset | ||
gardener.cloud/role: controlplane | ||
# networking.gardener.cloud/to-dns: allowed | ||
# networking.gardener.cloud/to-private-networks: allowed | ||
# networking.gardener.cloud/to-public-networks: allowed | ||
role: test | ||
labels: | ||
app: etcd-statefulset | ||
gardener.cloud/role: controlplane | ||
# networking.gardener.cloud/to-dns: allowed | ||
# networking.gardener.cloud/to-private-networks: allowed | ||
# networking.gardener.cloud/to-public-networks: allowed | ||
role: test | ||
etcd: | ||
metrics: basic | ||
defragmentationSchedule: "0 */24 * * *" | ||
resources: | ||
limits: { cpu: 500m, memory: 1Gi } | ||
requests: { cpu: 100m, memory: 200Mi } | ||
clientPort: 2379 | ||
serverPort: 2380 | ||
quota: 8Gi | ||
# heartbeatDuration: 10s | ||
backup: | ||
port: 8080 | ||
fullSnapshotSchedule: "0 */24 * * *" | ||
resources: | ||
limits: { cpu: 200m, memory: 1Gi } | ||
requests: { cpu: 23m, memory: 128Mi } | ||
garbageCollectionPolicy: Exponential | ||
garbageCollectionPeriod: 43200s | ||
deltaSnapshotPeriod: 300s | ||
deltaSnapshotMemoryLimit: 1Gi | ||
store: | ||
container: etcd-bucket | ||
prefix: etcd-test | ||
provider: gcp | ||
secretRef: | ||
name: etcd-backup-gcp | ||
compression: | ||
enabled: false | ||
policy: "gzip" | ||
leaderElection: | ||
reelectionPeriod: 5s | ||
etcdConnectionTimeout: 5s | ||
|
||
sharedConfig: | ||
autoCompactionMode: periodic | ||
autoCompactionRetention: "30m" | ||
# schedulingConstraints: | ||
# affinity: {} | ||
# topologySpreadConstraints: | ||
# - maxSkew: 1 | ||
# topologyKey: topology.kubernetes.io/zone | ||
# whenUnsatisfiable: DoNotSchedule | ||
# labelSelector: | ||
# matchLabels: | ||
# app: etcd-statefulset | ||
|
||
replicas: 3 | ||
# priorityClassName: priority-class-name | ||
# storageClass: default | ||
# storageCapacity: 10Gi |
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,12 @@ | ||
apiVersion: v1 | ||
data: | ||
bucketName: ZXRjZC1idWNrZXQ= | ||
serviceaccount.json: ZHVtbXk= #dummy | ||
storageAPIEndpoint: aHR0cDovL2Zha2UtZ2NzLmRlZmF1bHQ6ODAwMC9zdG9yYWdlL3YxLw== #http://fake-gcs.default:8000/storage/v1/ | ||
emulatorEnabled: dHJ1ZQ== #true | ||
kind: Secret | ||
metadata: | ||
labels: | ||
app: etcd-statefulset | ||
name: etcd-backup-gcp | ||
type: Opaque |
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
47 changes: 47 additions & 0 deletions
47
docs/deployment/getting-started-locally/manage-gcs-emulator.md
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,47 @@ | ||
# Manage GCS Emulator | ||
|
||
This document is a step-by-step guide on how to configure, deploy and cleanup [GCS Emulator](https://github.com/fsouza/fake-gcs-server), within a [kind](https://kind.sigs.k8s.io/) cluster. GCS Emulator emulates Google Cloud Storage locally, which allows the `Etcd` cluster to interact with GCS. This setup is ideal for local development and testing. | ||
|
||
## 00-Prerequisites | ||
|
||
Ensure that you have setup the development environment as per the [documentation](../../development/prepare-dev-environment.md). | ||
|
||
> **Note:** It is assumed that you have already created kind cluster and the `KUBECONFIG` is pointing to this Kubernetes cluster. | ||
### Installing gsutil | ||
|
||
To interact with `GCS Emulator` you must also install the [gsutil](https://cloud.google.com/storage/docs/gsutil) utility. Follow the instructions [here](https://cloud.google.com/storage/docs/gsutil_install) to install `gsutil`. | ||
|
||
## 01-Deploy FakeGCS | ||
|
||
Deploy FakeGCS onto the Kubernetes cluster using the command below: | ||
|
||
```bash | ||
make deploy-fakegcs | ||
``` | ||
|
||
## 02-Setup GCS Bucket | ||
|
||
To create a GCS bucket for `Etcd` backup purposes, execute the following command: | ||
|
||
```bash | ||
gsutil -o "Credentials:gs_json_host=127.0.0.1" -o "Credentials:gs_json_port=4443" -o "Boto:https_validate_certificates=False" mb "gs://etcd-bucket" | ||
``` | ||
|
||
## 03-Configure Secret | ||
|
||
Connection details for a GCS Object Store are put into a Kubernetes [Secret](https://kubernetes.io/docs/concepts/configuration/secret/). Apply the Kubernetes Secret manifest through: | ||
|
||
```bash | ||
kubectl apply -f config/samples/etcd-secret-fakegcs.yaml | ||
``` | ||
|
||
> **Note:** The secret created should be referred to in the `Etcd` CR in `spec.backup.store.secretRef`. | ||
## 04-Cleanup | ||
|
||
To clean the setup, delete the FakeGCS deployment: | ||
|
||
```bash | ||
kubectl delete -f ./hack/e2e-test/infrastructure/fake-gcs-server/fake-gcs-server.yaml | ||
``` |
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
Oops, something went wrong.