From 9ea0a621e4e199e042983a39b8788034736b3ab9 Mon Sep 17 00:00:00 2001 From: tm8enk Date: Mon, 8 Mar 2021 18:00:34 +0000 Subject: [PATCH] release hive metastore 0.0.1 --- charts/hive-metastore/Chart.yaml | 31 +++++ charts/hive-metastore/templates/NOTES.txt | 1 + charts/hive-metastore/templates/_helpers.tpl | 113 ++++++++++++++++++ .../hive-metastore/templates/configmap.yaml | 28 +++++ .../hive-metastore/templates/deployment.yaml | 70 +++++++++++ .../templates/networkpolicy.yaml | 15 +++ charts/hive-metastore/templates/service.yaml | 18 +++ charts/hive-metastore/values.schema.json | 35 ++++++ charts/hive-metastore/values.yaml | 103 ++++++++++++++++ 9 files changed, 414 insertions(+) create mode 100644 charts/hive-metastore/Chart.yaml create mode 100644 charts/hive-metastore/templates/NOTES.txt create mode 100644 charts/hive-metastore/templates/_helpers.tpl create mode 100644 charts/hive-metastore/templates/configmap.yaml create mode 100644 charts/hive-metastore/templates/deployment.yaml create mode 100644 charts/hive-metastore/templates/networkpolicy.yaml create mode 100644 charts/hive-metastore/templates/service.yaml create mode 100644 charts/hive-metastore/values.schema.json create mode 100644 charts/hive-metastore/values.yaml diff --git a/charts/hive-metastore/Chart.yaml b/charts/hive-metastore/Chart.yaml new file mode 100644 index 00000000..1eb46c0b --- /dev/null +++ b/charts/hive-metastore/Chart.yaml @@ -0,0 +1,31 @@ +apiVersion: v2 +name: hive-metastore +description: A hive metastore manage the metadata of persistent relational entities (e.g. databases, tables, columns, partitions) in a relational database (for fast access). +icon: https://upload.wikimedia.org/wikipedia/commons/thumb/b/bb/Apache_Hive_logo.svg/1200px-Apache_Hive_logo.svg.png +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.0.1 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +appVersion: 1 +dependencies: + - name: postgres + version: 0.1.5 + repository: https://inseefrlab.github.io/helm-charts-datascience + enabled: true + + + diff --git a/charts/hive-metastore/templates/NOTES.txt b/charts/hive-metastore/templates/NOTES.txt new file mode 100644 index 00000000..7d790da0 --- /dev/null +++ b/charts/hive-metastore/templates/NOTES.txt @@ -0,0 +1 @@ +1. Get the application URL by running these commands: diff --git a/charts/hive-metastore/templates/_helpers.tpl b/charts/hive-metastore/templates/_helpers.tpl new file mode 100644 index 00000000..86590ef4 --- /dev/null +++ b/charts/hive-metastore/templates/_helpers.tpl @@ -0,0 +1,113 @@ +{{/* 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 name of the config map S3 to use +*/}} +{{- define "hive-metastore.configMapNameS3" -}} +{{- if .Values.s3.create }} +{{- $name:= (printf "%s-configmaps3" (include "hive-metastore.fullname" .) ) }} +{{- default $name .Values.s3.configMapName }} +{{- else }} +{{- default "default" .Values.s3.configMapName }} +{{- end }} +{{- end }} + +{{/* +Create the name of the config map Vault to use +*/}} +{{- define "hive-metastore.configMapNameVault" -}} +{{- if .Values.vault.create }} +{{- $name:= (printf "%s-configmapvault" (include "hive-metastore.fullname" .) ) }} +{{- default $name .Values.vault.configMapName }} +{{- else }} +{{- default "default" .Values.vault.configMapName }} +{{- end }} +{{- end }} + +{{/* +Create the name of the config map Git to use +*/}} +{{- define "hive-metastore.configMapNameGit" -}} +{{- if .Values.vault.create }} +{{- $name:= (printf "%s-configmapgit" (include "hive-metastore.fullname" .) ) }} +{{- default $name .Values.git.configMapName }} +{{- else }} +{{- default "default" .Values.git.configMapName }} +{{- end }} +{{- end }} + +{{/* +ingress annotations +*/}} +{{- define "hive-metastore.ingress.annotations" -}} +{{- with .Values.ingress.annotations }} + {{- toYaml . }} +{{- end }} +{{- if .Values.security.whitelist.enable }} +nginx.ingress.kubernetes.io/whitelist-source-range: {{ .Values.security.whitelist.ip }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/hive-metastore/templates/configmap.yaml b/charts/hive-metastore/templates/configmap.yaml new file mode 100644 index 00000000..ef16b0bb --- /dev/null +++ b/charts/hive-metastore/templates/configmap.yaml @@ -0,0 +1,28 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "hive-metastore.fullname" . }} + labels: + {{- include "hive-metastore.labels" . | nindent 4 }} +data: + hive-site.xml: | + + + + + javax.jdo.option.ConnectionURL + jdbc:postgresql://{{ .Release.Name }}-postgres:5432/defaultdb + + + javax.jdo.option.ConnectionDriverName + org.postgresql.Driver + + + javax.jdo.option.ConnectionUserName + {{ .Values.postgres.postgresql.username }} + + + javax.jdo.option.ConnectionPassword + {{ .Values.postgres.postgresql.password }} + + \ No newline at end of file diff --git a/charts/hive-metastore/templates/deployment.yaml b/charts/hive-metastore/templates/deployment.yaml new file mode 100644 index 00000000..34f51c99 --- /dev/null +++ b/charts/hive-metastore/templates/deployment.yaml @@ -0,0 +1,70 @@ +{{- $fullName := include "hive-metastore.fullname" . -}} +{{- $volumeName := printf "%s-%s" $fullName "data" | trunc 63 | trimSuffix "-" -}} +{{- $initContainerName := printf "%s-%s" $fullName "init-data" | trunc 63 | trimSuffix "-" -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "hive-metastore.fullname" . }} + labels: + {{- include "hive-metastore.labels" . | nindent 4 }} +spec: +{{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} +{{- end }} + selector: + matchLabels: + {{- include "hive-metastore.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "hive-metastore.selectorLabels" . | nindent 8 }} + spec: + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.service.image.repository }}:{{ .Values.service.image.tag | default .Chart.AppVersion }}" + command: ["/bin/sh","-c"] + args: ["$HIVE_HOME/bin/schematool -dbType postgres -initSchema ; $HIVE_HOME/bin/hiveserver2 --service metastore"] + imagePullPolicy: {{ .Values.service.image.pullPolicy }} + ports: + - name: thrift + containerPort: 9083 + protocol: TCP + readinessProbe: + tcpSocket: + port: 9083 + initialDelaySeconds: 5 + periodSeconds: 10 + livenessProbe: + tcpSocket: + port: 9083 + initialDelaySeconds: 15 + periodSeconds: 20 + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - name: hive-config + mountPath: /opt/hive/conf + volumes: + - name: hive-config + configMap: + name: {{ include "hive-metastore.fullname" . }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/hive-metastore/templates/networkpolicy.yaml b/charts/hive-metastore/templates/networkpolicy.yaml new file mode 100644 index 00000000..455b9205 --- /dev/null +++ b/charts/hive-metastore/templates/networkpolicy.yaml @@ -0,0 +1,15 @@ +{{- if .Values.security.networkPolicy.enable -}} +kind: NetworkPolicy +apiVersion: networking.k8s.io/v1 +metadata: + name: {{ include "hive-metastore.fullname" . }} +spec: + podSelector: + matchLabels: + {{- include "hive-metastore.selectorLabels" . | nindent 6 }} + ingress: + - from: + - podSelector: {} + policyTypes: + - Ingress +{{- end }} \ No newline at end of file diff --git a/charts/hive-metastore/templates/service.yaml b/charts/hive-metastore/templates/service.yaml new file mode 100644 index 00000000..6b469bea --- /dev/null +++ b/charts/hive-metastore/templates/service.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "hive-metastore.fullname" . }} + labels: + {{- include "hive-metastore.labels" . | nindent 4 }} +spec: + type: {{ .Values.networking.type }} + {{- if .Values.networking.clusterIP }} + clusterIP: {{ .Values.networking.clusterIP }} + {{- end }} + ports: + - port: {{ .Values.networking.port }} + targetPort: thrift + protocol: TCP + name: thrift + selector: + {{- include "hive-metastore.selectorLabels" . | nindent 4 }} diff --git a/charts/hive-metastore/values.schema.json b/charts/hive-metastore/values.schema.json new file mode 100644 index 00000000..3bd4b10f --- /dev/null +++ b/charts/hive-metastore/values.schema.json @@ -0,0 +1,35 @@ +{ + "$schema": "http://json-schema.org/schema#", + "type": "object", + "properties": { + "postgres": { + "description": "postgres specific configuration", + "type": "object", + "properties": { + "postgresql": { + "description": "postgres specific configuration", + "type": "object", + "properties": { + "username": { + "description": "Postgres user name.", + "type": "string", + "default": "admin", + "x-form": { + "value": "{{user.idep}}" + } + }, + "password": { + "description": "Postgres password.", + "type": "string", + "default": "changeme", + "x-form": { + "value": "{{user.password}}" + } + } + } + } + } + } + } + +} diff --git a/charts/hive-metastore/values.yaml b/charts/hive-metastore/values.yaml new file mode 100644 index 00000000..03e11c62 --- /dev/null +++ b/charts/hive-metastore/values.yaml @@ -0,0 +1,103 @@ +# Default values for postgres. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +service: + image: + repository: "inseefrlab/jupyter-datascience" + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "master" + +liveness: + enabled : "true" + +security: + password: "changeme" + networkPolicy: + enable: true + +postgresql: + version: "12" + username: postgres + dbname: defaultdb + password: changeme + +postgis: + enabled: false + version: "3.1" + +readiness: + enabled: "true" + + +init: + enabled: false + image: curimages/curl + command: ["curl"] + args: ["https://example.com/example.sql", "-o", "/data/dump.sql"] + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +networkPolicy: + enabled: false + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +networking: + type: ClusterIP + port: 9083 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +persistence: + enabled: true + ## database data Persistent Volume Storage Class + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + # storageClass: "-" + accessMode: ReadWriteOnce + size: 10Gi + # existingClaim: "" + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} \ No newline at end of file