Skip to content

Commit 7a468a4

Browse files
authored
Skip k8s resources that have an empty name during resource deletion (#2032)
Summary: Skip k8s resources that have an empty name during resource deletion Newer versions of k8s break our `px delete` cli logic (see details on #2029). I tracked this down to the the [condition function](https://github.com/kubernetes/kubectl/blob/0315be426ca25e6554f1c9089534b62ce12254d4/pkg/cmd/wait/delete.go#L41-L43) in our ObjectDeleter. I believe the newer versions of k8s added resources that match our visitor, but don't have a resource name. From my testing, it seemed related to the `ValidatingAdmissionPolicies` or `ValidatingAdmissionPolicyBindings` resources. Relevant Issues: Closes #2029 Type of change: /kind bugfix Test Plan: Deployed a vizier and verified that a subsequent `px delete` deleted the following * `pl` namespace * `px-operator` namespace * Cluster scoped resources: `pl-cloud-connector-role`, `pl-vizier-metadata` and `pl-node-view` cluster roles Changelog Message: Fixed an issue that caused `px delete` to fail on newer k8s clusters (1.30 and later) Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
1 parent 5292f58 commit 7a468a4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/utils/shared/k8s/delete.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,13 @@ func (o *ObjectDeleter) runDelete(r *resource.Result) (int, error) {
185185
if err != nil {
186186
return err
187187
}
188+
// In newer versions of k8s, the resource name can be empty. This causes
189+
// the delete to fail since it can't watch for the resource. See
190+
// https://github.com/pixie-io/pixie/issues/2029 for more details.
191+
if info.Name == "" {
192+
log.Debugf("Skipping resource with empty name: %+v\n", info)
193+
return nil
194+
}
188195
deletedInfos = append(deletedInfos, info)
189196
found++
190197

0 commit comments

Comments
 (0)