https://pulumi.com logo
#general
Title
# general
f

future-refrigerator-88869

09/13/2021, 11:38 PM
Hi, is there any way that I could manage the ingresses of k8s? I am trying to dynamically create and delete ingress instances based on how many stacks are created (without manually specifying them in code). Eg: for every 10 added stacks create a new ingress with ELB, and for every 10 deleted stacks, delete the unused ingress and elb.
b

billowy-army-68599

09/13/2021, 11:40 PM
hmm this is a little tricky because of the declarative model, it would have to be done outside the parent stack with a second stack I think
can you talk a little more about your use case, I feel like there may be better solutions..
f

future-refrigerator-88869

09/13/2021, 11:47 PM
sure. So i have a stack that setup up the infrastructure. The K8S cluster. Another stack sets up the ECRs and their configs. Then I want to create a "deployer" project which would dynamically set the stack via github actions. This one will deploy the projects to a stack. It would create the k8s resources (namespace, fargate profile, etc). Now, the tricky part for me is that the ELB can only have 100 rules. So if i predefined one ELB, then I'd be limited in the number of stacks. So my idea was to calculate at each deployment how many ELB instances I need and, if one more is needed, add it. Then if one can be removed, remove it before deployment.
I am basically trying to dynamically allocate ELB resources via ingress
b

billowy-army-68599

09/14/2021, 12:01 AM
are you using an ingress controller?
f

future-refrigerator-88869

09/14/2021, 12:03 AM
Yes, i am using aws load balancer controller
b

billowy-army-68599

09/14/2021, 12:05 AM
ahh I see, I was confused because ALBs have rules but ELBS do not. i think the best recommendation I have is to provision multiple ingress classes and round robin them
f

future-refrigerator-88869

09/14/2021, 12:10 AM
I meant alb, sorry :) provisioning multiple ones might not be ideal though. Not scalable either right ? We could easily over provision or under provision. I was hoping i could do some kind of for loop and provision the ingress with predictable names (eg ingress-index) and i was hoping that pulumi could figure out to either add or remove them.
I would deal with the rule declaration for them before that would happen
p

prehistoric-activity-61023

09/14/2021, 6:55 AM
How are you going to perform the application deployment? Is it going to be managed by pulumi?
f

future-refrigerator-88869

09/14/2021, 9:39 AM
@prehistoric-activity-61023 Yes, it will be managed by pulumi
p

prehistoric-activity-61023

09/14/2021, 9:42 AM
I didn’t see the part when you wrote about separate stacks. I guess it’s not gonna be trivial to do that automatically inside pulumi.
My first thought (but I’d need to dig more into ALB, I mainly work on GCP) was to use/write some k8s operator to manage this automatically inside k8s cluster.