Skip to content

Commit

Permalink
provider deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
amitza committed Sep 4, 2024
1 parent 122056b commit 704c75f
Show file tree
Hide file tree
Showing 9 changed files with 212 additions and 30 deletions.
2 changes: 1 addition & 1 deletion charts/cache/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ icon: https://github.com/lavanet/helm-charts/blob/main/docs/logo/logo.png?raw=tr
sources:
- https://github.com/lavanet/helm-charts
type: application
version: 0.5.15
version: 0.5.16
appVersion: "v2.5.0"
kubeVersion: ">=1.25.0-0"
home: https://lavanet.xyz
Expand Down
2 changes: 1 addition & 1 deletion charts/cache/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Lava helm chart for the cache service

![Version: 0.5.15](https://img.shields.io/badge/Version-0.5.15-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.5.0](https://img.shields.io/badge/AppVersion-v2.5.0-informational?style=flat-square)
![Version: 0.5.16](https://img.shields.io/badge/Version-0.5.16-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.5.0](https://img.shields.io/badge/AppVersion-v2.5.0-informational?style=flat-square)

## Lavanet Cache Helm Chart

Expand Down
2 changes: 1 addition & 1 deletion charts/consumer/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ icon: https://github.com/lavanet/helm-charts/blob/main/docs/logo/logo.png?raw=tr
sources:
- https://github.com/lavanet/helm-charts
type: application
version: 0.5.15
version: 0.5.16
appVersion: "v2.5.0"
kubeVersion: ">=1.25.0-0"
home: https://lavanet.xyz
Expand Down
2 changes: 1 addition & 1 deletion charts/consumer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Lava helm chart for the consumer service

![Version: 0.5.15](https://img.shields.io/badge/Version-0.5.15-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.5.0](https://img.shields.io/badge/AppVersion-v2.5.0-informational?style=flat-square)
![Version: 0.5.16](https://img.shields.io/badge/Version-0.5.16-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.5.0](https://img.shields.io/badge/AppVersion-v2.5.0-informational?style=flat-square)

## Lavanet Consumer Helm Chart

Expand Down
2 changes: 1 addition & 1 deletion charts/provider/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ icon: https://github.com/lavanet/helm-charts/blob/main/docs/logo/logo.png?raw=tr
sources:
- https://github.com/lavanet/helm-charts
type: application
version: 0.5.15
version: 0.5.16
appVersion: "v2.5.0"
kubeVersion: ">=1.25.0-0"
home: https://lavanet.xyz
Expand Down
8 changes: 5 additions & 3 deletions charts/provider/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Lava helm chart for the provider service

![Version: 0.5.15](https://img.shields.io/badge/Version-0.5.15-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.5.0](https://img.shields.io/badge/AppVersion-v2.5.0-informational?style=flat-square)
![Version: 0.5.16](https://img.shields.io/badge/Version-0.5.16-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.5.0](https://img.shields.io/badge/AppVersion-v2.5.0-informational?style=flat-square)

## Lavanet Provider Helm Chart

Expand Down Expand Up @@ -204,6 +204,9 @@ Kubernetes: `>=1.25.0-0`
| certificate.secretTemplateAnnotations | object | `{}` | Annotations that allow the certificate to be composed from data residing in existing Kubernetes Resources |
| certificate.usages | list | `[]` | Usages for the certificate ## Ref: <https://cert-manager.io/docs/reference/api-docs/#cert-manager.io/v1.KeyUsage> |
| chainId | string | `"lava-testnet-2"` | Lava chain id |
| deploymentUpdate.maxSurge | string | `"100%"` | |
| deploymentUpdate.maxUnavailable | int | `0` | |
| deploymentUpdate.type | string | `"RollingUpdate"` | |
| fullnameOverride | string | `""` | String to fully override `"provider.fullname"` |
| geolocation | string | `"2"` | Provider geo-location can be one of the [geolocations](https://docs.lavanet.xyz/provider-setup#geolocations) |
| global.domain | string | `"my-provider.local"` | Default domain used by all components # Used for ingresses, certificates, etc. |
Expand Down Expand Up @@ -248,7 +251,6 @@ Kubernetes: `>=1.25.0-0`
| node | string | `"https://testnet2-rpc.lavapro.xyz:443"` | Lava node to connect to |
| nodeSelector | object | `{}` | [Node selector] |
| podAnnotations | object | `{}` | Annotations for the all deployed pods |
| podManagementPolicy | string | `"Parallel"` | Pod Management Policy for StatefulSets |
| podSecurityContext | object | `{}` | |
| readinessProbe.failureThreshold | int | `3` | Minimum consecutive failures for the [probe] to be considered failed after having succeeded |
| readinessProbe.initialDelaySeconds | int | `10` | Number of seconds after the container has started before [probe] is initiated |
Expand All @@ -264,8 +266,8 @@ Kubernetes: `>=1.25.0-0`
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template |
| statefulSetUpdate.updateStrategy | string | `"RollingUpdate"` | |
| tolerations | list | `[]` | [Tolerations] for use with node taints |
| updateStrategy | string | `"RollingUpdate"` | Update strategy for StatefulSets |
| wallet | string | `"test"` | Wallet name |

----------------------------------------------
Expand Down
173 changes: 173 additions & 0 deletions charts/provider/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
{{- range $chain := $.Values.chains }}
{{- if or (not $chain.persistence) (not $chain.persistence.enabled) }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ $chain.name | lower }}-{{ include "provider.fullname" $ }}
labels:
{{- include "provider.labels" $ | nindent 4 }}
app.lavanet.io/chain: {{ $chain.name | lower }}
spec:
strategy:
type: {{ $.Values.deploymentUpdate.type }}
{{- if eq $.Values.deploymentUpdate.type "RollingUpdate" }}
rollingUpdate:
maxSurge: {{ $.Values.deploymentUpdate.maxSurge }}
maxUnavailable: {{ $.Values.deploymentUpdate.maxUnavailable }}
{{- end }}
replicas: {{ $.Values.replicaCount }}
selector:
matchLabels:
{{- include "provider.selectorLabels" $ | nindent 6 }}
app.lavanet.io/chain: {{ $chain.id | lower }}
template:
metadata:
annotations:
{{- with $.Values.podAnnotations }}
{{- toYaml $ | nindent 8 }}
{{- end }}
{{- if not $chain.existingConfigSecret }}
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") $ | sha256sum }}
{{- end }}
labels:
{{- include "provider.selectorLabels" $ | nindent 8 }}
app.lavanet.io/chain: {{ $chain.id | lower }}
spec:
{{- with $.Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml $ | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "provider.serviceAccountName" $ }}
securityContext:
{{- toYaml $.Values.podSecurityContext | nindent 8 }}
initContainers:
- name: import-keys
image: "{{ $.Values.image.repository }}:{{ $.Values.image.tag | default $.Chart.AppVersion }}"
imagePullPolicy: {{ $.Values.image.pullPolicy }}
command: ["sh", "-c"]
args:
- |
if [ -f /lava/.key-{{ $.Values.wallet }}.imported ]; then
echo "Key {{ $.Values.wallet }} has already been exported, exiting..."
exit 0
fi
echo $KEY_PASSWORD | lavap keys \
import {{ $.Values.wallet }} /tmp/keyfile/{{ $.Values.key.secretKey }} \
--keyring-backend {{ $.Values.keyringBackend }}
touch /lava/.key-{{ $.Values.wallet }}.imported
env:
- name: KEY_PASSWORD
valueFrom:
secretKeyRef:
name: {{ $.Values.key.passwordSecretName }}
key: {{ $.Values.key.passwordSecretKey }}
volumeMounts:
- name: "private-key-volume"
mountPath: /tmp/keyfile/{{ $.Values.key.secretKey }}
subPath: {{ $.Values.key.secretKey }}
readOnly: true
- mountPath: "/lava"
name: data
containers:
- name: {{ $.Chart.Name }}
securityContext:
{{- toYaml $.Values.securityContext | nindent 12 }}
image: "{{ $.Values.image.repository }}:{{ $.Values.image.tag | default $.Chart.AppVersion }}"
imagePullPolicy: {{ $.Values.image.pullPolicy }}
args:
- "rpcprovider"
{{- if $chain.existingConfigSecret }}
- {{ $chain.existingConfigSecretKey }}
{{- else }}
- config.yml
{{- end }}
- --node
- {{ $.Values.node }}
- --from
- {{ $.Values.wallet }}
- --keyring-backend
- {{ $.Values.keyringBackend }}
- --chain-id
- {{ $.Values.chainId }}
- --geolocation
- {{ $.Values.geolocation | quote }}
{{- if $.Values.cache.enabled }}
- --cache-be
- {{ $.Values.cache.address }}
{{- end }}
- --log_level
- {{ $.Values.log.level }}
- --log_format
- {{ $.Values.log.format }}
{{- range $i, $val := $.Values.additionalArgs }}
- {{ $val | quote }}
{{- end }}
ports:
- name: grpc
containerPort: {{ $.Values.service.port }}
protocol: TCP
{{- if $.Values.metrics.enabled }}
- name: metrics
containerPort: {{ $.Values.metrics.port }}
protocol: TCP
{{- end }}
livenessProbe:
httpGet:
path: /lava/health
port: grpc
scheme: {{ $.Values.livenessProbe.scheme }}
initialDelaySeconds: {{ $.Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ $.Values.livenessProbe.periodSeconds }}
timeoutSeconds: {{ $.Values.livenessProbe.timeoutSeconds }}
successThreshold: {{ $.Values.livenessProbe.successThreshold }}
failureThreshold: {{ $.Values.livenessProbe.failureThreshold }}
readinessProbe:
httpGet:
path: /lava/health
port: grpc
scheme: {{ $.Values.livenessProbe.scheme }}
initialDelaySeconds: {{ $.Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ $.Values.readinessProbe.periodSeconds }}
timeoutSeconds: {{ $.Values.readinessProbe.timeoutSeconds }}
successThreshold: {{ $.Values.readinessProbe.successThreshold }}
failureThreshold: {{ $.Values.readinessProbe.failureThreshold }}
volumeMounts:
- mountPath: "/lava"
name: data
- mountPath: "/lava/config/config.yml"
subPath: config.yml
name: {{ $chain.name | lower }}-config
readOnly: true
resources:
{{- toYaml $.Values.resources | nindent 12 }}
volumes:
- name: {{ $chain.name | lower }}-config
secret:
{{- if $chain.existingConfigSecret }}
secretName: {{ $chain.existingConfigSecret }}
{{- else }}
secretName: {{ $chain.name | lower }}-{{ include "provider.fullname" $ }}
{{- end }}
- name: "private-key-volume"
secret:
secretName: {{ $.Values.key.secretName }}
optional: false
- name: data
emptyDir: {}
{{- with $.Values.nodeSelector }}
nodeSelector:
{{- toYaml $ | nindent 8 }}
{{- end }}
{{- with $.Values.affinity }}
affinity:
{{- toYaml $ | nindent 8 }}
{{- end }}
{{- with $.Values.tolerations }}
tolerations:
{{- toYaml $ | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}
6 changes: 4 additions & 2 deletions charts/provider/templates/statefulset.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- range $chain := $.Values.chains }}
{{- if and $chain.persistence $chain.persistence.enabled }}
---
apiVersion: apps/v1
kind: StatefulSet
Expand All @@ -11,8 +12,8 @@ spec:
replicas: {{ $.Values.replicaCount }}
serviceName: {{ $chain.name | lower }}-{{ include "provider.fullname" $ }}
updateStrategy:
type: {{ $.Values.updateStrategy }}
podManagementPolicy: {{ $.Values.podManagementPolicy }}
type: {{ $.Values.statefulSetUpdate.updateStrategy }}
podManagementPolicy: "Parallel"
selector:
matchLabels:
{{- include "provider.selectorLabels" $ | nindent 6 }}
Expand Down Expand Up @@ -180,3 +181,4 @@ spec:
{{- toYaml $ | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}
45 changes: 25 additions & 20 deletions charts/provider/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@ nameOverride: ""
# -- String to fully override `"provider.fullname"`
fullnameOverride: ""

# -- Update strategy for StatefulSets
updateStrategy: "RollingUpdate"
# -- Pod Management Policy for StatefulSets
podManagementPolicy: "Parallel"
## -- Update strategy for StatefulSets
statefulSetUpdate:
updateStrategy: RollingUpdate

## -- Update strategy for Deployments
deploymentUpdate:
type: RollingUpdate
maxUnavailable: 0
maxSurge: 100%

serviceAccount:
# -- Specifies whether a service account should be created
Expand Down Expand Up @@ -243,22 +248,22 @@ additionalArgs: []

# @ignored
chains:
# - id: lav1
# name: my-lav1
# persistence:
# enabled: true
# accessModes:
# - "ReadWriteOnce"
# size: "100Mi"
# interfaces:
# - interface: rest
# disableTLS: true
# nodes:
# - endpoint: rest.example.com
# type: full
# - endpoint: rest.archive.example.com
# type: archive
# skipVerifications: pruning
- id: lav1
name: my-lav1
persistence:
enabled: true
accessModes:
- "ReadWriteOnce"
size: "100Mi"
interfaces:
- interface: rest
disableTLS: true
nodes:
- endpoint: rest.example.com
type: full
- endpoint: rest.archive.example.com
type: archive
skipVerifications: pruning
# - interface: tendermintrpc
# nodes:
# - endpoint: tendermintrpc.example.com
Expand Down

0 comments on commit 704c75f

Please sign in to comment.