Skip to content

Commit

Permalink
feat: [influxdb3-clustered] add the initial chart (#634)
Browse files Browse the repository at this point in the history
* feat: [influxdb3-clustered] add the initial chart

* chore: [influxdb3-clustered] full url to maintainer team

* chore: [influxdb3-clustered] full url to maintainer team

* chore: [influxdb3-clustered] full url to maintainer team

* chore: [influxdb3-clustered] add team email

* chore: [influxdb3-clustered] use a real github user

* fix[infludb3-clustered]: remove optional ingress config from default values

* fix[infludb3-clustered]: remove optional ingress config from default values
  • Loading branch information
jenniferplusplus committed Apr 16, 2024
1 parent 7df1768 commit 6963302
Show file tree
Hide file tree
Showing 10 changed files with 728 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/influxdb3-clustered/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
20 changes: 20 additions & 0 deletions charts/influxdb3-clustered/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v2
type: application

version: 0.1.0
appVersion: "20240326-922145"
name: influxdb3-clustered
description: InfluxDB 3.0 Clustered
maintainers:
- name: jenniferplusplus
email: [email protected]
url: https://github.com/orgs/influxdata/teams/project-clustered
keywords:
- influxdb
- influxdb3
- database
- timeseries
- influxdata
home: https://www.influxdata.com/products/influxdb-clustered/
sources:
- https://github.com/influxdata/influxdb
66 changes: 66 additions & 0 deletions charts/influxdb3-clustered/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# InfluxDB 3.0 Clustered

## Quick Start

```shell
helm repo add influxdata https://helm.influxdata.com/
helm upgrade --install influxdb influxdata/influxdb3-clustered -f values.yml --namespace influxdb
```

## Introduction

[InfluxDB](https://github.com/influxdata/influxdb) is an open source time series database written in Rust, using Apache Arrow, Apache Parquet, and Apache DataFusion as its foundational building blocks. [InfluxDB Clustered](https://www.influxdata.com/products/influxdb-clustered/) is the evolution of InfluxDB Enterprise, making it the solution for enterprises that need control over their data and underlying infrastructure.

## Installing the Chart

InfluxDB depends on a small number of external services, and these must be configured in your values file. See the [InfludDB Clustered documentation](https://docs.influxdata.com/influxdb/clustered/) for a detailed configuration guide.

To install the chart using the release name `my-release`:

```shell
helm upgrade --install my-release influxdata/influxdb3-clustered -f values.yml
```

InfluxDB Clustered is a complex distributed database, composed of numerous interconnected resources. These resources are managed using the [Kubit operator](https://github.com/kubecfg/kubit/). This helm chart will install that operator and the InfluxDB Clustered AppInstance resource, which encapsulates all of the resources and configuration for the database. Helm cannot be used to bypass the Kubit operator. If you cannot install the operator, then please consult the documentation for alternatives.

## Adopting existing resources into Helm

To allow Helm to take over managing an InfluxDB Clustered AppInstance resource, you must set some helm specific metadata on it, first. Otherwise, Helm will refuse to perform the installation or upgrade. This is a safety feature built into Helm, and is by design.

1. If you have installed the Kubit operator in its own namespace, set `skipOperator: true` in your values file. Normally, the InfluxDB 3.0 Clustered helm chart will deploy the Kubit operator along with the AppInstance resource, as a convenience. However, there's no clear mechanism to adopt existing resources from multiple namespaces into a single helm chart. So you can instead exclude the operator so it will not be managed by Helm.

2. Set your Helm values to match your existing configuration. We recommend using `helm template` to preview the generated resources and diff those against your deployed versions. Replace `DEPLOYMENT-NAME` and `NAMESPACE` to match your existing resources.

```shell
helm template DEPLOYMENT-NAME ./clustered-chart/ -f ./values.yml --namespace NAMESPACE | kubectl diff -f -
```
The AppInstance resource is a little bit more flexible than the Helm template, so there may be some small differences between them that do not actually impact the deployment. It's still best to minimize those differences, which may require updating the existing AppInstance resource slightly to more closely match the resource manifest generated by helm.

3. When you have matched your existing configuration, set the required metadata on your existing AppInstance. Replace `<NAME>` and `<NAMESPACE>` to match your existing resource's name and namespace.

```shell
kubectl label -f example-customer.yml app.kubernetes.io/managed-by=Helm
kubectl annotate -f example-customer.yml meta.helm.sh/release-name=<NAME> meta.helm.sh/release-namespace=<NAMESPACE>
```

4. Helm should now be able to manage the Clustered AppInstance resource. Again, replace `DEPLOYMENT-NAME` and `NAMESPACE` with the appropriate values to match your existing deployment.

```shell
helm install DEPLOYMENT-NAME ./clustered-chart/ -f values.yml --namespace NAMESPACE
```

The expected output will look similar to this, depending on your specific configuration.
```
NAME: clustered
LAST DEPLOYED: Wed Apr 10 17:01:11 2024
NAMESPACE: NAMESPACE
STATUS: deployed
REVISION: 3
TEST SUITE: None
NOTES:
Thank you for installing InfluxDB 3.0 Clustered
Your release is named DEPLOYMENT-NAME
You are running build number 20240326-922145
Our documentation is available at https://docs.influxdata.com/influxdb/clustered/
```
101 changes: 101 additions & 0 deletions charts/influxdb3-clustered/crds/kubit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: appinstances.kubecfg.dev
spec:
group: kubecfg.dev
names:
categories: []
kind: AppInstance
plural: appinstances
shortNames: []
singular: appinstance
scope: Namespaced
versions:
- additionalPrinterColumns: []
name: v1alpha1
schema:
openAPIV3Schema:
description: Auto-generated derived type for AppInstanceSpec via `CustomResource`
properties:
spec:
properties:
imagePullSecrets:
items:
description: LocalObjectReference contains enough information to
let you locate the referenced object inside the same namespace.
properties:
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
type: object
nullable: true
type: array
package:
properties:
apiVersion:
type: string
image:
type: string
spec:
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- apiVersion
- image
- spec
type: object
pause:
description: If true, the controller will not reconcile this application.
You can use this if you need to do some manual changes (either with
kubectl directly or with kubit CLI)
type: boolean
required:
- package
type: object
status:
nullable: true
properties:
conditions:
items:
properties:
lastTransitionTime:
description: Time is a wrapper around time.Time which supports
correct marshaling to YAML and JSON. Wrappers are provided
for many of the factory methods that the time package offers.
format: date-time
type: string
message:
type: string
observedGeneration:
format: int64
nullable: true
type: integer
reason:
type: string
status:
type: string
type:
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
lastLogs:
additionalProperties:
type: string
nullable: true
type: object
type: object
required:
- spec
title: AppInstance
type: object
served: true
storage: true
subresources:
status: {}
5 changes: 5 additions & 0 deletions charts/influxdb3-clustered/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Thank you for installing {{ .Chart.Description }}
Your release is named {{ .Release.Name }}
You are running build number {{ .Chart.AppVersion }}

Our documentation is available at https://docs.influxdata.com/influxdb/clustered/
62 changes: 62 additions & 0 deletions charts/influxdb3-clustered/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "chart.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 "chart.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 "chart.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "chart.labels" -}}
helm.sh/chart: {{ include "chart.chart" . }}
{{ include "chart.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "chart.selectorLabels" -}}
app.kubernetes.io/name: {{ include "chart.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "chart.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "chart.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
68 changes: 68 additions & 0 deletions charts/influxdb3-clustered/templates/app-instance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
apiVersion: kubecfg.dev/v1alpha1
kind: AppInstance
metadata:
name: {{.Values.nameOverride | default .Release.Name}}
namespace: {{.Values.namespaceOverride | default .Release.Namespace}}
spec:
imagePullSecrets: {{.Values.imagePullSecrets | toYaml | nindent 2}}
package:
image: "{{.Values.fullnameOverride | default "us-docker.pkg.dev/influxdb2-artifacts/clustered/influxdb"}}:{{ .Values.image.tag | default .Chart.AppVersion }}"
apiVersion: influxdata.com/v1alpha1
spec:
{{- if .Values.hostingEnvironment}}
hostingEnvironment:
{{- if hasKey .Values.hostingEnvironment "eks"}}
eks: {{.Values.hostingEnvironment.eks | include "mapTrim" | trim | nindent 10}}
{{- else if hasKey .Values.hostingEnvironment "openshift"}}
openshift: {{.Values.hostingEnvironment.openshift | include "mapTrim" | trim | nindent 10}}
{{- else if hasKey .Values.hostingEnvironment "gke"}}
gke: {{.Values.hostingEnvironment.gke | include "mapTrim" | trim | nindent 10}}
{{- end }}
{{- end}}
catalog:
dsn:
valueFrom:
secretKeyRef:
name: {{(required "missing catalog.dsn.SecretName" .Values.catalog.dsn.SecretName)}}
key: {{required "missing catalog.dsn.SecretKey" .Values.catalog.dsn.SecretKey}}
{{- if or .Values.images.overrides .Values.images.registryOverride}}
images:
{{- if .Values.images.overrides}}
overrides: {{.Values.images.overrides}}
{{- end}}
{{- if .Values.images.registryOverride}}
registryOverride: {{.Values.images.registryOverride}}
{{- end}}
{{- end}}
objectStore:
bucket: {{required "missing objectStore.bucket" .Values.objectStore.bucket}}
{{- if hasKey .Values.objectStore "s3"}}
s3: {{- .Values.objectStore.s3 | include "mapTrim" | trim | nindent 10 }}
{{- else if hasKey .Values.objectStore "azure"}}
azure: {{- .Values.objectStore.azure | include "mapTrim" | trim | nindent 10}}
{{- else if hasKey .Values.objectStore "google"}}
google: {{- .Values.objectStore.google | include "mapTrim" | trim | nindent 10}}
{{- end}}
ingesterStorage:{{.Values.ingesterStorage | include "mapTrim" | trim | nindent 8}}
monitoringStorage:{{.Values.monitoringStorage | include "mapTrim" | trim | nindent 8}}
ingress:{{- .Values.ingress | include "mapTrim" | trim | nindent 8 -}}
{{- $components := (.Values.components | include "mapTrim" | fromYaml)}}
{{- if $components}}
components:{{$components | toYaml | trim | nindent 8}}
{{- end}}
{{- $resources := (.Values.resources | include "mapTrim" | fromYaml)}}
{{- if $resources}}
resources:{{$resources | toYaml | trim | nindent 8}}
{{- end}}
admin:
users: {{required "missing admin.users" .Values.admin.users | toYaml | nindent 8}}
dsn: {{required "missing admin.dsn" .Values.admin.dsn | toYaml | nindent 10}}
identityProvider: {{required "missing admin.identityProvider" .Values.admin.identityProvider}}
jwksEndpoint: {{required "missing admin.jwksEndpoint" .Values.admin.jwksEndpoint}}
{{- if .Values.useCustomEgress}}
egress:
customCertificates: {{.Values.egress.customCertificates | toYaml | nindent 12}}
{{- end}}
{{- if .Values.featureFlags}}
featureFlags: {{.Values.featureFlags | toYaml | nindent 6}}
{{- end}}
Loading

0 comments on commit 6963302

Please sign in to comment.