[incubator/zookeeper] Normalize names, labels and selectors (#1317)

* Rename files

* Remove trailing whitespaces

* Rename resources

* [incubator/zookeeper] Bump version to 0.3.1

* [incubator/zookeeper] Fix wrong references

* [incubator/zookeeper] Adjust labels and selectors

* [incubator/zookeeper] Add quotes to labels and selectors

* [incubator/zookeeper] Use consistent formatting

* [incubator/zookeeper] 'quote' works with 'include'

* Fix typo in podAffinityTerm

* [incubator/zookeeper] Lowercase filenames are commonly used

* Remove the helm.sh/created annotation

* [incubator/zookeeper] Updates to PodDisruptionBudget spec are forbidden

* [incubator/zookeeper] Remove default resources
This commit is contained in:
Marc Villacorta
2017-07-18 15:54:39 +02:00
committed by Reinhard Nägele
parent b5b2fc73b1
commit 75a3b8adcb
8 changed files with 74 additions and 54 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
name: zookeeper
home: https://zookeeper.apache.org/
version: 0.3.0
version: 0.3.1
description: Centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services.
icon: https://zookeeper.apache.org/images/zookeeper_small.gif
sources:
+5 -3
View File
@@ -6,11 +6,13 @@ to provide coordination for distributed systems running inside the cluster. As
ZooKeeper uses a TCP based protocol with an internal wire format, you will
probably want to use an existing client library for communication with the
ensemble.
2. The officially maintained clients are written in C and Java, and these can be
obtained with ZooKeeper release from
http://www-us.apache.org/dist/zookeeper/zookeeper-3.4.9/.
A list of language specific bindings and higher level libraries is available
here https://cwiki.apache.org/confluence/display/ZOOKEEPER/ZKClientBindings.
3. Most ZooKeeper clients require a connection string when instantiating an
instance of the client library, or when first connecting the client to the
ensemble. The connection string takes the form
@@ -19,6 +21,6 @@ server, you should provide multiple servers in the connection string to allow
for the client to continue to function in the presence of individual server
failures. It is important that you do not use IP addresses and instead use the
DNS entries for the domain established by the StatefulSet's HeadlessService.
Your connection string should look like zk-{{ .Release.Name | trunc 24 }}-0.{{ printf "zk-hsvc-%s" .Release.Name | trunc 24 }}:{{ .Values.ClientPort }},zk-{{ .Release.Name | trunc 24 }}-1.{{ printf "zk-hsvc-%s" .Release.Name | trunc 24 }}:{{ .Values.ClientPort }},... .
You can also use the client Service zk-csvc:{{ .Values.ClientPort }} to
connect to an available ZooKeeper server.
Your connection string should look like {{ template "fullname" . }}-headless-0:{{ .Values.ClientPort }},{{ template "fullname" . }}-headless-1:{{ .Values.ClientPort }},...
You can also use the client Service {{ template "fullname" . }}:{{ .Values.ClientPort }} to connect to an
available ZooKeeper server.
@@ -0,0 +1,16 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 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 63 | trimSuffix "-" -}}
{{- end -}}
@@ -1,20 +1,21 @@
{{- if .Release.IsInstall -}}
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: "{{ printf "zk-pdb-%s" .Release.Name | trunc 24 }}"
annotations:
helm.sh/created: {{ .Release.Time.Seconds | quote }}
name: {{ template "fullname" . }}
labels:
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
app: {{ include "name" . | quote }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
component: "{{ printf "zk-%s" .Release.Name | trunc 24 }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
spec:
selector:
matchLabels:
component: "{{ printf "zk-%s" .Release.Name | trunc 24 }}"
app: {{ include "name" . | quote }}
release: {{ .Release.Name | quote }}
{{- if .Values.MinAvailable }}
minAvailable: {{ .Values.MinAvailable }}
{{- else }}
minAvailable: {{ sub .Values.Servers 1 }}
{{- end }}
{{- end -}}
@@ -1,15 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: "{{ printf "zk-csvc-%s" .Release.Name | trunc 24 }}"
name: {{ template "fullname" . }}
labels:
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
app: {{ include "name" . | quote }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
component: "{{ printf "zk-%s" .Release.Name | trunc 24 }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
spec:
ports:
- port: {{ .Values.ClientPort }}
name: client
selector:
component: "{{ printf "zk-%s" .Release.Name | trunc 24 }}"
app: {{ include "name" . | quote }}
release: {{ .Release.Name | quote }}
@@ -1,12 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: "{{ printf "zk-hsvc-%s" .Release.Name | trunc 24 }}"
name: {{ template "fullname" . }}-headless
labels:
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
app: {{ include "name" . | quote }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
component: "{{ printf "zk-%s" .Release.Name | trunc 24 }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
spec:
ports:
- port: {{ .Values.ServerPort }}
@@ -15,4 +15,5 @@ spec:
name: leader-election
clusterIP: None
selector:
component: "{{ printf "zk-%s" .Release.Name | trunc 24 }}"
app: {{ include "name" . | quote }}
release: {{ .Release.Name | quote }}
@@ -1,54 +1,48 @@
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: "{{ printf "zk-%s" .Release.Name | trunc 24 }}"
annotations:
helm.sh/created: {{ .Release.Time.Seconds | quote }}
name: {{ template "fullname" . }}
labels:
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
app: {{ include "name" . | quote }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
component: "{{ printf "zk-%s" .Release.Name | trunc 24 }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
spec:
serviceName: "{{ printf "zk-hsvc-%s" .Release.Name | trunc 24 }}"
serviceName: {{ template "fullname" . }}-headless
replicas: {{ .Values.Servers }}
template:
metadata:
labels:
component: "{{ printf "zk-%s" .Release.Name | trunc 24 }}"
app: {{ include "name" . | quote }}
release: {{ .Release.Name | quote }}
spec:
{{- if eq .Values.AntiAffinity "hard" }}
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "component"
operator: In
values:
- "{{ printf "zk-%s" .Release.Name | trunc 24 }}"
topologyKey: "kubernetes.io/hostname"
- topologyKey: "kubernetes.io/hostname"
labelSelector:
matchLabels:
app: {{ include "name" . | quote }}
release: {{ .Release.Name | quote }}
{{- else if eq .Values.AntiAffinity "soft" }}
affinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
podAntiAffinityTerm:
labelSelector:
matchExpressions:
- key: "component"
operator: In
values:
- "{{ printf "zk-%s" .Release.Name | trunc 24 }}"
topologyKey: "kubernetes.io/hostname"
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
podAffinityTerm:
topologyKey: "kubernetes.io/hostname"
labelSelector:
matchLabels:
app: {{ include "name" . | quote }}
release: {{ .Release.Name | quote }}
{{- end }}
containers:
- name: k8szk
imagePullPolicy: {{ .Values.ImagePullPolicy }}
image: gcr.io/google_samples/k8szk:v2
resources:
requests:
memory: {{ .Values.Memory }}
cpu: {{ .Values.Cpu }}
{{ toYaml .Values.Resources | indent 10 }}
ports:
- containerPort: {{ .Values.ClientPort }}
name: client
+10 -5
View File
@@ -3,10 +3,15 @@
# Declare name/value pairs to be passed into your templates.
# name: value
Servers: 3
Cpu: "1"
Memory: "4Gi"
Heap: "2G"
Storage: "50Gi"
Resources: {}
# requests:
# cpu: 250m
# memory: 1Gi
# limits:
# cpu: 500m
# memory: 2Gi
Heap: "1G"
Storage: "2Gi"
#StorageClass : default
ServerPort: 2888
LeaderElectionPort: 3888
@@ -21,4 +26,4 @@ PurgeHours: 1
ProbeInitialDelaySeconds : 15
ProbeTimeoutSeconds : 5
AntiAffinity : "hard"
LogLevel : "INFO"
LogLevel : "INFO"