devx icon indicating copy to clipboard operation
devx copied to clipboard

Transformer arugments can clash each other

Open thethumbler opened this issue 3 years ago • 1 comments

In kubernetes transformers, the following sample uses appName and serviceAccountName as arugments which will eventually be part of the component model and these names can not be used across any other transformer.

https://github.com/devopzilla/guku-devx/blob/5743b77354638b7fe4e592ddaf83df47e6691a19/pkg/guku.io/devx/v1/transformers/kubernetes/transformers.cue#L35-L36

As a suggestion, I would add some annotations field to $metadata and use it as a freemap then use it to define arguments, for example:

#SomeTransformer: v1.#Transformer & {
  v1.#Component
  …
  $metadata: annotations: kubernetes: deployment: appName: string | *$metadata.id 
}

thethumbler avatar Nov 27 '22 16:11 thethumbler

On a second thought. This will disallow using the same transformer twice, e.g. you can’t use #AddDeployment twice in the environment unless the match different components. We need to somehow record the transformer arguments in a unique key/label.

P.S. whether or not it makes sense to use a transformer twice in a single environment does not have a clear decision yet.

thethumbler avatar Nov 28 '22 11:11 thethumbler