diff --git a/.github/workflows/helm.yml b/.github/workflows/helm.yml index 0db8e68e11..6915d015d6 100644 --- a/.github/workflows/helm.yml +++ b/.github/workflows/helm.yml @@ -34,6 +34,9 @@ jobs: - name: lint chart run: ct lint --charts deploy/charts/firefly + - name: test chart templating + run: helm template deploy/charts/firefly + - name: setup kind uses: engineerd/setup-kind@v0.5.0 with: diff --git a/deploy/charts/firefly/Chart.yaml b/deploy/charts/firefly/Chart.yaml index e77c2ec974..20873013b8 100644 --- a/deploy/charts/firefly/Chart.yaml +++ b/deploy/charts/firefly/Chart.yaml @@ -3,7 +3,7 @@ name: firefly description: A Helm chart for deploying FireFly and FireFly HTTPS Dataexchange onto Kubernetes. type: application appVersion: "0.11.4" -version: "0.0.1" +version: "0.0.3" maintainers: - name: hfuss diff --git a/deploy/charts/firefly/ci/eth-values.yaml b/deploy/charts/firefly/ci/eth-values.yaml index 5fbf113bd7..c7654d2d1e 100644 --- a/deploy/charts/firefly/ci/eth-values.yaml +++ b/deploy/charts/firefly/ci/eth-values.yaml @@ -30,3 +30,6 @@ dataexchange: tlsSecret: enabled: false + +erc1155: + enabled: false diff --git a/deploy/charts/firefly/ci/fab-values.yaml b/deploy/charts/firefly/ci/fab-values.yaml index 7f48973c57..f6b45106a5 100644 --- a/deploy/charts/firefly/ci/fab-values.yaml +++ b/deploy/charts/firefly/ci/fab-values.yaml @@ -23,3 +23,6 @@ dataexchange: tlsSecret: enabled: false + +erc1155: + enabled: false diff --git a/deploy/charts/firefly/templates/_helpers.tpl b/deploy/charts/firefly/templates/_helpers.tpl index 47f61c851b..51558ea86c 100644 --- a/deploy/charts/firefly/templates/_helpers.tpl +++ b/deploy/charts/firefly/templates/_helpers.tpl @@ -43,9 +43,6 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} app.kuberentes.io/part-of: {{ .Chart.Name }} {{- end }} -{{/* -Common labels -*/}} {{- define "firefly.dataexchangeLabels" -}} helm.sh/chart: {{ include "firefly.chart" . }} {{ include "firefly.dataexchangeSelectorLabels" . }} @@ -56,6 +53,16 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} app.kuberentes.io/part-of: {{ .Chart.Name }} {{- end }} +{{- define "firefly.erc1155Labels" -}} +helm.sh/chart: {{ include "firefly.chart" . }} +{{ include "firefly.erc1155SelectorLabels" . }} +{{- 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 */}} @@ -65,15 +72,18 @@ app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: core {{- end }} -{{/* -Selector labels -*/}} {{- define "firefly.dataexchangeSelectorLabels" -}} app.kubernetes.io/name: {{ include "firefly.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: dx {{- end }} +{{- define "firefly.erc1155SelectorLabels" -}} +app.kubernetes.io/name: {{ include "firefly.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/component: erc1155 +{{- end }} + {{- define "firefly.dataexchangeP2PHost" -}} {{- if .Values.dataexchange.ingress.enabled }} {{- (index .Values.dataexchange.ingress.hosts 0).host }} @@ -205,4 +215,13 @@ dataexchange: {{- end }} {{- end }} {{- end }} +{{- if and .Values.config.tokensOverride (not .Values.erc1155.enabled) }} +tokens: + {{- toYaml (tpl .Values.config.tokensOverride .) | nindent 2 }} +{{- else if and .Values.erc1155.enabled }} +tokens: + - plugin: fftokens + name: erc1155 + url: http://{{ include "firefly.fullname" . }}-erc1155.{{ .Release.Namespace }}.svc:{{ .Values.erc1155.service.port }} +{{- end }} {{- end }} \ No newline at end of file diff --git a/deploy/charts/firefly/templates/erc1155/deployment.yaml b/deploy/charts/firefly/templates/erc1155/deployment.yaml new file mode 100644 index 0000000000..98603711b3 --- /dev/null +++ b/deploy/charts/firefly/templates/erc1155/deployment.yaml @@ -0,0 +1,89 @@ +{{- if .Values.erc1155.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "firefly.fullname" . }}-erc1155 + labels: + {{- include "firefly.erc1155Labels" . | nindent 4 }} +spec: + replicas: 1 + selector: + matchLabels: + {{- include "firefly.erc1155SelectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.erc1155.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "firefly.erc1155SelectorLabels" . | nindent 8 }} + spec: + {{- with .Values.erc1155.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- toYaml .Values.erc1155.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }}-erc1155 + securityContext: + {{- toYaml .Values.erc1155.securityContext | nindent 12 }} + image: "{{ .Values.erc1155.image.repository }}:{{ .Values.erc1155.image.tag }}" + imagePullPolicy: {{ .Values.erc1155.image.pullPolicy }} + ports: + - name: http + containerPort: {{ .Values.erc1155.service.port }} + protocol: TCP + livenessProbe: + httpGet: + path: /api/v1/health/liveness + port: http + successThreshold: 1 + failureThreshold: 2 + periodSeconds: 10 + timeoutSeconds: 1 + initialDelaySeconds: 5 + readinessProbe: + httpGet: + path: /api/v1/health/readiness + port: http + successThreshold: 1 + failureThreshold: 4 + periodSeconds: 15 + timeoutSeconds: 2 + initialDelaySeconds: 15 + env: + - name: PORT + value: {{ .Values.erc1155.service.port | quote }} + - name: ETHCONNECT_URL + value: {{ tpl .Values.config.ethconnectUrl . }} + - name: ETHCONNECT_INSTANCE + value: {{ .Values.config.erc1155ContractAddress }} + - name: ETHCONNECT_TOPIC + value: {{ .Values.config.erc1155EthconnectTopic | quote }} + - name: ETHCONNECT_PREFIX + value: {{ .Values.config.ethconnectPrefixShort | default "fly" }} + {{- if and .Values.config.ethconnectUsername .Values.config.ethconnectPassword }} + - name: ETHCONNECT_USERNAME + value: {{ .Values.config.ethconnectUsername | quote }} + - name: ETHCONNECT_PASSWORD + value: {{ .Values.config.ethconnectPassword | quote }} + {{- end }} + - name: AUTO_INIT + value: "true" + resources: + {{- toYaml .Values.erc1155.resources | nindent 12 }} + {{- with .Values.erc1155.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.erc1155.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.erc1155.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} diff --git a/deploy/charts/firefly/templates/erc1155/service.yaml b/deploy/charts/firefly/templates/erc1155/service.yaml new file mode 100644 index 0000000000..dfc3d245eb --- /dev/null +++ b/deploy/charts/firefly/templates/erc1155/service.yaml @@ -0,0 +1,17 @@ +{{- if .Values.erc1155.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "firefly.fullname" . }}-erc1155 + labels: + {{- include "firefly.erc1155Labels" . | nindent 4 }} +spec: + type: {{ .Values.erc1155.service.type }} + ports: + - port: {{ .Values.erc1155.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "firefly.erc1155SelectorLabels" . | nindent 4 }} +{{- end }} diff --git a/deploy/charts/firefly/values.yaml b/deploy/charts/firefly/values.yaml index 4f5fdeaf04..20ad5bb043 100644 --- a/deploy/charts/firefly/values.yaml +++ b/deploy/charts/firefly/values.yaml @@ -73,7 +73,7 @@ config: # The Ethconnect topic to use for blockchain event subscriptions ethconnectTopic: 0 - # The short prefix FireFly will prepend to certain headers it sends to Ethconnect i.e. ff or kld + # The short prefix FireFly will prepend to certain headers it sends to Ethconnect i.e. fly or kld ethconnectPrefixShort: "" # The long prefix FireFly will prepend to certain headers it sends to Ethconnect i.e. FireFly or Kaleido @@ -100,6 +100,12 @@ config: # The Fabric to use for signing transactions, must be pre-registered and enrolled fabconnectSigner: "" + # The Ethconnet URI representing the ERC1155 tokens contract + erc1155ContractAddress: "/contracts/erc1155Addrress" + + # The Ethconnet topic to use for tokens event subscriptions + erc1155EthconnectTopic: "" + # The following values can be used to override the templating of specific plugin sections, in the case where # the user wants greater control to template the sections using global values, additional helpers, etc. OR if they # want to use other plugin types i.e. `fabric` which currently do not exist at the time of writing. @@ -110,6 +116,8 @@ config: publicstorageOverride: {} + tokensOverride: {} + blockchainOverride: {} # type: ethereum # ethereum: @@ -126,7 +134,7 @@ config: core: image: repository: ghcr.io/hyperledger/firefly - pullPolicy: Always + pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. # tag: latest @@ -135,8 +143,6 @@ core: # value: debug imagePullSecrets: [] - nameOverride: "" - fullnameOverride: "" podAnnotations: {} @@ -233,12 +239,10 @@ dataexchange: image: repository: ghcr.io/hyperledger/firefly-dataexchange-https - pullPolicy: Always + pullPolicy: IfNotPresent tag: v0.9.3 imagePullSecrets: [] - nameOverride: "" - fullnameOverride: "" podAnnotations: {} @@ -304,3 +308,48 @@ dataexchange: subPath: "" size: 2Gi storageClass: "" + +erc1155: + enabled: true + + image: + repository: ghcr.io/hyperledger/firefly-tokens-erc1155 + pullPolicy: IfNotPresent + tag: v0.10.2 + + imagePullSecrets: [] + + podAnnotations: {} + + podSecurityContext: {} + # fsGroup: 2000 + + securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + + service: + type: ClusterIP + port: 3000 + + resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + + nodeSelector: {} + + tolerations: [] + + affinity: {}