DMaaP MR fixes
[oom.git] / kubernetes / dmaap / components / message-router / charts / message-router-kafka / templates / statefulset.yaml
index f4583a1..bfe4b11 100644 (file)
@@ -34,7 +34,11 @@ spec:
         release: {{ .Release.Name }}
     spec:
       podAntiAffinity:
+         {{if eq .Values.podAntiAffinityType "hard" -}}
+         requiredDuringSchedulingIgnoredDuringExecution:
+         {{- else -}}
          preferredDuringSchedulingIgnoredDuringExecution:
+         {{- end}}
          - weight: 1
            podAffinityTerm:
              labelSelector:
@@ -66,14 +70,43 @@ spec:
         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         name: {{ include "common.name" . }}-readiness
+      - command:
+        -  sh
+        - -exec
+        - |
+          chown -R 1000:1000 /opt/kafka/data;
+          cp /opt/kafka/tmpconfig/server.properties /opt/kafka/config/;
+          chown 1000:1000 /opt/kafka/config/server.properties;
+          cd /opt/kafka/config;
+          ls;
+        image: "{{ .Values.busyBoxRepository }}/{{ .Values.busyBoxImage }}"
+        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+        volumeMounts:
+        - mountPath: /opt/kafka/data
+          name: kafka-data
+        - mountPath: /opt/kafka/tmpconfig/server.properties
+          subPath: server.properties
+          name: server
+        - mountPath: /opt/kafka/config
+          name: config-data
+        name: {{ include "common.name" . }}-permission-fixer
       containers:
       - name: {{ include "common.name" .  }}
         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
         imagePullPolicy:  {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+        command:
+        - sh
+        - -exc
+        - |
+          export KAFKA_BROKER_ID=${HOSTNAME##*-} && \
+          export ENDPOINT_PORT=$(( $KAFKA_BROKER_ID + {{ .Values.service.baseNodePort }} )) && \
+          export KAFKA_ADVERTISED_LISTENERS=EXTERNAL_SASL_PLAINTEXT://$(HOST_IP):$(( $KAFKA_BROKER_ID + {{ .Values.service.baseNodePort }} )),INTERNAL_SASL_PLAINTEXT://:{{ .Values.service.internalPort }} && \
+          exec start-kafka.sh
         resources:
 {{ include "common.resources" . | indent 12 }}
         ports:
         - containerPort: {{ .Values.service.internalPort }}
+        - containerPort: {{ .Values.service.externalPort }}
        {{ if eq .Values.liveness.enabled true }}
         livenessProbe:
           tcpSocket:
@@ -87,43 +120,33 @@ spec:
           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
           periodSeconds: {{ .Values.readiness.periodSeconds }}
         env:
-        - name: HOST_NAME
-          valueFrom:
-            fieldRef:
-              apiVersion: v1
-              fieldPath: metadata.name
-        - name: HOST_NAMESPACE
+        - name: HOST_IP
           valueFrom:
             fieldRef:
               apiVersion: v1
-              fieldPath: metadata.namespace
-        - name: KAFKA_ZOOKEEPER_CONNECT
-          value: "{{.Values.zookeeper.name}}:{{.Values.zookeeper.port}}"
-        - name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP
-          value: "INTERNAL_PLAINTEXT:PLAINTEXT,EXTERNAL_PLAINTEXT:PLAINTEXT"
-        - name: KAFKA_ADVERTISED_LISTENERS
-          value: "INTERNAL_PLAINTEXT://$(HOST_NAME).{{ .Values.service.name }}.$(HOST_NAMESPACE).svc.cluster.local:{{ .Values.service.internalPort}}"
-        - name: KAFKA_LISTENERS
-          value: "INTERNAL_PLAINTEXT://0.0.0.0:{{.Values.service.internalPort}}"
-        - name: KAFKA_INTER_BROKER_LISTENER_NAME
-          value: "INTERNAL_PLAINTEXT"
-        - name: KAFKA_LOG_DIRS
-          value: "kafka/logs"
-        - name: BROKER_ID_COMMAND
-          value: "hostname | awk -F '-' '{print $NF}'"
-        - name: KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR
-          value: "{{ .Values.replicaCount }}"
-        - name: KAFKA_DEFAULT_REPLICATION_FACTOR
-          value: "{{ .Values.replicaCount }}"
-        - name: KAFKA_NUM_PARTITIONS
-          value: "{{ .Values.defaultpartitions }}"
+              fieldPath: status.hostIP
+        - name: aaf_locate_url
+          value: https://aaf-locate.{{ include "common.namespace" . }}:8095
+
         volumeMounts:
         - mountPath: /etc/localtime
           name: localtime
           readOnly: true
         - mountPath: /var/run/docker.sock
           name: docker-socket
-        - mountPath: /kafka
+        - mountPath: /opt/kafka/tmpconfig/server.properties
+          subPath: server.properties
+          name: server
+        - mountPath: /opt/kafka/config/server.properties
+          subPath: server.properties
+          name: config-data
+        - mountPath: /opt/kafka/config/log4j.properties
+          subPath: log4j.properties
+          name: log4j
+        - mountPath: /opt/kafka/config/cadi.properties
+          subPath: cadi.properties
+          name: cadi
+        - mountPath: /opt/kafka/data
           name: kafka-data
       {{- if .Values.tolerations }}
       tolerations:
@@ -133,9 +156,20 @@ spec:
       - name: localtime
         hostPath:
           path: /etc/localtime
+      - name: config-data
+        emptyDir: {}
       - name: docker-socket
         hostPath:
           path: /var/run/docker.sock
+      - name: server
+        configMap:
+          name: {{ include "common.fullname" . }}-server-prop-configmap
+      - name: log4j
+        configMap:
+          name: {{ include "common.fullname" . }}-log4j-prop-configmap
+      - name: cadi
+        configMap:
+          name: {{ include "common.fullname" . }}-cadi-prop-configmap
 {{ if not .Values.persistence.enabled }}
       - name: kafka-data
         emptyDir: {}
@@ -162,4 +196,4 @@ spec:
             heritage: "{{ .Release.Service }}"
 {{ end }}
       imagePullSecrets:
-      - name: "{{ include "common.namespace" . }}-docker-registry-key"
+      - name: "{{ include "common.namespace" . }}-docker-registry-key"
\ No newline at end of file