diff --git a/incubator/zookeeper/Chart.yaml b/incubator/zookeeper/Chart.yaml index 6eac3331eb..86c690894a 100755 --- a/incubator/zookeeper/Chart.yaml +++ b/incubator/zookeeper/Chart.yaml @@ -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: diff --git a/incubator/zookeeper/templates/NOTES.txt b/incubator/zookeeper/templates/NOTES.txt index 0cfe82ed27..1581e2c3d2 100644 --- a/incubator/zookeeper/templates/NOTES.txt +++ b/incubator/zookeeper/templates/NOTES.txt @@ -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. diff --git a/incubator/zookeeper/templates/_helpers.tpl b/incubator/zookeeper/templates/_helpers.tpl new file mode 100644 index 0000000000..f0d83d2edb --- /dev/null +++ b/incubator/zookeeper/templates/_helpers.tpl @@ -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 -}} diff --git a/incubator/zookeeper/templates/pdb.yaml b/incubator/zookeeper/templates/poddisruptionbudget.yaml similarity index 60% rename from incubator/zookeeper/templates/pdb.yaml rename to incubator/zookeeper/templates/poddisruptionbudget.yaml index bd1af2da4e..8d39ff2457 100644 --- a/incubator/zookeeper/templates/pdb.yaml +++ b/incubator/zookeeper/templates/poddisruptionbudget.yaml @@ -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 -}} diff --git a/incubator/zookeeper/templates/csvc.yaml b/incubator/zookeeper/templates/service-clients.yaml similarity index 58% rename from incubator/zookeeper/templates/csvc.yaml rename to incubator/zookeeper/templates/service-clients.yaml index 692977ba7c..3a12f5578c 100644 --- a/incubator/zookeeper/templates/csvc.yaml +++ b/incubator/zookeeper/templates/service-clients.yaml @@ -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 }} diff --git a/incubator/zookeeper/templates/svc.yaml b/incubator/zookeeper/templates/service-headless.yaml similarity index 65% rename from incubator/zookeeper/templates/svc.yaml rename to incubator/zookeeper/templates/service-headless.yaml index 6d81873903..a1a8a09af5 100644 --- a/incubator/zookeeper/templates/svc.yaml +++ b/incubator/zookeeper/templates/service-headless.yaml @@ -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 }} diff --git a/incubator/zookeeper/templates/ss.yaml b/incubator/zookeeper/templates/statefulset.yaml similarity index 71% rename from incubator/zookeeper/templates/ss.yaml rename to incubator/zookeeper/templates/statefulset.yaml index b2366028a8..a3a09c7162 100644 --- a/incubator/zookeeper/templates/ss.yaml +++ b/incubator/zookeeper/templates/statefulset.yaml @@ -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 diff --git a/incubator/zookeeper/values.yaml b/incubator/zookeeper/values.yaml index cfe32cc609..548499e7c0 100644 --- a/incubator/zookeeper/values.yaml +++ b/incubator/zookeeper/values.yaml @@ -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" \ No newline at end of file +LogLevel : "INFO"