diff --git a/node/Chart.yaml b/node/Chart.yaml new file mode 100644 index 00000000..54ee1af8 --- /dev/null +++ b/node/Chart.yaml @@ -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" diff --git a/node/templates/deployment.yaml b/node/templates/deployment.yaml new file mode 100644 index 00000000..c9dd3b31 --- /dev/null +++ b/node/templates/deployment.yaml @@ -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 }} \ No newline at end of file diff --git a/node/templates/service.yaml b/node/templates/service.yaml new file mode 100644 index 00000000..316fb7d3 --- /dev/null +++ b/node/templates/service.yaml @@ -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 }} diff --git a/node/values.yaml b/node/values.yaml new file mode 100644 index 00000000..0937d243 --- /dev/null +++ b/node/values.yaml @@ -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 diff --git a/secret-store/node-secret.yaml b/secret-store/node-secret.yaml new file mode 100644 index 00000000..dd5c571f --- /dev/null +++ b/secret-store/node-secret.yaml @@ -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