Skip to content

Commit

Permalink
Merge pull request #27 from gardener/example-template
Browse files Browse the repository at this point in the history
Add generate-example script
  • Loading branch information
georgekuruvillak authored May 22, 2018
2 parents 1c587e1 + c45e7b3 commit 76d29f3
Show file tree
Hide file tree
Showing 13 changed files with 657 additions and 144 deletions.
14 changes: 4 additions & 10 deletions .ci/build
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,16 @@ set -e
# For the build step concourse will set the following environment variables:
# SOURCE_PATH - path to component repository root directory.
# BINARY_PATH - path to an existing (empty) directory to place build results into.
if [[ $(uname) == 'Darwin' ]]; then
READLINK_BIN="greadlink"
else
READLINK_BIN="readlink"
fi

if [[ -z "${SOURCE_PATH}" ]]; then
export SOURCE_PATH="$(${READLINK_BIN} -f $(dirname ${0})/..)"
export SOURCE_PATH="$(readlink -f $(dirname ${0})/..)"
else
export SOURCE_PATH="$(${READLINK_BIN} -f "${SOURCE_PATH}")"
export SOURCE_PATH="$(readlink -f "${SOURCE_PATH}")"
fi

if [[ -z "${BINARY_PATH}" ]]; then
export BINARY_PATH="${SOURCE_PATH}/bin"
else
export BINARY_PATH="$(${READLINK_BIN} -f "${BINARY_PATH}")/bin"
export BINARY_PATH="$(readlink -f "${BINARY_PATH}")/bin"
fi

VCS="github.com"
Expand All @@ -60,7 +54,7 @@ fi

###############################################################################

VERSION_FILE="$(${READLINK_BIN} -f "${SOURCE_PATH}/VERSION")"
VERSION_FILE="$(readlink -f "${SOURCE_PATH}/VERSION")"
VERSION="$(cat "${VERSION_FILE}")"

# If no LOCAL_BUILD environment variable is set, we configure the `go build` command
Expand Down
9 changes: 2 additions & 7 deletions .ci/check
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,11 @@ set -e

# For the check step concourse will set the following environment variables:
# SOURCE_PATH - path to component repository root directory.
if [[ $(uname) == 'Darwin' ]]; then
READLINK_BIN="greadlink"
else
READLINK_BIN="readlink"
fi

if [[ -z "${SOURCE_PATH}" ]]; then
export SOURCE_PATH="$(${READLINK_BIN} -f "$(dirname ${0})/..")"
export SOURCE_PATH="$(readlink -f "$(dirname ${0})/..")"
else
export SOURCE_PATH="$(${READLINK_BIN} -f ${SOURCE_PATH})"
export SOURCE_PATH="$(readlink -f ${SOURCE_PATH})"
fi

VCS="github.com"
Expand Down
10 changes: 2 additions & 8 deletions .ci/test
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,10 @@ set -e

# For the test step concourse will set the following environment variables:
# SOURCE_PATH - path to component repository root directory.
if [[ $(uname) == 'Darwin' ]]; then
READLINK_BIN="greadlink"
else
READLINK_BIN="readlink"
fi

if [[ -z "${SOURCE_PATH}" ]]; then
export SOURCE_PATH="$(${READLINK_BIN} -f "$(dirname ${0})/..")"
export SOURCE_PATH="$(readlink -f "$(dirname ${0})/..")"
else
export SOURCE_PATH="$(${READLINK_BIN} -f "${SOURCE_PATH}")"
export SOURCE_PATH="$(readlink -f "${SOURCE_PATH}")"
fi

VCS="github.com"
Expand Down
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## [Unreleased]
## 0.2.3 - 2018-05-22

### Docker Image: eu.gcr.io/gardener-project/gardener/etcdbrctl:0.2.3

### Fixed

Expand All @@ -11,7 +13,7 @@

- Readiness probe renamed to `/healthz`.

## 0.2.2 - 2018-05-30
## 0.2.2 - 2018-04-30

### Docker Image: eu.gcr.io/gardener-project/gardener/etcdbrctl:0.2.2

Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ docker-push:
@if ! docker images $(IMAGE_REPOSITORY) | awk '{ print $$2 }' | grep -q -F $(IMAGE_TAG); then echo "$(IMAGE_REPOSITORY) version $(IMAGE_TAG) is not yet built. Please run 'make docker-image'"; false; fi
@docker push $(IMAGE_REPOSITORY):$(IMAGE_TAG)

.PHONY: examples
examples:
@hack/generate-examples
.PHONY: clean
clean:
@rm -rf $(BIN_DIR)/
Expand Down
75 changes: 43 additions & 32 deletions example/etcd-statefulset-aws.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
apiVersion: v1
kind: Service
metadata:
name: etcd-client
name: etcd-client-aws
labels:
app: etcd
spec:
Expand All @@ -16,7 +17,7 @@ spec:
apiVersion: v1
kind: ConfigMap
metadata:
name: etcd-bootstrap
name: etcd-bootstrap-aws
labels:
app: etcd
data:
Expand All @@ -35,30 +36,25 @@ data:
"Failed")
continue;;
"Successful")
exec etcd --data-dir=/var/etcd/data \
--name=etcd \
--advertise-client-urls=http://0.0.0.0:2379 \
--listen-client-urls=http://0.0.0.0:2379 \
--initial-cluster-state=new \
--initial-cluster-token=new
exec etcd --data-dir=/var/etcd/data --name=etcd --advertise-client-urls=http://0.0.0.0:2379 --listen-client-urls=http://0.0.0.0:2379 --initial-cluster-state=new --initial-cluster-token=new
;;
esac;
done
---
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: etcd
name: etcd-aws
spec:
selector:
matchLabels:
app: etcd
serviceName: "etcd"
app: etcd-aws
serviceName: "etcd-aws"
replicas: 1
template:
metadata:
labels:
app: etcd
app: etcd-aws
spec:
containers:
- name: etcd
Expand Down Expand Up @@ -89,45 +85,60 @@ spec:
protocol: TCP
volumeMounts:
- mountPath: /var/etcd/data
name: etcd-data
- name: etcd-bootstrap
mountPath: /bootstrap
name: etcd-data-aws
- mountPath: /bootstrap
name: etcd-bootstrap
- name: backup
command:
- etcdbrctl
- server
- --schedule=*/5 * * * *
- --schedule=*/1 * * * *
- --max-backups=5
- --data-dir=/var/etcd/data
- --storage-provider=S3 # change provider details here. (S3/Local)
image: <docker.io/gardener/etcdbr/etcdbrctl:0.2.0> # change image here
- --insecure-transport=true
- --storage-provider=S3
image: eu.gcr.io/gardener-project/gardener/etcdbrctl:0.2.3
imagePullPolicy: Always
ports:
- containerPort: 8080
name: server
protocol: TCP
env:
- name: STORAGE_CONTAINER
value: <Container Name> # change storage container name here
- name: STORAGE_CONTAINER
value: etcd-store # Change the container name here
- name: AWS_REGION
valueFrom:
secretKeyRef:
name: secret-aws
key: region
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: secret-aws
key: secretAccessKey
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: secret-aws
key: accessKeyID
volumeMounts:
- mountPath: /root/.aws/
name: aws-secret
- mountPath: /var/etcd/data
name: etcd-data
- mountPath: /var/etcd/data
name: etcd-data-aws
volumes:
- name: aws-secret
secret:
secretName: <backup provider secret> # change provider credential secret name here
defaultMode: 420
- name: etcd-bootstrap
configMap:
name: etcd-bootstrap
defaultMode: 356
name: etcd-bootstrap-aws
defaultMode: 0356
- name: secret-aws
secret:
secretName: secret-aws # change the secret name here
defaultMode: 0420
volumeClaimTemplates:
- metadata:
name: etcd-data
name: etcd-data-aws
spec:
accessModes: [ "ReadWriteOnce" ]
accessModes:
- "ReadWriteOnce"
resources:
requests:
storage: 1Gi
Loading

0 comments on commit 76d29f3

Please sign in to comment.