Skip to content

Conversation

haelekuin
Copy link

@haelekuin haelekuin commented Oct 14, 2025

Currently, when a configuration is invalid it will be deployed and the service restarted, breaking the agent. Since the configuration can be checked with the -dryRun flag, we can validate it before deploying.

Output of make molecule-converge-vmagent with invalid configuration:

vmagent_scrape_config:
  scrape_configs:
    - job_name: localhost
      static_configs:
        - clearlynotcorrect: []

Error:

TASK [vmagent : Configure promscrape config] ***********************************
.....
 cannot unmarshal data: yaml: unmarshal errors:", "  line 8: field clearlynotcorrect not found in type promscrape.StaticConfig; pass -promscrape.config.strictParse=false command-line flag for ignoring unknown fields in yaml config"], "stdout": "", "stdout_lines": []}    
vmagent_aggregation_config:
    - thisdoesntlookright: 'http_request_duration_seconds_bucket'
      interval: 5m
      without: [ instance ]
      outputs: [ total ]

Error:

....
 cannot initialize aggregators from \"/root/.ansible/tmp/ansible-tmp-1760437836.091619-5351-245839758935917/source\": cannot parse stream aggregation config: yaml: unmarshal errors:", "  line 8: field thisdoesntlookright not found in type streamaggr.Config; see https://docs.victoriametrics.com/victoriametrics/stream-aggregation/#stream-aggregation-config"]

With valid configurations, both tests pass successfully.

Checks config before restarting to ensure an invalid config isn't
deployed
@haelekuin haelekuin marked this pull request as ready for review October 14, 2025 10:33
@haelekuin haelekuin requested a review from zekker6 as a code owner October 14, 2025 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant