Skip to content

Commit

Permalink
(BAOBAB) Orakl Node (#256)
Browse files Browse the repository at this point in the history
* feat: orakl-node helm chart

* feat: update app version

* feat: update version with cli commands

* feat: update image with go task updates

* feat: use 'test' setting for chain
  • Loading branch information
nick-bisonai authored Apr 2, 2024
1 parent e5e9d95 commit e359d19
Show file tree
Hide file tree
Showing 5 changed files with 226 additions and 0 deletions.
21 changes: 21 additions & 0 deletions node/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v2
name: orakl-node
description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "v0.0.1.20240402.0346.2e409db"
120 changes: 120 additions & 0 deletions node/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.deployment.name }}
labels:
app: {{ .Values.deployment.name }}
app.kubernetes.io/name: {{ .Values.deployment.name }}
app.kubernetes.io/instance: {{ .Values.deployment.name }}
spec:
replicas: {{ .Values.node.replicas }}
selector:
matchLabels:
app: {{ .Values.deployment.name }}
app.kubernetes.io/name: {{ .Values.deployment.name }}
app.kubernetes.io/instance: {{ .Values.deployment.name }}
template:
metadata:
{{- with .Values.global.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app: {{ .Values.deployment.name }}
app.kubernetes.io/name: {{ .Values.deployment.name }}
app.kubernetes.io/instance: {{ .Values.deployment.name }}
spec:
{{- with .Values.global.image.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.node.podSecurityContext | nindent 8 }}
{{- if .Values.global.affinity.enabled }}
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
preference:
matchExpressions:
- key: {{ .Values.global.affinity.key }}
operator: In
values:
- {{ .Values.global.affinity.value }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.node.containerSecurityContext | nindent 12 }}
image: "{{ .Values.global.image.repository }}:{{ .Values.global.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.global.image.pullPolicy }}
env:
- name: APP_PORT
value: "3030"
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: node-secrets
key: DATABASE_URL
- name: REDIS_HOST
value: "redis-data-feed-master.redis.svc.cluster.local"
- name: REDIS_PORT
value: 6379
- name: LISTEN_PORT
value: "10010"
- name: KLAYTN_PROVIDER_URL
value: "https://public-en.klaytnfinder.io/v1/baobab"
- name: SUBMISSION_PROXY_CONTRACT
value: "0x47ff979f01FC2a6748560ef973d3AA2f8EeAe77c"
- name: DELEGATOR_URL
value: "http://orakl-delegator.orakl.svc.cluster.local:3030"
- name: CHAIN
value: "test"
- name: KLAYTN_REPORTER_PK
valueFrom:
secretKeyRef:
name: node-secrets
key: KLAYTN_REPORTER_PK
- name: PRIVATE_NETWORK_SECRET
valueFrom:
secretKeyRef:
name: node-secrets
key: PRIVATE_NETWORK_SECRET
- name: BOOT_API_URL
value: "http://orakl-boot-api.orakl.svc.cluster.local:5050"
ports:
- name: http
containerPort: 3030
{{- if .Values.global.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: {{ .Values.global.livenessProbe.path }}
port: 3030
initialDelaySeconds: {{ .Values.global.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.global.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.global.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.global.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.global.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.global.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: {{ .Values.global.readinessProbe.path }}
port: 3030
initialDelaySeconds: {{ .Values.global.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.global.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.global.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.global.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.global.readinessProbe.failureThreshold }}
{{- end }}
resources:
{{- toYaml .Values.node.resources | nindent 12 }}

{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
12 changes: 12 additions & 0 deletions node/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.deployment.name }}
spec:
type: ClusterIP
ports:
- port: 3030
targetPort: http
protocol: TCP
selector:
app: {{ .Values.deployment.name }}
51 changes: 51 additions & 0 deletions node/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
## Klaytn Orakl Api Configuration
## created by Bisonai
global:
name: node
namespace: orakl
image:
repository: public.ecr.aws/bisonai/orakl-node
pullPolicy: IfNotPresent
tag: "v0.0.1.20240402.0346.2e409db"
imagePullPolicy: IfNotPresent
# -- If defined, uses a Secret to pull an image from a private Docker registry or repository
imagePullSecrets: []
affinity:
enabled: false
key: kubernetes.io/hostname
value:
podAnnotations: {}
livenessProbe:
enabled: true
path: /api/v1/
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 5
readinessProbe:
enabled: true
path: /api/v1/
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 5
node:
enabled: true
replicas: 1
podSecurityContext: {}
containerSecurityContext: {}
resources:
limits:
cpu: 2000m
memory: 4Gi
requests:
cpu: 2000m
memory: 4Gi
nodeSelector: {}
tolerations: []
dotenv: {}
deployment:
name: orakl-node
replicas: 1
22 changes: 22 additions & 0 deletions secret-store/node-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: node-secrets
spec:
refreshInterval: "15s"
secretStoreRef:
name: vault-backend
kind: SecretStore
data:
- secretKey: DATABASE_URL
remoteRef:
key: baobab/node
property: DATABASE_URL
- secretKey: KLAYTN_REPORTER_PK
remoteRef:
key: baobab/node
property: KLAYTN_REPORTER_PK
- secretKey: PRIVATE_NETWORK_SECRET
remoteRef:
key: baobab/node
property: PRIVATE_NETWORK_SECRET

0 comments on commit e359d19

Please sign in to comment.