diff --git a/charts/firefly/Chart.yaml b/charts/firefly/Chart.yaml index a4bf5fa..2a38ce2 100644 --- a/charts/firefly/Chart.yaml +++ b/charts/firefly/Chart.yaml @@ -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 diff --git a/charts/firefly/templates/_helpers.tpl b/charts/firefly/templates/_helpers.tpl index e6bbd70..df4f60b 100644 --- a/charts/firefly/templates/_helpers.tpl +++ b/charts/firefly/templates/_helpers.tpl @@ -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 */}} @@ -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 }} diff --git a/charts/firefly/templates/sandbox/deployment.yaml b/charts/firefly/templates/sandbox/deployment.yaml new file mode 100644 index 0000000..535a6a1 --- /dev/null +++ b/charts/firefly/templates/sandbox/deployment.yaml @@ -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 }} \ No newline at end of file diff --git a/charts/firefly/templates/sandbox/ingress.yaml b/charts/firefly/templates/sandbox/ingress.yaml new file mode 100644 index 0000000..6c785af --- /dev/null +++ b/charts/firefly/templates/sandbox/ingress.yaml @@ -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 }} diff --git a/charts/firefly/templates/sandbox/service.yaml b/charts/firefly/templates/sandbox/service.yaml new file mode 100644 index 0000000..2d0aef5 --- /dev/null +++ b/charts/firefly/templates/sandbox/service.yaml @@ -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 }} \ No newline at end of file diff --git a/charts/firefly/values.yaml b/charts/firefly/values.yaml index 37fe95a..ba5052f 100644 --- a/charts/firefly/values.yaml +++ b/charts/firefly/values.yaml @@ -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: {} \ No newline at end of file