Skip to content

Commit

Permalink
[0.6.0] Support for EVMConnect and FireFly v1.1.x (#60)
Browse files Browse the repository at this point in the history
* outlining evmconnect

Signed-off-by: hfuss <haydenfuss@gmail.com>

* [0.6.0] EVMConnect StatefulSet

Signed-off-by: hfuss <haydenfuss@gmail.com>

* fixing helper from mergE

Signed-off-by: hfuss <haydenfuss@gmail.com>

* fixing linter and ensuring evmconnect template compiles

Signed-off-by: hfuss <haydenfuss@gmail.com>

* Refactoring EVMConnect Support for Separate Chart

Signed-off-by: hfuss <haydenfuss@gmail.com>

* renamed ci values for evmconnect

Signed-off-by: hfuss <haydenfuss@gmail.com>

* first pass at big refactor

Signed-off-by: hfuss <haydenfuss@gmail.com>

* including polling interval and confirmations in sample goerli values

Signed-off-by: hfuss <haydenfuss@gmail.com>

* fixing default leveldb config

Signed-off-by: hfuss <haydenfuss@gmail.com>

* Ethconnect Manage Them Nonces

Signed-off-by: hfuss <haydenfuss@gmail.com>

* PVC Support for DX Destinations

Signed-off-by: hfuss <haydenfuss@gmail.com>

* Finishing FireFly 1.1 Support

Signed-off-by: hfuss <haydenfuss@gmail.com>

* dep up for ff

Signed-off-by: hfuss <haydenfuss@gmail.com>

* multi namespace registration support; fixing config templating

Signed-off-by: hfuss <haydenfuss@gmail.com>

* fixing registration, confirmed fabric and ethereum multi-party namespaces work togher

Signed-off-by: hfuss <haydenfuss@gmail.com>

Signed-off-by: hfuss <haydenfuss@gmail.com>
  • Loading branch information
onelapahead authored Oct 3, 2022
1 parent 43767a8 commit 8423a1f
Show file tree
Hide file tree
Showing 22 changed files with 799 additions and 185 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ clean:
kind delete cluster

lint:
helm template charts/firefly --set "erc20erc721.enabled=true" --set "erc1155.enabled=true" --set "ethconnect.enabled=true"
helm dep up charts/firefly
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
23 changes: 23 additions & 0 deletions charts/firefly-evmconnect/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
19 changes: 19 additions & 0 deletions charts/firefly-evmconnect/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v2
name: firefly-evmconnect
description: |
A Helm chart for deploying the FireFly EVMConnect microservice to Kubernetes.
Requires a running instance of FireFly and a persistent volume for managing its
transaction state.
type: application
version: 0.6.0
appVersion: "0.1.2"

maintainers:
- name: hfuss
email: hayden.fuss@kaleido.io
- name: drewmarshburn
email: drew.marshburn@kaleido.io
- name: peterbroadhurst
email: peter.broadhurst@kaleido.io
- name: calbritt
email: cari.albritton@kaleido.io
11 changes: 11 additions & 0 deletions charts/firefly-evmconnect/ci/gasless-sidechain-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
fullnameOverride: "evmconnect-nogas"

config:
jsonRpcUrl: "http://geth.local:8545"

policyEngine: |
policyengine.simple:
fixedGasPrice: "0"
resubmitInterval: 5m
gasOracle:
mode: fixed
11 changes: 11 additions & 0 deletions charts/firefly-evmconnect/ci/goerli-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
fullnameOverride: "evmconnect-public"

config:
jsonRpcUrl: "https://goerli.infura.io/v3/apikey"

confirmations:
required: 20

connector: |
url: {{ .Values.config.jsonRpcUrl | quote }}
pollingInterval: 10s
52 changes: 52 additions & 0 deletions charts/firefly-evmconnect/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "firefly-evmconnect.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 "firefly-evmconnect.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 "firefly-evmconnect.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "firefly-evmconnect.labels" -}}
helm.sh/chart: {{ include "firefly-evmconnect.chart" . }}
{{ include "firefly-evmconnect.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "firefly-evmconnect.selectorLabels" -}}
app.kubernetes.io/name: {{ include "firefly-evmconnect.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: evmconnect
{{- end }}
76 changes: 76 additions & 0 deletions charts/firefly-evmconnect/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{{/*
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.
*/}}

apiVersion: v1
kind: Secret
metadata:
name: {{ include "firefly-evmconnect.fullname" . }}-config
labels:
{{- include "firefly-evmconnect.labels" . | nindent 4 }}
stringData:
config.yaml: |-
{{- with .Values.config.confirmations }}
confirmations:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.config.eventstreams }}
eventstreams:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.config.webhooks }}
webhooks:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.config.policyLoop }}
policyloop:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.config.transactions }}
transactions:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- tpl .Values.config.policyEngine . | nindent 4 }}
log:
level: {{ .Values.config.log.level | quote }}
json:
enabled: {{ .Values.config.log.jsonEnabled }}
persistence:
{{- if eq .Values.config.persistence.type "leveldb" }}
type: leveldb
leveldb:
maxHandles: {{ .Values.config.persistence.leveldb.maxHandles | int }}
path: /var/run/leveldb
syncWrites: {{ .Values.config.persistence.leveldb.syncWrites }}
{{- else if .Values.config.persistence.templateOverride }}
{{ tpl .Values.config.persistence.templateOverride . | nindent 8 }}
{{- end }}
connector:
{{- tpl .Values.config.connector . | nindent 6 }}
api:
port: {{ .Values.service.port }}
address: 0.0.0.0
publicURL: "http://{{ include "firefly-evmconnect.fullname" . }}:{{ .Values.service.port }}"
33 changes: 33 additions & 0 deletions charts/firefly-evmconnect/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{/*
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.
*/}}

apiVersion: v1
kind: Service
metadata:
name: {{ include "firefly-evmconnect.fullname" . }}
labels:
{{- include "firefly-evmconnect.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "firefly-evmconnect.selectorLabels" . | nindent 4 }}
131 changes: 131 additions & 0 deletions charts/firefly-evmconnect/templates/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.
*/}}

apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "firefly-evmconnect.fullname" . }}
labels:
{{- include "firefly-evmconnect.labels" . | nindent 4 }}
spec:
replicas: 1
serviceName: {{ include "firefly-evmconnect.fullname" . }}
updateStrategy:
type: RollingUpdate
selector:
matchLabels:
{{- include "firefly-evmconnect.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "firefly-evmconnect.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if .Values.initContainers }}
initContainers:
{{- tpl .Values.initContainers . | nindent 8 }}
{{- end }}
containers:
- name: evmconnect
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default (printf "v%s" .Chart.AppVersion) }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- -f
- /etc/evmconnect/config.yaml
{{- if .Values.extraEnv }}
env:
{{- toYaml .Values.extraEnv | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.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.resources | nindent 12 }}
volumeMounts:
- mountPath: /var/run/leveldb
name: evmconnect
- mountPath: /etc/evmconnect/config.yaml
name: config
subPath: config.yaml
{{- if .Values.extraContainers }}
{{- tpl .Values.extraContainers . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: config
secret:
secretName: "{{ include "firefly-evmconnect.fullname" . }}-config"
volumeClaimTemplates:
{{- if eq .Values.config.persistence.type "leveldb" }}
- metadata:
name: evmconnect
{{- with .Values.persistentVolume }}
{{- with .annotations }}
annotations:
{{- toYaml . | nindent 10 }}
{{- end }}
spec:
accessModes:
{{- toYaml .accessModes | nindent 10 }}
storageClassName: {{ .storageClass }}
resources:
requests:
storage: {{ .size }}
{{- end }}
{{- end }}
{{- if .Values.extraVolumeClaimTemplates }}
{{- tpl .Values.extraVolumeClaimTemplates . | nindent 4 }}
{{- end }}
Loading

0 comments on commit 8423a1f

Please sign in to comment.