You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tz...@apache.org on 2020/03/25 08:50:40 UTC

[flink-statefun] 01/05: [FLINK-16757] Add Helm charts under tools

This is an automated email from the ASF dual-hosted git repository.

tzulitai pushed a commit to branch release-2.0
in repository https://gitbox.apache.org/repos/asf/flink-statefun.git

commit ca733bdefecca82f4a0b769b15458ce2afb360b7
Author: Igal Shilman <ig...@gmail.com>
AuthorDate: Tue Mar 24 22:34:35 2020 +0100

    [FLINK-16757] Add Helm charts under tools
---
 tools/k8s/Chart.yaml                         | 21 +++++++++
 tools/k8s/templates/config-map.yaml          | 47 ++++++++++++++++++++
 tools/k8s/templates/master-deployment.yaml   | 63 ++++++++++++++++++++++++++
 tools/k8s/templates/master-rest-service.yaml | 28 ++++++++++++
 tools/k8s/templates/master-service.yaml      | 31 +++++++++++++
 tools/k8s/templates/worker-deployment.yaml   | 66 ++++++++++++++++++++++++++++
 tools/k8s/values.yaml                        | 31 +++++++++++++
 7 files changed, 287 insertions(+)

diff --git a/tools/k8s/Chart.yaml b/tools/k8s/Chart.yaml
new file mode 100644
index 0000000..032d7ce
--- /dev/null
+++ b/tools/k8s/Chart.yaml
@@ -0,0 +1,21 @@
+# 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.
+#
+apiVersion: v2
+name: statefun-k8s
+description: A Helm chart for a Stateful function pplication deployed on Kubernetes
+type: application
+version: 2.0-SNAPSHOT
+appVersion: 1.16.0
\ No newline at end of file
diff --git a/tools/k8s/templates/config-map.yaml b/tools/k8s/templates/config-map.yaml
new file mode 100644
index 0000000..a57e7ff
--- /dev/null
+++ b/tools/k8s/templates/config-map.yaml
@@ -0,0 +1,47 @@
+# 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.
+#
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: flink-config
+  labels:
+    app: statefun
+data:
+  flink-conf.yaml: |+
+    jobmanager.rpc.address: {{ .Values.master.name }}
+    taskmanager.numberOfTaskSlots: 1
+    blob.server.port: 6124
+    jobmanager.rpc.port: 6123
+    taskmanager.rpc.port: 6122
+    classloader.parent-first-patterns.additional: org.apache.flink.statefun;org.apache.kafka;com.google.protobuf
+    state.checkpoints.dir: {{ .Values.checkpoint.dir }}
+    state.backend: rocksdb
+    state.backend.rocksdb.timer-service.factory: ROCKSDB
+    state.backend.incremental: true
+    execution.checkpointing.interval: {{ .Values.checkpoint.interval }}
+    taskmanager.memory.process.size: {{ .Values.worker.jvm_mem }}
+    parallelism.default: {{ .Values.worker.replicas }}
+
+  log4j-console.properties: |+
+    log4j.rootLogger=INFO, console
+    log4j.appender.console=org.apache.log4j.ConsoleAppender
+    log4j.appender.console.layout=org.apache.log4j.PatternLayout
+    log4j.appender.console.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p %-60c %x - %m%n
+    log4j.logger.akka=INFO
+    log4j.logger.org.apache.kafka=INFO
+    log4j.logger.org.apache.hadoop=INFO
+    log4j.logger.org.apache.zookeeper=INFO
+    log4j.logger.org.apache.flink.shaded.akka.org.jboss.netty.channel.DefaultChannelPipeline=ERROR
diff --git a/tools/k8s/templates/master-deployment.yaml b/tools/k8s/templates/master-deployment.yaml
new file mode 100644
index 0000000..e46e988
--- /dev/null
+++ b/tools/k8s/templates/master-deployment.yaml
@@ -0,0 +1,63 @@
+# 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.
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: {{ .Values.master.name }}
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: statefun
+      component: master
+  template:
+    metadata:
+      labels:
+        app: statefun
+        component: master
+    spec:
+      containers:
+        - name: master
+          image: {{ .Values.statefun_image }}
+          env:
+            - name: ROLE
+              value: master
+            - name: MASTER_HOST
+              value: {{ .Values.master.name }}
+          ports:
+            - containerPort: 6123
+              name: rpc
+            - containerPort: 6124
+              name: blob
+            - containerPort: 8081
+              name: ui
+          livenessProbe:
+            tcpSocket:
+              port: 6123
+            initialDelaySeconds: 30
+            periodSeconds: 60
+          volumeMounts:
+            - name: flink-config-volume
+              mountPath: /opt/flink/conf
+      volumes:
+        - name: flink-config-volume
+          configMap:
+            name: flink-config
+            items:
+              - key: flink-conf.yaml
+                path: flink-conf.yaml
+              - key: log4j-console.properties
+                path: log4j-console.properties
diff --git a/tools/k8s/templates/master-rest-service.yaml b/tools/k8s/templates/master-rest-service.yaml
new file mode 100644
index 0000000..d09861d
--- /dev/null
+++ b/tools/k8s/templates/master-rest-service.yaml
@@ -0,0 +1,28 @@
+# 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.
+#
+apiVersion: v1
+kind: Service
+metadata:
+  name: {{.Values.master.name}}-rest
+spec:
+  type: NodePort
+  ports:
+    - name: rest
+      port: 8081
+      targetPort: 8081
+  selector:
+    app: statefun
+    component: master
diff --git a/tools/k8s/templates/master-service.yaml b/tools/k8s/templates/master-service.yaml
new file mode 100644
index 0000000..116180a
--- /dev/null
+++ b/tools/k8s/templates/master-service.yaml
@@ -0,0 +1,31 @@
+# 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.
+#
+apiVersion: v1
+kind: Service
+metadata:
+  name: {{ .Values.master.name }}
+spec:
+  type: ClusterIP
+  ports:
+    - name: rpc
+      port: 6123
+    - name: blob
+      port: 6124
+    - name: ui
+      port: 8081
+  selector:
+    app: statefun
+    component: master
diff --git a/tools/k8s/templates/worker-deployment.yaml b/tools/k8s/templates/worker-deployment.yaml
new file mode 100644
index 0000000..2d1100a
--- /dev/null
+++ b/tools/k8s/templates/worker-deployment.yaml
@@ -0,0 +1,66 @@
+# 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.
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: {{ .Values.worker.name }}
+spec:
+  replicas: {{ .Values.worker.replicas }}
+  selector:
+    matchLabels:
+      app: statefun
+      component: worker
+  template:
+    metadata:
+      labels:
+        app: statefun
+        component: worker
+    spec:
+      containers:
+        - name: worker
+          image: {{ .Values.statefun_image }}
+          env:
+            - name: ROLE
+              value: worker
+            - name: MASTER_HOST
+              value: {{ .Values.master.name }}
+          resources:
+            requests:
+              memory: "{{ .Values.worker.container_mem }}"
+          ports:
+            - containerPort: 6123
+              name: rpc
+            - containerPort: 6124
+              name: blob
+            - containerPort: 8081
+              name: ui
+          livenessProbe:
+            tcpSocket:
+              port: 6123
+            initialDelaySeconds: 30
+            periodSeconds: 60
+          volumeMounts:
+            - name: flink-config-volume
+              mountPath: /opt/flink/conf
+      volumes:
+        - name: flink-config-volume
+          configMap:
+            name: flink-config
+            items:
+              - key: flink-conf.yaml
+                path: flink-conf.yaml
+              - key: log4j-console.properties
+                path: log4j-console.properties
diff --git a/tools/k8s/values.yaml b/tools/k8s/values.yaml
new file mode 100644
index 0000000..624fa75
--- /dev/null
+++ b/tools/k8s/values.yaml
@@ -0,0 +1,31 @@
+# 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.
+#
+
+checkpoint:
+  dir: file:///checkpoint-dir
+  interval: 10sec
+
+master:
+  name: statefun-master
+  image: statefun-application # replace with your image
+
+worker:
+  name: statefun-worker
+  image: statefun-application # replace with your image
+  jvm_mem: 1g
+  container_mem: 1.5Gi
+  replicas: 3
+