Skip to content

Commit

Permalink
[sc-3400]: refactor gofer chart to allow some override (#114)
Browse files Browse the repository at this point in the history
* [sc-3400]: refactor gofer chart to allow some override

* update image

* fix test connection
  • Loading branch information
WesleyCharlesBlake authored Jan 17, 2024
1 parent e945903 commit 590140a
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 31 deletions.
4 changes: 2 additions & 2 deletions charts/gofer/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ 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.0.4
version: 0.2.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: "0.10.0"
appVersion: "0.29"
16 changes: 12 additions & 4 deletions charts/gofer/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# gofer

![Version: 0.0.3](https://img.shields.io/badge/Version-0.0.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.10.0](https://img.shields.io/badge/AppVersion-0.10.0-informational?style=flat-square)
![Version: 0.2.0](https://img.shields.io/badge/Version-0.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.29](https://img.shields.io/badge/AppVersion-0.29-informational?style=flat-square)

A Helm chart for deploying gofer to Kubernetes

Expand All @@ -21,11 +21,12 @@ A Helm chart for deploying gofer to Kubernetes
| autoscaling.minReplicas | int | `1` | |
| autoscaling.targetCPUUtilizationPercentage | int | `80` | |
| configHcl | object | `{}` | |
| env | object | `{}` | |
| env | object | `{}` | Environment variable listing |
| fullnameOverride | string | `""` | |
| goferMode | string | `"agent"` | can be "agent" or "watch" |
| image.pullPolicy | string | `"IfNotPresent"` | |
| image.repository | string | `"ghcr.io/chronicleprotocol/gofer"` | |
| image.tag | string | `"sha-7375716"` | |
| image.tag | string | `"sha-f2a5f01"` | |
| imagePullSecrets | list | `[]` | |
| ingress.annotations | object | `{}` | |
| ingress.className | string | `""` | |
Expand All @@ -34,15 +35,22 @@ A Helm chart for deploying gofer to Kubernetes
| ingress.hosts[0].paths[0].path | string | `"/"` | |
| ingress.hosts[0].paths[0].pathType | string | `"ImplementationSpecific"` | |
| ingress.tls | list | `[]` | |
| livenessProbe.initialDelaySeconds | int | `60` | |
| livenessProbe.periodSeconds | int | `120` | |
| livenessProbe.tcpSocket.port | string | `"gofer"` | |
| logLevel | string | `"debug"` | |
| nameOverride | string | `""` | |
| nodeSelector | object | `{}` | |
| podAnnotations | object | `{}` | |
| podSecurityContext | object | `{}` | |
| readinessProbe.initialDelaySeconds | int | `10` | |
| readinessProbe.periodSeconds | int | `10` | |
| readinessProbe.tcpSocket.port | string | `"gofer"` | |
| replicaCount | int | `1` | |
| resources | object | `{}` | |
| securityContext | object | `{}` | |
| service.port | int | `9200` | |
| service.ports.gofer.port | int | `9090` | |
| service.ports.gofer.protocol | string | `"TCP"` | |
| service.type | string | `"ClusterIP"` | |
| serviceAccount.annotations | object | `{}` | |
| serviceAccount.create | bool | `true` | |
Expand Down
1 change: 1 addition & 0 deletions charts/gofer/ci/agent-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
goferMode: "agent"
8 changes: 8 additions & 0 deletions charts/gofer/ci/watch-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
goferMode: "watch"

env:
normal:
WATCHDOG_CHAIN_RPC_URLS: "https://rpc.testnet.chroniclelabs.io/sep"
WATCHDOG_CONFIG_REGISTRY: 0xE1CcD31f46F30A764DbACB4759E69d8799126941
WATCHDOG_INTERVAL: 60s
WATCHDOG_ETH_FROM: "0x0000000000000000000000000000000000000000"
28 changes: 13 additions & 15 deletions charts/gofer/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,20 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.configHcl }}
args: [ "-c", "/config/gofer.hcl", "agent", "-v", "{{ .Values.logLevel | default "debug" }}"]
args: [ "-c", "/config/gofer.hcl", "{{ .Values.goferMode }}", "-v", "{{ .Values.logLevel | default "debug" }}"]
{{- else }}
args: ["agent", "-v", "{{ .Values.logLevel | default "debug" }}"]
args: ["{{ .Values.goferMode }}", "-v", "{{ .Values.logLevel | default "debug" }}"]
{{- end }}
ports:
- name: listener
containerPort: {{ .Values.service.port }}
protocol: TCP
# readinessProbe:
# tcpSocket:
# port: {{ .Values.service.port }}
# initialDelaySeconds: 5
# periodSeconds: 10
# livenessProbe:
# tcpSocket:
# port: {{ .Values.service.port }}
# initialDelaySeconds: 15
# periodSeconds: 20
{{- range $key, $val := .Values.service.ports }}
- name: {{ $key }}
containerPort: {{ $val.port }}
protocol: {{ $val.protocol }}
{{- end }}
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
Expand All @@ -67,9 +63,11 @@ spec:
{{- include "helpers.list-env-variables" . | indent 12 }}

volumes:
{{- if .Values.configHcl }}
- name: config
configMap:
name: {{ include "gofer.fullname" . -}}-config
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
10 changes: 6 additions & 4 deletions charts/gofer/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ metadata:
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: listener
protocol: TCP
name: listener
{{- range $key, $val := .Values.service.ports }}
- port: {{ $val.port }}
targetPort: {{ $val.port }}
protocol: {{ $val.protocol }}
name: {{ $key }}
{{- end }}
selector:
{{- include "gofer.selectorLabels" . | nindent 4 }}
10 changes: 7 additions & 3 deletions charts/gofer/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ metadata:
"helm.sh/hook": test
spec:
containers:
- name: nc
{{- $serviceName := include "gofer.fullname" . }}
{{- range $name, $config := .Values.service.ports }}
- name: nc-{{ $name }}
image: busybox
command: ['nc']
args:
- '-zv'
- '{{ include "gofer.fullname" . }}'
- '{{ .Values.service.port }}'
- '-v'
- '{{ $serviceName }}'
- '{{ $config.port }}'
{{- end }}
restartPolicy: Never
24 changes: 21 additions & 3 deletions charts/gofer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
replicaCount: 1

logLevel: "debug"
# -- can be "agent" or "watch"
goferMode: "agent"

# Environment variable listing
# -- Environment variable listing
env: {}
# non sensitive variables
# refer to https://github.com/chronicleprotocol/oracle-suite/tree/master/cmd/gofer#environment-variables
Expand All @@ -17,7 +19,7 @@ image:
repository: ghcr.io/chronicleprotocol/gofer
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "sha-7375716"
tag: "sha-f2a5f01"

imagePullSecrets: []
nameOverride: ""
Expand Down Expand Up @@ -47,7 +49,10 @@ securityContext: {}

service:
type: ClusterIP
port: 9200
ports:
gofer:
port: 9090
protocol: TCP

ingress:
enabled: false
Expand All @@ -65,6 +70,19 @@ ingress:
# hosts:
# - chart-example.local

# @default -- See `values.yaml`
livenessProbe:
tcpSocket:
port: gofer
initialDelaySeconds: 60
periodSeconds: 120

# @default -- See `values.yaml`
readinessProbe:
tcpSocket:
port: gofer
initialDelaySeconds: 10
periodSeconds: 10

resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
Expand Down

0 comments on commit 590140a

Please sign in to comment.