Skip to content

Commit

Permalink
First drop
Browse files Browse the repository at this point in the history
  • Loading branch information
spilchen committed Nov 8, 2023
1 parent 687b91a commit fa353b0
Show file tree
Hide file tree
Showing 13 changed files with 698 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.tgz
21 changes: 21 additions & 0 deletions Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# (c) Copyright [2023] Open Text.
# Licensed 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: vertica-kafka-scheduler
description: Deploys the Vertica Kafka Scheduler in Kubernetes
type: application
version: 0.1.0
# The appVersion corresponds to the Vertica version
appVersion: "23.4.0"
icon: https://raw.githubusercontent.com/vertica/kafka-scheduler-chart/main/vertica-logo.png
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright [2023] Open Text.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
37 changes: 35 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,35 @@
# kafka-scheduler-chart
Helm chart to deploy the Vertica Kafka Scheduler in Kubernetes
This helm chart will deploy the vertica kafka scheduler. It will deploy the vertica/vertica-kafka-scheduler in two modes: initializer and launcher. When deployed as the initializer it will run the container so that you can exec into it and do your setup. When deployed as the launcher, the container will automatically call 'vkconfig launch'. This is expected to be done once everything has been setup.

| Parameter Name | Description | Default Value |
|----------------|-------------|---------------|
| affinity | Affinity to use with the pods to control where it is scheduled | |
| conf.configMapName | The name of the ConfigMap to use and optionally generate. If omitted, the chart will pick a suitable default. | |
| conf.content | Set of key/values pairs that will be included in the generated ConfigMap. This is ignored if conf.generate is false. | |
| conf.generate | If true, the helm chart will control creation of the vkconfig.conf ConfigMap. | true |
| fullNameOverride | Gives full controls over the name of the objects that get created. This takes precedence over nameOverride. | |
| initializerEnabled | If true, the initializer pod is created. This can be used to run any setup tasks needed. | true |
| image.pullPolicy | The pull policy to use for the image | IfNotPresent |
| image.repository | The image repository and name that contains the Vertica Kafka Scheduler | vertica/kafka-scheduler |
| image.tag | The tag corresponds to the version to use. The version of the Vertica Kafka Scheduler must match version of the Vertica server you are connecting to | Defaults to the charts appVersion |
| imagePullSecrets | A list of Secret's that are needed to be able to pull the image | |
| launcherEnabled | If true, the launch deployment is created. This should only be enabled once everything has been setup. | true |
| jvmOpts | Values to assign to the VKCONFIG_JVM_OPTS environment variable in the pods. You can omit most trustrtore/keystore settings as they are controlled by tls.* | |
| nameOverride | Controls the name of the objects that get created. This is combined with the helm chart release to form the name | |
| nodeSelector | A node selector to use with the pod to control where it is scheduled | |
| podAnnotations | Annotations to attach to the pods | |
| podSecurityContext | A PodSecurityContext to use for the pods | |
| replicaCount | If you want more than one launch pod deployed set this to a value greater than 1. | 1 |
| resourecs | Resources to use with the pod | |
| securityContext | A SecurityContext to use for the container in the pod | |
| serviceAccount.annotations | Annotations to attach to the ServiceAccount | |
| serviceAccount.create | If true, a ServiceAccount is created as part of the deployment | true |
| serviceAccount.name | Name of the service account. If not set and create is true, a name is generated using the fullname template | |
| tls.enabled | If true, we setup with the assumption that TLS authentication will be used. | false |
| tls.keyStoreMountPath | Directory name where the keystore will be mounted in the pod | |
| tls.keyStorePassword | The password to use along with the keystore | |
| tls.keyStoreSecretKey | A key within the tls.keyStoreSecretName that will be used as the keystore file name | |
| tls.keyStoreSecretName | Name of an existing Secret that contains the keystore | |
| tls.trustStoreMountPath | Directory name where the truststore will be mounted in the pod | |
| tls.trustStoreSecretKey | A key within tls.trustStoreSecretName that will be used as the truststore file name | |
| tls.trustStoreSecretName | Name of an existing Secret that contains the truststore | |
| tolerations | Tolerations to use with the pods to control where it is scheduled | |
24 changes: 24 additions & 0 deletions templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Vertica's Kafka Scheduler has been deployed.

{{ if .Values.initializerEnabled -}}
The initializer pod is running. You can exec into it and run your vkconfig
commands with this command:

kubectl exec -n {{ .Release.Namespace }} -it {{ include "vertica-kafka-scheduler.initializer-fullname" . }} -- bash

{{ end -}}
{{ if .Values.launcherEnabled -}}
{{- if eq (.Values.replicaCount | int) 1 }}
The launcher deployment object was created with a replica size of 1. You can
monitor the output of the pod with this command:

kubectl logs -n {{ .Release.Namespace }} deployment/{{ include "vertica-kafka-scheduler.fullname" . }}
{{- else if eq (.Values.replicaCount | int) 0 }}
The launcher deployment object was created, but no launcher pods are running
since the replica count is 0.
{{- else }}
The launcher deployment object was created with multiple replicas. A leader election process occurs to decide the pod that actually handles the traffic. You can list the pods with this command:

kubectl get pods -n {{ .Release.Namespace }} --selector vertica.com/kafka-scheduler-component=launcher
{{- end }}
{{ end }}
110 changes: 110 additions & 0 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "vertica-kafka-scheduler.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 "vertica-kafka-scheduler.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 a default fully qualified name for the initializer pod.
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 "vertica-kafka-scheduler.initializer-fullname" -}}
{{- if .Values.fullnameOverride }}
{{- cat .Values.fullnameOverride "-initializer" | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- printf "%s-initializer" .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s-initializer" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create a default fully qualified name for the configMap.
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 "vertica-kafka-scheduler.configmap-fullname" -}}
{{- if .Values.conf.configMapName }}
{{- .Values.conf.configMapName }}
{{- else 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 "vertica-kafka-scheduler.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "vertica-kafka-scheduler.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "vertica-kafka-scheduler.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Generate te value for VKCONFIG_JVM_OPTS based on values.yaml
*/}}
{{- define "vertica-kafka-scheduler.jvmOpts" -}}
{{ default (quote "") .Values.jvmOpts }}
{{- if .Values.tls.enabled }}
-Djavax.net.ssl.trustStore={{ .Values.tls.trustStoreMountPath }}/{{ .Values.tls.trustStoreSecretKey }} -Djavax.net.ssl.keyStore={{ .Values.tls.keyStoreMountPath }}/{{ .Values.tls.keyStoreSecretKey }} -Djavax.net.ssl.keyStorePassword={{ .Values.tls.keystorePassword }}
{{- end }}
{{- end }}
32 changes: 32 additions & 0 deletions templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- if .Values.conf.generate }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "vertica-kafka-scheduler.configmap-fullname" . }}
labels:
{{- include "vertica-kafka-scheduler.labels" . | nindent 4 }}
data:
vkconfig.conf: |
{{- range $key, $value := $.Values.conf.content }}
{{ $key }}={{ $value }}
{{- end }}
vkafka-log-config.xml: |
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="error" shutdownHook="disable">
<Appenders>
<Console name="stdout" target="SYSTEM.OUT">
<PatternLayout>
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%X{PID}:%t] %logger::%t %X{tuple} [%p] %m%n</Pattern>
</PatternLayout>
</Console>
</Appenders>
<Loggers>
<Logger name="com.vertica.solutions.kafka" level="info" additivity="false">
<AppenderRef ref="stdout"/>
</Logger>
</Loggers>
</Configuration>
{{- end }}
80 changes: 80 additions & 0 deletions templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{{- if .Values.launcherEnabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "vertica-kafka-scheduler.fullname" . }}
labels:
{{- include "vertica-kafka-scheduler.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
vertica.com/kafka-scheduler-component: "launcher"
{{- include "vertica-kafka-scheduler.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
vertica.com/kafka-scheduler-component: "launcher"
{{- include "vertica-kafka-scheduler.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "vertica-kafka-scheduler.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: main
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- vkconfig
- launch
- --conf
- /opt/vertica/packages/kafka/config/vkconfig.conf
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: vkconfig
mountPath: /opt/vertica/packages/kafka/config
{{- if .Values.tls.enabled }}
- name: trustStore
mountPath: {{ .Values.tls.trustStoreMountPath }}
- name: keyStore
mountPath: {{ .Values.tls.keyStoreMountPath }}
{{- end }}
env:
- name: VKCONFIG_JVM_OPTS
value: {{ include "vertica-kafka-scheduler.jvmOpts" . }}
volumes:
- name: vkconfig
configMap:
name: {{ include "vertica-kafka-scheduler.configmap-fullname" . }}
{{- if .Values.tls.enabled }}
- name: trustStore
secret:
secretName: {{ .Values.tls.trustStoreSecretName }}
- name: keyStore
secret:
secretName: {{ .Values.tls.keyStoreSecretName }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end -}}
64 changes: 64 additions & 0 deletions templates/pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{{- if .Values.initializerEnabled }}
apiVersion: v1
kind: Pod
metadata:
name: {{ include "vertica-kafka-scheduler.initializer-fullname" . }}
labels:
vertica.com/kafka-scheduler-component: "initializer"
{{- include "vertica-kafka-scheduler.labels" . | nindent 4 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "vertica-kafka-scheduler.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: main
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- sleep
- infinity
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: vkconfig
mountPath: /opt/vertica/packages/kafka/config
{{- if .Values.tls.enabled }}
- name: trustStore
mountPath: {{ .Values.tls.trustStoreMountPath }}
- name: keyStore
mountPath: {{ .Values.tls.keyStoreMountPath }}
{{- end }}
env:
- name: VKCONFIG_JVM_OPTS
value: {{ include "vertica-kafka-scheduler.jvmOpts" . }}
volumes:
- name: vkconfig
configMap:
name: {{ include "vertica-kafka-scheduler.configmap-fullname" . }}
{{- if .Values.tls.enabled }}
- name: trustStore
secret:
secretName: {{ .Values.tls.trustStoreSecretName }}
- name: keyStore
secret:
secretName: {{ .Values.tls.keyStoreSecretName }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end -}}
12 changes: 12 additions & 0 deletions templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "vertica-kafka-scheduler.serviceAccountName" . }}
labels:
{{- include "vertica-kafka-scheduler.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
Loading

0 comments on commit fa353b0

Please sign in to comment.