kubernetes-sigs / aws-load-balancer-controller

A Kubernetes controller for Elastic Load Balancers
https://kubernetes-sigs.github.io/aws-load-balancer-controller/
Apache License 2.0
3.93k stars 1.46k forks source link

Which annotations are needed to use multiple ingresses in a group? #1816

Closed johnjeffers closed 3 years ago

johnjeffers commented 3 years ago

Apologies for asking a question instead of reporting an issue, but this isn't answered in the docs anywhere that I can find.

When you are creating a group of ingresses with alb.ingress.kubernetes.io/group.name what annotations are required to be present on all of the ingresses in the group?

From my testing, it looks like you need:

    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/group.name: my-group
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/listen-ports: '[{"HTTP":80},{"HTTPS":443}]'

If I'm missing one of those annotations, the target group rules don't get created correctly.

I would appreciate if someone could confirm that.

johnjeffers commented 3 years ago

I should probably ask this question more clearly.

If I have multiple ingresses in a group, do I have to set every single annotation on every single ingress? Or can I have a "default" ingress that has the majority of the annotations I need, while the other ingresses simply inherit from that one?

Let's say I have a "default" ingress that looks like this:

    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/group.name: my-group
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/listen-ports: '[{"HTTP":80},{"HTTPS":443}]'
    alb.ingress.kubernetes.io/tags: environment=dev
    alb.ingress.kubernetes.io/load-balancer-attributes: deletion_protection.enabled=true
    alb.ingress.kubernetes.io/certificate-arns: my-cert-arns
    alb.ingress.kubernetes.io/security-groups: my-sg
    alb.ingress.kubernetes.io/wafv2-acl-arn: my-waf-arn

Which of those annotations need to be present on other ingresses in the same group?

As I mentioned above, it looks like all I need is:

    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/group.name: my-group
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/listen-ports: '[{"HTTP":80},{"HTTPS":443}]'

and the other annotations are "inherited" from what I'm calling the default ingress.

M00nF1sh commented 3 years ago

@johnjeffers thanks for creating this issue(and feel free to do it as it means our docs isn't good) 😄

It's currently documented as "MergeBehavior" column in the annotation table. In general,

other annotations are MergeBehavior "Merge". which means they will impact each Ingress separately, and the semantic slightly differs per annotation.

johnjeffers commented 3 years ago

Thank you for the explanation, super helpful. I'm embarrassed that I missed the stuff on merge behavior in the docs 😳