Skip to content

Commit 816c7e3

Browse files
authored
chore: support hive for kb09 (#1807)
1 parent 67def28 commit 816c7e3

14 files changed

Lines changed: 624 additions & 0 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
apiVersion: v2
2+
name: hive
3+
description: A Hive Helm chart for KubeBlocks.
4+
5+
type: application
6+
7+
version: 0.9.0
8+
9+
appVersion: 3.1.3
10+
11+
dependencies:
12+
- name: kblib
13+
version: 0.1.1
14+
repository: file://../kblib-v2
15+
alias: extra
16+
17+
home: https://hive.apache.org/
18+
icon: https://hive.apache.org/images/hive.svg
19+
keywords:
20+
- bigdata
21+
- datawarehousing
22+
- SQL
23+
24+
maintainers:
25+
- name: ApeCloud
26+
url: https://kubeblocks.io/
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "hive.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "hive.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "hive.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "hive.labels" -}}
37+
helm.sh/chart: {{ include "hive.chart" . }}
38+
{{ include "hive.selectorLabels" . }}
39+
app.kubernetes.io/version: {{ default .Chart.AppVersion .Values.appVersionOverride | quote }}
40+
app.kubernetes.io/managed-by: {{ .Release.Service }}
41+
{{- end }}
42+
43+
{{/*
44+
Selector labels
45+
*/}}
46+
{{- define "hive.selectorLabels" -}}
47+
app.kubernetes.io/name: {{ include "hive.name" . }}
48+
app.kubernetes.io/instance: {{ .Release.Name }}
49+
{{- end }}
50+
51+
{{- define "clustername" -}}
52+
{{ include "hive.fullname" .}}
53+
{{- end}}
54+
55+
{{/*
56+
Create the name of the service account to use
57+
*/}}
58+
{{- define "hive.serviceAccountName" -}}
59+
{{- default (printf "kb-%s" (include "clustername" .)) .Values.serviceAccount.name }}
60+
{{- end }}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
apiVersion: apps.kubeblocks.io/v1alpha1
2+
kind: Cluster
3+
metadata:
4+
namespace: {{ .Release.Namespace }}
5+
name: {{ include "kblib.clusterName" . }}
6+
labels: {{ include "kblib.clusterLabels" . | nindent 4 }}
7+
spec:
8+
terminationPolicy: Delete
9+
{{- include "kblib.affinity" . | indent 2 }}
10+
clusterDefinitionRef: hive
11+
topology: hive-cluster
12+
componentSpecs:
13+
- name: metastore
14+
componentDef: hive-metastore
15+
serviceRefs:
16+
- name: hive-mysql-metadb
17+
namespace: {{ .Values.serviceRefs.hiveMysqlMetadb.namespace }}
18+
clusterServiceSelector:
19+
cluster: {{ .Values.serviceRefs.hiveMysqlMetadb.clusterServiceSelector.cluster }}
20+
service:
21+
component: {{ .Values.serviceRefs.hiveMysqlMetadb.clusterServiceSelector.service.component }}
22+
service: {{ .Values.serviceRefs.hiveMysqlMetadb.clusterServiceSelector.service.service }}
23+
port: {{ .Values.serviceRefs.hiveMysqlMetadb.clusterServiceSelector.service.port }}
24+
credential:
25+
component: {{ .Values.serviceRefs.hiveMysqlMetadb.clusterServiceSelector.credential.component }}
26+
name: {{ .Values.serviceRefs.hiveMysqlMetadb.clusterServiceSelector.credential.name }}
27+
replicas: {{ .Values.replicas.metastore }}
28+
resources:
29+
requests:
30+
cpu: {{ .Values.resources.metastore.requests.cpu | quote }}
31+
memory: {{ .Values.resources.metastore.requests.memory }}
32+
limits:
33+
cpu: {{ .Values.resources.metastore.limits.cpu | quote }}
34+
memory: {{ .Values.resources.metastore.limits.memory }}
35+
volumes:
36+
- name: hadoop-core-config
37+
configMap:
38+
name: {{ include "kblib.clusterName" . }}-hadoop-core-config
39+
- name: hadoop-hdfs-config
40+
configMap:
41+
name: {{ include "kblib.clusterName" . }}-namenode-config
42+
volumeClaimTemplates:
43+
- name: metadata
44+
spec:
45+
accessModes:
46+
- ReadWriteOnce
47+
resources:
48+
requests:
49+
storage: {{ .Values.storage.metastore }}
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"type": "object",
4+
"properties": {
5+
"replicas": {
6+
"type": "object",
7+
"properties": {
8+
"metastore": { "type": "integer", "default": 1, "minimum": 1, "maximum": 5 }
9+
},
10+
"required": ["metastore"],
11+
"description": "Number of replicas for each component."
12+
},
13+
"resources": {
14+
"type": "object",
15+
"properties": {
16+
"metastore": { "$ref": "#/definitions/resourceSchema" }
17+
},
18+
"required": ["metastore"],
19+
"description": "Resource requests and limits for each component."
20+
},
21+
"storage": {
22+
"type": "object",
23+
"properties": {
24+
"metastore": { "type": "string", "default": "5Gi" }
25+
},
26+
"required": ["metastore"],
27+
"description": "Storage requirements for each component."
28+
},
29+
"serviceRefs": {
30+
"type": "object",
31+
"properties": {
32+
"hiveMysqlMetadb": {
33+
"type": "object",
34+
"properties": {
35+
"namespace": { "type": "string", "default": "default" },
36+
"clusterServiceSelector": {
37+
"type": "object",
38+
"properties": {
39+
"cluster": { "type": "string", "default": "mysql-meta" },
40+
"service": {
41+
"type": "object",
42+
"properties": {
43+
"component": { "type": "string", "default": "mysql" },
44+
"service": { "type": "string", "default": "headless" },
45+
"port": { "type": "string", "default": "client" }
46+
},
47+
"required": ["component", "service", "port"]
48+
},
49+
"credential": {
50+
"type": "object",
51+
"properties": {
52+
"component": { "type": "string", "default": "mysql" },
53+
"name": { "type": "string", "default": "root" }
54+
},
55+
"required": ["component", "name"]
56+
}
57+
},
58+
"required": ["cluster", "service", "credential"]
59+
}
60+
},
61+
"required": ["namespace", "clusterServiceSelector"],
62+
"description": "References to external services."
63+
}
64+
},
65+
"required": ["hiveMysqlMetadb"],
66+
"description": "Service references for external dependencies."
67+
},
68+
"serviceAccount": {
69+
"type": "object",
70+
"properties": {
71+
"name": { "type": "string", "default": "kb-hive-cluster" },
72+
"create": { "type": "boolean", "default": true }
73+
},
74+
"required": ["name", "create"],
75+
"description": "Configuration for the service account."
76+
},
77+
"terminationPolicy": {
78+
"type": "string",
79+
"default": "Delete",
80+
"description": "Policy for terminating the release."
81+
},
82+
"clusterDefinitionRef": {
83+
"type": "string",
84+
"default": "hive",
85+
"description": "Reference to the cluster definition."
86+
},
87+
"topology": {
88+
"type": "string",
89+
"default": "hive-cluster",
90+
"description": "Cluster topology configuration."
91+
}
92+
},
93+
"required": ["replicas", "resources", "storage", "serviceRefs", "serviceAccount", "terminationPolicy", "clusterDefinitionRef", "topology"],
94+
"definitions": {
95+
"resourceSchema": {
96+
"type": "object",
97+
"properties": {
98+
"requests": {
99+
"type": "object",
100+
"properties": {
101+
"cpu": { "type": "string", "default": "0.1" },
102+
"memory": { "type": "string", "default": "0.5Gi" }
103+
},
104+
"required": ["cpu", "memory"],
105+
"description": "Resource requests for the component."
106+
},
107+
"limits": {
108+
"type": "object",
109+
"properties": {
110+
"cpu": { "type": "string", "default": "1" },
111+
"memory": { "type": "string", "default": "2Gi" }
112+
},
113+
"required": ["cpu", "memory"],
114+
"description": "Resource limits for the component."
115+
}
116+
},
117+
"required": ["requests", "limits"],
118+
"description": "Resource configuration for a component."
119+
}
120+
},
121+
"description": "Schema for Hive Helm chart values."
122+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Hive Configuration
2+
3+
nameOverride: ""
4+
5+
fullnameOverride: ""
6+
7+
# Replicas for each component
8+
replicas:
9+
metastore: 1
10+
11+
# Resource requirements for each component
12+
resources:
13+
metastore:
14+
requests:
15+
cpu: "0.1"
16+
memory: 0.5Gi
17+
limits:
18+
cpu: "1"
19+
memory: 2Gi
20+
21+
# Storage requirements for each component
22+
storage:
23+
metastore: 5Gi
24+
25+
# Service references for external dependencies
26+
serviceRefs:
27+
hiveMysqlMetadb:
28+
namespace: default
29+
clusterServiceSelector:
30+
cluster: mysql-meta
31+
service:
32+
component: mysql
33+
service: headless
34+
port: client
35+
credential:
36+
component: mysql
37+
name: root
38+
39+
# Service account configuration
40+
serviceAccount:
41+
name: kb-hive-cluster
42+
create: true
43+
44+
# Advanced configurations
45+
terminationPolicy: Delete
46+
clusterDefinitionRef: hive
47+
topology: hive-cluster

addons/hive/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

addons/hive/Chart.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: hive
3+
description: A Helm chart for Kubernetes
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "3.1.3"

0 commit comments

Comments
 (0)