https://pulumi.com logo
g

gifted-island-55702

01/04/2019, 2:58 PM
Kubernetes provider: it seems that interfaces like
core.v1.ContainerPort
etc are not exported. Is there a change to change it? I would like to create my own
ComponentResource
class that would compose multiple k8s resources as a single ’deployment unit` and I would like to accept input options like a list of
core.v1.ContainerPort
or
core.v1.EnvVar
to customise the pod spec that will be part of that deployment. Otherwise I will need to create my own types to cover that which will be unnecessary boilerplate 😞
Doh, I’m a typescript beginner and I’m struggling with converting my
Map<string, number
(I would like to pass port name -> port number mapping that I could then use to generate an array of core.v1.ContainerPort instances 😞
i

important-carpenter-15282

01/04/2019, 4:31 PM
👍, I would like this as well. It's not hard to return an object shaped like a
ContainerPort
from a helper function and TypeScript will DTRT, but it'd be nicer to be able to strongly type everything.
c

creamy-potato-29402

01/04/2019, 5:57 PM
@gifted-island-55702 @important-carpenter-15282 this is an interesting use case… would you mind filing a bug?
I hadn’t really thought of this.
g

gifted-island-55702

01/04/2019, 5:59 PM
I will open a ticket - thanks @creamy-potato-29402
c

creamy-potato-29402

01/07/2019, 4:05 AM
@gifted-island-55702 @important-carpenter-15282 actually, I lied — this already is possible.
import * as inputApi from "@pulumi/kubernetes/types/input"
there are technically two shapes — the “input shape” which is the set of properties required at submission time, and the “output shape” which is the set of properties required when you get the resource definition from the API server.
g

gifted-island-55702

01/07/2019, 12:01 PM
Thank you @creamy-potato-29402 - I wasn’t aware I could import it like this (I’m still typescript newbie)