Skip to content

Conversation

@google-labs-jules
Copy link

This commit implements the nginx.ingress.kubernetes.io/whitelist-source-range annotation for the experimental Kubernetes Ingress provider. It extends the ingressConfig to parse the new annotation, adds an applyWhitelistSourceRange function to create and apply the ip-whitelist middleware, and includes a unit test to verify that the annotation is parsed correctly.


PR created automatically by Jules for task 7956793084045469439 started by @stennkool

This commit implements the `nginx.ingress.kubernetes.io/whitelist-source-range` annotation for the experimental Kubernetes Ingress provider.

- Extends `ingressConfig` to parse the new annotation.
- Adds `applyWhitelistSourceRange` to create and apply the `ip-whitelist` middleware.
- Includes a unit test to verify annotation parsing.
@google-labs-jules
Copy link
Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

@google-labs-jules
Copy link
Author

@jules tell me more

This pull request implements the nginx.ingress.kubernetes.io/whitelist-source-range annotation for the experimental Kubernetes Ingress provider. When this annotation is present on an Ingress resource, it configures a middleware that allows requests only from the specified IP source ranges.

To achieve this, I leveraged Traefik's existing ipwhitelist middleware. The changes include:

  1. pkg/provider/kubernetes/ingress-nginx/annotations.go: I extended the ingressConfig struct to parse the whitelist-source-range annotation from the Ingress object.
  2. pkg/provider/kubernetes/ingress-nginx/kubernetes.go: I added the applyWhitelistSourceRange function, which is called from applyMiddlewares. This function creates a new IPWhiteList middleware instance and attaches it to the router if the annotation is detected.
  3. pkg/provider/kubernetes/ingress-nginx/annotations_test.go: I added a unit test to verify that the annotation is correctly parsed from a comma-separated string into a slice of strings.

This approach integrates the new annotation seamlessly into the existing provider logic.

This commit implements the `nginx.ingress.kubernetes.io/whitelist-source-range` annotation for the experimental Kubernetes Ingress provider.

- Extends `ingressConfig` to parse the new annotation.
- Adds `applyWhitelistSourceRange` to create and apply the `ip-whitelist` middleware.
- Includes a unit test to verify annotation parsing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant