Skip to content

[tmpnet] Switch FlagsMap from map[string]any to map[string]string #3884

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

Merged
merged 3 commits into from
Apr 18, 2025

Conversation

maru-ava
Copy link
Contributor

@maru-ava maru-ava commented Apr 13, 2025

PR Chain: tmpnet+kube

This PR chain enables tmpnet to deploy temporary networks to Kubernetes. Early PRs refactor tmpnet to support the addition in #3615 of a new tmpnet node runtime for kube.

Why this should be merged

map[string]any complicates comparison of values converted to strings (e.g. when node configuration is provided as env vars to a kube pod) to their original golang form. Switching FlagsMap to use map[string]string forces the decision of how to serialize on the developer to ensure that all subsequent usage will be consistent.

This change also updates subnet, chain and monitor configuration to stop using FlagsMap since their use-cases still require map[string]any.

How this was tested

CI

Need to be documented in RELEASES.md?

N/A

TODO

@maru-ava maru-ava added the tooling Build, test and development tooling label Apr 13, 2025
@maru-ava maru-ava self-assigned this Apr 13, 2025
@github-project-automation github-project-automation bot moved this to Backlog 🗄️ in avalanchego Apr 13, 2025
@maru-ava maru-ava moved this from Backlog 🗄️ to In Review 👀 in avalanchego Apr 13, 2025
@maru-ava maru-ava force-pushed the tmpnet-flagsmap-string-values branch from 1e37c28 to 2849541 Compare April 13, 2025 22:29
@maru-ava maru-ava force-pushed the tmpnet-final-refactor branch 2 times, most recently from 11caceb to 3661417 Compare April 14, 2025 18:11
@maru-ava maru-ava force-pushed the tmpnet-flagsmap-string-values branch from e67f6e8 to cfe0814 Compare April 14, 2025 21:24
@maru-ava maru-ava force-pushed the tmpnet-final-refactor branch from 3661417 to 36f1837 Compare April 17, 2025 01:49
@maru-ava maru-ava force-pushed the tmpnet-flagsmap-string-values branch from cfe0814 to bbe84a2 Compare April 17, 2025 14:45
@maru-ava maru-ava changed the base branch from tmpnet-final-refactor to tmpnet-rename-node-process April 17, 2025 14:47
Base automatically changed from tmpnet-rename-node-process to master April 17, 2025 14:51
@maru-ava maru-ava force-pushed the tmpnet-flagsmap-string-values branch from cb924af to e450a64 Compare April 17, 2025 14:56
`map[string]any` complicates comparison of values converted to
strings (e.g. when node configuration is provided as env vars to a
kube pod) to their original golang form. Switching `FlagsMap` to use
`map[string]string` forces the decision of how to serialize on the
developer to ensure that all subsequent usage will be consistent.

This change also updates chain and monitor configuration to stop using
FlagsMap in favor of locally-appropriate maps.
@maru-ava maru-ava force-pushed the tmpnet-flagsmap-string-values branch 3 times, most recently from 24d75ae to 53de819 Compare April 17, 2025 15:01
@maru-ava maru-ava force-pushed the tmpnet-flagsmap-string-values branch from 53de819 to 125ca3f Compare April 17, 2025 15:03
@maru-ava maru-ava marked this pull request as ready for review April 17, 2025 15:04
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR changes the FlagsMap type from map[string]any to map[string]string to enforce consistent string serialization for configuration values. Key changes include replacing FlagsMap with ConfigMap in subnet, process runtime, node, and network components, updating the related helper functions and tests, and revising the handling of boolean and duration values.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/fixture/tmpnet/subnet.go Replaces FlagsMap with ConfigMap for subnet configuration
tests/fixture/tmpnet/process_runtime.go Updates monitoring configuration to use ConfigMap and uses maps.Copy
tests/fixture/tmpnet/node.go Modifies flag retrieval by removing type conversion helper methods
tests/fixture/tmpnet/network.go Updates network configuration and sybil protection flag handling
tests/fixture/tmpnet/flagsmap.go Changes FlagsMap from map[string]interface{} to map[string]string
tests/fixture/tmpnet/defaults.go Converts boolean and duration flag values to string representations
tests/fixture/tmpnet/check_monitoring.go Updates label retrieval to use the new ConfigMap style
tests/fixture/subnet/xsvm.go Revises subnet configuration to use ConfigMap
tests/e2e/p/staking_rewards.go & others Adjusts test assertions to compare against string representations
tests/antithesis/compose.go Modifies compose project construction to remove redundant type checks
Comments suppressed due to low confidence (2)

tests/fixture/tmpnet/process_runtime.go:290

  • The use of maps.Copy on line 291 relies on Go 1.21+ features; please confirm that the project’s minimum Go version supports this function to avoid runtime issues.
promtailLabels := map[string]string{}

tests/antithesis/compose.go:134

  • [nitpick] Since the function signature was changed to remove error returns, please ensure that all failure cases are properly handled upstream, or add a clarifying comment if any errors are now impossible.
func newComposeProject(network *tmpnet.Network, nodeImageName string, workloadImageName string) *types.Project {

Copy link
Contributor

@qdm12 qdm12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@maru-ava maru-ava added this pull request to the merge queue Apr 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tooling Build, test and development tooling
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants