{"action":"created","issue":{"url":"https://api.github.com/repos/spotahome/kooper/issues/56","repository_url":"https://api.github.com/repos/spotahome/kooper","labels_url":"https://api.github.com/repos/spotahome/kooper/issues/56/labels{/name}","comments_url":"https://api.github.com/repos/spotahome/kooper/issues/56/comments","events_url":"https://api.github.com/repos/spotahome/kooper/issues/56/events","html_url":"https://github.com/spotahome/kooper/issues/56","id":354376526,"node_id":"MDU6SXNzdWUzNTQzNzY1MjY=","number":56,"title":"Namespace Is Empty In the Handler","user":{"login":"YiannisGkoufas","id":16906312,"node_id":"MDQ6VXNlcjE2OTA2MzEy","avatar_url":"https://avatars1.githubusercontent.com/u/16906312?v=4","gravatar_id":"","url":"https://api.github.com/users/YiannisGkoufas","html_url":"https://github.com/YiannisGkoufas","followers_url":"https://api.github.com/users/YiannisGkoufas/followers","following_url":"https://api.github.com/users/YiannisGkoufas/following{/other_user}","gists_url":"https://api.github.com/users/YiannisGkoufas/gists{/gist_id}","starred_url":"https://api.github.com/users/YiannisGkoufas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YiannisGkoufas/subscriptions","organizations_url":"https://api.github.com/users/YiannisGkoufas/orgs","repos_url":"https://api.github.com/users/YiannisGkoufas/repos","events_url":"https://api.github.com/users/YiannisGkoufas/events{/privacy}","received_events_url":"https://api.github.com/users/YiannisGkoufas/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-08-27T15:57:14Z","updated_at":"2018-09-14T10:17:55Z","closed_at":"2018-09-14T09:54:13Z","author_association":"NONE","body":"What I am trying to do is having the operator running and be responsible for my new CRD across all the namespaces. In the crd.go (as the pod terminator example) I have the following:\r\n```\r\nfunc (p *myCRD) GetListerWatcher() cache.ListerWatcher {\r\n\treturn &cache.ListWatch{\r\n\t\tListFunc: func(options metav1.ListOptions) (runtime.Object, error) {\r\n\t\t\treturn p.myCRDCli.V1alpha1().MyCRD(\"\").List(options)\r\n\t\t},\r\n\t\tWatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {\r\n\t\t\treturn p.myCRDCli.V1alpha1().MyCRD(\"\").Watch(options)\r\n\t\t},\r\n\t}\r\n}\r\n```\r\nIn the above way I am able to monitor the custom CRDs across all the namespaces.\r\nThe definition of the CRD is:\r\n```\r\n// +genclient\r\n// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object\r\n\r\n// PodTerminator represents a pod terminator.\r\ntype MyCRD struct {\r\n\tmetav1.TypeMeta `json:\",inline\"`\r\n\t// Standard object's metadata.\r\n\t// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata\r\n\t// +optional\r\n\tmetav1.ObjectMeta `json:\"metadata,omitempty\"`\r\n}\r\n```\r\nNotice that I omit the nonNamespaced option of the example.\r\nIn the handler this code:\r\n```\r\nfunc (h *handler) Add(_ context.Context, obj runtime.Object) error {\r\n\r\n\tpt, ok := obj.(*v1alpha1.MyCRD)\r\n\tif !ok {\r\n\t\treturn fmt.Errorf(\"%v is not a valid object\", obj.GetObjectKind())\r\n\t}\r\n\t\r\n        fmt.Println(\"namespace is :\"+pt.Namespace)\r\n```\r\nit produces an empty namespace.\r\nAn example of the object I create is:\r\n```\r\napiVersion: v1alpha1\r\nkind: MyCRD\r\nmetadata:\r\n  name: test\r\n  namespace: development\r\n```\r\nIs this the expected behavior? Is it also possible the namespace to be filled out by the current kubectl context?\r\n\r\nThanks a lot!\r\n```"},"comment":{"url":"https://api.github.com/repos/spotahome/kooper/issues/comments/421308877","html_url":"https://github.com/spotahome/kooper/issues/56#issuecomment-421308877","issue_url":"https://api.github.com/repos/spotahome/kooper/issues/56","id":421308877,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMTMwODg3Nw==","user":{"login":"slok","id":128204,"node_id":"MDQ6VXNlcjEyODIwNA==","avatar_url":"https://avatars3.githubusercontent.com/u/128204?v=4","gravatar_id":"","url":"https://api.github.com/users/slok","html_url":"https://github.com/slok","followers_url":"https://api.github.com/users/slok/followers","following_url":"https://api.github.com/users/slok/following{/other_user}","gists_url":"https://api.github.com/users/slok/gists{/gist_id}","starred_url":"https://api.github.com/users/slok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slok/subscriptions","organizations_url":"https://api.github.com/users/slok/orgs","repos_url":"https://api.github.com/users/slok/repos","events_url":"https://api.github.com/users/slok/events{/privacy}","received_events_url":"https://api.github.com/users/slok/received_events","type":"User","site_admin":false},"created_at":"2018-09-14T10:17:55Z","updated_at":"2018-09-14T10:17:55Z","author_association":"MEMBER","body":"No problem! You got it working?"}}
{"actor":{"display_login":"slok"}}