Skip to content

Commit b867039

Browse files
committed
hbase chart
1 parent 896060e commit b867039

16 files changed

+672
-0
lines changed

charts/hbase/.helmignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj

charts/hbase/Chart.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v1
2+
appVersion: 2.0.1
3+
description: HBase is an open-source non-relational distributed database modeled after
4+
Google's Bigtable and written in Java.
5+
home: https://hbase.apache.org/
6+
icon: http://hbase.apache.org/images/hbase_logo_with_orca.png
7+
maintainers:
8+
9+
name: cgiraldo
10+
name: hbase
11+
version: 0.1.0

charts/hbase/README.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
hbase
2+
=====
3+
HBase is an open-source non-relational distributed database modeled after Google's Bigtable and written in Java.
4+
5+
Current chart version is `0.1.0`
6+
7+
Source code can be found [here](https://hbase.apache.org/)
8+
9+
## Chart Requirements
10+
11+
| Repository | Name | Version |
12+
|------------|------|---------|
13+
| https://gradiant.github.io/charts | hdfs | ~0.1.0 |
14+
| https://kubernetes-charts-incubator.storage.googleapis.com/ | zookeeper | ~2.1.0 |
15+
16+
## Installing the Chart
17+
18+
Add gradiant helm repo:
19+
20+
```
21+
helm repo add gradiant https://gradiant.github.io/charts
22+
```
23+
24+
To install the chart with the release name `hbase`:
25+
26+
```
27+
$ helm install --name hbase gradiant/hbase
28+
```
29+
30+
The chart will also install required zookeeper and hdfs by default.
31+
To only install hbase and provide external zookeeper and/or hdfs:
32+
33+
```
34+
$ helm install --name hbase
35+
--set hdfs.enabled=false \
36+
--set conf.hbaseSite."hbase.rootdir"="hdfs://my-hdfs:8020/hbase" \
37+
--set zookeeper.enabled=false \
38+
--set conf.hbaseSite."hbase.zookeeper.quorum"="my-zookeeper:2181" \
39+
gradiant/hbase
40+
```
41+
42+
```
43+
and setup an external hdfs and zookeper by setting hdfs.enabled=false and h
44+
45+
## Chart Values
46+
47+
| Key | Type | Default | Description |
48+
|-----|------|---------|-------------|
49+
| antiAffinity | string | `"soft"` | |
50+
| conf.hbaseSite."hbase.rootdir" | string | `"{{.Release.Name}}-hdfs-namenode:8020/hbase"` | |
51+
| conf.hbaseSite."hbase.zookeeper.quorum" | string | `"{{.Release.Name}}-zookeeper:2181"` | |
52+
| hbase.master.resources.limits.cpu | string | `"1000m"` | |
53+
| hbase.master.resources.limits.memory | string | `"2048Mi"` | |
54+
| hbase.master.resources.requests.cpu | string | `"10m"` | |
55+
| hbase.master.resources.requests.memory | string | `"256Mi"` | |
56+
| hbase.regionServer.replicas | int | `1` | |
57+
| hbase.regionServer.resources.limits.cpu | string | `"1000m"` | |
58+
| hbase.regionServer.resources.limits.memory | string | `"2048Mi"` | |
59+
| hbase.regionServer.resources.requests.cpu | string | `"10m"` | |
60+
| hbase.regionServer.resources.requests.memory | string | `"256Mi"` | |
61+
| hbaseVersion | string | `"2.0.1"` | |
62+
| hdfs.enabled | bool | `true` | |
63+
| image.pullPolicy | string | `"IfNotPresent"` | |
64+
| image.repository | string | `"gradiant/hbase-base"` | |
65+
| image.tag | string | `"2.0.1"` | |
66+
| prometheus.config.lowercaseOutputLabelNames | bool | `true` | |
67+
| prometheus.config.lowercaseOutputName | bool | `true` | |
68+
| prometheus.config.rules[0].labels.namespace | string | `"$1"` | |
69+
| prometheus.config.rules[0].labels.region | string | `"$3"` | |
70+
| prometheus.config.rules[0].labels.table | string | `"$2"` | |
71+
| prometheus.config.rules[0].name | string | `"HBase_metric_$4"` | |
72+
| prometheus.config.rules[0].pattern | string | `"Hadoop\u003cservice=HBase, name=RegionServer, sub=Regions\u003e\u003c\u003eNamespace_([^\\W_]+)_table_([^\\W_]+)_region_([^\\W_]+)_metric_(\\w+)"` | |
73+
| prometheus.config.rules[1].labels.name | string | `"$2"` | |
74+
| prometheus.config.rules[1].labels.sub | string | `"$3"` | |
75+
| prometheus.config.rules[1].name | string | `"hadoop_$1_$4"` | |
76+
| prometheus.config.rules[1].pattern | string | `"Hadoop\u003cservice=(\\w+), name=(\\w+), sub=(\\w+)\u003e\u003c\u003e([\\w._]+)"` | |
77+
| prometheus.config.rules[2].pattern | string | `".+"` | |
78+
| prometheus.enabled | bool | `true` | |
79+
| prometheus.image | string | `"spdigital/prometheus-jmx-exporter-kubernetes"` | |
80+
| prometheus.imageTag | string | `"0.3.1"` | |
81+
| prometheus.port | int | `5556` | |
82+
| prometheus.resources | object | `{}` | |
83+
| prometheus.thriftPort | int | `5557` | |
84+
| zookeeper.enabled | bool | `true` | |
85+
| zookeeper.replicaCount | int | `1` | |

charts/hbase/requirements.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
dependencies:
2+
- name: hdfs
3+
version: ~0.1.0
4+
repository: https://gradiant.github.io/charts
5+
condition: hdfs.enabled
6+
- name: zookeeper
7+
version: ~2.1.0
8+
repository: https://kubernetes-charts-incubator.storage.googleapis.com/
9+
condition: zookeeper.enabled

charts/hbase/templates/NOTES.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
1. You can get an HBASE Shell by running this command:
2+
kubectl exec -n {{ .Release.Namespace }} -it {{ include "hbase.fullname" . }}-master-0 -- hbase shell
3+
4+
2. Inspect hbase master service ports with:
5+
kubectl exec -n {{ .Release.Namespace }} describe service {{ include "hbase.fullname" . }}-master
6+
7+
3. Create a port-forward to the hbase manager UI:
8+
kubectl port-forward -n {{ .Release.Namespace }} svc/{{ include "hbase.fullname" . }}-master 16010:16010
9+
10+
Then open the ui in your browser:
11+
12+
open http://localhost:16010
13+
14+
4. Create a port-forward to the hbase thrift manager UI:
15+
kubectl port-forward -n {{ .Release.Namespace }} svc/{{ include "hbase.fullname" . }}-master 9095:9095
16+
17+
Then open the ui in your browser:
18+
19+
open http://localhost:9095
20+
21+

charts/hbase/templates/_helpers.tpl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "hbase.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 47 chars because some Kubernetes name fields are limited to 63 (by the DNS naming spec),
12+
as we append -master or -region to the names
13+
If release name contains chart name it will be used as a full name.
14+
*/}}
15+
{{- define "hbase.fullname" -}}
16+
{{- if .Values.fullnameOverride -}}
17+
{{- .Values.fullnameOverride | trunc 47 | trimSuffix "-" -}}
18+
{{- else -}}
19+
{{- $name := default .Chart.Name .Values.nameOverride -}}
20+
{{- printf "%s-%s" .Release.Name $name | trunc 47 | trimSuffix "-" -}}
21+
{{- end -}}
22+
{{- end -}}
23+
24+
{{/*
25+
Standard Labels from Helm documentation https://helm.sh/docs/chart_best_practices/#labels-and-annotations
26+
*/}}
27+
28+
{{- define "hbase.labels" -}}
29+
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
30+
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
31+
app.kubernetes.io/instance: {{ .Release.Name | quote }}
32+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
33+
app.kubernetes.io/part-of: {{ .Chart.Name }}
34+
{{- end -}}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{{- if .Values.prometheus.enabled }}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: {{ include "hbase.fullname" . }}-exporter
6+
labels:
7+
app.kubernetes.io/name: {{ include "hbase.name" . }}
8+
app.kubernetes.io/component: master
9+
{{- include "hbase.labels" . | nindent 4 }}
10+
data:
11+
jmx-hbase-prometheus.yml: |+
12+
{{ toYaml .Values.prometheus.config | indent 4 }}
13+
{{- end }}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ include "hbase.fullname" . }}
5+
labels:
6+
app.kubernetes.io/name: {{ include "hbase.name" . }}
7+
{{- include "hbase.labels" . | nindent 4 }}
8+
data:
9+
bootstrap.sh: |
10+
#!/bin/bash
11+
12+
: ${HBASE_PREFIX:=/usr/local/hbase}
13+
14+
. $HBASE_PREFIX/conf/hbase-env.sh
15+
16+
# Directory to find config artifacts
17+
CONFIG_DIR="/tmp/hbase-config"
18+
19+
# Copy config files from volume mount
20+
21+
for f in hbase-site.xml hbase-env.sh; do
22+
if [[ -e ${CONFIG_DIR}/$f ]]; then
23+
cp ${CONFIG_DIR}/$f $HBASE_PREFIX/conf/$f
24+
else
25+
echo "ERROR: Could not find $f in $CONFIG_DIR"
26+
exit 1
27+
fi
28+
done
29+
{{- if .Values.prometheus.enabled }}
30+
_HBASE_OPTS="$HBASE_OPTS"
31+
# SET HBASE_OPTS with prometheus javaagent jmx exporter port
32+
export HBASE_OPTS="$_HBASE_OPTS -javaagent:/jmx-exporter/jmx_prometheus_javaagent.jar={{ .Values.prometheus.port }}:/etc/exporter/jmx-hbase-prometheus.yml"
33+
{{- end }}
34+
if [[ $2 == "master" ]]; then
35+
$HBASE_PREFIX/bin/hbase-daemon.sh start master
36+
{{- if .Values.prometheus.enabled }}
37+
# RESET HBASE_OPTS with thrift jmx exporter port
38+
export HBASE_OPTS="$_HBASE_OPTS -javaagent:/jmx-exporter/jmx_prometheus_javaagent.jar={{ .Values.prometheus.thriftPort }}:/etc/exporter/jmx-hbase-prometheus.yml"
39+
{{- end }}
40+
$HBASE_PREFIX/bin/hbase-daemon.sh start thrift
41+
fi
42+
if [[ $2 == "regionserver" ]]; then
43+
# wait up to 30 seconds for masternode
44+
(while [[ $count -lt 15 && -z `curl -sf http://{{ include "hbase.fullname" . }}-master:16010` ]]; do ((count=count+1)) ; echo "Waiting for {{ include "hbase.fullname" . }}-master" ; sleep 2; done && [[ $count -lt 15 ]])
45+
[[ $? -ne 0 ]] && echo "Timeout waiting for hbase-master, exiting." && exit 1
46+
$HBASE_PREFIX/bin/hbase-daemon.sh start regionserver
47+
fi
48+
if [[ $1 == "-d" ]]; then
49+
until find ${HBASE_PREFIX}/logs -mmin -1 | egrep -q '.*'; echo "`date`: Waiting for logs..." ; do sleep 2 ; done
50+
tail -F ${HBASE_PREFIX}/logs/* &
51+
while true; do sleep 1000; done
52+
fi
53+
54+
if [[ $1 == "-bash" ]]; then
55+
/bin/bash
56+
fi
57+
hbase-env.sh: |
58+
# Extra Java runtime options.
59+
# Below are what we set by default. May only work with SUN JVM.
60+
# For more on why as well as other possible settings,
61+
# see http://hbase.apache.org/book.html#performance
62+
export HBASE_OPTS="$HBASE_OPTS -XX:+UseConcMarkSweepGC"
63+
hbase-site.xml: |
64+
<?xml version="1.0"?>
65+
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
66+
<configuration>
67+
<property>
68+
<name>hbase.cluster.distributed</name>
69+
<value>true</value>
70+
</property>
71+
<property>
72+
<name>hbase.master</name>
73+
<value>>{{ include "hbase.fullname" . }}-master:16000</value>
74+
</property>
75+
{{- if not (index .Values.conf "hbaseSite" "hbase.zookeeper.quorum") }}
76+
<property>
77+
<name>hbase.zookeeper.quorum</name>
78+
<value>{{- printf "%s-zookeeper:2181" .Release.Name }}</value>
79+
</property>
80+
{{- end }}
81+
{{- if not (index .Values.conf "hbaseSite" "hbase.rootdir") }}
82+
<property>
83+
<name>hbase.rootdir</name>
84+
<value>{{- printf "hdfs://%s-hdfs-namenode:8020/hbase" .Release.Name }}</value>
85+
</property>
86+
{{- end }}
87+
{{- if index .Values.conf "hbaseSite" }}
88+
{{- range $key, $value := index .Values.conf "hbaseSite" }}
89+
<property><name>{{ $key }}</name><value>{{ $value }}</value></property>
90+
{{- end }}
91+
{{- end }}
92+
</configuration>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{{- if .Values.prometheus.enabled -}}
2+
kind: Service
3+
apiVersion: v1
4+
metadata:
5+
name: {{ include "hbase.fullname" . }}-master-metrics
6+
labels:
7+
app.kubernetes.io/name: {{ include "hbase.name" . }}
8+
app.kubernetes.io/component: master
9+
{{- include "hbase.labels" . | nindent 4 }}
10+
spec:
11+
selector:
12+
app.kubernetes.io/name: {{ include "hbase.name" . }}
13+
app.kubernetes.io/component: master
14+
app.kubernetes.io/instance: {{ .Release.Name }}
15+
ports:
16+
- port: {{ .Values.prometheus.port }}
17+
name: metrics
18+
targetPort: {{ .Values.prometheus.port }}
19+
{{- end -}}

0 commit comments

Comments
 (0)