kill-kube-ns icon indicating copy to clipboard operation
kill-kube-ns copied to clipboard

Cannot iterate over null

Open oxr463 opened this issue 4 years ago • 4 comments

./kill-kube-ns cattle-global-data
jq: error (at <stdin>:63): Cannot iterate over null (null)

kubectl get ns                   
NAME                                     STATUS        AGE
cattle-global-data                       Terminating   22d

oxr463 avatar Sep 17 '21 20:09 oxr463

Can you show the finalizers which are set for this namespace?

ctron avatar Sep 20 '21 07:09 ctron

kubectl get namespace cattle-global-data -o yaml
apiVersion: v1
kind: Namespace
metadata:
  annotations:
    cattle.io/status: '{"Conditions":[{"Type":"ResourceQuotaInit","Status":"True","Message":"","LastUpdateTime":"2021-09-17T20:43:31Z"},{"Type":"InitialRolesPopulated","Status":"True","Message":"","LastUpdateTime":"2021-09-17T20:43:32Z"}]}'
    lifecycle.cattle.io/create.namespace-auth: "true"
  creationTimestamp: "2021-09-17T20:43:25Z"
  deletionTimestamp: "2021-09-20T18:36:45Z"
  finalizers:
  - controller.cattle.io/namespace-auth
  labels:
    cattle.io/creator: norman
  name: cattle-global-data
  resourceVersion: "25719370"
  selfLink: /api/v1/namespaces/cattle-global-data
  uid: 0443db08-abe0-4406-9036-e8bfd6741f28
spec: {}
status:
  phase: Terminating

oxr463 avatar Sep 20 '21 18:09 oxr463

I removed the finalizer manually and the namespace disappeared, but I figured this tool would've done that for me.

oxr463 avatar Sep 20 '21 18:09 oxr463

The tool does that, but only when the finalizer is the kubernetes finalizer. You can swap out the name of the finalizer in the script.

It would be cool to have this script handle "null", and also to have the ability to put in the correct finalizer to remove.

Then again, I didn't need to use this script for quite a while. I guess the underlying issue was resolved. So, I am not sure what to do here.

ctron avatar Sep 21 '21 07:09 ctron