Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Feature-Request: Pass namespace through #510

Open
snoby opened this issue Dec 4, 2017 · 8 comments
Open

Feature-Request: Pass namespace through #510

snoby opened this issue Dec 4, 2017 · 8 comments

Comments

@snoby
Copy link

snoby commented Dec 4, 2017

I know that this has been discussed before. However Would there be any harm in passing passing a defined metadata namespace object through to the output? If the incoming "kedge" yaml file has a metadata object with a subobject named "namespace" can that key value pair pair get sent through to the output yaml?

Thanks for your consideration.

@surajssd
Copy link
Member

surajssd commented Dec 5, 2017

$ cat kedge.yml 
name: web
namespace: apache

containers:
- image: centos/httpd

services:
- portMappings:
  - 80
  type: LoadBalancer

I am using above kedge file, I would expect both the configs to be created for namespace apache, but only deployment is created for that namespace while service is namespace less.

$ kedge generate -f kedge.yml 
---
apiVersion: v1
kind: Service
metadata:
  creationTimestamp: null
  labels:
    app: web
  name: web
spec:
  ports:
...
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    app: web
  name: web
  namespace: apache
spec:
...

I know I can define namespace in each and every object, but it is very unintuitive. What I would like to propose here is that we create a shortcut for the namespace at root level, so if root level namespace is defined it acts as global namespace for all the objects generated. A user can over-ride we populating the namespace in each every object by defining namespace explitcitly there for that object.

@cdrage
Copy link
Collaborator

cdrage commented Dec 5, 2017

@surajssd Yeah.. this needs to be addressed. If we define a namespace, it should create the service, etc associated with that file (in your example, the kedge.yml file) for everything (all have the same namespace).

@kadel
Copy link
Member

kadel commented Dec 12, 2017

As a rule, we don't want to redefine the behavior of keys from Kubernetes artifacts.
We have Deployment (or other controllers) at the root level of Kedge YAML, that means that namespace is for the controller.

Can we come up with some new name for key defining a global namespace that will be applied to all objects?

@concaf
Copy link
Collaborator

concaf commented Dec 18, 2017

@kadel how about adding root level namespace to every generated Kubernetes object if it is not passed in explicitly. That is what the user will expect when he/she will be specifying namespace at the root level anyway. We are not altering the behavior, we are auto-populating. WDYT?

@kadel
Copy link
Member

kadel commented Dec 19, 2017

@kadel how about adding root level namespace to every generated Kubernetes object if it is not passed in explicitly. That is what the user will expect when he/she will be specifying namespace at the root level anyway. We are not altering the behavior, we are auto-populating. WDYT?

That we could do. But I would rather see --namespace parameter for kedge apply/create/delete. I think that person who is deploying should be the one deciding to which namespace the application will be deployed to.

I don't like when namespace is hardcoded in artifacts

@concaf
Copy link
Collaborator

concaf commented Dec 19, 2017

I agree that namespace should not be a part of the application definition but should be a part of cluster operations passed via command line, but since ObjectMeta has namespace anyway, we could add auto population as well as a --namespace flag

@surajssd
Copy link
Member

@containscafeine auto-population from where ? I am not sure what you mean here?

@kadel
Copy link
Member

kadel commented Dec 20, 2017

@containscafeine auto-population from where ? I am not sure what you mean here?

@surajssd, what @containscafeine means is that we should do the same thing with with namespace as what we are doing with name (if not set use namespace from controller).

@containscafeine I'm ok with that as long as --namespace flag can always overwrite that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants