diff --git a/helm/Chart.yaml b/helm/Chart.yaml new file mode 100644 index 0000000..e23cb6e --- /dev/null +++ b/helm/Chart.yaml @@ -0,0 +1,42 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +apiVersion: v2 +name: iotdb-cluster +description: The distribution of Apache IoTDB + +# 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: 1.0.0 + +# 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. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/helm/templates/NOTES.txt b/helm/templates/NOTES.txt new file mode 100644 index 0000000..b8dde4c --- /dev/null +++ b/helm/templates/NOTES.txt @@ -0,0 +1 @@ +This is Apache IoTDB Distribution diff --git a/helm/templates/_helpers.tpl b/helm/templates/_helpers.tpl new file mode 100644 index 0000000..a476a24 --- /dev/null +++ b/helm/templates/_helpers.tpl @@ -0,0 +1,81 @@ +{{/* +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +*/}} + +{{/* +Expand the name of the chart. +*/}} +{{- define "iotdb-cluster.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 "iotdb-cluster.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 "iotdb-cluster.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "iotdb-cluster.labels" -}} +helm.sh/chart: {{ include "iotdb-cluster.chart" . }} +{{ include "iotdb-cluster.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "iotdb-cluster.selectorLabels" -}} +app.kubernetes.io/name: {{ include "iotdb-cluster.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "iotdb-cluster.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "iotdb-cluster.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/helm/templates/confignode-cm.yaml b/helm/templates/confignode-cm.yaml new file mode 100644 index 0000000..64d43eb --- /dev/null +++ b/helm/templates/confignode-cm.yaml @@ -0,0 +1,35 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Values.confignode.name }}-cm + namespace: {{ .Release.Namespace }} +data: + iotdb-system.properties: | + cn_internal_address=.{{ .Values.confignode.name }}-svc.{{ .Release.Namespace }} + cn_seed_config_node={{ .Values.confignode.name }}-0.{{ .Values.confignode.name }}-svc.{{ .Release.Namespace }}:10710 + config_node_consensus_protocol_class={{ .Values.confignode.configNodeConsensusProtocolClass }} + schema_replication_factor={{ .Values.confignode.schemaReplicationFactor }} + schema_region_consensus_protocol_class={{ .Values.confignode.schemaRegionConsensusProtocolClass }} + data_replication_factor={{ .Values.confignode.dataReplicationFactor }} + data_region_consensus_protocol_class={{ .Values.confignode.dataRegionConsensusProtocolClass }} + enable_last_cache={{ .Values.confignode.enableLastCache }} + data_region_group_extension_policy={{ .Values.confignode.dataRegionGroupExtensionPolicy }} + default_data_region_group_num_per_database={{ .Values.confignode.dataRegionGroupNumPerDatabase }} \ No newline at end of file diff --git a/helm/templates/confignode.yaml b/helm/templates/confignode.yaml new file mode 100644 index 0000000..61dfbd2 --- /dev/null +++ b/helm/templates/confignode.yaml @@ -0,0 +1,105 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.confignode.name }}-svc + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Values.confignode.name }} +spec: + type: NodePort + ports: + - port: 80 + targetPort: 80 + name: rpc + selector: + app: {{ .Values.confignode.name }} +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ .Values.confignode.name }} + namespace: {{ .Release.Namespace }} +spec: + selector: + matchLabels: + app: {{ .Values.confignode.name }} + serviceName: {{ .Values.confignode.name }}-svc + replicas: {{ .Values.confignode.nodeCount }} + template: + metadata: + labels: + app: {{ .Values.confignode.name }} + spec: + terminationGracePeriodSeconds: 10 + initContainers: + - name: init-confignode + image: busybox + command: [ 'sh', '-c', 'mkdir -p /iotdb/ && touch /iotdb/.env' ] + volumeMounts: + - name: map-confignode + mountPath: /iotdb + containers: + - name: confignode + image: {{ printf "%s:%s" .Values.image.repository .Values.image.tag }} + command: ["/bin/bash", "-c", "/iotdb/sbin/entrypoint.sh confignode"] + envFrom: + - configMapRef: + name: {{ .Values.confignode.name }}-cm + env: + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: cn_internal_address + value: "$(POD_NAME).{{ .Values.confignode.name }}-svc.{{ .Release.Namespace }}" + ports: + - containerPort: 80 + name: web + - containerPort: 10710 + name: internal + - containerPort: 10720 + name: consensus + volumeMounts: + - name: map-confignode + mountPath: /iotdb/data + subPath: data + - name: map-confignode + mountPath: /iotdb/ext + subPath: ext + - name: map-confignode + mountPath: /iotdb/logs + subPath: logs + - name: map-confignode + mountPath: /iotdb/.env + subPath: .env + resources: + requests: + cpu: {{ .Values.confignode.resources.requests.cpu }} + memory: {{ .Values.confignode.resources.requests.memory }} + volumeClaimTemplates: + - metadata: + name: map-confignode + spec: + accessModes: [ "ReadWriteOnce" ] + storageClassName: {{ .Values.storage.className }} + resources: + requests: + storage: {{ .Values.confignode.storageCapacity }} \ No newline at end of file diff --git a/helm/templates/datanode-cm.yaml b/helm/templates/datanode-cm.yaml new file mode 100644 index 0000000..a34d3f7 --- /dev/null +++ b/helm/templates/datanode-cm.yaml @@ -0,0 +1,29 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Values.datanode.name }}-cm + namespace: {{ .Release.Namespace }} +data: + iotdb-system.properties: | + dn_rpc_address=.{{ .Values.datanode.name }}-svc.{{ .Release.Namespace }} + dn_internal_address=.{{ .Values.datanode.name }}-svc.{{ .Release.Namespace }} + dn_seed_config_node={{ .Values.confignode.name }}-0.{{ .Values.confignode.name }}-svc.{{ .Release.Namespace }}:10710 + enable_rest_service={{ .Values.datanode.enableRestService }} \ No newline at end of file diff --git a/helm/templates/datanode.yaml b/helm/templates/datanode.yaml new file mode 100644 index 0000000..81d31df --- /dev/null +++ b/helm/templates/datanode.yaml @@ -0,0 +1,115 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +apiVersion: v1 +kind: Service +metadata: + namespace: {{ .Release.Namespace }} + name: {{ .Values.datanode.name }}-svc + labels: + app: {{ .Values.datanode.name }} +spec: + type: NodePort + ports: + - port: 6667 + targetPort: 6667 + name: rpc + selector: + app: {{ .Values.datanode.name }} +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + namespace: {{ .Release.Namespace }} + name: {{ .Values.datanode.name }} +spec: + selector: + matchLabels: + app: {{ .Values.datanode.name }} + serviceName: {{ .Values.datanode.name }}-svc + replicas: {{ .Values.datanode.nodeCount }} + template: + metadata: + labels: + app: {{ .Values.datanode.name }} + spec: + terminationGracePeriodSeconds: 10 + initContainers: + - name: init-datanode + image: busybox + command: [ 'sh', '-c', 'mkdir -p /iotdb/ && touch /iotdb/.env' ] + volumeMounts: + - name: map-datanode + mountPath: /iotdb + containers: + - name: datanode + image: {{ printf "%s:%s" .Values.image.repository .Values.image.tag }} + command: ["/bin/bash", "-c", "/iotdb/sbin/entrypoint.sh datanode;cp /iotdb/.env /iotdb/activation/.env"] + envFrom: + - configMapRef: + name: {{ .Values.datanode.name }}-cm + env: + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: dn_rpc_address + value: "$(POD_NAME).{{ .Values.datanode.name }}-svc.{{ .Release.Namespace }}" + - name: dn_internal_address + value: "$(POD_NAME).{{ .Values.datanode.name }}-svc.{{ .Release.Namespace }}" + ports: + - containerPort: 80 + name: web + - containerPort: 6667 + name: rpc + - containerPort: 18080 + name: rest + - containerPort: 10730 + name: internal + - containerPort: 10740 + name: mpp-exchange + - containerPort: 10750 + name: schema-cons + - containerPort: 10760 + name: data-cons + volumeMounts: + - name: map-datanode + mountPath: /iotdb/data + subPath: data + - name: map-datanode + mountPath: /iotdb/ext + subPath: ext + - name: map-datanode + mountPath: /iotdb/logs + subPath: logs + - name: map-datanode + mountPath: /iotdb/.env + subPath: .env + resources: + requests: + cpu: {{ .Values.datanode.resources.requests.cpu }} + memory: {{ .Values.datanode.resources.requests.memory }} + volumeClaimTemplates: + - metadata: + name: map-datanode + spec: + accessModes: [ "ReadWriteOnce" ] + storageClassName: {{ .Values.storage.className }} + resources: + requests: + storage: {{ .Values.datanode.storageCapacity }} \ No newline at end of file diff --git a/helm/templates/load-balancer.yaml b/helm/templates/load-balancer.yaml new file mode 100644 index 0000000..d81d347 --- /dev/null +++ b/helm/templates/load-balancer.yaml @@ -0,0 +1,29 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +apiVersion: v1 +kind: Service +metadata: + namespace: {{ .Values.namespace }} + name: jdbc-balancer +spec: + type: LoadBalancer + ports: + - port: 6667 + selector: + app: {{ .Values.datanode.name }} \ No newline at end of file diff --git a/helm/values.yaml b/helm/values.yaml new file mode 100644 index 0000000..19a8891 --- /dev/null +++ b/helm/values.yaml @@ -0,0 +1,62 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# Default values for iotdb-cluster. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +nameOverride: "iotdb" +fullnameOverride: "iotdb" + +image: + repository: apache/iotdb + pullPolicy: IfNotPresent + tag: latest + +storage: + className: local-storage + +datanode: + name: datanode + nodeCount: 3 + enableRestService: true + storageCapacity: 200Gi + resources: + requests: + memory: 8Gi + cpu: 4000m + limits: + memory: 16Gi + cpu: 8000m + +confignode: + name: confignode + nodeCount: 3 + storageCapacity: 100Gi + resources: + requests: + memory: 2048Mi + cpu: 2000m + limits: + memory: 4096Mi + cpu: 4000m + configNodeConsensusProtocolClass: org.apache.iotdb.consensus.ratis.RatisConsensus + schemaReplicationFactor: 3 + schemaRegionConsensusProtocolClass: org.apache.iotdb.consensus.ratis.RatisConsensus + dataReplicationFactor: 2 + dataRegionConsensusProtocolClass: org.apache.iotdb.consensus.iot.IoTConsensus