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

Remove k8s.io/kubernetes from project dependency #129

Merged
merged 2 commits into from
Jul 24, 2023

Conversation

Dyanngg
Copy link
Contributor

@Dyanngg Dyanngg commented Jul 21, 2023

Currently the network-policy-api uses k8s.io/kubernetes module as a dependency, which is being clearly stated as unsupported in kubernetes/kubernetes#79384.

Upon review, it seems that the only module which uses k8s.io/kubernetes is conformance, and all references could be refactored so that the project no longer directly imports k8s:

  1. all k8s.io/kubernetes/test/e2e/framework.ExpectNoError => github.com/stretchr/testify/require.NoErrorf, which is also common in other conformance suites like Gateway API.
  2. Use client-go to issue exec commands to Pods instead of k8s.io/kubernetes/test/e2e/framework/kubectl.RunKubectl
  3. Remove references to upstream k8s e2e config flags, which is not used in the project anyways.

This PR also partially addresses #108 as it cleans up the pokeServer utility function a bit.
Conformance test passes before and after this change, on a local testbed with Antrea deployed:

--- PASS: TestConformance (316.97s)
    --- PASS: TestConformance/AdminNetworkPolicyEgressSCTP (13.24s)
        --- PASS: TestConformance/AdminNetworkPolicyEgressSCTP/Should_support_an_'allow-egress'_policy_for_SCTP_protocol;_ensure_rule_ordering_is_respected (0.22s)
        --- PASS: TestConformance/AdminNetworkPolicyEgressSCTP/Should_support_an_'allow-egress'_policy_for_SCTP_protocol_at_the_specified_port (3.19s)
        --- PASS: TestConformance/AdminNetworkPolicyEgressSCTP/Should_support_an_'deny-egress'_policy_for_SCTP_protocol;_ensure_rule_ordering_is_respected (6.21s)
        --- PASS: TestConformance/AdminNetworkPolicyEgressSCTP/Should_support_a_'deny-egress'_policy_for_SCTP_protocol_at_the_specified_port (3.20s)
        --- PASS: TestConformance/AdminNetworkPolicyEgressSCTP/Should_support_an_'pass-egress'_policy_for_SCTP_protocol;_ensure_rule_ordering_is_respected (0.20s)
        --- PASS: TestConformance/AdminNetworkPolicyEgressSCTP/Should_support_a_'pass-egress'_policy_for_SCTP_protocol_at_the_specified_port (0.21s)
    --- PASS: TestConformance/AdminNetworkPolicyEgressTCP (13.25s)
        --- PASS: TestConformance/AdminNetworkPolicyEgressTCP/Should_support_an_'allow-egress'_policy_for_TCP_protocol;_ensure_rule_ordering_is_respected (0.18s)
        --- PASS: TestConformance/AdminNetworkPolicyEgressTCP/Should_support_an_'allow-egress'_policy_for_TCP_protocol_at_the_specified_port (3.22s)
        --- PASS: TestConformance/AdminNetworkPolicyEgressTCP/Should_support_an_'deny-egress'_policy_for_TCP_protocol;_ensure_rule_ordering_is_respected (6.23s)
        --- PASS: TestConformance/AdminNetworkPolicyEgressTCP/Should_support_a_'deny-egress'_policy_for_TCP_protocol_at_the_specified_port (3.20s)
        --- PASS: TestConformance/AdminNetworkPolicyEgressTCP/Should_support_an_'pass-egress'_policy_for_TCP_protocol;_ensure_rule_ordering_is_respected (0.21s)
        --- PASS: TestConformance/AdminNetworkPolicyEgressTCP/Should_support_a_'pass-egress'_policy_for_TCP_protocol_at_the_specified_port (0.19s)
    --- PASS: TestConformance/AdminNetworkPolicyEgressUDP (13.24s)
        --- PASS: TestConformance/AdminNetworkPolicyEgressUDP/Should_support_an_'allow-egress'_policy_for_UDP_protocol;_ensure_rule_ordering_is_respected (0.20s)
        --- PASS: TestConformance/AdminNetworkPolicyEgressUDP/Should_support_an_'allow-egress'_policy_for_UDP_protocol_at_the_specified_port (3.20s)
        --- PASS: TestConformance/AdminNetworkPolicyEgressUDP/Should_support_an_'deny-egress'_policy_for_UDP_protocol;_ensure_rule_ordering_is_respected (6.21s)
        --- PASS: TestConformance/AdminNetworkPolicyEgressUDP/Should_support_a_'deny-egress'_policy_for_UDP_protocol_at_the_specified_port (3.22s)
        --- PASS: TestConformance/AdminNetworkPolicyEgressUDP/Should_support_an_'pass-egress'_policy_for_UDP_protocol;_ensure_rule_ordering_is_respected (0.20s)
        --- PASS: TestConformance/AdminNetworkPolicyEgressUDP/Should_support_a_'pass-egress'_policy_for_UDP_protocol_at_the_specified_port (0.19s)
    --- PASS: TestConformance/AdminNetworkPolicyGress (59.33s)
        --- PASS: TestConformance/AdminNetworkPolicyGress/Should_support_an_'allow-gress'_policy_across_different_protocols (0.58s)
        --- PASS: TestConformance/AdminNetworkPolicyGress/Should_support_an_'allow-gress'_policy_across_different_protocols_at_the_specified_ports (19.17s)
        --- PASS: TestConformance/AdminNetworkPolicyGress/Should_support_an_'deny-gress'_policy_across_different_protocols (18.60s)
        --- PASS: TestConformance/AdminNetworkPolicyGress/Should_support_a_'deny-gress'_policy_across_different_protocols_at_the_specified_ports (19.20s)
        --- PASS: TestConformance/AdminNetworkPolicyGress/Should_support_an_'pass-gress'_policy_across_different_protocols (0.61s)
        --- PASS: TestConformance/AdminNetworkPolicyGress/Should_support_a_'pass-gress'_policy_across_different_protocols_at_the_specified_ports (1.14s)
    --- PASS: TestConformance/AdminNetworkPolicyIngressSCTP (13.29s)
        --- PASS: TestConformance/AdminNetworkPolicyIngressSCTP/Should_support_an_'allow-ingress'_policy_for_SCTP_protocol;_ensure_rule_ordering_is_respected (0.21s)
        --- PASS: TestConformance/AdminNetworkPolicyIngressSCTP/Should_support_an_'allow-ingress'_policy_for_SCTP_protocol_at_the_specified_port (3.20s)
        --- PASS: TestConformance/AdminNetworkPolicyIngressSCTP/Should_support_an_'deny-ingress'_policy_for_SCTP_protocol;_ensure_rule_ordering_is_respected (6.22s)
        --- PASS: TestConformance/AdminNetworkPolicyIngressSCTP/Should_support_a_'deny-ingress'_policy_for_SCTP_protocol_at_the_specified_port (3.21s)
        --- PASS: TestConformance/AdminNetworkPolicyIngressSCTP/Should_support_an_'pass-ingress'_policy_for_SCTP_protocol;_ensure_rule_ordering_is_respected (0.20s)
        --- PASS: TestConformance/AdminNetworkPolicyIngressSCTP/Should_support_a_'pass-ingress'_policy_for_SCTP_protocol_at_the_specified_port (0.24s)
    --- PASS: TestConformance/AdminNetworkPolicyIngressTCP (13.23s)
        --- PASS: TestConformance/AdminNetworkPolicyIngressTCP/Should_support_an_'allow-ingress'_policy_for_TCP_protocol;_ensure_rule_ordering_is_respected (0.18s)
        --- PASS: TestConformance/AdminNetworkPolicyIngressTCP/Should_support_an_'allow-ingress'_policy_for_TCP_protocol_at_the_specified_port (3.19s)
        --- PASS: TestConformance/AdminNetworkPolicyIngressTCP/Should_support_an_'deny-ingress'_policy_for_TCP_protocol;_ensure_rule_ordering_is_respected (6.21s)
        --- PASS: TestConformance/AdminNetworkPolicyIngressTCP/Should_support_a_'deny-ingress'_policy_for_TCP_protocol_at_the_specified_port (3.20s)
        --- PASS: TestConformance/AdminNetworkPolicyIngressTCP/Should_support_an_'pass-ingress'_policy_for_TCP_protocol;_ensure_rule_ordering_is_respected (0.20s)
        --- PASS: TestConformance/AdminNetworkPolicyIngressTCP/Should_support_a_'pass-ingress'_policy_for_TCP_protocol_at_the_specified_port (0.23s)
    --- PASS: TestConformance/AdminNetworkPolicyIngressUDP (13.24s)
        --- PASS: TestConformance/AdminNetworkPolicyIngressUDP/Should_support_an_'allow-ingress'_policy_for_UDP_protocol;_ensure_rule_ordering_is_respected (0.19s)
        --- PASS: TestConformance/AdminNetworkPolicyIngressUDP/Should_support_an_'allow-ingress'_policy_for_UDP_protocol_at_the_specified_port (3.20s)
        --- PASS: TestConformance/AdminNetworkPolicyIngressUDP/Should_support_an_'deny-ingress'_policy_for_UDP_protocol;_ensure_rule_ordering_is_respected (6.20s)
        --- PASS: TestConformance/AdminNetworkPolicyIngressUDP/Should_support_a_'deny-ingress'_policy_for_UDP_protocol_at_the_specified_port (3.20s)
        --- PASS: TestConformance/AdminNetworkPolicyIngressUDP/Should_support_an_'pass-ingress'_policy_for_UDP_protocol;_ensure_rule_ordering_is_respected (0.22s)
        --- PASS: TestConformance/AdminNetworkPolicyIngressUDP/Should_support_a_'pass-ingress'_policy_for_UDP_protocol_at_the_specified_port (0.21s)
    --- PASS: TestConformance/AdminNetworkPolicyIntegration (25.30s)
        --- PASS: TestConformance/AdminNetworkPolicyIntegration/Should_Deny_traffic_from_slytherin_to_gryffindor_respecting_ANP (6.19s)
        --- PASS: TestConformance/AdminNetworkPolicyIntegration/Should_Deny_traffic_to_slytherin_from_gryffindor_respecting_ANP (6.21s)
        --- PASS: TestConformance/AdminNetworkPolicyIntegration/Should_support_a_'pass-ingress'_policy_for_ANP_and_respect_the_match_for_network_policy (0.21s)
        --- PASS: TestConformance/AdminNetworkPolicyIntegration/Should_support_a_'pass-egress'_policy_for_ANP_and_respect_the_match_for_network_policy (0.20s)
        --- PASS: TestConformance/AdminNetworkPolicyIntegration/Should_support_a_'pass-ingress'_policy_for_ANP_and_respect_the_match_for_baseline_admin_network_policy (6.21s)
        --- PASS: TestConformance/AdminNetworkPolicyIntegration/Should_support_a_'pass-egress'_policy_for_ANP_and_respect_the_match_for_baseline_admin_network_policy (6.19s)
    --- PASS: TestConformance/AdminNetworkPolicyPriorityField (12.85s)
        --- PASS: TestConformance/AdminNetworkPolicyPriorityField/Should_Deny_traffic_from_slytherin_to_gryffindor_respecting_ANP (6.20s)
        --- PASS: TestConformance/AdminNetworkPolicyPriorityField/Should_Deny_traffic_to_slytherin_from_gryffindor_respecting_ANP (6.19s)
        --- PASS: TestConformance/AdminNetworkPolicyPriorityField/Should_respect_ANP_priority_field;_thus_passing_both_ingress_and_egress_traffic_over_to_BANP (0.41s)
    --- PASS: TestConformance/BaselineAdminNetworkPolicyEgressSCTP (12.82s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyEgressSCTP/Should_support_an_'allow-egress'_policy_for_SCTP_protocol;_ensure_rule_ordering_is_respected (0.20s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyEgressSCTP/Should_support_an_'allow-egress'_policy_for_SCTP_protocol_at_the_specified_port (3.19s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyEgressSCTP/Should_support_an_'deny-egress'_policy_for_SCTP_protocol;_ensure_rule_ordering_is_respected (6.20s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyEgressSCTP/Should_support_a_'deny-egress'_policy_for_SCTP_protocol_at_the_specified_port (3.21s)
    --- PASS: TestConformance/BaselineAdminNetworkPolicyEgressTCP (12.81s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyEgressTCP/Should_support_an_'allow-egress'_policy_for_TCP_protocol;_ensure_rule_ordering_is_respected (0.19s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyEgressTCP/Should_support_an_'allow-egress'_policy_for_TCP_protocol_at_the_specified_port (3.19s)
Remove k8s.io/kubernetes from project dependency
        --- PASS: TestConformance/BaselineAdminNetworkPolicyEgressTCP/Should_support_an_'deny-egress'_policy_for_TCP_protocol;_ensure_rule_ordering_is_respected (6.21s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyEgressTCP/Should_support_a_'deny-egress'_policy_for_TCP_protocol_at_the_specified_port (3.19s)
    --- PASS: TestConformance/BaselineAdminNetworkPolicyEgressUDP (12.85s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyEgressUDP/Should_support_an_'allow-egress'_policy_for_UDP_protocol;_ensure_rule_ordering_is_respected (0.18s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyEgressUDP/Should_support_an_'allow-egress'_policy_for_UDP_protocol_at_the_specified_port (3.20s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyEgressUDP/Should_support_an_'deny-egress'_policy_for_UDP_protocol;_ensure_rule_ordering_is_respected (6.24s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyEgressUDP/Should_support_a_'deny-egress'_policy_for_UDP_protocol_at_the_specified_port (3.21s)
    --- PASS: TestConformance/BaselineAdminNetworkPolicyGress (57.55s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyGress/Should_support_an_'allow-gress'_policy_across_different_protocols (0.59s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyGress/Should_support_an_'allow-gress'_policy_across_different_protocols_at_the_specified_ports (19.15s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyGress/Should_support_an_'deny-gress'_policy_across_different_protocols (18.63s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyGress/Should_support_a_'deny-gress'_policy_across_different_protocols_at_the_specified_ports (19.17s)
    --- PASS: TestConformance/BaselineAdminNetworkPolicyIngressSCTP (12.87s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyIngressSCTP/Should_support_an_'allow-ingress'_policy_for_SCTP_protocol;_ensure_rule_ordering_is_respected (0.21s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyIngressSCTP/Should_support_an_'allow-ingress'_policy_for_SCTP_protocol_at_the_specified_port (3.19s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyIngressSCTP/Should_support_an_'deny-ingress'_policy_for_SCTP_protocol;_ensure_rule_ordering_is_respected (6.24s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyIngressSCTP/Should_support_a_'deny-ingress'_policy_for_SCTP_protocol_at_the_specified_port (3.21s)
    --- PASS: TestConformance/BaselineAdminNetworkPolicyIngressTCP (12.85s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyIngressTCP/Should_support_an_'allow-ingress'_policy_for_TCP_protocol;_ensure_rule_ordering_is_respected (0.18s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyIngressTCP/Should_support_an_'allow-ingress'_policy_for_TCP_protocol_at_the_specified_port (3.18s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyIngressTCP/Should_support_an_'deny-ingress'_policy_for_TCP_protocol;_ensure_rule_ordering_is_respected (6.25s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyIngressTCP/Should_support_a_'deny-ingress'_policy_for_TCP_protocol_at_the_specified_port (3.21s)
    --- PASS: TestConformance/BaselineAdminNetworkPolicyIngressUDP (12.85s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyIngressUDP/Should_support_an_'allow-ingress'_policy_for_UDP_protocol;_ensure_rule_ordering_is_respected (0.21s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyIngressUDP/Should_support_an_'allow-ingress'_policy_for_UDP_protocol_at_the_specified_port (3.20s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyIngressUDP/Should_support_an_'deny-ingress'_policy_for_UDP_protocol;_ensure_rule_ordering_is_respected (6.22s)
        --- PASS: TestConformance/BaselineAdminNetworkPolicyIngressUDP/Should_support_a_'deny-ingress'_policy_for_UDP_protocol_at_the_specified_port (3.20s)
PASS
ok  	sigs.k8s.io/network-policy-api/conformance	317.883s

@Dyanngg Dyanngg added area/dependency Issues or PRs related to dependency changes area/conformance Issues or PRs related to conformance testing labels Jul 21, 2023
@Dyanngg Dyanngg requested a review from tssurya July 21, 2023 22:11
@netlify
Copy link

netlify bot commented Jul 21, 2023

Deploy Preview for kubernetes-sigs-network-policy-api ready!

Name Link
🔨 Latest commit 1e3b317
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-network-policy-api/deploys/64bb04f675bd4100082cd4cb
😎 Deploy Preview https://deploy-preview-129--kubernetes-sigs-network-policy-api.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 21, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Dyanngg

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jul 21, 2023
Copy link
Contributor

@tssurya tssurya left a comment

Choose a reason for hiding this comment

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

I am all for removing the k8s dependency.. But I need to test these changes to make sure it doesn't beak my d/s PR, give me some time...

DeleteTimeout: 10 * time.Second,
GetTimeout: 10 * time.Second,
DeleteTimeout: 20 * time.Second,
GetTimeout: 20 * time.Second,
Copy link
Contributor

@tssurya tssurya Jul 22, 2023

Choose a reason for hiding this comment

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

haha I actually had a PR ready to push to do this because we also hack it up: ovn-kubernetes/ovn-kubernetes@7b071de#diff-2894f83ecaa29479d162ded3f17561f1bbe1b4df762c7d65d06ff829c6f5aa9bR47 along with some other cleanup I wanted to do...
but lgtm to this commit since its useful and makes sense. (I have an upcoming cleanup PR for conformance including this so you could drop it from this one and keep it focused on removing k8s dependency but I'll leave it to you..)

Copy link
Contributor

Choose a reason for hiding this comment

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

actually nvm because my cleanup commit touches a log of framework.ExpectNoError parts, so i will wait for this to go in before i open my PR.. let this merge...

@tssurya
Copy link
Contributor

tssurya commented Jul 24, 2023

err I just realized I don't have an easy way to test this unless this lands and @astoycos includes this in his tagging and I re-pull, so going to approve this for now and then test it.

@tssurya
Copy link
Contributor

tssurya commented Jul 24, 2023

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 24, 2023
@k8s-ci-robot k8s-ci-robot merged commit bf98cec into kubernetes-sigs:master Jul 24, 2023
@Dyanngg Dyanngg deleted the fix-go-mod branch May 21, 2024 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/conformance Issues or PRs related to conformance testing area/dependency Issues or PRs related to dependency changes cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants