Azure / draft-classic

A tool for developers to create cloud-native applications on Kubernetes.
https://draft.sh
MIT License
3.92k stars 396 forks source link

Overriding '.Values.image.tag' during draft up #635

Closed jinglejengel closed 6 years ago

jinglejengel commented 6 years ago

Hey there!

I'm having issues overriding the .Values.image.tag attribute during a draft up. Our use case is that we'd like to set custom tags during a build (In this case a commit ID). When trying to set the value in values.yml it seems like draft arbitrarily picks a SHA for this value.

For example:

# Default values for Maven projects.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
  pullPolicy: IfNotPresent
  repository: my-awesome-repo.corp/foo
  tag: "abcd123"
service:
  name: java
  type: ClusterIP
  externalPort: 8080
  internalPort: 8080
ingress:
  enabled: false

This works fine with helm install I should note.

Digging a bit, it seems like the context ID of the build looks to be used to construct a checksum of the build as the tag? https://github.com/Azure/draft/blob/c7c7d08721328cf84a792b23affb1476080f510e/pkg/builder/builder.go#L84

Is there any way to have draft handle this?

radu-matei commented 6 years ago

Adding #541 for context I'm currently working on allowing the addition of custom tags in the draft.toml environment. But the scenario in #541 is used for tagging the image built in the process of draft up so that you can use it with other tools.

Your behaviour happens because Draft injects the image tag (among other values) in the Helm chart values at release time. What are you trying to achieve exactly?

Thanks!

jinglejengel commented 6 years ago

@radu-matei I think that's exactly what we're needing.

Our use case is that when we publish an image, we then refer to that same artifact across our different environments (dev/stage/prod). Certain stages we may even add additional tags to an object.

We're looking to streamline how our developers are able to develop in k8s as they would deploy in k8s, and draft up seems to be a great start to that equation :D

radu-matei commented 6 years ago

@Joeskyyy that sounds great! I will update here once I make progress on the image tag.

Thanks, and let us know if you have other questions!

radu-matei commented 6 years ago

Hi, @Joeskyyy! There's work in progress for this feature in #674 - it would be great if you could give it a try and let us know if this solves your particular use case.

Thanks!

jinglejengel commented 6 years ago

Sure, happy to give it a try! I'm a complete noob to go so need to get my hacking env set up for it. Will report back hopefully soon :D

radu-matei commented 6 years ago

Implemented in #674