Hi, is there any way that I could manage the ingre...
# general
f
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
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
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
are you using an ingress controller?
f
Yes, i am using aws load balancer controller
b
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
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
How are you going to perform the application deployment? Is it going to be managed by pulumi?
f
@prehistoric-activity-61023 Yes, it will be managed by pulumi
p
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.