https://github.com/looztra/kustomize-issue--empty-namespace
https://github.com/looztra/kustomize-issue--empty-namespace
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/looztra/kustomize-issue--empty-namespace
- Owner: looztra
- License: apache-2.0
- Created: 2019-07-25T17:43:44.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-26T11:55:17.000Z (almost 7 years ago)
- Last Synced: 2025-04-03T17:19:19.832Z (about 1 year ago)
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Kustomize v3.0.3 generates empty namespaces in some cases
## Status
The bug was reported by someone else, cf , this will be fixed in the next kustomize release.
## Requirements
- [kubesplit](https://github.com/looztra/kubesplit) installed (`pip3 install -U --user kubesplit` for instance)
## OK with kustomize whatever the version
`kustomize build component-sets/overlay-ok | kubesplit -p -q -c -o generated/ok`
Resulting descriptors can be seen in directory `generated/ok`
The clusterrolebinding and the rolebinding have the namespace correctly specified
```yaml
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
annotations:
company.com/kustomize-component: kube-state-metrics
company.com/kustomize-component-set: monitoring
name: company:kube-state-metrics
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: company:kube-state-metrics
subjects:
- kind: ServiceAccount
name: kube-state-metrics
namespace: monitoring
```
## NOK with kustomize v3.0.3, OK with v3.0.2 and v2.1.0
`kustomize build component-sets/overlay-not-ok | kubesplit -p -q -c -o generated/not-ok`
Resulting descriptors can be seen in directory `generated/not-ok`
The clusterrolebinding and the rolebinding have an empty namespace
```yaml
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
annotations:
company.com/kustomize-component: kube-state-metrics
company.com/kustomize-component-set: monitoring
name: company:kube-state-metrics
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: company:kube-state-metrics
subjects:
- kind: ServiceAccount
name: kube-state-metrics
namespace:
```
## What is the difference between the 2 use cases?
- OK => a configMapGenerator that generates a ConfigMap in another namespace as the one of the target ServiceAccount
- NOK => a configMapGenerator that generates a ConfigMap in the same namespace as the one of the target ServiceAccount
## Tip
How to build a custom `kustomize` binary (for the record) when inside a source tree :
```bash
# bash
GO111MODULE=on go build -o my-kustomize cmd/kustomize/main.go
# Fish
env GO111MODULE=on go build -o my-kustomize cmd/kustomize/main.go
```