Skip to content

Commit

Permalink
Prevent deletion of local cluster
Browse files Browse the repository at this point in the history
Signed-off-by: Dharmit Shah <[email protected]>
  • Loading branch information
dharmit committed Dec 5, 2024
1 parent 12879d9 commit 960be01
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/resources/management.cattle.io/v3/cluster/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ func (a *admitter) Admit(request *admission.Request) (*admissionv1.AdmissionResp
return nil, fmt.Errorf("failed get old and new clusters from request: %w", err)
}

if request.Operation == admissionv1.Delete && request.Name == "local" {
return admission.ResponseBadRequest("bad idea; nope, nope"), nil
}

response, err := a.validateFleetPermissions(request, oldCluster, newCluster)
if err != nil {
return nil, fmt.Errorf("failed to validate fleet permissions: %w", err)
Expand Down

0 comments on commit 960be01

Please sign in to comment.