Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions charts/warpstream/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v2
name: warpstream
description: A Helm chart for WarpStream - a cloud-native, Kafka-compatible streaming platform
type: application
version: 0.0.1
appVersion: "v694"
home: https://www.warpstream.com/
maintainers:
- name: zopdev
url: https://zop.dev
- name: warpstream
url: https://www.warpstream.com
annotations:
# REQUIRED: zop.dev integration annotation
type: "application"
32 changes: 32 additions & 0 deletions charts/warpstream/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "warpstream.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo "Kafka endpoint: $NODE_IP:$NODE_PORT"
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "warpstream.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "warpstream.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo "Kafka endpoint: $SERVICE_IP:{{ .Values.service.port }}"
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "warpstream.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:9092 to use your WarpStream cluster"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 9092:$CONTAINER_PORT
{{- end }}

2. Connect your Kafka clients to:
Bootstrap servers: {{ include "warpstream.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.port }}

3. Monitor your WarpStream cluster:
Metrics endpoint: {{ include "warpstream.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.metricsPort }}

4. Schema Registry endpoint:
{{ include "warpstream.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.schemaRegistryPort }}

83 changes: 83 additions & 0 deletions charts/warpstream/templates/_helper.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "warpstream.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
*/}}
{{- define "warpstream.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 "warpstream.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

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

{{/*
WarpStream agent arguments
*/}}
{{- define "warpstream.args" -}}
- "agent"
{{- if .Values.warpstream.agent.virtualClusterId }}
- "-defaultVirtualClusterID"
- {{ .Values.warpstream.agent.virtualClusterId | quote }}
{{- end }}
- "-region"
- {{ .Values.warpstream.agent.region | quote }}
- "-roles"
- {{ join "," .Values.warpstream.agent.roles | quote }}
{{- if .Values.warpstream.agent.agentPoolId }}
- "-agentPoolID"
- {{ .Values.warpstream.agent.agentPoolId | quote }}
{{- end }}
{{- if .Values.warpstream.storage.bucketURL }}
- "-bucketURL"
- {{ .Values.warpstream.storage.bucketURL | quote }}
{{- end }}
{{- end }}
40 changes: 40 additions & 0 deletions charts/warpstream/templates/alerts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{{- if .Values.monitoring.alerts.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "warpstream.fullname" . }}-alerts
labels:
{{- include "warpstream.labels" . | nindent 4 }}
grafana_alert: "1"
data:
warpstream-alerts.yaml: |
groups:
- name: warpstream
rules:
- alert: WarpStreamDown
expr: up{job="{{ include "warpstream.fullname" . }}"} == 0
for: 2m
labels:
severity: critical
annotations:
summary: "WarpStream agent is down"
description: "WarpStream agent {{ "{{ $labels.instance }}" }} has been down for more than 2 minutes."

- alert: WarpStreamHighMemoryUsage
expr: (container_memory_usage_bytes{pod=~"{{ include "warpstream.fullname" . }}.*"} / container_spec_memory_limit_bytes) > 0.85
for: 5m
labels:
severity: warning
annotations:
summary: "WarpStream agent high memory usage"
description: "WarpStream agent {{ "{{ $labels.pod }}" }} memory usage is above 85%."

- alert: WarpStreamHighCPUUsage
expr: (rate(container_cpu_usage_seconds_total{pod=~"{{ include "warpstream.fullname" . }}.*"}[5m]) / container_spec_cpu_quota * container_spec_cpu_period) > 0.85
for: 5m
labels:
severity: warning
annotations:
summary: "WarpStream agent high CPU usage"
description: "WarpStream agent {{ "{{ $labels.pod }}" }} CPU usage is above 85%."
{{- end }}
116 changes: 116 additions & 0 deletions charts/warpstream/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "warpstream.fullname" . }}
labels:
{{- include "warpstream.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "warpstream.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "warpstream.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "warpstream.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- range . }}
- maxSkew: {{ .maxSkew }}
topologyKey: {{ .topologyKey }}
whenUnsatisfiable: {{ .whenUnsatisfiable }}
labelSelector:
matchLabels:
{{- include "warpstream.selectorLabels" $ | nindent 14 }}
{{- end }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
{{- include "warpstream.args" . | nindent 12 }}
ports:
- name: kafka
containerPort: 9092
protocol: TCP
- name: metrics
containerPort: 8080
protocol: TCP
- name: schema-registry
containerPort: 9094
protocol: TCP
env:
- name: WARPSTREAM_API_KEY
valueFrom:
secretKeyRef:
name: {{ include "warpstream.fullname" . }}-secret
key: api-key
- name: WARPSTREAM_LOG_LEVEL
value: {{ .Values.warpstream.agent.logLevel | quote }}
{{- if .Values.warpstream.agent.availabilityZone }}
- name: WARPSTREAM_AVAILABILITY_ZONE
value: {{ .Values.warpstream.agent.availabilityZone | quote }}
{{- end }}
{{- if .Values.warpstream.performance.gomaxprocs }}
- name: GOMAXPROCS
value: {{ .Values.warpstream.performance.gomaxprocs | quote }}
{{- end }}
{{- range .Values.warpstream.extraEnvVars }}
- name: {{ .name }}
value: {{ .value | quote }}
{{- end }}
livenessProbe:
httpGet:
path: /metrics
port: metrics
initialDelaySeconds: 30
periodSeconds: 30
readinessProbe:
httpGet:
path: /metrics
port: metrics
initialDelaySeconds: 5
periodSeconds: 10
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if .Values.persistence.enabled }}
volumeMounts:
- name: data
mountPath: /tmp/warpstream
{{- end }}
{{- if .Values.persistence.enabled }}
volumes:
- name: data
persistentVolumeClaim:
claimName: {{ include "warpstream.fullname" . }}-pvc
{{- 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 }}

32 changes: 32 additions & 0 deletions charts/warpstream/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "warpstream.fullname" . }}
labels:
{{- include "warpstream.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "warpstream.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
18 changes: 18 additions & 0 deletions charts/warpstream/templates/poddisruptionbudget.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if .Values.podDisruptionBudget.enabled }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "warpstream.fullname" . }}
labels:
{{- include "warpstream.labels" . | nindent 4 }}
spec:
{{- if .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if .Values.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
{{- end }}
selector:
matchLabels:
{{- include "warpstream.selectorLabels" . | nindent 6 }}
{{- end }}
17 changes: 17 additions & 0 deletions charts/warpstream/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if .Values.persistence.enabled }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "warpstream.fullname" . }}-pvc
labels:
{{- include "warpstream.labels" . | nindent 4 }}
spec:
accessModes:
- {{ .Values.persistence.accessMode }}
resources:
requests:
storage: {{ .Values.persistence.size }}
{{- if .Values.persistence.storageClass }}
storageClassName: {{ .Values.persistence.storageClass }}
{{- end }}
{{- end }}
27 changes: 27 additions & 0 deletions charts/warpstream/templates/rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "warpstream.fullname" . }}
labels:
{{- include "warpstream.labels" . | nindent 4 }}
rules:
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "warpstream.fullname" . }}
labels:
{{- include "warpstream.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "warpstream.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ include "warpstream.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
Loading