diff --git a/addons/influxdb/.helmignore b/addons/influxdb/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/addons/influxdb/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/addons/influxdb/Chart.yaml b/addons/influxdb/Chart.yaml new file mode 100644 index 000000000..24a872175 --- /dev/null +++ b/addons/influxdb/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: influxdb +type: application + +version: 0.7.0 + +appVersion: 2.7.4 + +annotations: + category: Database + licenses: Apache-2.0 + addon.kubeblocks.io/kubeblocks-version: ">=0.7.0" + addon.kubeblocks.io/model: "time-series" + +description: InfluxDB(TM) is an open source time-series database. It is a core component of the TICK (Telegraf, InfluxDB(TM), Chronograf, Kapacitor) stack. + +home: https://bitnami.com +icon: https://bitnami.com/assets/stacks/influxdb/img/influxdb-stack-220x234.png + +keywords: + - influxdb + - tick + - database + - timeseries diff --git a/addons/influxdb/templates/__helpers.tpl b/addons/influxdb/templates/__helpers.tpl new file mode 100644 index 000000000..cb0971837 --- /dev/null +++ b/addons/influxdb/templates/__helpers.tpl @@ -0,0 +1,33 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "influxdb.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "influxdb.selectorLabels" -}} +app.kubernetes.io/name: {{ include "influxdb.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "influxdb.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "influxdb.labels" -}} +helm.sh/chart: {{ include "influxdb.chart" . }} +{{ include "influxdb.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} \ No newline at end of file diff --git a/addons/influxdb/templates/clusterdefinition.yaml b/addons/influxdb/templates/clusterdefinition.yaml new file mode 100644 index 000000000..fda15f7c2 --- /dev/null +++ b/addons/influxdb/templates/clusterdefinition.yaml @@ -0,0 +1,123 @@ +apiVersion: apps.kubeblocks.io/v1alpha1 +kind: ClusterDefinition +metadata: + name: influxdb + labels: + {{- include "influxdb.labels" . | nindent 4 }} +spec: + connectionCredential: + admin-user: "admin" + admin-user-password: "$(RANDOM_PASSWD)" + admin-user-token: "$(RANDOM_PASSWD)" + http-endpoint: "$(SVC_FQDN):$(SVC_PORT_http)" + http-port: "$(SVC_PORT_http)" + rpc-endpoint: "$(SVC_FQDN):$(SVC_PORT_rpc)" + rpc-port: "$(SVC_PORT_rpc)" + host: "$(SVC_FQDN)" + componentDefs: + - name: influxdb + characterType: influxdb + workloadType: Stateful + service: + ports: + - name: http + port: 8086 + targetPort: http + - name: rpc + port: 8088 + targetPort: rpc + podSpec: + containers: + - name: influxdb + image: docker.io/bitnami/influxdb:2.7.4-debian-11-r0 + imagePullPolicy: "IfNotPresent" + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + privileged: false + readOnlyRootFilesystem: false + runAsNonRoot: true + runAsUser: 1001 + seccompProfile: + type: RuntimeDefault + env: + - name: BITNAMI_DEBUG + value: "false" + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + - name: INFLUXDB_HTTP_AUTH_ENABLED + value: "true" + - name: INFLUXDB_CREATE_USER_TOKEN + value: "no" + - name: INFLUXDB_ADMIN_USER + valueFrom: + secretKeyRef: + name: $(CONN_CREDENTIAL_SECRET_NAME) + key: admin-user + - name: INFLUXDB_ADMIN_USER_PASSWORD + valueFrom: + secretKeyRef: + name: $(CONN_CREDENTIAL_SECRET_NAME) + key: admin-user-password + - name: INFLUXDB_ADMIN_USER_TOKEN + valueFrom: + secretKeyRef: + name: $(CONN_CREDENTIAL_SECRET_NAME) + key: admin-user-token + - name: INFLUXDB_ADMIN_BUCKET + value: "primary" + - name: INFLUXDB_ADMIN_ORG + value: "primary" + ports: + - name: http + containerPort: 8086 + protocol: TCP + - name: rpc + containerPort: 8088 + protocol: TCP + livenessProbe: + failureThreshold: 6 + initialDelaySeconds: 180 + periodSeconds: 45 + successThreshold: 1 + timeoutSeconds: 30 + exec: + command: + - bash + - -c + - | + . /opt/bitnami/scripts/libinfluxdb.sh + + influxdb_env + export INFLUX_USERNAME="$INFLUXDB_ADMIN_USER" + export INFLUX_PASSWORD="$INFLUXDB_ADMIN_USER_PASSWORD" + + timeout 29s influx ping --host http://$POD_IP:8086 + readinessProbe: + failureThreshold: 6 + initialDelaySeconds: 60 + periodSeconds: 45 + successThreshold: 1 + timeoutSeconds: 30 + exec: + command: + - bash + - -c + - | + . /opt/bitnami/scripts/libinfluxdb.sh + + influxdb_env + export INFLUX_USERNAME="$INFLUXDB_ADMIN_USER" + export INFLUX_PASSWORD="$INFLUXDB_ADMIN_USER_PASSWORD" + + timeout 29s influx ping --host http://$POD_IP:8086 + resources: + limits: {} + requests: {} + volumeMounts: + - name: data + mountPath: /bitnami/influxdb \ No newline at end of file diff --git a/addons/influxdb/templates/clusterversion.yaml b/addons/influxdb/templates/clusterversion.yaml new file mode 100644 index 000000000..552cd2707 --- /dev/null +++ b/addons/influxdb/templates/clusterversion.yaml @@ -0,0 +1,15 @@ +apiVersion: apps.kubeblocks.io/v1alpha1 +kind: ClusterVersion +metadata: + name: influxdb-{{ default .Chart.AppVersion .Values.clusterVersionOverride }} + labels: + {{- include "influxdb.labels" . | nindent 4 }} +spec: + clusterDefinitionRef: influxdb + componentVersions: + - componentDefRef: influxdb + versionsContext: + containers: + - name: influxdb + image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:{{ .Values.image.tag }} + imagePullPolicy: {{ default .Values.image.pullPolicy "IfNotPresent" }} \ No newline at end of file diff --git a/addons/influxdb/values.yaml b/addons/influxdb/values.yaml new file mode 100644 index 000000000..d2b6cea83 --- /dev/null +++ b/addons/influxdb/values.yaml @@ -0,0 +1,12 @@ +# Default values for mysql. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +image: + registry: docker.io + repository: bitnami/influxdb + pullPolicy: IfNotPresent + tag: 2.7.4-debian-11-r0 + +nameOverride: "" +fullnameOverride: "" +clusterVersionOverride: "2.7.4" \ No newline at end of file