Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[helm-chart] sidecar container taraxa-indexer for rpc nodes #2344

Merged
merged 27 commits into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,11 @@ commands:
--set consensusnode.persistence.enabled=true \
--set node.serviceMonitor.enabled=true \
--set bootnode.serviceMonitor.enabled=false \
--set consensusnode.serviceMonitor.enabled=true
--set consensusnode.serviceMonitor.enabled=true \
--set node.nodeSelector."cloud\\.google\\.com/gke-nodepool"=blockchain-prnet \
--set bootnode.nodeSelector."cloud\\.google\\.com/gke-nodepool"=blockchain-prnet \
--set consensusnode.nodeSelector."cloud\\.google\\.com/gke-nodepool"=blockchain-prnet \
--set node.indexer.enabled=true
fi

cleanup_prnet_chart:
Expand Down Expand Up @@ -568,6 +572,8 @@ jobs:
https://explorer-pr-<<pipeline.parameters.pr_number>>.prnet.taraxa.io </a></td></tr> \
<tr><td>RPC</td><td><a href=https://rpc-pr-<<pipeline.parameters.pr_number>>.prnet.taraxa.io >\
https://rpc-pr-<<pipeline.parameters.pr_number>>.prnet.taraxa.io </a></td></tr>\
<tr><td>Indexer</td><td><a href=https://indexer-pr-<<pipeline.parameters.pr_number>>.prnet.taraxa.io >\
https://indexer-pr-<<pipeline.parameters.pr_number>>.prnet.taraxa.io </a></td></tr>\
</table>\
<h4><p>Boot Nodes</p></h4>\
<table>\
Expand Down
6 changes: 6 additions & 0 deletions charts/taraxa-node/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# do not include into git chart dependencies
charts/*.tgz

# Helm stuff
requirements.lock
Chart.lock
13 changes: 13 additions & 0 deletions charts/taraxa-node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
This file documents all notable changes to `taraxa-node` Helm Chart. The release
numbering uses [semantic versioning](http://semver.org).

## v0.3.3

### Major changes

* Added sidecar container to RPC nodes with [taraxa-indexer](https://github.com/Taraxa-project/taraxa-indexer)

## v0.3.2

### Minor changes
Expand All @@ -21,6 +27,13 @@ numbering uses [semantic versioning](http://semver.org).

* Separate config for genesis

## v0.2.5

### Minor changes

* Allow for different images in `StatefulSet`s for boot, rpc and consensus nodes


## v0.2.4

### Minor changes
Expand Down
2 changes: 1 addition & 1 deletion charts/taraxa-node/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
appVersion: "1.0"
description: Kubernetes helm chart for Taraxa blockchain full node implementation.
name: taraxa-node
version: 0.3.2
version: 0.3.3
keywords:
- blockchain
- taraxa
Expand Down
13 changes: 13 additions & 0 deletions charts/taraxa-node/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,19 @@ If release name contains chart name it will be used as a full name.
{{- end -}}
{{- end -}}

{{/*
Create a default fully qualified indexer name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "taraxa-node.indexerName" -}}
{{- if .Values.indexerNameOverride -}}
{{- .Values.indexerNameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s.%s" "indexer" .Release.Name .Values.domain | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}

{{/*
Create a default fully qualified graphql websocket.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,17 @@ spec:
spec:
initContainers:
- name: config-adapter
{{- if and .Values.bootnode.image.repository .Values.bootnode.image.tag }}
image: "{{ .Values.bootnode.image.repository }}:{{ .Values.bootnode.image.tag }}"
{{- else }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
{{- end }}

{{- if .Values.bootnode.image.pullPolicy }}
imagePullPolicy: {{ .Values.bootnode.image.pullPolicy }}
{{- else }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- end }}
envFrom:
- secretRef:
name: {{ .Release.Name }}
Expand All @@ -54,8 +63,17 @@ spec:
mountPath: /root/.taraxa
containers:
- name: boot-node
{{- if and .Values.bootnode.image.repository .Values.bootnode.image.tag }}
image: "{{ .Values.bootnode.image.repository }}:{{ .Values.bootnode.image.tag }}"
{{- else }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
{{- end }}

{{- if .Values.bootnode.image.pullPolicy }}
imagePullPolicy: {{ .Values.bootnode.image.pullPolicy }}
{{- else }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- end }}
args:
{{- toYaml .Values.bootnode.args | nindent 12 }}
- --chain-id
Expand Down
16 changes: 16 additions & 0 deletions charts/taraxa-node/templates/consensus-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,16 @@ spec:
subPath: entrypoint.sh
{{- end }}
- name: config-adapter
{{- if and .Values.consensusnode.image.repository .Values.consensusnode.image.tag }}
image: "{{ .Values.consensusnode.image.repository }}:{{ .Values.consensusnode.image.tag }}"
{{- else }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
{{- end }}
{{- if .Values.consensusnode.image.pullPolicy }}
imagePullPolicy: {{ .Values.consensusnode.image.pullPolicy }}
{{- else }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- end }}
envFrom:
- secretRef:
name: {{ .Release.Name }}
Expand Down Expand Up @@ -94,8 +102,16 @@ spec:
subPath: status.py
{{- end }}
- name: consensus-node
{{- if and .Values.consensusnode.image.repository .Values.consensusnode.image.tag }}
image: "{{ .Values.consensusnode.image.repository }}:{{ .Values.consensusnode.image.tag }}"
{{- else }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
{{- end }}
{{- if .Values.consensusnode.image.pullPolicy }}
imagePullPolicy: {{ .Values.consensusnode.image.pullPolicy }}
{{- else }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- end }}
args:
{{- toYaml .Values.consensusnode.args | nindent 12 }}
env:
Expand Down
50 changes: 50 additions & 0 deletions charts/taraxa-node/templates/taraxa-node-ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{ if .Values.node.enabled }}
{{- if .Values.node.ingress.enabled -}}

{{- $fullName := include "taraxa-node.fullname" . -}}
{{- $apiIsStable := eq (include "taraxa-node.ingress.isStable" .) "true" -}}
{{- $ingressSupportsPathType := eq (include "taraxa-node.ingress.supportsPathType" .) "true" -}}
Expand All @@ -9,11 +10,14 @@
{{- $servicePortRpcWs := 8777 -}}
{{- $servicePortGraphQl := 9777 -}}
{{- $servicePortGraphQlWs := 6777 -}}
{{- $servicePortHttp := 8080 -}}

{{- range .Values.node.service.ports }}
{{ if eq .name "rest"}} {{ $servicePortRpc = .port }} {{ end }}
{{ if eq .name "ws"}} {{ $servicePortRpcWs = .port }} {{ end }}
{{ if eq .name "graphql"}} {{ $servicePortGraphQl = .port }} {{ end }}
{{ if eq .name "graphql-ws"}} {{ $servicePortGraphQlWs = .port }} {{ end }}
{{ if eq .name "http-indexer"}} {{ $servicePortHttp = .port }} {{ end }}
{{- end }}

{{- $pathType := .Values.node.ingress.pathType | default "ImplementationSpecific" -}}
Expand Down Expand Up @@ -197,5 +201,51 @@ spec:
serviceName: {{ $serviceName }}
servicePort: {{ $servicePortGraphQlWs }}
{{- end }}

---
apiVersion: {{ include "taraxa-node.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ $fullName }}-indexer
labels:
app: taraxa-node
app.kubernetes.io/name: {{ include "taraxa-node.name" . }}
helm.sh/chart: {{ include "taraxa-node.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- with .Values.node.ingress.annotationsIndexer }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if $apiIsStable }}
{{- if .Values.node.ingress.ingressClassName }}
ingressClassName: {{ .Values.node.ingress.ingressClassName }}
{{- end }}
{{- end }}
{{- if .Values.wildCertDomainSecret }}
tls:
- hosts:
- {{ include "taraxa-node.indexerName" . | quote }}
secretName: {{ .Values.wildCertDomainSecret }}
{{- end }}
rules:
- host: {{ include "taraxa-node.indexerName" . | quote }}
http:
paths:
- path: /
{{- if and $pathType $ingressSupportsPathType }}
pathType: {{ $pathType }}
{{- end }}
backend:
{{- if $apiIsStable }}
service:
name: {{ $serviceName }}
port:
number: {{ $servicePortHttp }}
{{- else }}
serviceName: {{ $serviceName }}
servicePort: {{ $servicePortHttp }}
{{- end }}
{{- end }}
{{- end }}
51 changes: 51 additions & 0 deletions charts/taraxa-node/templates/taraxa-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,16 @@ spec:
spec:
initContainers:
- name: config-adapter
{{- if and .Values.node.image.repository .Values.node.image.tag }}
image: "{{ .Values.node.image.repository }}:{{ .Values.node.image.tag }}"
{{- else }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
{{- end }}
{{- if .Values.node.image.pullPolicy }}
imagePullPolicy: {{ .Values.node.image.pullPolicy }}
{{- else }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- end }}
envFrom:
- secretRef:
name: {{ .Release.Name }}
Expand Down Expand Up @@ -90,9 +98,31 @@ spec:
readOnly: true
subPath: status.py
{{- end }}
{{- if .Values.node.indexer.enabled }}
- name: taraxa-indexer
image: "{{ .Values.node.indexer.image.repository }}:{{ .Values.node.indexer.image.tag }}"
imagePullPolicy: {{ .Values.node.indexer.image.pullPolicy }}
command: ["/taraxa-indexer"]
args:
- -db_path
- {{ .Values.node.indexer.persistence.mountPoint }}
- -blockchain_ws
- 'ws://localhost:8777'
volumeMounts:
- name: indexer-data
mountPath: /data
{{- end }}
- name: taraxa-node
{{- if and .Values.node.image.repository .Values.node.image.tag }}
image: "{{ .Values.node.image.repository }}:{{ .Values.node.image.tag }}"
{{- else }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
{{- end }}
{{- if .Values.node.image.pullPolicy }}
imagePullPolicy: {{ .Values.node.image.pullPolicy }}
{{- else }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- end }}
args:
{{- toYaml .Values.node.args | nindent 12 }}
env:
Expand Down Expand Up @@ -208,5 +238,26 @@ spec:
resources:
requests:
storage: "{{ .Values.node.persistence.size }}"
{{- if .Values.node.indexer.enabled }}
- metadata:
name: indexer-data
annotations:
{{- if .Values.node.indexer.persistence.annotations}}
{{- toYaml .Values.node.indexer.persistence.annotations | nindent 4 }}
{{- end }}
spec:
accessModes:
- {{ .Values.node.indexer.persistence.accessMode | quote }}
{{- if .Values.node.indexer.persistence.storageClass }}
{{- if (eq "-" .Values.node.indexer.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.node.indexer.persistence.storageClass }}"
{{- end }}
{{- end }}
resources:
requests:
storage: "{{ .Values.node.indexer.persistence.size }}"
{{- end }}
{{- end }}
{{- end }}
29 changes: 28 additions & 1 deletion charts/taraxa-node/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ affinity: {}

node:
enabled: true
image: {}
replicaCount: 20
loadBalancer:
enabled: false
Expand Down Expand Up @@ -94,6 +95,12 @@ node:
annotationsRpcWS: {}
annotationsGraphQl: {}
annotationsGraphQlWS: {}
annotationsIndexer:
nginx.ingress.kubernetes.io/affinity: "cookie"
nginx.ingress.kubernetes.io/session-cookie-name: "stickounet"
nginx.ingress.kubernetes.io/session-cookie-expires: "172800"
nginx.ingress.kubernetes.io/session-cookie-max-age: "172800"
rjonczy marked this conversation as resolved.
Show resolved Hide resolved
nginx.ingress.kubernetes.io/affinity-mode: persistent
hosts: []
tls: []
ports:
Expand All @@ -111,6 +118,9 @@ node:
- name: udp-listen-port
containerPort: 10002
protocol: UDP
- name: http-indexer
containerPort: 8080
protocol: TCP
service:
ports:
- name: rest
Expand All @@ -130,6 +140,9 @@ node:
- name: metrics
port: 8888
protocol: TCP
- name: http-indexer
port: 8080
protocol: TCP
serviceMonitor:
enabled: false
resources: {}
Expand All @@ -140,10 +153,23 @@ node:
size: 30Gi
storageClass:
annotations: {}

indexer:
enabled: false
image:
repository: gcr.io/jovial-meridian-249123/taraxa-indexer
tag: latest
pullPolicy: IfNotPresent
persistence:
enabled: false
accessMode: ReadWriteOnce
size: 30Gi
storageClass:
annotations: {}
mountPoint: /data

bootnode:
enabled: true
image: {}
replicaCount: 1
loadBalancer:
enabled: false
Expand Down Expand Up @@ -187,6 +213,7 @@ bootnode:

consensusnode:
enabled: true
image: {}
replicaCount: 1
probes:
enabled: true
Expand Down