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

dataclients/kubernetes: append predicates to routes of Ingress/RouteGroup having specific annotation #3328

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MustafaSaber
Copy link
Member

The main purpose of this change is to allow skipper operators to dynamically add predicates to routes based on annotations key-value pairs in Kubernetes resources (metadata.annotation). This provides more flexibility in routing configuration without modifying the core Ingress or RouteGroup definitions.

Key changes:

  • Added KubernetesAnnotationPredicates option & -kubernetes-annotation-predicates flag for public hostnames, which can be specified multiple times.
  • Added KubernetesEastWestRangeAnnotationPredicates option & -kubernetes-east-west-range-annotation-predicates flag for internal hostnames, which can be specified multiple times.
  • Modified Ingress and RouteGroup clients to apply annotation predicates depending on the host
  • Added test cases for new functionality

Run & test with

➜ ./bin/skipper -kubernetes -kubernetes-annotation-predicates="zalando.org/traffic-disabled=true=False()" -kubernetes-east-west-range-annotation-predicates="zalando.org/traffic-disabled=true=False()"#or
➜ ./bin/routesrv -kubernetes -kubernetes-annotation-predicates="zalando.org/traffic-disabled=true=False()" -kubernetes-east-west-range-annotation-predicates="zalando.org/traffic-disabled=true=False()"

Having both flags with same value will append configured predicates to all routes of Ingress/RouteGroup resources annotated with zalando.org/traffic-disabled: true, routes defined in:

  • The spec.rules section of Ingress resources.
  • Routes specified using the zalando.org/skipper-routes annotation of Ingress resources.
  • The spec.routes section of RouteGroup resources.

@MustafaSaber MustafaSaber added the major moderate risk, for example new API, small filter changes that have no risk like refactoring or logs label Dec 4, 2024
@MustafaSaber MustafaSaber self-assigned this Dec 4, 2024
skipper.go Outdated Show resolved Hide resolved
config/config.go Outdated Show resolved Hide resolved
config/config.go Outdated Show resolved Hide resolved
…roup having specific annotation

The main purpose of this change is to allow skipper operators to dynamically add predicates to routes based on annotations key-value pairs in Kubernetes resources (metadata.annotation). This provides more flexibility in routing configuration without modifying the core Ingress or RouteGroup definitions.

Key changes:
- Added KubernetesAnnotationPredicates option & `-kubernetes-annotation-predicates` flag for public hostnames, which can be specified multiple times.
- Added KubernetesEastWestRangeAnnotationPredicates option & `-kubernetes-east-west-range-annotation-predicates` flag for internal hostnames, which can be specified multiple times.
- Modified Ingress and RouteGroup clients to apply annotation predicates depending on the host
- Added test cases for new functionality

Run & test with

```sh

➜ ./bin/skipper -kubernetes -kubernetes-annotation-predicates="zalando.org/traffic-disabled=true=False()" -kubernetes-east-west-range-annotation-predicates="zalando.org/traffic-disabled=true=False()"
➜ #or
➜ ./bin/routesrv -kubernetes -kubernetes-annotation-predicates="zalando.org/traffic-disabled=true=False()" -kubernetes-east-west-range-annotation-predicates="zalando.org/traffic-disabled=true=False()"
```

Having both flags with same value will append configured predicates to all routes of Ingress/RouteGroup resources annotated with `zalando.org/traffic-disabled: true`, routes defined in:

* The `spec.rules` section of Ingress resources.
* Routes specified using the `zalando.org/skipper-routes` annotation of Ingress resources.
* The `spec.routes` section of RouteGroup resources.

Signed-off-by: Mustafa Abdelrahman <[email protected]>
@MustafaSaber MustafaSaber force-pushed the apply-predicates-on-a-set-of-ingresses-with-annotation branch from c71990f to 5839d17 Compare December 4, 2024 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major moderate risk, for example new API, small filter changes that have no risk like refactoring or logs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants