Skip to content

Commit

Permalink
Merge pull request #157 from warpstreamlabs/service-per-pod-ss
Browse files Browse the repository at this point in the history
Service per pod
  • Loading branch information
rmb938 authored Dec 23, 2024
2 parents e916ce3 + 88af0b8 commit cbf102d
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 2 deletions.
6 changes: 5 additions & 1 deletion charts/warpstream-agent/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.13.69] - 2024-12-XX
## [0.13.70] - 2024-12-23

- Add the ability to create services per pod to expose each pod outside of the cluster

## [0.13.69] - 2024-12-19

- Make certificates first class variables so it is easier to configure without having to use volumes and env variables

Expand Down
2 changes: 1 addition & 1 deletion charts/warpstream-agent/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: warpstream-agent
description: WarpStream Agent for Kubernetes.
type: application
version: 0.13.69
version: 0.13.70
appVersion: v609
icon: https://avatars.githubusercontent.com/u/132156278
home: https://docs.warpstream.com/warpstream/
Expand Down
47 changes: 47 additions & 0 deletions charts/warpstream-agent/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
apiVersion: v1
kind: Service
metadata:
Expand Down Expand Up @@ -32,3 +33,49 @@ spec:
{{- end }}
selector:
{{- include "warpstream-agent.selectorLabels" . | nindent 4 }}
...
{{- if .Values.service.perPod }}
{{- if and (eq (include "warpstream-agent.deploymentKind" .) "StatefulSet") (.Values.service.perPod.enabled) }}
{{ $replicas := (.Values.replicas | int) }}
{{- range $i, $e := until $replicas }}
{{- with $ }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "warpstream-agent.fullname" . }}-{{ $i }}
labels:
{{- include "warpstream-agent.labels" . | nindent 4 }}
{{- with .Values.service.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
ports:
{{- if or (.Values.config.playground) (not (hasPrefix "vci_sr_" .Values.config.virtualClusterID)) }}
- port: {{ .Values.service.port }}
targetPort: kafka
protocol: TCP
name: kafka
{{- end }}
- port: {{ .Values.service.httpPort }}
targetPort: http
protocol: TCP
name: http
{{- if or (.Values.config.playground) (hasPrefix "vci_sr_" .Values.config.virtualClusterID) }}
- port: {{ .Values.service.schemaRegistryPort | default 9094 }}
targetPort: schema-registry
protocol: TCP
name: schema-registry
{{- end }}
selector:
statefulset.kubernetes.io/pod-name: {{ include "warpstream-agent.fullname" . }}-{{ $i }}
...
{{- end }}
{{- end }}
{{- end }}
{{- end }}
6 changes: 6 additions & 0 deletions charts/warpstream-agent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ service:
schemaRegistryPort: 9094
labels: {}

# Create services per pod, this can be used in combination with deploymentKind=StatefulSet and statefulSetConfig.clusterDomain
# to expose each pod outside of the cluster when using Kong or Isto ingresses.
# See https://github.com/warpstreamlabs/charts/pull/156 for details
perPod:
enabled: false

# A service that only contains the Kafka TCP port
# Typically used to help with exposing only Kafka via a Load Balancer
kafkaService:
Expand Down

0 comments on commit cbf102d

Please sign in to comment.