kubernetes/kops · info

stop requested

Error message

stop requested

What it means

During the DNS-controller's runOnce loop, before updating records for a hostname, it polls c.StopRequested(). If the controller is shutting down (stop channel closed), it aborts immediately instead of applying further updates, returning this sentinel error. It is an intentional cooperative-shutdown signal, not a fault in the DNS provider.

Source

Thrown at dns-controller/pkg/dns/dnscontroller.go:265

	}

	var oldValueMap map[recordKey][]string
	if c.lastSuccessfulSnapshot != nil {
		oldValueMap = c.lastSuccessfulSnapshot.recordValues
	}

	op, err := newDNSOp(c.zoneRules, c.dnsCache)
	if err != nil {
		return err
	}

	// Store a list of all the errors, so that one bad apple doesn't block every other request
	var errors []error

	// Check each hostname for changes and apply them
	for k, newValues := range newValueMap {
		if c.StopRequested() {
			return fmt.Errorf("stop requested")
		}
		oldValues := oldValueMap[k]

		if util.StringSlicesEqual(newValues, oldValues) {
			klog.V(4).Infof("no change to records for %s", k)
			continue
		}

		ttl := DefaultTTL
		klog.Infof("Using default TTL of %v", ttl)

		klog.V(4).Infof("updating records for %s: %v -> %v", k, oldValues, newValues)

		// Duplicate records are a hard-error on e.g. Route53
		var dedup []string
		for _, s := range newValues {
			alreadyExists := false
			for _, e := range dedup {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Treat as expected during shutdown: ensure the watcher/leader loop treats this error as a clean exit rather than crash-looping or alerting.
  2. If it recurs without shutdown, verify nothing is closing the stop channel prematurely (e.g. context cancellation in the caller of Run/watcher).
  3. Reduce loop duration (fewer records per pass) so in-flight passes finish faster before SIGTERM grace expires.

Example fix

// before: treating all errors from runOnce as failures
if err := runOnce(...); err != nil {
    klog.Errorf("dns update failed: %v", err)
}
// after
if err := runOnce(...); err != nil {
    if err.Error() == "stop requested" {
        klog.V(2).Infof("dns update aborted: shutdown in progress")
        return
    }
    klog.Errorf("dns update failed: %v", err)
}
Defensive patterns

Strategy: fallback

Validate before calling

// before invoking the watcher, check shutdown state
select {
case <-stopCh:
    klog.Infof("shutdown already requested; skipping dns runOnce")
    return
default:
}
runWatcher(ctx)

Try / catch

if err := runOnce(...); err != nil {
    if strings.Contains(err.Error(), "stop requested") {
        return // clean exit, not a failure
    }
    klog.Errorf("dns update failed: %v", err)
}

Prevention

When it happens

Trigger: Sentinel/term signal received (c.Stop Signal/stopCh closed) while runOnce is iterating newValueMap; the check fires at the top of each per-hostname iteration before updateRecords.

Common situations: kops dns-controller pod receiving SIGTERM during node rotation, cluster teardown, or a kubectl rollout restart; a slow update loop spanning many hostnames is mid-flight when shutdown begins.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/73dd50ca9e2d1216. Report an issue: GitHub.