I think, I’ve asked this question already, and ans...
# kubernetes
i
I think, I’ve asked this question already, and answer was to use dynamic provider, possibly after 2 months something changed, just trying to double check. For example I am deploying StatefulSet (elasticsearch operator) that manages resources in my cluster, what will be the easiest way to wait for
Copy code
export const elasticService = k8s.core.v1.Service.get(
  'elastic-lb',
  pulumi.interpolate`${namespace.metadata.name}/${elastic.metadata.name}-es-http`,
  { parent: namespace, dependsOn: elastic, provider: aks.k8s.provider }
);
elasticService
- I need to wait for this resource to appear, instead of failing instantly on preview step? Thanks!
any ideas here?
@gorgeous-egg-16927
really need your suggestion here 🙂 please
g
Yeah, we still don’t have a great answer to this built in. However, since you’re using TypeScript, I actually do have a solution that might work well here: https://gist.github.com/lblackstone/d2d1c29507685c0833612988945dedf3 This was a hackday project from a couple months ago, and isn’t well tested, but you can use a streaming invoke to watch k8s events for the Service to be created. The dynamic provider may still be your best option, but this example happens to be exactly what you’re doing here.
i
this looks awesome! thanks @gorgeous-egg-16927, I will let you know how it went on my side, but this should make a trick
@gorgeous-egg-16927 trying your script right now, and it also freezes on preview 😞