Skip to content

Commit

Permalink
[v0.5.4] Support for FireFly Sandbox (#53)
Browse files Browse the repository at this point in the history
* Support for FireFly Sandbox

Signed-off-by: hfuss <[email protected]>

* api endpoint

Signed-off-by: hfuss <[email protected]>
  • Loading branch information
onelapahead authored Aug 9, 2022
1 parent 208ad84 commit 62f6204
Show file tree
Hide file tree
Showing 6 changed files with 262 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/firefly/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ name: firefly
description: A Helm chart for deploying FireFly and FireFly HTTPS Dataexchange onto Kubernetes.
type: application
appVersion: "1.0.3"
version: "0.5.3"
version: "0.5.4"

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

{{- define "firefly.sandboxLabels" -}}
helm.sh/chart: {{ include "firefly.chart" . }}
{{ include "firefly.sandboxSelectorLabels" . }}
{{- 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 }}

{{/*
Common labels
*/}}
Expand Down Expand Up @@ -149,6 +159,12 @@ app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: ethconnect
{{- end }}

{{- define "firefly.sandboxSelectorLabels" -}}
app.kubernetes.io/name: {{ include "firefly.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: sandbox
{{- 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
93 changes: 93 additions & 0 deletions charts/firefly/templates/sandbox/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{{/*
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.sandbox.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "firefly.fullname" . }}-sandbox
labels:
{{- include "firefly.sandboxLabels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
{{- include "firefly.sandboxSelectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.sandbox.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "firefly.sandboxSelectorLabels" . | nindent 8 }}
spec:
{{- with .Values.sandbox.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.sandbox.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}-sandbox
securityContext:
{{- toYaml .Values.sandbox.securityContext | nindent 12 }}
image: "{{ .Values.sandbox.image.repository }}:{{ .Values.sandbox.image.tag }}"
imagePullPolicy: {{ .Values.sandbox.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.sandbox.service.port }}
protocol: TCP
livenessProbe:
httpGet:
path: /api
port: http
successThreshold: 1
failureThreshold: 2
periodSeconds: 10
timeoutSeconds: 1
initialDelaySeconds: 5
readinessProbe:
httpGet:
path: /api
port: http
successThreshold: 1
failureThreshold: 4
periodSeconds: 15
timeoutSeconds: 2
initialDelaySeconds: 15
env:
- name: SERVER_PORT
value: {{ .Values.sandbox.service.port | quote }}
- name: FF_ENDPOINT
value: "http://{{ include "firefly.fullname" . }}:{{ .Values.core.service.httpPort }}"
resources:
{{- toYaml .Values.sandbox.resources | nindent 12 }}
{{- with .Values.sandbox.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.sandbox.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.sandbox.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
75 changes: 75 additions & 0 deletions charts/firefly/templates/sandbox/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{{/*
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.sandbox.ingress.enabled }}
{{- $fullName := include "firefly.fullname" . -}}
{{- $svcPort := .Values.sandbox.service.port -}}
{{- if and .Values.sandbox.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.sandbox.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.sandbox.ingress.annotations "kubernetes.io/ingress.class" .Values.sandbox.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else -}}
apiVersion: networking.k8s.io/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}-sandbox
labels:
{{- include "firefly.sandboxLabels" . | nindent 4 }}
{{- with .Values.sandbox.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.sandbox.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.sandbox.ingress.className }}
{{- end }}
{{- if .Values.sandbox.ingress.tls }}
tls:
{{- range .Values.sandbox.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.sandbox.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
- path: /
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
pathType: Prefix
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
35 changes: 35 additions & 0 deletions charts/firefly/templates/sandbox/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.sandbox.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "firefly.fullname" . }}-sandbox
labels:
{{- include "firefly.sandboxLabels" . | nindent 4 }}
spec:
type: {{ .Values.sandbox.service.type }}
ports:
- port: {{ .Values.sandbox.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "firefly.sandboxSelectorLabels" . | nindent 4 }}
{{- end }}
42 changes: 42 additions & 0 deletions charts/firefly/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -559,3 +559,45 @@ ethconnect:
annotations: {}
size: 2Gi
storageClass: ""


sandbox:
enabled: true

podAnnotations: {}

podSecurityContext: {}
# fsGroup: 2000

imagePullSecrets: []

image:
repository: ghcr.io/hyperledger/firefly-sandbox
pullPolicy: IfNotPresent
tag: v0.1.10

resources: {}

# NOTE: The Ingress will only expose the HTTP API and never the Admin or Debug APIs
ingress:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local

service:
type: ClusterIP
port: 3001

nodeSelector: {}

tolerations: []

affinity: {}

0 comments on commit 62f6204

Please sign in to comment.