Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Kustomize deployer mutations #1395

Closed
paultiplady opened this issue Dec 16, 2018 · 5 comments
Closed

Add support for Kustomize deployer mutations #1395

paultiplady opened this issue Dec 16, 2018 · 5 comments
Labels
area/deploy deploy/kustomize kind/feature-request priority/awaiting-more-evidence Lowest Priority. May be useful, but there is not yet enough supporting evidence.

Comments

@paultiplady
Copy link

Expected behavior

It should be possible to configure the namespace of the kustomization dynamically.

Actual behavior

It appears there is no way to configure the namespace dynamically in a Kustomization.

Information

A common pattern for deploying k8s apps is to use a namespace per deploy. Another alternative is to use name prefixes inside a single namespace.

Both of these options are supported in Kustomize using the kustomize edit set namespace|nameprefix commands.

I don't see a way to achieve this effect in Skaffold. The best I can do is

  - name: builds
    deploy:
      kustomize:
        path: deploy/kustomize/overlays/review
        flags:
          global:
            - "--namespace=foo"

but this fixes the namespace, rather than allowing it to be configured dynamically by the build environment (e.g. based on a PR slug).

  • Skaffold version: v0.19.0
  • Operating system: MacOS 10.14 (18A391)
  • Contents of skaffold.yaml:
apiVersion: skaffold/v1beta1
kind: Config
build:
  artifacts:
    - image: us.gcr.io/qwil-build/monolith
deploy:
  kustomize:
    path: deploy/kustomize/overlays/minikube
profiles:
 - name: builds
    deploy:
      kustomize:
        path: deploy/kustomize/overlays/review
        flags:
          global:
            - "--namespace="

This is certainly a feature request, but it's also not clear exactly what the best approach here would be.

@paultiplady
Copy link
Author

I raised this over at the Kustomize project a while ago and got some good suggestions: kubernetes-sigs/kustomize#164

Maybe the answer is just "use the kustomize CLI to preprocess the YAML appropriately", but wondering if you have different ideas.

@nkubala
Copy link
Contributor

nkubala commented Feb 6, 2019

skaffold actually uses kubectl under the hood to do the deployments for kustomize; it runs a kustomize build to generate the manifests, and then kubectl applys them. so you should be able to just pass the namespace as a CLI flag and it will get plumbed through to the kubectl CLI:

skaffold dev --namespace=namespace

is that enough to address your use case?

another option would be to go the env var route, but we try to avoid that whenever possible :)

@balopat balopat added the priority/awaiting-more-evidence Lowest Priority. May be useful, but there is not yet enough supporting evidence. label Sep 24, 2019
@balopat
Copy link
Contributor

balopat commented Sep 24, 2019

This is interesting, for ephemeral environments we don't have a good answer for this.
I just ran into this in one of our integration tests and in the end ended up with templatizing the kustomization yaml.

As we discussed with @nkubala we could do something like generateName behavior (https://kubernetes.io/docs/reference/using-api/api-concepts/) in kubernetes for certain transformations in kustomize like namespace.

@paultiplady is this still an issue?
If other people run into this please thumbs up.

@nkubala
Copy link
Contributor

nkubala commented Apr 30, 2020

this one has gone stale, and I'm not entirely sure what the path forward would be here. realistically, our team isn't gonna be able to put any work into this any time soon, and since it doesn't seem to be causing too much of an issue, I'm going to close it.

if this is still causing you issues in your daily skaffold workflow, please react to this comment and give us more details on your use case!

@nkubala nkubala closed this as completed Apr 30, 2020
@wstrange
Copy link
Contributor

Support for Kpt might resolve this as well..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/deploy deploy/kustomize kind/feature-request priority/awaiting-more-evidence Lowest Priority. May be useful, but there is not yet enough supporting evidence.
Projects
None yet
Development

No branches or pull requests

6 participants