Skip to content

[WIP] Reject deleting default felixconfiguration#12110

Open
mazdakn wants to merge 1 commit intoprojectcalico:masterfrom
mazdakn:reject-deleting-default-felixconf
Open

[WIP] Reject deleting default felixconfiguration#12110
mazdakn wants to merge 1 commit intoprojectcalico:masterfrom
mazdakn:reject-deleting-default-felixconf

Conversation

@mazdakn
Copy link
Member

@mazdakn mazdakn commented Mar 12, 2026

Release note:

TBD

@mazdakn mazdakn requested a review from a team as a code owner March 12, 2026 22:18
Copilot AI review requested due to automatic review settings March 12, 2026 22:18
@marvin-tigera marvin-tigera added this to the Calico v3.32.0 milestone Mar 12, 2026
@marvin-tigera marvin-tigera added release-note-required Change has user-facing impact (no matter how small) docs-pr-required Change is not yet documented labels Mar 12, 2026
Copy link
Contributor

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

Prevents deletion of the global default FelixConfiguration (name: "default") via the libcalico-go v3 client, to protect the baseline Felix configuration object from being removed.

Changes:

  • Add DefaultFelixConfigurationName = "default" constant.
  • Reject FelixConfigurations().Delete(..., "default", ...) by returning ErrorOperationNotSupported.

Comment on lines +86 to +93
if name == DefaultFelixConfigurationName {
return nil, cerrors.ErrorOperationNotSupported{
Identifier: name,
Operation: "Delete",
Reason: fmt.Sprintf("Cannot delete %v felixconfiguration", name),
}
}

Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

This change makes deleting the global FelixConfiguration named "default" impossible, but Felix FV infrastructure currently relies on being able to delete that object during topology setup when Create returns ErrorResourceAlreadyExists (see felix/fv/infrastructure/topology.go around the InitialFelixConfiguration install loop). With this change, that Eventually loop will keep failing and FV runs will likely hang/fail whenever an unexpected default FelixConfiguration exists. Update the callers to Get+Update the existing "default" FelixConfiguration (or otherwise reset it) instead of attempting Delete, or provide an alternative supported path for tests/tools that need to replace the default config.

Suggested change
if name == DefaultFelixConfigurationName {
return nil, cerrors.ErrorOperationNotSupported{
Identifier: name,
Operation: "Delete",
Reason: fmt.Sprintf("Cannot delete %v felixconfiguration", name),
}
}

Copilot uses AI. Check for mistakes.
return nil, cerrors.ErrorOperationNotSupported{
Identifier: name,
Operation: "Delete",
Reason: fmt.Sprintf("Cannot delete %v felixconfiguration", name),
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

The ErrorOperationNotSupported reason string is hard to read and inconsistent with similar messages elsewhere (e.g., Profile uses quoted names and a full sentence). Consider using proper resource casing ("FelixConfiguration") and quoting the name (e.g., %q) so the final error is clearer for users and for any tooling that surfaces these errors.

Suggested change
Reason: fmt.Sprintf("Cannot delete %v felixconfiguration", name),
Reason: fmt.Sprintf("Cannot delete FelixConfiguration %q", name),

Copilot uses AI. Check for mistakes.
Comment on lines +86 to +92
if name == DefaultFelixConfigurationName {
return nil, cerrors.ErrorOperationNotSupported{
Identifier: name,
Operation: "Delete",
Reason: fmt.Sprintf("Cannot delete %v felixconfiguration", name),
}
}
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

New behavior (rejecting Delete for the "default" FelixConfiguration) should be covered by tests. There are existing clientv3 FelixConfiguration e2e CRUD tests; add an assertion that Delete("default") returns ErrorOperationNotSupported (and does not delete the resource) to prevent regressions and to make the contract explicit.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-pr-required Change is not yet documented release-note-required Change has user-facing impact (no matter how small)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants