kontena / mortar

The manifest shooter for Kubernetes
Apache License 2.0
145 stars 14 forks source link

Handle namespace defaulting #10

Open jnummelin opened 6 years ago

jnummelin commented 6 years ago

Currently the namespace is a mandatory for each of the resources. Mortar could handle the namespace defaulting same way as kubectl does. The underlying k8s-client library has also some support for it coming, see https://github.com/kontena/k8s-client/pull/33. It might be better to handle namespace defaulting actually on Mortar level rather than in the API client level.

jnummelin commented 6 years ago

The make this bit worse, the error is rather misleading:

/usr/local/lib/ruby/gems/2.5.0/gems/k8s-client-0.4.1/lib/k8s/transport.rb:192:in `parse_response’: POST /api/v1/services => HTTP 405 Method Not Allowed: the server does not allow this method on the requested resource (K8s::Error::MethodNotAllowed)

Without the namespace in the resources, k8s-client Mortar uses will POST the resources into wrong API endpoint...

matti commented 5 years ago

so if you copy/paste a sample yaml from: https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/

it will bomb because of this