Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

allow skiping ipv6 lookup by adding aaaa-lookups annotation #25

Merged
merged 5 commits into from
Dec 2, 2022
Merged

Conversation

k11h-de
Copy link
Contributor

@k11h-de k11h-de commented Dec 1, 2022

Hi Théo,

as suggested in issue #24 , here's the adapted code, basically just introducing a check whether the annotation fqdnnetworkpolicies.networking.gke.io/aaaa-lookups is set to skip in the FQDNNetworkPolicy.

I tested this locally with following manifest:

apiVersion: networking.gke.io/v1alpha3
kind: FQDNNetworkPolicy
metadata:
  name: allow-test
  namespace: test1
  annotations:
    fqdnnetworkpolicies.networking.gke.io/aaaa-lookups: "skip"
spec:
  podSelector: {}
  egress:
    - to:
      - fqdns:
        - heise.de # resolves to 193.99.144.80 (A) and 2a02:2e0:3fe:1001:302:: (AAAA)
      ports:
      - port: 443
        protocol: TCP

Both scenarios, with and without the fqdnnetworkpolicies.networking.gke.io/aaaa-lookups annotation, the code produces the expected NetworkPolicy.

I have to admit, I haven't added a test - if that is strictly required, please let me know.
Please, feel free to adapt to your naming schema or coding guidelines.

Thanks a lot
Karsten

@google-cla
Copy link

google-cla bot commented Dec 1, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@MrTrustor
Copy link
Member

/gcbrun

Copy link
Member

@MrTrustor MrTrustor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Can you add a test in controllers/fqdnnetworkpolicy_controller_test.go ?
Take a look at the existing tests to understand how to build one (using a new Context() function).

README.md Outdated Show resolved Hide resolved
controllers/fqdnnetworkpolicy_controller.go Outdated Show resolved Hide resolved
@MrTrustor
Copy link
Member

/gcbrun

@MrTrustor
Copy link
Member

Thanks a lot! This works as expected.

@MrTrustor MrTrustor merged commit 7ab9e0d into GoogleCloudPlatform:main Dec 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants