Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.6.0] EVMConnect StatefulSet #54

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ clean:
kind delete cluster

lint:
helm template charts/firefly --set "erc20erc721.enabled=true" --set "erc1155.enabled=true" --set "ethconnect.enabled=true"
helm template charts/firefly --set "erc20erc721.enabled=true" --set "erc1155.enabled=true" --set "ethconnect.enabled=true" --set "evmconnect.enabled=true"
ct lint \
--target-branch=main \
--exclude-deprecated \
Expand Down
4 changes: 2 additions & 2 deletions charts/firefly/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ apiVersion: v2
name: firefly
description: A Helm chart for deploying FireFly and FireFly HTTPS Dataexchange onto Kubernetes.
type: application
appVersion: "1.0.4"
version: "0.5.6"
appVersion: "1.1.0"
version: "0.6.0"

maintainers:
- name: hfuss
Expand Down
19 changes: 16 additions & 3 deletions charts/firefly/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kuberentes.io/part-of: {{ .Chart.Name }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "firefly.ethconnectLabels" -}}
helm.sh/chart: {{ include "firefly.chart" . }}
{{ include "firefly.ethconnectSelectorLabels" . }}
Expand All @@ -126,6 +123,16 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kuberentes.io/part-of: {{ .Chart.Name }}
{{- end }}

{{- define "firefly.evmconnectLabels" -}}
helm.sh/chart: {{ include "firefly.chart" . }}
{{ include "firefly.evmconnectSelectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kuberentes.io/part-of: {{ .Chart.Name }}
{{- end }}

{{/*
Selector labels
*/}}
Expand Down Expand Up @@ -165,6 +172,12 @@ app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: sandbox
{{- end }}

{{- define "firefly.evmconnectSelectorLabels" -}}
app.kubernetes.io/name: {{ include "firefly.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: evmconnect
{{- end }}

{{- define "firefly.ethconnectRegisterContractsJobName" -}}
{{ printf "%s-%s-%s-register-contracts" (include "firefly.fullname" .) (.Values.config.organizationName | lower) .Chart.Version | trunc 63 | trimSuffix "-" }}
{{- end }}
Expand Down
80 changes: 80 additions & 0 deletions charts/firefly/templates/evmconnect/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{{/*
Copyright © 2022 Kaleido, Inc.

SPDX-License-Identifier: Apache-2.0

Licensed 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://swww.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 .Values.evmconnect.enabled }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "firefly.fullname" . }}-evmconnect-config
labels:
{{- include "firefly.evmconnectLabels" . | nindent 4 }}
stringData:
config.yaml: |-
{{- with .Values.evmconnect.config.confirmations }}
confirmations:
{{- toYaml . | nindent 6 }}
{{- end }}

{{- with .Values.evmconnect.config.eventstreams }}
eventstreams:
{{- toYaml . | nindent 6 }}
{{- end }}

{{- with .Values.evmconnect.config.webhooks }}
webhooks:
{{- toYaml . | nindent 6 }}
{{- end }}

{{- with .Values.evmconnect.config.policyLoop }}
policyloop:
{{- toYaml . | nindent 6 }}
{{- end }}

{{- with .Values.evmconnect.config.transactions }}
transactions:
{{- toYaml . | nindent 6 }}
{{- end }}

{{- tpl .Values.evmconnect.config.policyEngine . | nindent 4 }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that a policy engine is required, but currently only a simple engine has been implemented in the open source.

This template by default configures the simple engine, but offers the ability to customize its config and / or plugin future policy engines.


log:
level: {{ .Values.evmconnect.config.log.level | quote }}
json:
enabled: {{ .Values.evmconnect.config.log.jsonEnabled }}

persistence:
type: leveldb
leveldb:
maxHandles: {{ .Values.evmconnect.config.leveldb.maxHandles | int }}
path: /var/run/leveldb
syncWrites: {{ .Values.evmconnect.config.leveldb.syncWrites }}

connector:
{{- tpl .Values.evmconnect.config.connector . | nindent 6 }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A connector (i.e. the blockchain) is required, and so this template defaults to simply setting the JSONRPC URL of the node to use but offers customizing the connector config if necessary.


api:
port: {{ .Values.evmconnect.service.port }}
address: 0.0.0.0
publicURL: http://{{ include "firefly.fullname" . }}-evmconnect:{{ .Values.evmconnect.service.port }}

ffcore:
url: "http://{{ include "firefly.fullname" . }}:{{ .Values.core.service.httpPort }}"
# TODO
namespaces:
- default
{{- end }}
35 changes: 35 additions & 0 deletions charts/firefly/templates/evmconnect/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{{/*
Copyright © 2022 Kaleido, Inc.

SPDX-License-Identifier: Apache-2.0

Licensed 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://swww.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 .Values.evmconnect.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "firefly.fullname" . }}-evmconnect
labels:
{{- include "firefly.evmconnectLabels" . | nindent 4 }}
spec:
type: {{ .Values.evmconnect.service.type }}
ports:
- port: {{ .Values.evmconnect.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "firefly.evmconnectSelectorLabels" . | nindent 4 }}
{{- end }}
131 changes: 131 additions & 0 deletions charts/firefly/templates/evmconnect/statefulset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
{{/*
Copyright © 2022 Kaleido, Inc.

SPDX-License-Identifier: Apache-2.0

Licensed 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://swww.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 .Values.evmconnect.enabled }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "firefly.fullname" . }}-evmconnect
labels:
{{- include "firefly.evmconnectLabels" . | nindent 4 }}
spec:
replicas: 1
serviceName: {{ include "firefly.fullname" . }}-evmconnect
updateStrategy:
type: RollingUpdate
selector:
matchLabels:
{{- include "firefly.evmconnectSelectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/evmconnect/secret.yaml") . | sha256sum }}
{{- with .Values.evmconnect.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "firefly.evmconnectSelectorLabels" . | nindent 8 }}
spec:
{{- with .Values.evmconnect.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.evmconnect.podSecurityContext | nindent 8 }}
{{- if .Values.evmconnect.initContainers }}
initContainers:
{{- tpl .Values.evmconnect.initContainers . | nindent 8 }}
{{- end }}
containers:
- name: evmconnect
securityContext:
{{- toYaml .Values.evmconnect.securityContext | nindent 12 }}
image: "{{ .Values.evmconnect.image.repository }}:{{ .Values.evmconnect.image.tag }}"
imagePullPolicy: {{ .Values.evmconnect.image.pullPolicy }}
args:
- -f
- /etc/evmconnect/config.yaml
{{- if .Values.evmconnect.extraEnv }}
env:
{{- toYaml .Values.evmconnect.extraEnv | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.evmconnect.service.port }}
protocol: TCP
livenessProbe:
tcpSocket:
port: http
initialDelaySeconds: 5
failureThreshold: 5
successThreshold: 1
periodSeconds: 5
readinessProbe:
tcpSocket:
port: http
initialDelaySeconds: 5
failureThreshold: 10
successThreshold: 3
periodSeconds: 3
resources:
{{- toYaml .Values.evmconnect.resources | nindent 12 }}
volumeMounts:
- mountPath: /var/run/leveldb
name: evmconnect
- mountPath: /etc/evmconnect/config.yaml
name: config
subPath: config.yaml
{{- if .Values.evmconnect.extraContainers }}
{{- tpl .Values.evmconnect.extraContainers . | nindent 8 }}
{{- end }}
{{- with .Values.evmconnect.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.evmconnect.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.evmconnect.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: config
secret:
secretName: "{{ include "firefly.fullname" . }}-evmconnect-config"
volumeClaimTemplates:
- metadata:
name: evmconnect
{{- with .Values.evmconnect.persistentVolume }}
{{- with .annotations }}
annotations:
{{- toYaml . | nindent 10 }}
{{- end }}
spec:
accessModes:
{{- toYaml .accessModes | nindent 10 }}
storageClassName: {{ .storageClass }}
resources:
requests:
storage: {{ .size }}
{{- end }}
{{- if .Values.evmconnect.extraVolumeClaimTemplates }}
{{- tpl .Values.evmconnect.extraVolumeClaimTemplates . | nindent 4 }}
{{- end }}
{{- end }}
Loading