>From Ian Maxon <[email protected]>:

Ian Maxon has uploaded this change for review. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18242 )


Change subject: [ASTERIXDB-3382][CONF] Add Helm chart
......................................................................

[ASTERIXDB-3382][CONF] Add Helm chart

Details:
Helm chart using a StatefulSet to deploy a AsterixDB Cluster on Kubernetes.

Change-Id: Ibdacf4e6b156a3b6ef15b4420a4102c122f8bf1c
---
A asterixdb/asterix-helm/src/main/templates/configmap.yaml
M asterixdb/pom.xml
A asterixdb/asterix-helm/src/main/Chart.yaml
A asterixdb/asterix-helm/pom.xml
A asterixdb/asterix-helm/src/main/templates/ccnc-service.yaml
A asterixdb/asterix-helm/src/main/values.yaml
A asterixdb/asterix-helm/src/main/templates/_helpers.tpl
A asterixdb/asterix-helm/src/main/templates/ccnc-statefulset.yaml
8 files changed, 390 insertions(+), 0 deletions(-)



  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/42/18242/1

diff --git a/asterixdb/asterix-helm/pom.xml b/asterixdb/asterix-helm/pom.xml
new file mode 100644
index 0000000..0ac7e60
--- /dev/null
+++ b/asterixdb/asterix-helm/pom.xml
@@ -0,0 +1,99 @@
+<!--
+ ! 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.
+ !-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>apache-asterixdb</artifactId>
+    <groupId>org.apache.asterix</groupId>
+    <version>0.9.10-SNAPSHOT</version>
+  </parent>
+  <artifactId>asterix-helm</artifactId>
+    <dependencies>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>asterix-podman</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.testcontainers</groupId>
+            <artifactId>testcontainers</artifactId>
+            <version>1.17.1</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+  <properties>
+    <root.dir>${basedir}/..</root.dir>
+  </properties>
+
+  <licenses>
+    <license>
+      <name>Apache License, Version 2.0</name>
+      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+      <distribution>repo</distribution>
+      <comments>A business-friendly OSS license</comments>
+    </license>
+  </licenses>
+   <build>
+       <plugins>
+           <plugin>
+               <groupId>org.apache.rat</groupId>
+               <artifactId>apache-rat-plugin</artifactId>
+               <configuration>
+                   <excludes combine.children="append">
+                       <exclude>src/test/resources/setup.sh</exclude>
+                       <exclude>src/test/resources/passwd</exclude>
+                       
<exclude>src/test/resources/socktest/Containerfile</exclude>
+                       <exclude>src/test/resources/testenv.conf</exclude>
+                   </excludes>
+               </configuration>
+           </plugin>
+       </plugins>
+   </build>
+    <profiles>
+        <profile>
+            <id>podman.tests</id>
+            <properties>
+                <test.excludes>**/*.java</test.excludes>
+                <itest.includes>**/PodmanPythonFunctionIT.java</itest.includes>
+                <failIfNoTests>false</failIfNoTests>
+            </properties>
+            <build>
+            </build>
+        </profile>
+        <profile>
+            <id>podman.img</id>
+            <build>
+                <plugins>
+                  <plugin>
+                    <groupId>io.kokuwa.maven</groupId>
+                    <artifactId>helm-maven-plugin</artifactId>
+                    <version>6.14.0</version>
+                    <configuration>
+                      <chartDirectory>${project.basedir}</chartDirectory>
+                      <chartVersion>0.1.1</chartVersion>
+                    </configuration>
+                  </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+</project>
diff --git a/asterixdb/asterix-helm/src/main/Chart.yaml 
b/asterixdb/asterix-helm/src/main/Chart.yaml
new file mode 100644
index 0000000..db57e79
--- /dev/null
+++ b/asterixdb/asterix-helm/src/main/Chart.yaml
@@ -0,0 +1,24 @@
+# ------------------------------------------------------------
+# 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: asterixdb
+description: Basic Helm chart for AsterixDB
+type: application
+version: 0.1.1
+appVersion: "0.9.10-SNAPSHOT"
diff --git a/asterixdb/asterix-helm/src/main/templates/_helpers.tpl 
b/asterixdb/asterix-helm/src/main/templates/_helpers.tpl
new file mode 100644
index 0000000..7f5237d
--- /dev/null
+++ b/asterixdb/asterix-helm/src/main/templates/_helpers.tpl
@@ -0,0 +1,81 @@
+# ------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------
+
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "asterixdb.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
+{{- end }}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to 
this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "asterixdb.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 "asterixdb.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | 
trimSuffix "-" }}
+{{- end }}
+
+{{/*
+Common labels
+*/}}
+{{- define "asterixdb.labels" -}}
+helm.sh/chart: {{ include "asterixdb.chart" . }}
+{{ include "asterixdb.selectorLabels" . }}
+{{- if .Chart.AppVersion }}
+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
+{{- end }}
+app.kubernetes.io/managed-by: {{ .Release.Service }}
+{{- end }}
+
+{{/*
+Selector labels
+*/}}
+{{- define "asterixdb.selectorLabels" -}}
+app.kubernetes.io/name: {{ include "asterixdb.name" . }}
+app.kubernetes.io/instance: {{ .Release.Name }}
+{{- end }}
+
+{{/*
+Create the name of the service account to use
+*/}}
+{{- define "asterixdb.serviceAccountName" -}}
+{{- if .Values.serviceAccount.create }}
+{{- default (include "asterixdb.fullname" .) .Values.serviceAccount.name }}
+{{- else }}
+{{- default "default" .Values.serviceAccount.name }}
+{{- end }}
+{{- end }}
diff --git a/asterixdb/asterix-helm/src/main/templates/ccnc-service.yaml 
b/asterixdb/asterix-helm/src/main/templates/ccnc-service.yaml
new file mode 100644
index 0000000..a4aee87
--- /dev/null
+++ b/asterixdb/asterix-helm/src/main/templates/ccnc-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: {{ .Release.Name }}-svc
+  labels:
+    app: {{ .Release.Name }}-ccnc
+spec:
+  publishNotReadyAddresses: true
+  clusterIP: None
+  selector:
+    app: {{ .Release.Name }}-ccnc
+  sessionAffinity: None
+  type: ClusterIP
diff --git a/asterixdb/asterix-helm/src/main/templates/ccnc-statefulset.yaml 
b/asterixdb/asterix-helm/src/main/templates/ccnc-statefulset.yaml
new file mode 100644
index 0000000..bab54f3
--- /dev/null
+++ b/asterixdb/asterix-helm/src/main/templates/ccnc-statefulset.yaml
@@ -0,0 +1,81 @@
+# ------------------------------------------------------------
+# 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: StatefulSet
+metadata:
+  name: {{ .Release.Name }}-ccnc
+spec:
+  replicas: {{ .Values.numNodes }}
+  selector:
+    matchLabels:
+      app: {{ .Release.Name }}-ccnc
+  serviceName: {{ .Release.Name }}-svc
+  template:
+    metadata:
+      labels:
+        app: {{ .Release.Name }}-ccnc
+    spec:
+      containers:
+        - args: [ "-config-file","/etc/asterixdb/cc.conf", "--cc", "-address", 
"{{ .Release.Name }}-ccnc-$(NODE_ID).{{ .Release.Name }}-svc", 
"-controller-id", "$(NODE_ID)", "--nc", "-public-address", "{{ .Release.Name 
}}-ccnc-$(NODE_ID).{{ .Release.Name }}-svc", "-node-id", "{{ .Release.Name 
}}-ccnc-$(NODE_ID)", "-address", "{{ .Release.Name }}-ccnc-$(NODE_ID).{{ 
.Release.Name }}-svc" ]
+          env:
+          - name: NODE_ID
+            valueFrom:
+              fieldRef:
+                fieldPath: metadata.labels['apps.kubernetes.io/pod-index']
+          image: localhost/uci/asterixdb:latest
+          imagePullPolicy: Never
+          name: ccnc
+          ports:
+            - containerPort: 19001
+              protocol: TCP
+              name: old-web
+            - containerPort: 19002
+              protocol: TCP
+              name: api
+            - containerPort: 19004
+              protocol: TCP
+              name: nc-api
+            - containerPort: 19006
+              protocol: TCP
+              name: new-web
+            - containerPort: 1098
+              protocol: TCP
+              name: hyracks-ipc
+            - containerPort: 1099
+              protocol: TCP
+              name: hyracks-jobdist
+          volumeMounts:
+            - name: data
+              mountPath: /opt/apache-asterixdb/data
+            - name: config
+              mountPath: /etc/asterixdb/
+      volumes:
+      - name: config
+        configMap:
+          name: {{ .Release.Name }}-configmap
+
+  volumeClaimTemplates:
+  - metadata:
+      name: data
+    spec:
+      accessModes: [ "ReadWriteOnce" ]
+      storageClassName: local-path
+      resources:
+        requests:
+          storage: 10Gi
diff --git a/asterixdb/asterix-helm/src/main/templates/configmap.yaml 
b/asterixdb/asterix-helm/src/main/templates/configmap.yaml
new file mode 100644
index 0000000..3400ce8
--- /dev/null
+++ b/asterixdb/asterix-helm/src/main/templates/configmap.yaml
@@ -0,0 +1,41 @@
+# ------------------------------------------------------------
+# 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: {{ .Release.Name }}-configmap
+data:
+  cc.conf: |-
+    {{ $numNodes := (.Values.numNodes | int) }}
+{{ range until $numNodes }}
+    [nc/{{ $.Release.Name }}-ccnc-{{ . }}]
+    iodevices=io1,io2
+{{ end }}
+    [cc]
+    heartbeat.period=2000
+
+    [nc]
+    ncservice.port = -1
+    cluster.address = {{ .Release.Name }}-ccnc-0.{{ .Release.Name }}-svc
+
+    [common]
+    default.dir = .
+    log.level = TRACE
+
+
diff --git a/asterixdb/asterix-helm/src/main/values.yaml 
b/asterixdb/asterix-helm/src/main/values.yaml
new file mode 100644
index 0000000..bd46b67
--- /dev/null
+++ b/asterixdb/asterix-helm/src/main/values.yaml
@@ -0,0 +1,20 @@
+# ------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------
+
+numNodes: 3
diff --git a/asterixdb/pom.xml b/asterixdb/pom.xml
index 5bd1bdd..d1d7bf2 100644
--- a/asterixdb/pom.xml
+++ b/asterixdb/pom.xml
@@ -964,6 +964,7 @@
     <module>asterix-maven-plugins</module>
     <module>asterix-server</module>
     <module>asterix-podman</module>
+    <module>asterix-helm</module>
     <module>asterix-doc</module>
     <module>asterix-fuzzyjoin</module>
     <module>asterix-replication</module>

--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18242
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: Ibdacf4e6b156a3b6ef15b4420a4102c122f8bf1c
Gerrit-Change-Number: 18242
Gerrit-PatchSet: 1
Gerrit-Owner: Ian Maxon <[email protected]>
Gerrit-MessageType: newchange

Reply via email to