Skip to content

Commit

Permalink
CoreOS etcd-operator (helm#214)
Browse files Browse the repository at this point in the history
* initial commit

* update NOTES.txt, enable cluster by default

* update default etcd version
add README
rename default values
update NOTES.txt

* add quotes to app label value

* disable cluster by default as TPR get's created by operator

* update PV provisioner comments
  • Loading branch information
lachie83 authored Dec 5, 2016
1 parent 9059e24 commit f26a5a8
Show file tree
Hide file tree
Showing 8 changed files with 234 additions and 0 deletions.
21 changes: 21 additions & 0 deletions stable/etcd-operator/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
10 changes: 10 additions & 0 deletions stable/etcd-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
description: CoreOS etcd-operator Helm chart for Kubernetes
name: etcd-operator
version: 0.1.0
sources:
- https://github.com/coreos/etcd-operator
maintainers:
- name: Lachlan Evenson
email: [email protected]
icon: https://github.com/coreos/etcd/blob/master/logos/etcd-horizontal-color.png
81 changes: 81 additions & 0 deletions stable/etcd-operator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# CoreOS etcd-operator

[etcd-operator](https://coreos.com/blog/introducing-the-etcd-operator.html) Simplify etcd cluster
configuration and management.

__DISCLAIMER:__ While this chart has been well-tested, the etcd-operator is still currently in alpha.
Current project status is available [here](https://github.com/coreos/etcd-operator)

## Introduction

This chart bootstraps an etcd-operator and allows the deployment of etcd-cluster(s).

## Official Documentation

Official project documentation found [here](https://github.com/coreos/etcd-operator)

## Prerequisites

- Kubernetes 1.4+ with Beta APIs enabled
- __Suggested:__ PV provisioner support in the underlying infrastructure to support backups

## Installing the Chart

To install the chart with the release name `my-release`:

```bash
$ helm install stable/etcd-operator --name my-release
```

## Uninstalling the Chart

To uninstall/delete the `my-release` deployment:

```bash
$ helm delete my-release
```

The command removes all the Kubernetes components EXCEPT the persistent volume.

## Updating
Updating the TPR resource will not result in the cluster being update until `kubectl apply` for
TPRs is fixed see [kubernetes/issues/29542](https://github.com/kubernetes/kubernetes/issues/29542)
Work around options are documented [here](https://github.com/coreos/etcd-operator#resize-an-etcd-cluster)

## Configuration

The following tables lists the configurable parameters of the etcd-operator chart and their default values.

| Parameter | Description | Default |
| ------------------------------------------------- | -------------------------------------------------------------------- | ---------------------------------------------- |
| `replicaCount` | Number of etcd-operator replicas to create (only 1 is supported) | `1` |
| `image.repository` | etcd-operator container image | `quay.io/coreos/etcd-operator` |
| `image.tag` | etcd-operator container image tag | `latest` |
| `image.pullPolicy` | etcd-operator container image pull policy | `IfNotPresent` |
| `resources.limits.cpu` | CPU limit per etcd-operator pod | `100m` |
| `resources.limits.memory` | Memory limit per etcd-operator pod | `128Mi` |
| `resources.requests.cpu` | CPU request per etcd-operator pod | `100m` |
| `resources.requests.memory` | Memory request per etcd-operator pod | `128Mi` |
| `cluster.enabled` | Whether to enable provisioning of and etcd-cluster | `true` |
| `cluster.name` | etcd cluster name | `etcd-cluster` |
| `cluster.version` | etcd cluster version | `v3.1.0-rc.0` |
| `cluster.size` | etcd cluster size | `3` |
| `cluster.backup.enabled` | Whether to create PV for cluster backups | `true` |
| `cluster.backup.provisioner` | Which PV provisioner to use | `kubernetes.io/gce-pd` (kubernetes.io/aws-ebs) |
| `cluster.backup.config.snapshotIntervalInSecond` | etcd snapshot interval in seconds | `30` |
| `cluster.backup.config.maxSnapshot` | maximum number of snapshots to keep | `5` |
| `cluster.backup.config.volumeSizeInMB` | size of backup PV | `512MB` |
| `cluster.backup.config.storageType` | Type to storage to provision | `PersistentVolume` |

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example:

```bash
$ helm install --name my-release --set cluster.version=v3.1.0-alpha.1 stable/etcd-operator
```

Alternatively, a YAML file that specifies the values for the parameters can be provided while
installing the chart. For example:

```bash
$ helm install --name my-release --values values.yaml stable/etcd-operator
```
22 changes: 22 additions & 0 deletions stable/etcd-operator/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{- if .Values.cluster.enabled -}}
1. Watch etcd cluster start
kubectl get pods -l etcd_cluster={{ .Values.cluster.name }} --namespace {{ .Release.Namespace }} -w
2. Confirm etcd cluster is healthy
$ kubectl run --rm -i --tty etcd-test --image quay.io/coreos/etcd --restart=Never -- /bin/sh
/ # ETCDCTL_API=3 etcdctl --endpoints http://{{ .Values.cluster.name }}-0000:2379 put foo bar
/ # ETCDCTL_API=3 etcdctl --endpoints http://{{ .Values.cluster.name }}-0000:2379 member list
OK
(ctrl-D to exit)
3. Optional
Check the etcd-operator logs
export POD=$(kubectl get pods -l app={{ template "fullname" . }} --namespace {{ .Release.Namespace }} --output name)
kubectl logs $POD --namespace={{ .Release.Namespace }}

{{- else -}}
1. etcd-operator deployed.
If you would like to deploy an etcd-cluster set cluster.enabled to true in values.yaml
Check the etcd-operator logs
export POD=$(kubectl get pods -l app={{ template "fullname" . }} --namespace {{ .Release.Namespace }} --output name)
kubectl logs $POD --namespace={{ .Release.Namespace }}

{{- end -}}
16 changes: 16 additions & 0 deletions stable/etcd-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 24 -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 24 -}}
{{- end -}}
34 changes: 34 additions & 0 deletions stable/etcd-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "fullname" . }}
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
app: "{{ template "fullname" . }}"
heritage: "{{ .Release.Service }}"
release: "{{ .Release.Name }}"
spec:
replicas: {{ .Values.replicaCount }}
template:
metadata:
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
app: {{ template "fullname" . }}
heritage: "{{ .Release.Service }}"
release: "{{ .Release.Name }}"
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- "/bin/sh"
- "-c"
- "/usr/local/bin/etcd-operator --pv-provisioner={{ .Values.cluster.backup.provisioner }}"
env:
- name: MY_POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
resources:
{{ toYaml .Values.resources | indent 12 }}
18 changes: 18 additions & 0 deletions stable/etcd-operator/templates/etcd-cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if .Values.cluster.enabled -}}
apiVersion: "coreos.com/v1"
kind: "EtcdCluster"
metadata:
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
app: "{{ template "fullname" . }}"
heritage: "{{ .Release.Service }}"
release: "{{ .Release.Name }}"
name: "{{ .Values.cluster.name }}"
spec:
size: {{ .Values.cluster.size }}
version: "{{ .Values.cluster.version }}"
{{- if .Values.cluster.backup.enabled }}
backup:
{{ toYaml .Values.cluster.backup.config | indent 4 }}
{{- end -}}
{{- end -}}
32 changes: 32 additions & 0 deletions stable/etcd-operator/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Default values for etcd-operator.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: quay.io/coreos/etcd-operator
tag: latest
pullPolicy: IfNotPresent
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 100m
memory: 128Mi
## etcd-cluster specific values
cluster:
enabled: false
name: etcd-cluster
size: 3
version: v3.1.0-rc.0
backup:
enabled: false
## Cloud specific PV provisioner
## Supports either kubernetes.io/gce-pd or kubernetes.io/aws-ebs
provisioner: kubernetes.io/gce-pd
config:
## short snapshot interval for testing, do not use this in production!
snapshotIntervalInSecond: 30
maxSnapshot: 5
volumeSizeInMB: 512
storageType: PersistentVolume

0 comments on commit f26a5a8

Please sign in to comment.