sparse-intern-71089
09/08/2020, 6:36 PMgorgeous-egg-16927
09/08/2020, 7:15 PMpulumi.ResourceTransformationArgs
is incorrect for k8s (the general transformations API didn’t exist when k8s support was implemented).
You should double-check that typegorgeous-egg-16927
09/08/2020, 7:16 PMlimited-rainbow-51650
09/08/2020, 7:17 PMlimited-rainbow-51650
09/08/2020, 7:32 PMgetTransformation(): pulumi.ResourceTransformation {
return (args) => {
return this.attachPostgreSQLConfiguration(args)
}
}
attachPostgreSQLConfiguration(args: pulumi.ResourceTransformationArgs): pulumi.ResourceTransformationResult | undefined {
let props = args.props;
let env: kubernetes.types.input.core.v1.EnvVar[] = props.spec.template.spec.containers[0].env;
env = env.concat([
{
name: 'ORTHANC__POSTGRESQL__HOST',
value: this.databaseHost
},
{
name: 'ORTHANC__POSTGRESQL__DATABASE',
value: this.databaseName
},
{
name: 'ORTHANC__POSTGRESQL__USERNAME',
value: this.databaseUser
},
{
name: 'ORTHANC__POSTGRESQL__PASSWORD',
value: this.databasePassword
},
{
name: 'ORTHANC__POSTGRESQL__ENABLE_SSL',
value: 'true'
}
]);
props.spec.template.spec.containers[0].env = env
<http://pulumi.log.info|pulumi.log.info>(`env: ${util.inspect(env)}`)
// return { props: props, opts: args.opts }
return undefined
}
Even if I return undefined
, my resource spec is transformed. I am modifying my input args instead of copying+modifying. But given what I read in the docs, the transformation should only be applied when I return a ResourceTransformationResult
object, no?gorgeous-egg-16927
09/08/2020, 7:35 PMlimited-rainbow-51650
09/08/2020, 7:35 PMIf the transformation returns undefined, this indicates that the resource will not be transformed.https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/pulumi/#ResourceTransformation
gorgeous-egg-16927
09/08/2020, 7:36 PMlimited-rainbow-51650
09/08/2020, 7:36 PMgorgeous-egg-16927
09/08/2020, 7:37 PMlimited-rainbow-51650
09/08/2020, 7:41 PMResourceTransformation
type (in TypeScript) is the type definition of the callback function you can pass to the transformations
property of in the ResourceOptions
hash of each Pulumi resource. For me, this is the API. Can you tell me what you mean with that’s a separate API ?gorgeous-egg-16927
09/08/2020, 7:43 PMtransformations
field that works differently from the general purpose ResourceTransformation
API because it didn’t exist when those k8s resources were originally implemented.
https://www.pulumi.com/docs/reference/pkg/kubernetes/helm/v3/chart/#transformations_nodejslimited-rainbow-51650
09/08/2020, 7:56 PMStatefulSet
follows the regular Pulumi resource transformation model, right? Coming back to my remark, the typespec of a ResourceTransformation
mentions that if you return undefined
, no transformation will be applied. Still, my spec is changed because I’m modifying the input args it seems. This contradicts the docs. Is this a bug then?gorgeous-egg-16927
09/08/2020, 8:06 PMlimited-rainbow-51650
09/08/2020, 8:06 PMgorgeous-egg-16927
09/08/2020, 8:07 PMlimited-rainbow-51650
09/08/2020, 8:15 PMundefined
does nothing). But when I modify the input args, changes are applied anyhow.
(https://github.com/pvorb/clone)No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by