Skip to content

Commit

Permalink
Add nats to k8s installation config (#818)
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikriemer committed Dec 2, 2022
1 parent 1e680aa commit 2f67afd
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 3 deletions.
4 changes: 2 additions & 2 deletions installer/k8s/templates/core/backend-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ spec:
imagePullPolicy: {{ .Values.pullPolicy }}
env:
- name: SP_PRIORITIZED_PROTOCOL
{{ if (eq .Values.preferredBroker "mqtt") }}
value: "mqtt"
{{ if (eq .Values.preferredBroker "nats") }}
value: "nats"
{{ else }}
value: "kafka"
{{ end }}
Expand Down
2 changes: 2 additions & 0 deletions installer/k8s/templates/external/kafka/kafka-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

{{- if eq .Values.preferredBroker "kafka" }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -65,3 +66,4 @@ spec:
value: "5000012"
- name: KAFKA_REPLICA_FETCH_MAX_BYTES
value: "10000000"
{{- end }}
2 changes: 2 additions & 0 deletions installer/k8s/templates/external/kafka/kafka-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

{{- if eq .Values.preferredBroker "kafka" }}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -26,3 +27,4 @@ spec:
- name: main
protocol: TCP
port: 9092
{{- end }}
45 changes: 45 additions & 0 deletions installer/k8s/templates/external/nats/nats-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.

{{- if eq .Values.preferredBroker "nats" }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: nats
spec:
selector:
matchLabels:
app: nats
replicas: 1
template:
metadata:
labels:
app: nats
spec:
initContainers:
- name: init-wait-consul
image: alpine
command: ["sh", "-c", "for i in $(seq 1 300); do nc -zvw1 consul 8500 && exit 0 || sleep 3; done; exit 1"]
volumes:
- name: kafka-pv
persistentVolumeClaim:
claimName: kafka-pvc
containers:
- name: nats
image: nats
imagePullPolicy: {{ .Values.pullPolicy }}
ports:
- containerPort: 4222
{{- end }}
30 changes: 30 additions & 0 deletions installer/k8s/templates/external/nats/nats-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.

{{- if eq .Values.preferredBroker "nats" }}
apiVersion: v1
kind: Service
metadata:
name: nats
labels:
name: nats
spec:
selector:
app: nats
ports:
- name: main
protocol: TCP
port: 4222
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

{{- if eq .Values.preferredBroker "kafka" }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -42,3 +43,4 @@ spec:
volumeMounts:
- mountPath: "/opt/zookeeper-{{ .Values.external.zookeeperVersion }}/data"
name: zookeeper-pv
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

{{- if eq .Values.preferredBroker "kafka" }}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -25,3 +26,4 @@ spec:
protocol: TCP
port: 2181
targetPort: 2181
{{- end }}
2 changes: 1 addition & 1 deletion installer/k8s/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

# lite or full (default: lite)
deployment: lite
preferredBroker: "kafka"
preferredBroker: "nats"
pullPolicy: "IfNotPresent"
persistentVolumeReclaimPolicy: "Delete"
persistentVolumeAccessModes: "ReadWriteOnce"
Expand Down

0 comments on commit 2f67afd

Please sign in to comment.