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

Move namespace to own manifest #133

Merged
merged 2 commits into from
Jan 28, 2019
Merged

Move namespace to own manifest #133

merged 2 commits into from
Jan 28, 2019

Conversation

mgoodness
Copy link
Contributor

Allows kubectl apply -f manifests/ to create all required resources, including a metacontroller Namespace.

However, kustomization.yaml does not include that manifest in its resources, which lets kustomize handle namespace creation.

Replaces my borked #129.

@enisoc
Copy link

enisoc commented Jan 17, 2019

To get kubectl apply -f manifests/ to work, I had to rename namespace.yaml to kubernetes-namespace.yaml so it comes before kubernetes.yaml in the sort order.

I also tried with the latest Skaffold 0.20.0, and I'm not seeing it create the namespace automatically with either skaffold run or skaffold run -n metacontroller. Is it a feature of kustomize that it creates the namespace for you implicitly? It seems uncommon for tools to do that.

@mgoodness
Copy link
Contributor Author

To get kubectl apply -f manifests/ to work, I had to rename namespace.yaml to kubernetes-namespace.yaml so it comes before kubernetes.yaml in the sort order.

I can prefix the manifests so kubectl loads them in the correct order.

Is it a feature of kustomize that it creates the namespace for you implicitly?

No, kustomize doesn't create namespaces implicitly. My original comment was misworded.

That said, I think the common pattern so far is to not include a namespace manifest in the base layer. End users then have a couple of options in their overlays.

  • kustomize creates a namespace:
bases:
- github.com/GoogleCloudPlatform/metacontroller

resources:
- namespace.yaml
  • namespace is created through some other process then "consumed" by kustomize:
bases:
- github.com/GoogleCloudPlatform/metacontroller

namespace: my-namespace

The former seems like a good fit for tools like skaffold, while the latter is what I'm trying to do. Should I create a second kustomization.yaml for skaffold?

@enisoc enisoc merged commit cc5d8a9 into GoogleCloudPlatform:master Jan 28, 2019
@enisoc
Copy link

enisoc commented Jan 28, 2019

Thanks for clarifying. I added some commits after yours that should maintain the intent of your PR while keeping our Skaffold workflow unchanged. Please let me know if you find any problems.

@mgoodness
Copy link
Contributor Author

Perfect. Thanks!

@mgoodness mgoodness deleted the delete-namespace branch January 28, 2019 17:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants