Skip to content

Commit

Permalink
add hive-metastore chart
Browse files Browse the repository at this point in the history
  • Loading branch information
slamdev committed Nov 28, 2021
1 parent 6270cae commit ebc0ef8
Show file tree
Hide file tree
Showing 10 changed files with 462 additions and 0 deletions.
12 changes: 12 additions & 0 deletions charts/hive-metastore/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v2
name: hive-metastore
description: |-
Helm chart to deploy [hive-metastore](https://hive.apache.org/).
type: application
version: 0.0.1
appVersion: 2.3.9-2.10.1
home: https://github.com/slamdev/helm-charts/tree/master/charts/hive-metastore
icon: https://hive.apache.org/images/hive_logo_medium.jpg
maintainers:
- name: slamdev
email: [email protected]
46 changes: 46 additions & 0 deletions charts/hive-metastore/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# hive-metastore

![Version: 0.0.1](https://img.shields.io/badge/Version-0.0.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.3.9-2.10.1](https://img.shields.io/badge/AppVersion-2.3.9--2.10.1-informational?style=flat-square)

Helm chart to deploy [hive-metastore](https://hive.apache.org/).

**Homepage:** <https://github.com/slamdev/helm-charts/tree/master/charts/hive-metastore>

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| slamdev | [email protected] | |

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | affinity for scheduler pod assignment |
| env | list | `[]` | additional environment variables for the deployment |
| fullnameOverride | string | `""` | full name of the chart. |
| hiveSiteXml | string | `"<configuration>\n\n</configuration>\n"` | |
| image.pullPolicy | string | `"IfNotPresent"` | image pull policy |
| image.repository | string | `"slamdev/apache-hive"` | image repository |
| image.tag | string | `""` | image tag (chart's appVersion value will be used if not set) |
| imagePullSecrets | list | `[]` | image pull secret for private images |
| ingress.annotations | object | `{}` | ingress annotations |
| ingress.enabled | bool | `false` | enables Ingress for hive-metastore |
| ingress.hosts | list | `[]` | ingress accepted hostnames |
| ingress.tls | list | `[]` | ingress TLS configuration |
| nameOverride | string | `""` | override name of the chart |
| nodeSelector | object | `{}` | node for scheduler pod assignment |
| podSecurityContext | object | `{}` | specifies security settings for a pod |
| replicaCount | int | `1` | number of replicas for flux-notifier deployment. |
| resources | object | `{}` | custom resource configuration |
| schematool.dbType | string | `"postgres"` | schematool database type |
| schematool.enabled | bool | `false` | run schematool as int container |
| securityContext | object | `{}` | specifies security settings for a container |
| service.port | int | `9083` | service port |
| service.type | string | `"ClusterIP"` | service type |
| serviceAccount.annotations | object | `{}` | annotations to add to the service account |
| serviceAccount.create | bool | `false` | specifies whether a service account should be created |
| serviceAccount.name | string | `nil` | the name of the service account to use; if not set and create is true, a name is generated using the fullname template |
| tolerations | list | `[]` | tolerations for scheduler pod assignment |
| volumeMounts | list | `[]` | additional volume mounts |
| volumes | list | `[]` | additional volumes |
21 changes: 21 additions & 0 deletions charts/hive-metastore/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "hive-metastore.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "hive-metastore.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "hive-metastore.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "hive-metastore.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80
{{- end }}
70 changes: 70 additions & 0 deletions charts/hive-metastore/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "hive-metastore.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).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "hive-metastore.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "hive-metastore.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "hive-metastore.labels" -}}
helm.sh/chart: {{ include "hive-metastore.chart" . }}
{{ include "hive-metastore.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

{{/*
Selector labels
*/}}
{{- define "hive-metastore.selectorLabels" -}}
app.kubernetes.io/name: {{ include "hive-metastore.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "hive-metastore.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "hive-metastore.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
Create the tag for the docker image to use
*/}}
{{- define "hive-metastore.tag" -}}
{{- .Values.image.tag | default .Chart.AppVersion -}}
{{- end -}}
10 changes: 10 additions & 0 deletions charts/hive-metastore/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "hive-metastore.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "hive-metastore.labels" . | nindent 4 }}
data:
hive-site.xml: |
{{ .Values.hiveSiteXml | nindent 4 }}
116 changes: 116 additions & 0 deletions charts/hive-metastore/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "hive-metastore.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "hive-metastore.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "hive-metastore.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "hive-metastore.selectorLabels" . | nindent 8 }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "hive-metastore.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
- name: expand-configs
image: tempire/alpine-perl:3.14.0
command:
- sh
args:
- -c
- cp /tmp/hive-site.xml /opt/hive-configs/ && perl -pi -e 's/\${env:([_A-Z0-9]+)}/$ENV{$1}/g' /opt/hive-configs/hive-site.xml
{{- with .Values.env }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- name: hive-config-map
mountPath: /tmp/hive-site.xml
subPath: hive-site.xml
- name: hive-configs
mountPath: /opt/hive-configs
{{- if .Values.schematool.enabled -}}
- name: schematool
image: "{{ .Values.image.repository }}:{{ include "hive-metastore.tag" . }}"
command:
- sh
args:
- -c
- schematool -dbType {{ .Values.schematool.dbType }} -initSchema || true
env:
- name: HIVE_CONF_DIR
value: /opt/hive-configs
volumeMounts:
- name: hive-configs
mountPath: /opt/hive-configs
{{- end -}}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ include "hive-metastore.tag" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- --service
- metastore
ports:
- name: thrift
containerPort: 9083
protocol: TCP
livenessProbe:
tcpSocket:
port: thrift
readinessProbe:
tcpSocket:
port: thrift
startupProbe:
tcpSocket:
port: thrift
resources:
{{- toYaml .Values.resources | nindent 12 }}
env:
- name: HIVE_CONF_DIR
value: /opt/hive-configs
{{- with .Values.env }}
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- name: hive-configs
mountPath: /opt/hive-configs
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
- name: hive-configs
emptyDir: {}
- name: hive-config-map
configMap:
name: {{ include "hive-metastore.fullname" . }}
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
53 changes: 53 additions & 0 deletions charts/hive-metastore/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "hive-metastore.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: extensions/v1beta1
{{- else if semverCompare "<1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: networking.k8s.io/v1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "hive-metastore.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ . }}
{{- if semverCompare "<1.19-0" $.Capabilities.KubeVersion.GitVersion }}
backend:
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- else }}
pathType: Prefix
backend:
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
16 changes: 16 additions & 0 deletions charts/hive-metastore/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "hive-metastore.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "hive-metastore.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: thrift
protocol: TCP
name: thrift
selector:
{{- include "hive-metastore.selectorLabels" . | nindent 4 }}
13 changes: 13 additions & 0 deletions charts/hive-metastore/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "hive-metastore.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "hive-metastore.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end -}}
Loading

0 comments on commit ebc0ef8

Please sign in to comment.