From 4f1a8942d7833822a0e3a753a7b0dec1260bca42 Mon Sep 17 00:00:00 2001 From: nick Date: Wed, 27 Mar 2024 23:42:01 +0900 Subject: [PATCH 1/5] feat: orakl-node helm chart --- node/Chart.yaml | 21 ++++++ node/templates/deployment.yaml | 120 +++++++++++++++++++++++++++++++++ node/templates/service.yaml | 12 ++++ node/values.yaml | 51 ++++++++++++++ secret-store/node-secret.yaml | 22 ++++++ 5 files changed, 226 insertions(+) create mode 100644 node/Chart.yaml create mode 100644 node/templates/deployment.yaml create mode 100644 node/templates/service.yaml create mode 100644 node/values.yaml create mode 100644 secret-store/node-secret.yaml diff --git a/node/Chart.yaml b/node/Chart.yaml new file mode 100644 index 00000000..90760da5 --- /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: "" diff --git a/node/templates/deployment.yaml b/node/templates/deployment.yaml new file mode 100644 index 00000000..41bcf91d --- /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: "baobab" + - 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..6b0dcbc8 --- /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: "" + 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 From 4907f7678df6f0c29d3c13cda6d707749834ba61 Mon Sep 17 00:00:00 2001 From: nick Date: Mon, 1 Apr 2024 17:31:19 +0900 Subject: [PATCH 2/5] feat: update app version --- node/Chart.yaml | 2 +- node/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/node/Chart.yaml b/node/Chart.yaml index 90760da5..47dce18d 100644 --- a/node/Chart.yaml +++ b/node/Chart.yaml @@ -18,4 +18,4 @@ version: 0.1.0 # 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: "" +appVersion: "v0.0.1.20240401.0751.79abdf4" diff --git a/node/values.yaml b/node/values.yaml index 6b0dcbc8..25d804c0 100644 --- a/node/values.yaml +++ b/node/values.yaml @@ -6,7 +6,7 @@ global: image: repository: public.ecr.aws/bisonai/orakl-node pullPolicy: IfNotPresent - tag: "" + tag: "v0.0.1.20240401.0751.79abdf4" imagePullPolicy: IfNotPresent # -- If defined, uses a Secret to pull an image from a private Docker registry or repository imagePullSecrets: [] From 0fc1e5ac297919c7ae5674c33ed0443c72e08fce Mon Sep 17 00:00:00 2001 From: nick Date: Mon, 1 Apr 2024 19:17:29 +0900 Subject: [PATCH 3/5] feat: update version with cli commands --- node/Chart.yaml | 2 +- node/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/node/Chart.yaml b/node/Chart.yaml index 47dce18d..42f32764 100644 --- a/node/Chart.yaml +++ b/node/Chart.yaml @@ -18,4 +18,4 @@ version: 0.1.0 # 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.20240401.0751.79abdf4" +appVersion: "v0.0.1.20240401.1014.e67cb47" diff --git a/node/values.yaml b/node/values.yaml index 25d804c0..8124dc36 100644 --- a/node/values.yaml +++ b/node/values.yaml @@ -6,7 +6,7 @@ global: image: repository: public.ecr.aws/bisonai/orakl-node pullPolicy: IfNotPresent - tag: "v0.0.1.20240401.0751.79abdf4" + tag: "v0.0.1.20240401.1014.e67cb47" imagePullPolicy: IfNotPresent # -- If defined, uses a Secret to pull an image from a private Docker registry or repository imagePullSecrets: [] From 76053de955040c753f66eaba32c088ac08f3cfcc Mon Sep 17 00:00:00 2001 From: nick Date: Tue, 2 Apr 2024 12:50:52 +0900 Subject: [PATCH 4/5] feat: update image with go task updates --- node/Chart.yaml | 2 +- node/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/node/Chart.yaml b/node/Chart.yaml index 42f32764..54ee1af8 100644 --- a/node/Chart.yaml +++ b/node/Chart.yaml @@ -18,4 +18,4 @@ version: 0.1.0 # 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.20240401.1014.e67cb47" +appVersion: "v0.0.1.20240402.0346.2e409db" diff --git a/node/values.yaml b/node/values.yaml index 8124dc36..0937d243 100644 --- a/node/values.yaml +++ b/node/values.yaml @@ -6,7 +6,7 @@ global: image: repository: public.ecr.aws/bisonai/orakl-node pullPolicy: IfNotPresent - tag: "v0.0.1.20240401.1014.e67cb47" + 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: [] From a269b10f4f8b8eddd2dce8cebf41e149a98fdcb0 Mon Sep 17 00:00:00 2001 From: nick Date: Tue, 2 Apr 2024 13:35:01 +0900 Subject: [PATCH 5/5] feat: use 'test' setting for chain --- node/templates/deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/templates/deployment.yaml b/node/templates/deployment.yaml index 41bcf91d..c9dd3b31 100644 --- a/node/templates/deployment.yaml +++ b/node/templates/deployment.yaml @@ -69,7 +69,7 @@ spec: - name: DELEGATOR_URL value: "http://orakl-delegator.orakl.svc.cluster.local:3030" - name: CHAIN - value: "baobab" + value: "test" - name: KLAYTN_REPORTER_PK valueFrom: secretKeyRef: