Skip to content

operator: check config reload happened before completing reconcile#2399

Open
AndrewChubatiuk wants to merge 1 commit into
masterfrom
fix/vmauth-wait-for-reload
Open

operator: check config reload happened before completing reconcile#2399
AndrewChubatiuk wants to merge 1 commit into
masterfrom
fix/vmauth-wait-for-reload

Conversation

@AndrewChubatiuk

Copy link
Copy Markdown
Contributor
  • check config reload event happened before marking reconcile as complete for vmagent, vmauth, vmalertmanager and vmalert
  • force waiting for vmauth config reload event in vmdistributed

@AndrewChubatiuk
AndrewChubatiuk force-pushed the fix/vmauth-wait-for-reload branch from 94c8719 to 181498d Compare July 13, 2026 08:36

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed

Tip: instead of fixing issues one by one fix them all with cubic

Re-trigger cubic

Comment thread internal/podutil/discover.go Outdated
Comment thread internal/controller/operator/factory/vmagent/vmagent.go Outdated
Comment thread internal/controller/operator/factory/vmalert/rules.go Outdated
Comment thread internal/controller/operator/factory/vmalertmanager/statefulset.go Outdated
Comment thread internal/controller/operator/factory/reconcile/config_reload.go
Comment thread docs/CHANGELOG.md
Comment thread internal/podutil/metrics.go Outdated
Comment thread internal/controller/operator/factory/vmagent/vmagent.go Outdated
Comment thread internal/controller/operator/factory/vmalert/rules.go
@AndrewChubatiuk
AndrewChubatiuk force-pushed the fix/vmauth-wait-for-reload branch from 181498d to 399ff3a Compare July 13, 2026 09:07
@AndrewChubatiuk

Copy link
Copy Markdown
Contributor Author

@cubic-ai-dev

@cubic-dev-ai

cubic-dev-ai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

@cubic-ai-dev

@AndrewChubatiuk I have started the AI code review. It will take a few minutes to complete.

@AndrewChubatiuk
AndrewChubatiuk force-pushed the fix/vmauth-wait-for-reload branch 2 times, most recently from f10eaee to 9a303fb Compare July 13, 2026 09:18

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed

Tip: instead of fixing issues one by one fix them all with cubic

Re-trigger cubic

Comment thread internal/controller/operator/factory/vmsingle/vmsingle.go Outdated
Comment thread internal/controller/operator/factory/vmauth/vmauth.go Outdated
Comment thread internal/controller/operator/factory/vmagent/vmagent.go Outdated
Comment thread internal/controller/operator/factory/vmauth/vmauth.go Outdated
Comment thread internal/controller/operator/factory/vmalertmanager/statefulset.go Outdated
Comment thread internal/controller/operator/factory/vmalert/vmalert.go
@AndrewChubatiuk
AndrewChubatiuk force-pushed the fix/vmauth-wait-for-reload branch 5 times, most recently from 1d64c4f to b5c70ae Compare July 13, 2026 11:04
@AndrewChubatiuk
AndrewChubatiuk force-pushed the fix/vmauth-wait-for-reload branch 2 times, most recently from 3825d28 to 7cc4bcf Compare July 14, 2026 17:04
Comment thread api/operator/v1beta1/vmagent_types.go Outdated
// GetConfigReloadMetricNames returns metrics, that vmagent exposes for config-reload completion check
func (cr *VMAgent) GetConfigReloadMetricNames() []string {
return []string{
"vm_promscrape_config_last_reload_success_timestamp_seconds",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We may want to add those as consts and reuse them here - it would prevent us from making typos here

@AndrewChubatiuk AndrewChubatiuk Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

there's only one metric vm_promscrape_config_last_reload_success_timestamp_seconds, which is used in multiple places. not sure consts make sense

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Right, in that case its probably extra. I wonder if we have e2e tests for these to prevent us from referencing metric names which don't exist

@AndrewChubatiuk AndrewChubatiuk Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i can add a warning to logs that metric doesn't exist and exit from check

// that the merged config was written to a Secret. It's a no-op unless
// WaitForConfigReload is enabled on the CR and the CR type reports a
// config-reload-completion metric.
func WaitForConfigReload(ctx context.Context, rclient client.Client, cr configReloadWaitable, after time.Time) error {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should pass metric names here (and default to cr.GetConfigReloadMetricNames if unset). This would enable us to check exact metric reload time (in case multiple events are fired within one second). I think this is what https://github.com/VictoriaMetrics/operator/pull/2399/changes#r3569190534 is about too

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sorry, don't get your idea

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If I read this correctly whenever one secret is updated we'll check for all metrics - although we could check for just one metric in some cases. It could help us when multiple metrics are being updated simultaneously and I think there is a situation where we'll issue an extra reload

@AndrewChubatiuk
AndrewChubatiuk force-pushed the fix/vmauth-wait-for-reload branch 4 times, most recently from 289cb8a to 6aa74ac Compare July 15, 2026 15:03
@AndrewChubatiuk
AndrewChubatiuk force-pushed the fix/vmauth-wait-for-reload branch from 6aa74ac to f39a29b Compare July 15, 2026 15:07
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.

2 participants