Skip to content

Commit

Permalink
Add helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
bitsondatadev committed Feb 8, 2023
1 parent e7393b6 commit 71ec256
Show file tree
Hide file tree
Showing 8 changed files with 261 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: 3.0.0
home: https://github.com/bitsondatadev/hive-metastore/chart/
icon: https://hive.apache.org/images/hive_logo_medium.jpg
maintainers:
- name: bitsondatadev
email: brianolsen87@gmail.com
49 changes: 49 additions & 0 deletions charts/hive-metastore/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# 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: 3.0.0](https://img.shields.io/badge/AppVersion-3.0.0-informational?style=flat-square)

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

**Homepage:** <https://github.com/bitsondatadev/hive-metastore/chart>

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| bitsondatadev | brianolsen87@gmail.com | |

## 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 |
| importJars.coords | list | `[]` | maven coords |
| importJars.enabled | bool | `false` | import jars as init container |
| 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 |
| initContainers | list | `[]` | additional init containers; env vars and volume mounts are the same as for the main container |
| 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 init 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 |
53 changes: 53 additions & 0 deletions charts/hive-metastore/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{{/* 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 -}}

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 }}
68 changes: 68 additions & 0 deletions charts/hive-metastore/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
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:
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
volumeMounts:
- name: hive-config-map
mountPath: /tmp/hive-site.xml
subPath: hive-site.xml
- name: hive-configs
mountPath: /opt/hive-configs
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:
failureThreshold: 60
tcpSocket:
port: thrift
env:
- name: HIVE_CONF_DIR
value: /opt/hive-configs
volumeMounts:
- name: hive-configs
mountPath: /opt/hive-configs
volumes:
- name: hive-configs
emptyDir: {}
- name: hive-config-map
configMap:
name: {{ include "hive-metastore.fullname" . }}
31 changes: 31 additions & 0 deletions charts/hive-metastore/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "hive-metastore.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
apiVersion: networking.k8s.io/v1
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:
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ . }}
pathType: Prefix
backend:
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- 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 }}
22 changes: 22 additions & 0 deletions charts/hive-metastore/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
image:
repository: bitsondatadev/hive-metastore
tag: latest
pullPolicy: IfNotPresent

service:
type: ClusterIP
port: 9083

ingress:
enabled: false
annotations: {}
hosts:
- host: localhost
paths: /hive-metastore

replicaCount: 1

hiveSiteXml: |
<configuration>
</configuration>

0 comments on commit 71ec256

Please sign in to comment.