I have a program in ruby which creates deployments, services and ing in a specific namespace. When I want to create a namespace, it complains for NoMethodError.
This is the code:
namespace = Kubeclient::Resource.new
namespace.metadata = {}
namespace.metadata.name = ns
@kube_client.create_daemon_set namespace
And this is the exception:
Exception occurred undefined method `create_namespace' for #<Kubeclient::Client:0x0000000267b810>
All other functions including creating deployment and service works fine.
This is a snippet from a test:
namespace = Kubeclient::Resource.new
namespace.metadata = {}
namespace.metadata.name = 'development'
client = Kubeclient::Client.new('http://localhost:8080/api/')
created_namespace = client.create_namespace(namespace)
assert_instance_of(Kubeclient::Resource, created_namespace)
assert_equal(namespace.metadata.name, created_namespace.metadata.name)
You forgot parenthesis.