From c6145d0a420f6ee764d1c050e3d0373fe8449460 Mon Sep 17 00:00:00 2001 From: Ana C Date: Fri, 20 Dec 2024 17:53:03 -0800 Subject: [PATCH] fix(graph-network-indexer): update indexerAgent cli to handle duplicate (#439) --- charts/graph-network-indexer/Chart.yaml | 2 +- charts/graph-network-indexer/README.md | 2 +- .../templates/indexer-agent/statefulset.yaml | 67 ++++++++++++------- charts/graph-network-indexer/values.yaml | 2 +- 4 files changed, 44 insertions(+), 29 deletions(-) diff --git a/charts/graph-network-indexer/Chart.yaml b/charts/graph-network-indexer/Chart.yaml index 9c22aab4..b3cc2482 100644 --- a/charts/graph-network-indexer/Chart.yaml +++ b/charts/graph-network-indexer/Chart.yaml @@ -15,7 +15,7 @@ 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.5.12 +version: 0.5.13 # The appVersion field is intentionally left empty. Component versions are managed separately # and can be found in the values.yaml file or individual component configurations. diff --git a/charts/graph-network-indexer/README.md b/charts/graph-network-indexer/README.md index c3241192..795ed82f 100644 --- a/charts/graph-network-indexer/README.md +++ b/charts/graph-network-indexer/README.md @@ -2,7 +2,7 @@ Deploy and scale the [Graph Network Indexer](https://github.com/graphprotocol/indexer) components inside Kubernetes with ease -[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ![Version: 0.5.12](https://img.shields.io/badge/Version-0.5.12-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) +[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ![Version: 0.5.13](https://img.shields.io/badge/Version-0.5.13-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ## Introduction diff --git a/charts/graph-network-indexer/templates/indexer-agent/statefulset.yaml b/charts/graph-network-indexer/templates/indexer-agent/statefulset.yaml index 38a563d6..6a902d63 100644 --- a/charts/graph-network-indexer/templates/indexer-agent/statefulset.yaml +++ b/charts/graph-network-indexer/templates/indexer-agent/statefulset.yaml @@ -2,6 +2,44 @@ {{- $componentName := "agent" }} {{- $componentLabel := include "graph-network-indexer.componentLabelFor" $componentName }} +{{/* Compute command line arguments */}} +{{- $args := dict }} +{{/* Populate base arguments */}} +{{- $_ := set $args "graph-node-query-endpoint" (dict "value" $values.config.graph_node.query_url) }} +{{- $_ := set $args "graph-node-status-endpoint" (dict "value" $values.config.graph_node.status_url) }} +{{- $_ := set $args "indexer-address" (dict "value" $values.config.indexer.indexer_address "quote" true) }} + +{{/* Add network subgraph configs if they exist */}} +{{- with (index $values.config "subgraphs.network") }} +{{- if hasKey . "query_url" }} +{{- $_ := set $args "network-subgraph-endpoint" (dict "value" .query_url "quote" true) }} +{{- end }} +{{- if hasKey . "deployment_id" }} +{{- $_ := set $args "network-subgraph-deployment" (dict "value" .deployment_id "quote" true) }} +{{- end }} +{{- end }} + +{{/* Add escrow subgraph configs if they exist */}} +{{- with (index $values.config "subgraphs.escrow") }} +{{- if hasKey . "query_url" }} +{{- $_ := set $args "tap-subgraph-endpoint" (dict "value" .query_url "quote" true) }} +{{- end }} +{{- end }} + +{{/* Add postgres configs */}} +{{- $_ := set $args "postgres-database" (dict "value" $values.postgresConfig.database) }} +{{- $_ := set $args "postgres-host" (dict "value" $values.postgresConfig.host) }} +{{- $_ := set $args "postgres-port" (dict "value" $values.postgresConfig.port) }} + +{{/* Merge in indexerAgent.config values */}} +{{- with $.Values.indexerAgent.config }} +{{- range $key, $val := . }} +{{- if not (kindIs "invalid" $val) }} +{{- $_ := set $args $key (dict "value" $val) }} +{{- end }} +{{- end }} +{{- end }} + {{/* START StatefulSet */}} --- apiVersion: apps/v1 @@ -66,33 +104,10 @@ spec: name: {{ $val.secretName | quote }} key: {{ $val.key | quote }} {{- end }} - {{- end }} + {{- end }} args: - - --graph-node-query-endpoint={{ $values.config.graph_node.query_url }} - - --graph-node-status-endpoint={{ $values.config.graph_node.status_url }} - - --indexer-address={{ $values.config.indexer.indexer_address | quote }} - {{- with (index $values.config "subgraphs.network") }} - {{- if hasKey . "query_url" }} - - --network-subgraph-endpoint={{ .query_url | quote }} - {{- end }} - {{- if hasKey . "deployment_id" }} - - --network-subgraph-deployment={{ .deployment_id | quote }} - {{- end }} - {{- end }} - {{- with (index $values.config "subgraphs.escrow") }} - {{- if hasKey . "query_url" }} - - --tap-subgraph-endpoint={{ .query_url | quote }} - {{- end }} - {{- end }} - - --postgres-database={{ $values.postgresConfig.database }} - - --postgres-host={{ $values.postgresConfig.host }} - - --postgres-port={{ $values.postgresConfig.port }} - {{- with $.Values.indexerAgent.config }} - {{- range $key, $val := .}} - {{- if not (kindIs "invalid" $val) }} - - --{{ $key }}={{ $val }} - {{- end }} - {{- end }} + {{- range $key, $val := $args }} + - --{{ $key }}={{ if $val.quote }}{{ printf "%q" $val.value }}{{ else }}{{ $val.value }}{{ end }} {{- end }} {{- with $values.extraArgs }} {{- toYaml (. | default list) | nindent 12 }} diff --git a/charts/graph-network-indexer/values.yaml b/charts/graph-network-indexer/values.yaml index f8a802ef..5ccb0298 100644 --- a/charts/graph-network-indexer/values.yaml +++ b/charts/graph-network-indexer/values.yaml @@ -115,7 +115,7 @@ indexerAgent: tag: "v0.21.11" # -- Config to be supplied as CLI arguments, specified using YAML keys to allow overriding - config: + config: indexer-management-port: 8000 ethereum: null # -- Name of the network that you have specified a node URL for in `ethereum`