Skip to content

Commit

Permalink
Add etcd-operator helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
neoaggelos committed Mar 11, 2022
1 parent 568fe11 commit 6077e0a
Show file tree
Hide file tree
Showing 8 changed files with 184 additions and 0 deletions.
8 changes: 8 additions & 0 deletions chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v2
name: etcd-operator
description: A Helm chart to deploy etcd-operator

type: application
version: 0.0.1

appVersion: "0.10.0-5"
44 changes: 44 additions & 0 deletions chart/crds/etcd-cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: etcdclusters.etcd.database.coreos.com
spec:
scope: Namespaced
group: etcd.database.coreos.com
names:
kind: EtcdCluster
listKind: EtcdClusterList
plural: etcdclusters
shortNames:
- etcd
singular: etcdcluster
conversion:
strategy: None
versions:
- additionalPrinterColumns:
- jsonPath: .status.size
name: size
type: number
- jsonPath: .spec.version
name: version
type: string
- jsonPath: .status.serviceName
name: service
type: string
- jsonPath: .status.phase
name: phase
type: string
- jsonPath: .status.conditions[-1].type
name: status
type: string
- jsonPath: .metadata.creationTimestamp
name: age
type: date
name: v1beta3
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
served: true
storage: true
Binary file added chart/etcd-operator-0.0.1.tgz
Binary file not shown.
9 changes: 9 additions & 0 deletions chart/templates/etcd-clusters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{- range .Values.clusters }}
---
apiVersion: etcd.database.coreos.com/v1beta3
kind: EtcdCluster
metadata:
name: {{ .name | quote }}
namespace: {{ $.Release.Namespace }}
spec: {{ .spec | toYaml | nindent 2 }}
{{- end }}
37 changes: 37 additions & 0 deletions chart/templates/etcd-operator-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{{- if .Values.operator.enabled -}}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: etcd-operator-{{ .Release.Name }}
namespace: {{ .Release.Namespace }}
labels:
app: etcd-operator-{{ .Release.Name }}
spec:
replicas: 1
selector:
matchLabels:
app: etcd-operator-{{ .Release.Name }}
template:
metadata:
labels:
app: etcd-operator-{{ .Release.Name }}
spec:
serviceAccountName: etcd-operator-{{ .Release.Name }}-sa
containers:
- name: operator
# TODO(neoaggelos): https://github.com/neoaggelos/etcd-operator/pull/1
# Update to a stable build once PR is merged upstream
image: neoaggelos/etcd-operator:0.10.0-5
command:
- /operator
env:
- name: MY_POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: MY_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
{{ end }}
58 changes: 58 additions & 0 deletions chart/templates/etcd-operator-rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{{- if and .Values.rbac.enabled -}}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: etcd-operator-{{ .Release.Name }}-cluster-role
rules:
- apiGroups:
- etcd.database.coreos.com
resources:
- etcdclusters
- etcdbackups
- etcdrestores
verbs:
- "*"
- apiGroups:
- ""
resources:
- pods
- services
- endpoints
- persistentvolumeclaims
- events
verbs:
- "*"
- apiGroups:
- apps
resources:
- deployments
verbs:
- "*"
# The following permissions can be removed if not using S3 backup and TLS
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
- apiGroups:
- ""
resources:
- nodes
verbs:
- list
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: etcd-operator-{{ .Release.Name }}-cluster-role-binding
subjects:
- kind: ServiceAccount
name: etcd-operator-{{ .Release.Name }}-sa
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
apiGroup: rbac.authorization.k8s.io
name: etcd-operator-{{ .Release.Name }}-cluster-role
{{ end }}
6 changes: 6 additions & 0 deletions chart/templates/etcd-operator-sa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
namespace: {{ .Release.Namespace }}
name: etcd-operator-{{ .Release.Name }}-sa
22 changes: 22 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
operator:
enabled: true
rbac:
enabled: true

clusters:
- name: etcd
spec:
size: 3
limitSizeToMaxReadyNodes: true
version: "3.5.2"
pod:
restartPolicy: Always
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: etcd_cluster
operator: In
values: [etcd]
topologyKey: kubernetes.io/hostname

0 comments on commit 6077e0a

Please sign in to comment.