Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow ALB traffic management with more than one routing condition #2998

Open
mvgmb opened this issue Aug 30, 2023 · 1 comment
Open

Allow ALB traffic management with more than one routing condition #2998

mvgmb opened this issue Aug 30, 2023 · 1 comment

Comments

@mvgmb
Copy link
Contributor

mvgmb commented Aug 30, 2023

Summary

AWS ALB provides a method for specifying routing conditions by adding a condition annotation: alb.ingress.kubernetes.io/conditions.${conditions-name}.

Some scenarios require more than one condition to route traffic. The conditions-name in the annotation can be a either real serviceName or an annotation-based action name, i.e., the service does not need to exist. If it does not exist, you must specify an action annotation to be able to route its traffic: alb.ingress.kubernetes.io/actions.${action-name}.

Currently, argo-rollouts' traffic management only manages the action related to the rollout service, which uses the root/stable service name as the action name: alb.ingress.kubernetes.io/actions.<SERVICE-NAME>. This means I can't use the more than one condition per service since it needs to be named after the root/stable service.

Use Cases

Given I want to route requests based on their header value from the /path1 and requests based on their method to the /path2, the setup would look like this:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: demo
  annotations:
    alb.ingress.kubernetes.io/conditions.http-header: '[{"field":"http-header","httpHeaderConfig":{"httpHeaderName": "HeaderName", "values":["HeaderValue1"]}}]'
    alb.ingress.kubernetes.io/conditions.http-request-method: '[{"field":"http-request-method","httpRequestMethodConfig":{"Values":["POST"]}}]'
spec:
  rules:
    - host: www.example.com
      http:
        paths:
          - backend:
              serviceName: http-header # does not match the service name, requires actions annotation
              servicePort: use-annotation
            path: /path1
          - backend:
              serviceName: http-request-method # does not match the service name, requires actions annotation
              servicePort: use-annotation
            path: /path2
          - backend:
              serviceName: example
              servicePort: 80
            path: /*

If the Rollout knew which actions to take into account, it could take care of each condition's actions annotation weight management, e.g.:

apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: demo
spec:
  strategy:
    canary:
      pingPong:
        pingService: demo-ping
        pongService: demo-pong
      trafficRouting:
        alb:
          ingress: demo
          servicePort: 80
          actionNames: # this field specifies a list of action names argo-rollouts should manage
            - http-header
            - http-request-method

By doing this, argo-rollouts would add an actions annotation for each condition:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: demo
  annotations:
    alb.ingress.kubernetes.io/actions.http-header: '{"Type":"forward","ForwardConfig":{"TargetGroups":[{"ServiceName":"demo-pong","ServicePort":"80","Weight":80},{"ServiceName":"demo-ping","ServicePort":"80","Weight":20}]}}'
    alb.ingress.kubernetes.io/actions.http-request-method: '{"Type":"forward","ForwardConfig":{"TargetGroups":[{"ServiceName":"demo-pong","ServicePort":"80","Weight":80},{"ServiceName":"demo-ping","ServicePort":"80","Weight":20}]}}'
    alb.ingress.kubernetes.io/conditions.http-header: '[{"field":"http-header","httpHeaderConfig":{"httpHeaderName": "HeaderName", "values":["HeaderValue1"]}}]'
    alb.ingress.kubernetes.io/conditions.http-request-method: '[{"field":"http-request-method","httpRequestMethodConfig":{"Values":["POST"]}}]'
@mvgmb mvgmb added the enhancement New feature or request label Aug 30, 2023
@github-actions
Copy link
Contributor

This issue is stale because it has been open 60 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants