kubernetes/kops · error
cannot apply changes to Subnet: %v
Error message
cannot apply changes to Subnet: %v
What it means
Returned from Subnet.RenderGCE when, after secondary-range and StackType updates are handled, the residual diff is still non-empty. Subnets cannot be resized or moved in place, so remaining changes (e.g. CIDR change) are reported as unappliable.
Source
Thrown at upup/pkg/fi/cloudup/gcetasks/subnet.go:176
return err
}
}
changes.SecondaryIpRanges = nil
}
if changes.StackType != nil {
if err := updateStackTypeAndIPv6AccessType(cloud, e); err != nil {
return err
}
changes.StackType = nil
changes.Ipv6AccessType = nil
}
empty := &Subnet{}
if !reflect.DeepEqual(empty, changes) {
return fmt.Errorf("cannot apply changes to Subnet: %v", changes)
}
}
return nil
}
func updateSecondaryRanges(cloud gce.GCECloud, op string, e *Subnet) error {
// We need to refetch to patch it
subnet, err := cloud.Compute().Subnetworks().Get(cloud.Project(), cloud.Region(), *e.Name)
if err != nil {
return fmt.Errorf("error fetching subnet for patch: %w", err)
}
expectedRanges := e.SecondaryIpRanges
actualRanges := make(map[string]string)
for _, r := range subnet.SecondaryIpRanges {
actualRanges[r.RangeName] = r.IpCidrRangeView on GitHub (pinned to 4c8573c808)
Solutions
- Inspect the printed changes to see which fields could not be applied
- Align the cluster spec's subnet settings with the live subnet
- Recreate the subnet (usually only feasible for non-shared, non-production networks) if the CIDR must change
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at upup/pkg/fi/cloudup/gcetasks/subnet.go:176 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/108faf98f38449e9.
Report an issue: GitHub.