incalculable-midnight-8291
01/05/2022, 11:12 AMcluster.eksCluster.name.apply seems to work a bit differently than I thought.
so basically using it like this seems to work:
cluster.eksCluster.name.apply((eksClusterName) => {
const nodegroup = new eks.NodeGroup(`${name}-nodegroup`, {
cluster,
instanceProfile,
labels: {
role: 'managed-nodes',
},
instanceType: 't2.medium',
desiredCapacity: 1,
minSize: 1,
maxSize: 3,
autoScalingGroupTags: {
['k8s.io/cluster-autoscaler/enabled']: 'true',
[`k8s.io/cluster-autoscaler/${eksClusterName}`]: 'owned',
},
});
------------
Original:
Hi!
Im trying to setup an eks cluster with k8s cluster autoscaler.
To get this to work, I need to tag the nodegroup with:
autoScalingGroupTags: {
['k8s.io/cluster-autoscaler/enabled']: 'true',
[`k8s.io/cluster-autoscaler/${cluster.eksCluster.name}`]: 'owned',
},
However, the operation fails since Template format error: YAML not well-formed
Checking details shows that cluster.eksCluster.name is never expanded to the name, instead it becomes: k8s.io/cluster-autoscaler/Calling [toString] on an [Output<T>] is not supported....
Im creating the cluster with
const cluster = new eks.Cluster(name, { optionsĀ });
But the eks cluster dont just get the name name , but ${name}-eksCluster-1234567
The number seems to be generated on creation, so I would really need some way of extracting it so I can use it in my tag.
I have tried `pulumi.interpolate`k8s.io/cluster-autoscaler/${cluster.eksCluster.name}`` and
cluster.eksCluster.name.apply(v => `k8s.io/cluster-autoscaler/${v}`)
but they both fail with error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
Any ideas?