kubeclient icon indicating copy to clipboard operation
kubeclient copied to clipboard

delete_namespaces("") deletes all namespaces

Open ghost opened this issue 8 years ago • 2 comments

Thankfully, it does it with --cascade false, but this seems like improper behavior. Is there any reason why an empty string corresponds to all for an entity function? Maybe this shouldn't be the delete default behavior.

ghost avatar Jul 10 '17 19:07 ghost

Does not sound like a desired behavior. Might be related to https://github.com/abonas/kubeclient/blob/1e7e4f4db3c3f79985651db298d60f6ca31be778/lib/kubeclient/common.rb#L302.

@Ryan-Rose-Bose can you add a reproducer? I could not reproduce with master:

client = Kubeclient::Client.new(
  'https://<IP>:8443/api',
  'v1',
  ssl_options: { verify_ssl: 0 },
  auth_options: { bearer_token: <TOKEN>})

puts client.get_namespaces.map {|ns| ns.metadata.name}
client.delete_namespaces("")

> /home/mtayer/.rvm/gems/ruby-2.3.2/gems/kubeclient-2.4.0/lib/kubeclient/common.rb:91:in `method_missing': undefined method `delete_namespaces' for #<Kubeclient::Client:0x000000025f1458> (NoMethodError)
Did you mean?  delete_namespace

moolitayer avatar Jul 11 '17 07:07 moolitayer

same happens when doing get_node '' ... returns all nodes ... that was fun to debug :D

grosser avatar Sep 12 '18 23:09 grosser