├── .github ├── ISSUE_TEMPLATE │ ├── broken-link.md │ ├── bug-report.md │ ├── committership.md │ ├── enhancement.md │ ├── failing-test.md │ ├── flaking-test.md │ ├── membership.md │ └── support.md ├── PULL_REQUEST_TEMPLATE.md ├── dependabot.yml ├── renovate.json └── workflows │ ├── branch.yml │ ├── codeowners.yml │ ├── dependent-issues.yml │ ├── e2e.yml │ ├── flake_finder.yml │ ├── linting.yml │ ├── multiarch.yml │ ├── periodic.yml │ ├── release.yml │ ├── report.yml │ ├── stale.yml │ ├── unit.yml │ └── upgrade-e2e.yml ├── .gitignore ├── .golangci.yml ├── .grype.yaml ├── .lichen.yaml ├── .markdownlinkcheck.json ├── .markdownlint.yml ├── .markdownlintignore ├── .shellcheckrc ├── .shipyard.e2e.ovn.yml ├── .shipyard.e2e.yml ├── .submarinerbot.yaml ├── .tekton ├── submariner-gateway-devel-pull-request.yaml ├── submariner-gateway-devel-push.yaml ├── submariner-globalnet-devel-pull-request.yaml ├── submariner-globalnet-devel-push.yaml ├── submariner-route-agent-devel-pull-request.yaml └── submariner-route-agent-devel-push.yaml ├── .yamllint.yml ├── ADOPTERS.md ├── CODE-OF-CONDUCT.md ├── CODEOWNERS ├── CODEOWNERS.in ├── CONTRIBUTING.md ├── GOVERNANCE.md ├── LICENSE ├── Makefile ├── README.md ├── go.mod ├── go.sum ├── main.go ├── package ├── Dockerfile.submariner-gateway ├── Dockerfile.submariner-globalnet ├── Dockerfile.submariner-route-agent ├── await-node-ready.sh ├── dnf_install ├── iptables-wrapper-installer.sh ├── pluto ├── submariner-globalnet.sh ├── submariner-route-agent.sh └── submariner.sh ├── pkg ├── apis │ └── submariner.io │ │ └── v1 │ │ ├── doc.go │ │ ├── endpoint.go │ │ ├── endpoint_test.go │ │ ├── register.go │ │ ├── string.go │ │ ├── string_test.go │ │ ├── types.go │ │ └── zz_generated.deepcopy.go ├── await_node_ready │ └── main.go ├── cable │ ├── driver.go │ ├── fake │ │ └── driver.go │ ├── libreswan │ │ ├── libreswan.go │ │ ├── libreswan_suite_test.go │ │ ├── libreswan_test.go │ │ └── preferred_server.go │ ├── metrics.go │ ├── vxlan │ │ ├── vxlan.go │ │ └── vxlan_test.go │ └── wireguard │ │ ├── README.md │ │ ├── client.go │ │ ├── driver.go │ │ ├── getconnections.go │ │ ├── wireguard_suite_test.go │ │ └── wireguard_test.go ├── cableengine │ ├── cableengine.go │ ├── cableengine_test.go │ ├── fake │ │ └── cableengine.go │ ├── healthchecker │ │ ├── healthchecker.go │ │ ├── healthchecker_suite_test.go │ │ └── healthchecker_test.go │ └── syncer │ │ ├── syncer.go │ │ └── syncer_test.go ├── cidr │ ├── cidr_test.go │ └── iputil.go ├── client │ ├── applyconfiguration │ │ ├── internal │ │ │ └── internal.go │ │ ├── submariner.io │ │ │ └── v1 │ │ │ │ ├── cluster.go │ │ │ │ ├── clusterglobalegressip.go │ │ │ │ ├── clusterglobalegressipspec.go │ │ │ │ ├── clusterspec.go │ │ │ │ ├── connection.go │ │ │ │ ├── endpoint.go │ │ │ │ ├── endpointspec.go │ │ │ │ ├── gateway.go │ │ │ │ ├── gatewayroute.go │ │ │ │ ├── gatewaystatus.go │ │ │ │ ├── globalegressip.go │ │ │ │ ├── globalegressipspec.go │ │ │ │ ├── globalegressipstatus.go │ │ │ │ ├── globalingressip.go │ │ │ │ ├── globalingressipspec.go │ │ │ │ ├── globalingressipstatus.go │ │ │ │ ├── latencyrttspec.go │ │ │ │ ├── nongatewayroute.go │ │ │ │ ├── remoteendpoint.go │ │ │ │ ├── routeagent.go │ │ │ │ ├── routeagentstatus.go │ │ │ │ └── routepolicyspec.go │ │ └── utils.go │ ├── clientset │ │ └── versioned │ │ │ ├── clientset.go │ │ │ ├── fake │ │ │ ├── clientset_generated.go │ │ │ ├── doc.go │ │ │ └── register.go │ │ │ ├── scheme │ │ │ ├── doc.go │ │ │ └── register.go │ │ │ └── typed │ │ │ └── submariner.io │ │ │ └── v1 │ │ │ ├── cluster.go │ │ │ ├── clusterglobalegressip.go │ │ │ ├── doc.go │ │ │ ├── endpoint.go │ │ │ ├── fake │ │ │ ├── doc.go │ │ │ ├── fake_cluster.go │ │ │ ├── fake_clusterglobalegressip.go │ │ │ ├── fake_endpoint.go │ │ │ ├── fake_gateway.go │ │ │ ├── fake_gatewayroute.go │ │ │ ├── fake_globalegressip.go │ │ │ ├── fake_globalingressip.go │ │ │ ├── fake_nongatewayroute.go │ │ │ ├── fake_routeagent.go │ │ │ └── fake_submariner.io_client.go │ │ │ ├── gateway.go │ │ │ ├── gatewayroute.go │ │ │ ├── generated_expansion.go │ │ │ ├── globalegressip.go │ │ │ ├── globalingressip.go │ │ │ ├── nongatewayroute.go │ │ │ ├── routeagent.go │ │ │ └── submariner.io_client.go │ ├── informers │ │ └── externalversions │ │ │ ├── factory.go │ │ │ ├── generic.go │ │ │ ├── internalinterfaces │ │ │ └── factory_interfaces.go │ │ │ └── submariner.io │ │ │ ├── interface.go │ │ │ └── v1 │ │ │ ├── cluster.go │ │ │ ├── clusterglobalegressip.go │ │ │ ├── endpoint.go │ │ │ ├── gateway.go │ │ │ ├── gatewayroute.go │ │ │ ├── globalegressip.go │ │ │ ├── globalingressip.go │ │ │ ├── interface.go │ │ │ ├── nongatewayroute.go │ │ │ └── routeagent.go │ └── listers │ │ └── submariner.io │ │ └── v1 │ │ ├── cluster.go │ │ ├── clusterglobalegressip.go │ │ ├── endpoint.go │ │ ├── expansion_generated.go │ │ ├── gateway.go │ │ ├── gatewayroute.go │ │ ├── globalegressip.go │ │ ├── globalingressip.go │ │ ├── nongatewayroute.go │ │ └── routeagent.go ├── cni │ ├── cni_iface.go │ ├── cni_iface_test.go │ ├── cni_suite_test.go │ └── plugins.go ├── controllers │ ├── datastoresyncer │ │ ├── datastore_cluster_sync_test.go │ │ ├── datastore_endpoint_sync_test.go │ │ ├── datastoresyncer.go │ │ ├── datastoresyncer_suite_test.go │ │ └── gateway_handler.go │ └── tunnel │ │ ├── tunnel.go │ │ └── tunnel_test.go ├── endpoint │ ├── local_endpoint.go │ ├── local_endpoint_suite_test.go │ ├── local_endpoint_test.go │ ├── local_ip.go │ ├── public_ip.go │ ├── public_ip_test.go │ ├── public_ip_watcher.go │ └── public_ip_watcher_test.go ├── event │ ├── controller │ │ ├── controller.go │ │ ├── controller_suite_test.go │ │ ├── controller_test.go │ │ ├── endpoint_created.go │ │ ├── endpoint_removed.go │ │ ├── endpoint_updated.go │ │ └── node_handlers.go │ ├── event_suite_test.go │ ├── handler.go │ ├── logger │ │ └── handler.go │ ├── registry.go │ ├── registry_test.go │ └── testing │ │ ├── controller_support.go │ │ └── testing.go ├── gateway │ ├── gateway.go │ ├── gateway_suite_test.go │ └── gateway_test.go ├── globalnet │ ├── constants │ │ └── constants.go │ ├── controllers │ │ ├── base_controllers.go │ │ ├── cluster_egressip_controller.go │ │ ├── cluster_egressip_controller_test.go │ │ ├── controllers_suite_test.go │ │ ├── egress_pod_watcher.go │ │ ├── endpoints_controller.go │ │ ├── gateway_controller.go │ │ ├── gateway_controller_test.go │ │ ├── gateway_monitor.go │ │ ├── gateway_monitor_test.go │ │ ├── global_egressip_controller.go │ │ ├── global_egressip_controller_test.go │ │ ├── global_ingressip_controller.go │ │ ├── global_ingressip_controller_test.go │ │ ├── ingress_endpoints_controller.go │ │ ├── ingress_endpoints_controllers.go │ │ ├── ingress_pod_controller.go │ │ ├── ingress_pod_controllers.go │ │ ├── packetfilter │ │ │ └── iface.go │ │ ├── service_controller.go │ │ ├── service_controller_test.go │ │ ├── service_export_controller.go │ │ ├── service_export_controller_test.go │ │ ├── service_export_endpoints_controllers.go │ │ ├── types.go │ │ └── uninstall.go │ ├── main.go │ └── metrics │ │ └── metrics.go ├── ipset │ ├── ipset.go │ ├── ipset_test.go │ └── types.go ├── natdiscovery │ ├── listener.go │ ├── listener_internal_test.go │ ├── natdiscovery.go │ ├── natdiscovery_suite_test.go │ ├── natdiscovery_test.go │ ├── proto │ │ ├── consts.go │ │ ├── methods.go │ │ ├── natdiscovery.pb.go │ │ └── natdiscovery.proto │ ├── remote_endpoint.go │ ├── remote_endpoint_internal_test.go │ ├── request_handle.go │ ├── request_handle_test.go │ ├── request_send.go │ ├── request_send_test.go │ └── response_handle.go ├── netlink │ ├── adapter.go │ ├── fake │ │ └── netlink.go │ ├── netlink.go │ └── network_interface.go ├── node │ ├── node.go │ ├── node_suite_test.go │ └── node_test.go ├── packetfilter │ ├── adapter.go │ ├── adapter_test.go │ ├── configure │ │ ├── configure.go │ │ └── configure_suite_test.go │ ├── fake │ │ ├── driver.go │ │ ├── namedset.go │ │ └── packetfilter.go │ ├── iptables │ │ ├── iptables.go │ │ ├── iptables_suite_test.go │ │ ├── iptables_test.go │ │ └── namedset.go │ ├── nftables │ │ ├── namedset.go │ │ ├── nftables.go │ │ ├── nftables_suite_test.go │ │ ├── nftables_test.go │ │ └── rule_conversion.go │ ├── packetfilter.go │ └── packetfilter_suite_test.go ├── pinger │ ├── controller.go │ ├── controller_test.go │ ├── fake │ │ └── pinger.go │ ├── pinger.go │ ├── pinger_suite_test.go │ ├── pinger_test.go │ ├── statistics.go │ └── statistics_internal_test.go ├── pod │ └── pod.go ├── port │ └── ports.go ├── routeagent_driver │ ├── cabledriver │ │ ├── vxlan_tunnel_cleanup_handler.go │ │ └── xfrm_cleanup_handler.go │ ├── constants │ │ └── constants.go │ ├── environment │ │ └── env.go │ ├── handlers │ │ ├── calico │ │ │ ├── calico_suite_test.go │ │ │ ├── ippool_handler.go │ │ │ └── ippool_handler_test.go │ │ ├── handlers_suite_test.go │ │ ├── handlers_test.go │ │ ├── healthchecker │ │ │ ├── health_checker_suite_test.go │ │ │ ├── healthchecker.go │ │ │ └── healthchecker_test.go │ │ ├── kubeproxy │ │ │ ├── constants.go │ │ │ ├── dual_stack_test.go │ │ │ ├── endpoint_handler.go │ │ │ ├── endpoint_test.go │ │ │ ├── gw_transition.go │ │ │ ├── gw_transition_test.go │ │ │ ├── kp_packetfilter.go │ │ │ ├── kubeproxy_suite_test.go │ │ │ ├── node_handler.go │ │ │ ├── packetfilter_iface.go │ │ │ ├── routes_iface.go │ │ │ ├── sync_handler_test.go │ │ │ ├── uninstall.go │ │ │ └── vxlan.go │ │ ├── mtu │ │ │ ├── mtuhandler.go │ │ │ ├── mtuhandler_suite_test.go │ │ │ └── mtuhandler_test.go │ │ └── ovn │ │ │ ├── connection.go │ │ │ ├── constants.go │ │ │ ├── env.go │ │ │ ├── fake │ │ │ └── ovsdb_client.go │ │ │ ├── gateway_dataplane.go │ │ │ ├── gateway_route_controller.go │ │ │ ├── gateway_route_handler.go │ │ │ ├── gateway_route_handler_test.go │ │ │ ├── handler.go │ │ │ ├── handler_test.go │ │ │ ├── host_networking.go │ │ │ ├── non_gateway_route_controller.go │ │ │ ├── non_gateway_route_handler.go │ │ │ ├── non_gateway_route_handler_test.go │ │ │ ├── ovn_logical_routes.go │ │ │ ├── ovn_suite_test.go │ │ │ ├── route_config_syncer.go │ │ │ ├── south_rules.go │ │ │ ├── subnets.go │ │ │ ├── transit_switch_ip.go │ │ │ ├── transit_switch_ip_test.go │ │ │ ├── uninstall.go │ │ │ ├── utils.go │ │ │ └── vsctl │ │ │ └── vsctl.go │ └── main.go ├── types │ └── types.go ├── util │ └── clusterfiles │ │ ├── cluster_files.go │ │ └── cluster_files_test.go ├── versions │ └── version.go └── vxlan │ ├── vxlan.go │ └── vxlan_test.go ├── scripts ├── boilerplate.go.txt ├── codegen └── e2e │ └── external │ ├── hook │ └── utils ├── sonar-project.properties ├── staticcheck.conf ├── test ├── e2e │ ├── cluster │ │ └── add_remove_cluster.go │ ├── compliance │ │ └── fips.go │ ├── dataplane │ │ ├── gateway_status.go │ │ ├── tcp_gn_pod_connectivity.go │ │ └── tcp_pod_connectivity.go │ ├── e2e_test.go │ ├── framework │ │ ├── dataplane.go │ │ ├── framework.go │ │ ├── gateways.go │ │ └── submariner_resources.go │ └── redundancy │ │ ├── gateway_failover.go │ │ ├── leader_election.go │ │ └── route_agent_restart.go └── external │ ├── dataplane │ ├── connectivity.go │ └── gn_connectivity.go │ └── e2e_external_test.go └── tools ├── go.mod ├── go.sum └── tools.go /.github/ISSUE_TEMPLATE/broken-link.md: -------------------------------------------------------------------------------- 1 | Periodic link aliveness CI detected a broken link. 2 | 3 | Please check the [Periodic workflow](https://github.com/submariner-io/submariner/actions?query=workflow%3APeriodic). 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: Report a bug in Submariner 4 | labels: bug 5 | 6 | --- 7 | 8 | 15 | 16 | 17 | **What happened**: 18 | 19 | **What you expected to happen**: 20 | 21 | **How to reproduce it (as minimally and precisely as possible)**: 22 | 23 | **Anything else we need to know?**: 24 | 25 | **Environment**: 26 | - Diagnose information (use `subctl diagnose all`): 27 | - Gather information (use `subctl gather`): 28 | - Cloud provider or hardware configuration: 29 | - Install tools: 30 | - Others: 31 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/committership.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Submariner Committer Request 3 | about: Request Submariner Committer rights on some files 4 | title: 'REQUEST: New Committer rights request for ' 5 | labels: committer-request 6 | assignees: '' 7 | 8 | --- 9 | 10 | ### GitHub Username 11 | e.g. (at)example_user 12 | 13 | ### Code you are requesting Committer rights for 14 | e.g. submariner-operator/\* or submariner-operator/scripts/\* 15 | 16 | ### Requirements 17 | - [ ] I have reviewed the contributor roles guidelines (https://submariner.io/community/contributor-roles/) 18 | - [ ] I have enabled 2FA on my GitHub account (https://github.com/settings/security) 19 | - [ ] I have subscribed to the submariner-dev e-mail list (https://groups.google.com/forum/#!forum/submariner-dev) 20 | - [ ] I have been actively contributing to Submariner for at least 3 months 21 | - [ ] I have two sponsors that meet the sponsor requirements listed in the community membership guidelines 22 | - [ ] I have spoken to my sponsors ahead of this application, and they have agreed to sponsor my application 23 | 24 | ### Sponsors 25 | - (at)sponsor-1 26 | - (at)sponsor-2 27 | 28 | ### List of required reviews to Submariner project PRs 29 | - At least 20 PRs to the relevant codebase that you reviewed, and at least 5 for which you were the primary reviewer 30 | - `https://github.com/submariner-io//pulls?q=is%3Apr+reviewed-by%3A+-author%3A` 31 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/enhancement.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Enhancement Request 3 | about: Suggest an enhancement to the Submariner project 4 | labels: enhancement 5 | 6 | --- 7 | 8 | 9 | **What would you like to be added**: 10 | 11 | **Why is this needed**: 12 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/failing-test.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Failing Test 3 | about: Report continuously failing tests or jobs in Submariner CI 4 | labels: failing-test 5 | 6 | --- 7 | 8 | 10 | 11 | **Which jobs are failing**: 12 | 13 | **Which test(s) are failing**: 14 | 15 | **Since when has it been failing**: 16 | 17 | **Testgrid link**: 18 | 19 | **Reason for failure**: 20 | 21 | **Anything else we need to know**: 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/flaking-test.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Flaking Test 3 | about: Report flaky tests or jobs in Submariner CI 4 | labels: flake 5 | 6 | --- 7 | 8 | 10 | 11 | **Which jobs are flaking**: 12 | 13 | **Which test(s) are flaking**: 14 | 15 | **Testgrid link**: 16 | 17 | **Reason for failure**: 18 | 19 | **Anything else we need to know**: 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/membership.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Submariner Member Request 3 | about: Request Submariner GitHub org Membership 4 | title: 'REQUEST: New Membership request for ' 5 | labels: member-request 6 | assignees: '' 7 | 8 | --- 9 | 10 | ### GitHub Username 11 | e.g. (at)example_user 12 | 13 | ### Requirements 14 | - [ ] I have reviewed the contributor roles guidelines (https://submariner.io/community/contributor-roles/) 15 | - [ ] I have enabled 2FA on my GitHub account (https://github.com/settings/security) 16 | - [ ] I have subscribed to the submariner-dev e-mail list (https://groups.google.com/forum/#!forum/submariner-dev) 17 | - [ ] I have multiple contributions to Submariner that meet the requirements listed in the community membership guidelines 18 | - [ ] I have two sponsors that meet the sponsor requirements listed in the community membership guidelines 19 | - [ ] I have spoken to my sponsors ahead of this application, and they have agreed to sponsor my application 20 | 21 | ### Sponsors 22 | - (at)sponsor-1 23 | - (at)sponsor-2 24 | 25 | ### List of contributions to the Submariner project 26 | - Multiple contributions to Submariner that meet the requirements listed in the community membership guidelines 27 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/support.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Support Request 3 | about: Support request or question relating to Submariner 4 | labels: support 5 | 6 | --- 7 | 8 | 19 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 14 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 2 3 | updates: 4 | - package-ecosystem: github-actions 5 | directory: / 6 | schedule: 7 | interval: monthly 8 | groups: 9 | github-actions: 10 | patterns: 11 | - "*" 12 | - package-ecosystem: github-actions 13 | directory: / 14 | target-branch: release-0.16 15 | schedule: 16 | interval: monthly 17 | groups: 18 | github-actions: 19 | patterns: 20 | - "*" 21 | - package-ecosystem: github-actions 22 | directory: / 23 | target-branch: release-0.17 24 | schedule: 25 | interval: monthly 26 | groups: 27 | github-actions: 28 | patterns: 29 | - "*" 30 | - package-ecosystem: github-actions 31 | directory: / 32 | target-branch: release-0.18 33 | schedule: 34 | interval: monthly 35 | groups: 36 | github-actions: 37 | patterns: 38 | - "*" 39 | - package-ecosystem: github-actions 40 | directory: / 41 | target-branch: release-0.19 42 | schedule: 43 | interval: monthly 44 | groups: 45 | github-actions: 46 | patterns: 47 | - "*" 48 | - package-ecosystem: github-actions 49 | directory: / 50 | target-branch: release-0.20 51 | schedule: 52 | interval: monthly 53 | groups: 54 | github-actions: 55 | patterns: 56 | - "*" 57 | - package-ecosystem: gomod 58 | directory: / 59 | schedule: 60 | interval: weekly 61 | groups: 62 | gomod: 63 | patterns: 64 | - "*" 65 | ignore: 66 | # protobuf must be handled manually 67 | - dependency-name: google.golang.org/protobuf 68 | # Our own dependencies are handled during releases 69 | - dependency-name: github.com/submariner-io/* 70 | # Managed in admiral 71 | - dependency-name: github.com/kelseyhightower/envconfig 72 | - dependency-name: github.com/onsi/ginkgo/v2 73 | - dependency-name: github.com/onsi/gomega 74 | - dependency-name: github.com/pkg/errors 75 | - dependency-name: github.com/prometheus/client_golang 76 | - dependency-name: k8s.io/api 77 | - dependency-name: k8s.io/apimachinery 78 | - dependency-name: k8s.io/client-go 79 | - dependency-name: sigs.k8s.io/controller-runtime 80 | # Managed in shipyard 81 | - dependency-name: k8s.io/utils 82 | - dependency-name: sigs.k8s.io/mcs-api 83 | - package-ecosystem: gomod 84 | directory: /tools 85 | schedule: 86 | interval: weekly 87 | groups: 88 | gomod: 89 | patterns: 90 | - "*" 91 | -------------------------------------------------------------------------------- /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": ["config:base"], 4 | "enabledManagers": ["tekton"] 5 | } 6 | -------------------------------------------------------------------------------- /.github/workflows/branch.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Branch Checks 3 | 4 | on: 5 | pull_request: 6 | 7 | permissions: {} 8 | 9 | jobs: 10 | target_branch: 11 | name: PR targets branch 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Check that the PR targets devel 15 | if: ${{ github.base_ref != 'devel' }} 16 | run: exit 1 17 | -------------------------------------------------------------------------------- /.github/workflows/codeowners.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: CODEOWNERS 3 | 4 | on: 5 | pull_request: 6 | paths: 7 | - 'CODEOWNERS' 8 | - 'CODEOWNERS.in' 9 | 10 | permissions: {} 11 | 12 | jobs: 13 | updated: 14 | name: Up-to-date 15 | runs-on: ubuntu-latest 16 | steps: 17 | - name: Check out the repository 18 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 19 | - name: Delete current CODEOWNERS file 20 | run: rm CODEOWNERS 21 | - name: Run gen-codeowners to rebuild CODEOWNERS file 22 | run: make CODEOWNERS 23 | - name: Validate new CODEOWNERS file is the same as tracked by Git 24 | run: git diff --exit-code CODEOWNERS 25 | -------------------------------------------------------------------------------- /.github/workflows/dependent-issues.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: PR Dependencies 3 | 4 | on: 5 | issues: 6 | types: 7 | - opened 8 | - edited 9 | - closed 10 | - reopened 11 | - synchronize 12 | pull_request_target: 13 | types: 14 | - opened 15 | - edited 16 | - closed 17 | - reopened 18 | - synchronize 19 | schedule: 20 | - cron: '0 0/6 * * *' # every 6 hours 21 | 22 | permissions: 23 | issues: write 24 | pull-requests: write 25 | statuses: write 26 | 27 | jobs: 28 | check: 29 | name: Check Dependencies 30 | if: github.repository_owner == 'submariner-io' 31 | runs-on: ubuntu-latest 32 | steps: 33 | - uses: z0al/dependent-issues@950226e7ca8fc43dc209a7febf67c655af3bdb43 34 | env: 35 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 36 | with: 37 | # The label to use to mark dependent issues 38 | label: dependent 39 | 40 | # Enable checking for dependencies in issues. 41 | check_issues: on 42 | 43 | # A comma-separated list of keywords to mark dependency. 44 | keywords: depends on, Depends on 45 | -------------------------------------------------------------------------------- /.github/workflows/e2e.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: End to End 3 | 4 | on: 5 | pull_request: 6 | types: [labeled, opened, synchronize, reopened] 7 | 8 | permissions: {} 9 | 10 | jobs: 11 | images: 12 | name: Images 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Check out the repository 16 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 17 | 18 | - name: Build the images if necessary 19 | uses: submariner-io/shipyard/gh-actions/cache-images@devel 20 | 21 | # Both E2E jobs have the same name; the default job is un-suffixed, the full jobs are suffixed with their matrix combination 22 | e2e-default: 23 | name: E2E 24 | needs: images 25 | timeout-minutes: 30 26 | runs-on: ubuntu-latest 27 | steps: 28 | - name: Check out the repository 29 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 30 | 31 | - name: Run E2E deployment and tests 32 | uses: submariner-io/shipyard/gh-actions/e2e@devel 33 | 34 | - name: Post mortem 35 | if: failure() 36 | uses: submariner-io/shipyard/gh-actions/post-mortem@devel 37 | 38 | e2e-full: 39 | name: E2E 40 | needs: images 41 | if: contains(github.event.pull_request.labels.*.name, 'ready-to-test') 42 | timeout-minutes: 45 43 | runs-on: ubuntu-latest 44 | strategy: 45 | fail-fast: false 46 | matrix: 47 | cable-driver: ['', 'wireguard', 'vxlan'] 48 | extra-toggles: ['', 'ovn'] 49 | globalnet: ['', 'globalnet'] 50 | # Run most tests against the latest K8s version 51 | k8s_version: ['1.32'] 52 | exclude: 53 | - cable-driver: wireguard 54 | extra-toggles: ovn 55 | include: 56 | - extra-toggles: dual-stack 57 | - extra-toggles: dual-stack, globalnet 58 | - extra-toggles: ipv6-stack 59 | - extra-toggles: nftables 60 | - extra-toggles: nftables, ovn 61 | - extra-toggles: nftables, globalnet 62 | # Oldest Kubernetes version thought to work with SubM. 63 | # This should match minK8sMajor.minK8sMinor in subctl/pkg/version/version.go. 64 | # If this breaks, we may advance the oldest-working K8s version instead of fixing it. See: 65 | # https://submariner.io/development/building-testing/ci-maintenance/ 66 | - k8s_version: '1.19' 67 | # Test top and bottom of supported K8s version range 68 | - k8s_version: '1.29' 69 | steps: 70 | - name: Check out the repository 71 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 72 | 73 | - name: Run E2E deployment and tests 74 | uses: submariner-io/shipyard/gh-actions/e2e@devel 75 | with: 76 | using: ${{ matrix.globalnet }} ${{ matrix.cable-driver }} ${{ matrix.extra-toggles }} 77 | 78 | - name: Post mortem 79 | if: failure() 80 | uses: submariner-io/shipyard/gh-actions/post-mortem@devel 81 | -------------------------------------------------------------------------------- /.github/workflows/flake_finder.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Flake Finder 3 | 4 | on: 5 | schedule: 6 | - cron: "0 0,1 * * *" 7 | 8 | permissions: {} 9 | 10 | jobs: 11 | e2e: 12 | name: E2E 13 | if: github.repository_owner == 'submariner-io' 14 | timeout-minutes: 45 15 | runs-on: ubuntu-latest 16 | strategy: 17 | fail-fast: false 18 | matrix: 19 | cable-driver: ['', 'wireguard', 'vxlan'] 20 | extra-toggles: ['', 'ovn'] 21 | globalnet: ['', 'globalnet'] 22 | # Run most tests against the latest K8s version 23 | k8s_version: ['1.32'] 24 | exclude: 25 | - cable-driver: wireguard 26 | extra-toggles: ovn 27 | include: 28 | # Test top and bottom of supported K8s version range 29 | - k8s_version: '1.29' 30 | steps: 31 | - name: Check out the repository 32 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 33 | 34 | - name: Run E2E deployment and tests 35 | uses: submariner-io/shipyard/gh-actions/e2e@devel 36 | with: 37 | using: ${{ matrix.cable-driver }} ${{ matrix.extra-toggles }} 38 | 39 | - name: Post mortem 40 | if: failure() 41 | uses: submariner-io/shipyard/gh-actions/post-mortem@devel 42 | -------------------------------------------------------------------------------- /.github/workflows/multiarch.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Multi-arch Builds 3 | 4 | on: 5 | pull_request: 6 | 7 | permissions: {} 8 | 9 | jobs: 10 | check-multiarch: 11 | name: Check the multi-arch builds 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Check out the repository 15 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 16 | - name: Set up QEMU (to support building on non-native architectures) 17 | uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 18 | - name: Build the multi-arch images 19 | run: make multiarch-images 20 | - name: Check that we actually build multi-arch images 21 | run: bash -c '[ "$(echo package/*.tar)" != "package/*.tar" ]' 22 | -------------------------------------------------------------------------------- /.github/workflows/periodic.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Periodic 3 | 4 | on: 5 | schedule: 6 | - cron: "0 0 * * 0" 7 | 8 | permissions: {} 9 | 10 | jobs: 11 | internal-integration: 12 | name: Internal Integration 13 | if: github.repository_owner == 'submariner-io' 14 | runs-on: ubuntu-latest 15 | permissions: 16 | contents: write 17 | pull-requests: write 18 | steps: 19 | - name: Check out the repository 20 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 21 | 22 | - name: Update internal submariner-io/* dependencies to latest 23 | run: | 24 | for dep in $(awk '!/module/ && /github.com.submariner-io/ { print $1 }' go.mod) 25 | do go get ${dep}@devel 26 | done 27 | 28 | - name: Create Pull Request 29 | uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e 30 | with: 31 | title: Update submariner-io/* dependencies to latest 32 | body: | 33 | This checks the current status of this repository against the latest version of all the Submariner projects it depends on. 34 | If something fails, the failure should be investigated and at least tracked as an issue blocking the next release. 35 | Since some CI only runs periodically, if on-PR CI passes it's still good to merge this update for full integration coverage. 36 | commit-message: | 37 | Update submariner-io/* dependencies to latest 38 | 39 | This upgrades all our dependencies on other Submariner projects to their 40 | latest development snapshots, ensuring the code in the projects remains 41 | coherent and that tests of development images verify the latest code. 42 | signoff: true 43 | author: GitHub 44 | labels: automated, dependencies 45 | 46 | markdown-link-check-periodic: 47 | name: Markdown Links (all files) 48 | if: github.repository_owner == 'submariner-io' 49 | runs-on: ubuntu-latest 50 | permissions: 51 | issues: write 52 | steps: 53 | - name: Check out the repository 54 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 55 | 56 | - name: Run markdown-link-check 57 | uses: gaurav-nelson/github-action-markdown-link-check@3c3b66f1f7d0900e37b71eca45b63ea9eedfce31 58 | with: 59 | config-file: ".markdownlinkcheck.json" 60 | 61 | - name: Raise an Issue to report broken links 62 | if: ${{ failure() }} 63 | uses: peter-evans/create-issue-from-file@e8ef132d6df98ed982188e460ebb3b5d4ef3a9cd 64 | with: 65 | title: Broken link detected by periodic linting 66 | content-filepath: .github/ISSUE_TEMPLATE/broken-link.md 67 | labels: automated, broken link 68 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Release Images 3 | 4 | on: 5 | workflow_dispatch: 6 | push: 7 | branches: 8 | - devel 9 | - release-* 10 | 11 | permissions: {} 12 | 13 | jobs: 14 | release: 15 | name: Release Images 16 | if: github.repository_owner == 'submariner-io' 17 | runs-on: ubuntu-latest 18 | steps: 19 | - name: Check out the repository 20 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 21 | with: 22 | fetch-depth: 0 23 | 24 | - name: Build and release new images 25 | uses: submariner-io/shipyard/gh-actions/release-images@devel 26 | with: 27 | username: ${{ secrets.QUAY_USERNAME }} 28 | password: ${{ secrets.QUAY_PASSWORD }} 29 | -------------------------------------------------------------------------------- /.github/workflows/report.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Reporting 3 | 4 | on: 5 | push: 6 | branches: 7 | - devel 8 | - release-* 9 | 10 | permissions: {} 11 | 12 | jobs: 13 | unit-coverage: 14 | name: Go Unit Test Coverage 15 | if: github.repository_owner == 'submariner-io' 16 | runs-on: ubuntu-latest 17 | steps: 18 | - name: Check out the repository 19 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 20 | with: 21 | fetch-depth: 0 22 | 23 | - name: Run Go unit tests 24 | run: make unit 25 | 26 | - name: Run SonarScan, upload Go test results and coverage 27 | uses: SonarSource/sonarqube-scan-action@aa494459d7c39c106cc77b166de8b4250a32bb97 28 | env: 29 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 30 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} 31 | 32 | variant-analysis: 33 | name: Variant Analysis 34 | runs-on: ubuntu-latest 35 | permissions: 36 | security-events: write 37 | steps: 38 | - name: Check out the repository 39 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 40 | - name: Initialize CodeQL 41 | uses: github/codeql-action/init@60168efe1c415ce0f5521ea06d5c2062adbeed1b 42 | with: 43 | languages: go 44 | - name: Run CodeQL variant analysis 45 | uses: github/codeql-action/analyze@60168efe1c415ce0f5521ea06d5c2062adbeed1b 46 | - name: Show CodeQL scan SARIF report 47 | if: always() 48 | run: cat ../results/go.sarif 49 | 50 | vulnerability-scan: 51 | name: Vulnerability Scanning 52 | if: github.repository_owner == 'submariner-io' 53 | runs-on: ubuntu-latest 54 | permissions: 55 | security-events: write 56 | steps: 57 | - name: Check out the repository 58 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 59 | - name: Run Anchore vulnerability scanner 60 | uses: anchore/scan-action@2c901ab7378897c01b8efaa2d0c9bf519cc64b9e 61 | id: scan 62 | with: 63 | path: "." 64 | fail-build: false 65 | - name: Show Anchore scan SARIF report 66 | run: cat ${{ steps.scan.outputs.sarif }} 67 | - name: Upload Anchore scan SARIF report 68 | uses: github/codeql-action/upload-sarif@60168efe1c415ce0f5521ea06d5c2062adbeed1b 69 | with: 70 | sarif_file: ${{ steps.scan.outputs.sarif }} 71 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Stale 3 | 4 | on: 5 | schedule: 6 | - cron: "0 0 * * *" 7 | 8 | permissions: {} 9 | 10 | jobs: 11 | stale: 12 | name: Close Stale Issues and PRs 13 | if: github.repository_owner == 'submariner-io' 14 | runs-on: ubuntu-latest 15 | permissions: 16 | issues: write 17 | pull-requests: write 18 | steps: 19 | - uses: actions/stale@816d9db1aba399a7f70277f1a2b01a4d21497fdd 20 | with: 21 | days-before-issue-stale: 120 22 | days-before-pr-stale: 14 23 | exempt-issue-labels: 'confirmed,security' 24 | exempt-pr-labels: 'confirmed,security' 25 | stale-issue-label: 'stale' 26 | stale-issue-message: | 27 | This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further 28 | activity occurs. Thank you for your contributions. 29 | stale-pr-label: 'stale' 30 | stale-pr-message: | 31 | This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further 32 | activity occurs. Thank you for your contributions. 33 | -------------------------------------------------------------------------------- /.github/workflows/unit.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Unit Tests 3 | 4 | on: 5 | pull_request: 6 | 7 | permissions: {} 8 | 9 | jobs: 10 | unit-testing: 11 | name: Go Unit Tests 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Check out the repository 15 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 16 | 17 | - name: Create artifacts directory 18 | run: mkdir artifacts 19 | 20 | - name: Run Go unit tests 21 | run: | 22 | set -o pipefail 23 | make unit 2>&1 | tee artifacts/unittest.log 24 | 25 | - name: Collect artifacts 26 | run: | 27 | for f in $(find ./pkg -name "*.xml"); do 28 | mkdir -p artifacts/$(dirname $f) 29 | cp $f -rfp artifacts/$f 30 | done 31 | 32 | - name: Upload artifacts 33 | uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 34 | with: 35 | name: Unit test artifacts 36 | path: artifacts 37 | -------------------------------------------------------------------------------- /.github/workflows/upgrade-e2e.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Upgrade 3 | 4 | on: 5 | pull_request: 6 | branches: [devel] 7 | 8 | permissions: {} 9 | 10 | jobs: 11 | upgrade-e2e: 12 | name: Latest Release to Latest Version 13 | timeout-minutes: 45 14 | runs-on: ubuntu-latest 15 | strategy: 16 | fail-fast: false 17 | steps: 18 | - name: Check out the repository 19 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 20 | 21 | - name: Install an old cluster, upgrade it and check it 22 | uses: submariner-io/shipyard/gh-actions/upgrade-e2e@devel 23 | 24 | - name: Post Mortem 25 | if: failure() 26 | uses: submariner-io/shipyard/gh-actions/post-mortem@devel 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .dapper 3 | /bin 4 | /include 5 | /package/.image.* 6 | dist 7 | output 8 | /vendor 9 | .project 10 | .settings 11 | *coverprofile* 12 | junit.xml 13 | scripts/broker-info.subm* 14 | /Dockerfile.* 15 | .shflags 16 | Makefile.shipyard 17 | Makefile.dapper 18 | -------------------------------------------------------------------------------- /.grype.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | ignore: 3 | # False positive, CVE is actually about the C++ project protocolbuffers/protobuf 4 | # https://github.com/anchore/grype/issues/558 5 | - vulnerability: CVE-2015-5237 6 | package: 7 | name: google.golang.org/protobuf 8 | # False positive, CVE is actually about the C++ project protocolbuffers/protobuf 9 | # https://github.com/anchore/grype/issues/633 10 | - vulnerability: CVE-2021-22570 11 | package: 12 | name: google.golang.org/protobuf 13 | -------------------------------------------------------------------------------- /.lichen.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Licenses other than Apache-2.0 are governed by 3 | # https://github.com/cncf/foundation/blob/master/allowed-third-party-license-policy.md#approved-licenses-for-allowlist 4 | # Note that Allowlist also requires that projects were created 5 | # on GitHub at least 12 months prior and have at least 10 stars 6 | # or 10 forks 7 | allow: 8 | - "Apache-2.0" 9 | - "BSD-2-Clause" 10 | - "BSD-2-Clause-FreeBSD" 11 | - "BSD-3-Clause" 12 | - "MIT" 13 | - "ISC" 14 | - "Python-2.0" 15 | - "PostgreSQL" 16 | - "X11" 17 | - "Zlib" 18 | 19 | override: 20 | - path: "sigs.k8s.io/yaml" 21 | licenses: ["Apache-2.0", "MIT"] 22 | -------------------------------------------------------------------------------- /.markdownlinkcheck.json: -------------------------------------------------------------------------------- 1 | { 2 | "ignorePatterns": [ 3 | { 4 | "pattern": "^https://docs.github.com" 5 | }, 6 | { 7 | "pattern": "^https://github.com/\\S+/\\S+/(issues|pull)/[0-9]+" 8 | }, 9 | { 10 | "pattern": "^https://github.com/submariner-io/submariner/workflows/(.*)/badge.svg" 11 | }, 12 | { 13 | "pattern": "^http://localhost:" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /.markdownlint.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Set maximum line Length to 140c to match Go linting 3 | line-length: 4 | line_length: 140 5 | -------------------------------------------------------------------------------- /.markdownlintignore: -------------------------------------------------------------------------------- 1 | tweets/README.md 2 | -------------------------------------------------------------------------------- /.shellcheckrc: -------------------------------------------------------------------------------- 1 | # SC2154 is excluded to avoid false positives based on our use of global variables 2 | disable=SC2154 3 | -------------------------------------------------------------------------------- /.shipyard.e2e.ovn.yml: -------------------------------------------------------------------------------- 1 | --- 2 | cni: ovn 3 | submariner: true 4 | nodes: control-plane worker 5 | clusters: 6 | cluster1: 7 | cluster2: 8 | nodes: control-plane worker worker 9 | -------------------------------------------------------------------------------- /.shipyard.e2e.yml: -------------------------------------------------------------------------------- 1 | --- 2 | submariner: true 3 | nodes: control-plane worker 4 | clusters: 5 | cluster1: 6 | cluster2: 7 | nodes: control-plane worker worker 8 | gateways: 2 9 | -------------------------------------------------------------------------------- /.submarinerbot.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | label-approved: 3 | approvals: 2 4 | label: ready-to-test 5 | -------------------------------------------------------------------------------- /.yamllint.yml: -------------------------------------------------------------------------------- 1 | --- 2 | extends: default 3 | 4 | rules: 5 | line-length: 6 | max: 140 7 | # Allow standard GHA syntax for "on: *" 8 | truthy: 9 | ignore: '.github/workflows/*.yml' 10 | 11 | ignore: | 12 | **/vendor 13 | .tekton 14 | -------------------------------------------------------------------------------- /ADOPTERS.md: -------------------------------------------------------------------------------- 1 | # Submariner Adopters 2 | 3 | | Type | Name | Since | Website | Use-Case | 4 | |:-|:-|:-|:-|:-| 5 | | Vendor | Red Hat, Inc. | 2019 | [link](https://www.redhat.com) | Building Submariner into multicluster solutions like [ACM](https://www.redhat.com/en/technologies/management/advanced-cluster-management). | 6 | -------------------------------------------------------------------------------- /CODE-OF-CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | Please see the [Code of Conduct docs on Submariner's website](https://submariner.io/community/code-of-conduct/). 4 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Auto-generated, do not edit; see CODEOWNERS.in 2 | * @Oats87 @skitt @sridhargaddam @tpantelis @vthapar @yboaron 3 | *.md @dfarrell07 @Oats87 @skitt @sridhargaddam @tpantelis @vthapar @yboaron 4 | /.github/workflows/ @mkolesnik @Oats87 @skitt @sridhargaddam @tpantelis @vthapar @yboaron 5 | /package/ @mkolesnik @Oats87 @skitt @sridhargaddam @tpantelis @vthapar @yboaron 6 | /scripts/ @mkolesnik @Oats87 @skitt @sridhargaddam @tpantelis @vthapar @yboaron 7 | Dockerfile.dapper @mkolesnik @Oats87 @skitt @sridhargaddam @tpantelis @vthapar @yboaron 8 | go.mod @aswinsuryan @dfarrell07 @maayanf24 @Oats87 @skitt @sridhargaddam @tpantelis @vthapar @yboaron 9 | go.sum @aswinsuryan @dfarrell07 @maayanf24 @Oats87 @skitt @sridhargaddam @tpantelis @vthapar @yboaron 10 | Makefile* @mkolesnik @Oats87 @skitt @sridhargaddam @tpantelis @vthapar @yboaron 11 | -------------------------------------------------------------------------------- /CODEOWNERS.in: -------------------------------------------------------------------------------- 1 | @aswinsuryan go.mod go.sum 2 | @dfarrell07 *.md go.mod go.sum 3 | @maayanf24 go.mod go.sum 4 | @mkolesnik /.github/workflows/ /scripts/ Makefile* Dockerfile.dapper /package/ 5 | @Oats87 * 6 | @skitt * 7 | @sridhargaddam * 8 | @tpantelis * 9 | @vthapar * 10 | @yboaron * 11 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Please see the [Development docs on Submariner's website](https://submariner.io/development/). 4 | -------------------------------------------------------------------------------- /package/Dockerfile.submariner-gateway: -------------------------------------------------------------------------------- 1 | ARG BASE_BRANCH=devel 2 | ARG FEDORA_VERSION=41 3 | ARG SOURCE=/go/src/github.com/submariner-io/submariner 4 | 5 | FROM --platform=${BUILDPLATFORM} quay.io/submariner/shipyard-dapper-base:${BASE_BRANCH} AS builder 6 | ARG FEDORA_VERSION 7 | ARG SOURCE 8 | ARG TARGETPLATFORM 9 | 10 | COPY . ${SOURCE} 11 | 12 | RUN make -C ${SOURCE} LOCAL_BUILD=1 BUILD_UPX=false bin/${TARGETPLATFORM}/submariner-gateway 13 | RUN make -C ${SOURCE} LOCAL_BUILD=1 BUILD_UPX=false bin/${TARGETPLATFORM}/await-node-ready 14 | 15 | FROM --platform=${BUILDPLATFORM} fedora:${FEDORA_VERSION} AS base 16 | ARG FEDORA_VERSION 17 | ARG SOURCE 18 | ARG TARGETPLATFORM 19 | 20 | COPY package/dnf_install / 21 | 22 | # iproute and iptables are used internally 23 | # libreswan provides IKE 24 | # kmod is required so that libreswan can load modules 25 | RUN /dnf_install -a ${TARGETPLATFORM} -v ${FEDORA_VERSION} -r /output/gateway \ 26 | glibc bash glibc-minimal-langpack coreutils-single \ 27 | libcurl-minimal iproute libreswan kmod 28 | 29 | FROM scratch 30 | ARG SOURCE 31 | ARG TARGETPLATFORM 32 | 33 | WORKDIR /var/submariner 34 | 35 | COPY --from=base /output/gateway / 36 | COPY --from=builder ${SOURCE}/package/submariner.sh ${SOURCE}/package/pluto ${SOURCE}/bin/${TARGETPLATFORM}/submariner-gateway \ 37 | ${SOURCE}/package/await-node-ready.sh ${SOURCE}/bin/${TARGETPLATFORM}/await-node-ready /usr/local/bin/ 38 | 39 | ENTRYPOINT ["submariner.sh"] 40 | -------------------------------------------------------------------------------- /package/Dockerfile.submariner-globalnet: -------------------------------------------------------------------------------- 1 | ARG BASE_BRANCH=devel 2 | ARG FEDORA_VERSION=41 3 | ARG SOURCE=/go/src/github.com/submariner-io/submariner 4 | 5 | FROM --platform=${BUILDPLATFORM} quay.io/submariner/shipyard-dapper-base:${BASE_BRANCH} AS builder 6 | ARG FEDORA_VERSION 7 | ARG SOURCE 8 | ARG TARGETPLATFORM 9 | 10 | COPY . ${SOURCE} 11 | 12 | RUN make -C ${SOURCE} LOCAL_BUILD=1 BUILD_UPX=false bin/${TARGETPLATFORM}/submariner-globalnet 13 | 14 | FROM --platform=${BUILDPLATFORM} fedora:${FEDORA_VERSION} AS base 15 | ARG FEDORA_VERSION 16 | ARG SOURCE 17 | ARG TARGETPLATFORM 18 | 19 | COPY package/dnf_install / 20 | 21 | RUN /dnf_install -a ${TARGETPLATFORM} -v ${FEDORA_VERSION} -r /output/globalnet \ 22 | glibc bash glibc-minimal-langpack coreutils-single \ 23 | iproute iptables-legacy iptables-nft nftables ipset grep 24 | 25 | FROM scratch 26 | ARG SOURCE 27 | ARG TARGETPLATFORM 28 | 29 | WORKDIR /var/submariner 30 | 31 | COPY --from=base /output/globalnet / 32 | 33 | COPY --from=builder ${SOURCE}/package/submariner-globalnet.sh ${SOURCE}/bin/${TARGETPLATFORM}/submariner-globalnet /usr/local/bin/ 34 | 35 | # Wrapper scripts to choose the appropriate iptables 36 | # https://github.com/kubernetes-sigs/iptables-wrappers 37 | COPY --from=builder ${SOURCE}/package/iptables-wrapper-installer.sh /usr/sbin/ 38 | # The sanity checks can fail when building foreign arch images; we know we meet the requirements 39 | RUN /usr/sbin/iptables-wrapper-installer.sh --no-sanity-check 40 | 41 | ENTRYPOINT ["submariner-globalnet.sh"] 42 | -------------------------------------------------------------------------------- /package/Dockerfile.submariner-route-agent: -------------------------------------------------------------------------------- 1 | ARG BASE_BRANCH=devel 2 | ARG FEDORA_VERSION=41 3 | ARG SOURCE=/go/src/github.com/submariner-io/submariner 4 | 5 | FROM --platform=${BUILDPLATFORM} quay.io/submariner/shipyard-dapper-base:${BASE_BRANCH} AS builder 6 | ARG FEDORA_VERSION 7 | ARG SOURCE 8 | ARG TARGETPLATFORM 9 | 10 | COPY . ${SOURCE} 11 | 12 | RUN make -C ${SOURCE} LOCAL_BUILD=1 BUILD_UPX=false bin/${TARGETPLATFORM}/submariner-route-agent 13 | RUN make -C ${SOURCE} LOCAL_BUILD=1 BUILD_UPX=false bin/${TARGETPLATFORM}/await-node-ready 14 | 15 | FROM --platform=${BUILDPLATFORM} fedora:${FEDORA_VERSION} AS base 16 | ARG FEDORA_VERSION 17 | ARG SOURCE 18 | ARG TARGETPLATFORM 19 | 20 | COPY package/dnf_install / 21 | 22 | RUN /dnf_install -a ${TARGETPLATFORM} -v ${FEDORA_VERSION} -r /output/route-agent \ 23 | glibc bash glibc-minimal-langpack coreutils-single \ 24 | iproute iptables-legacy iptables-nft nftables ipset openvswitch procps-ng grep 25 | 26 | FROM scratch 27 | ARG SOURCE 28 | ARG TARGETPLATFORM 29 | 30 | WORKDIR /var/submariner 31 | 32 | COPY --from=base /output/route-agent / 33 | COPY --from=builder ${SOURCE}/package/submariner-route-agent.sh ${SOURCE}/bin/${TARGETPLATFORM}/submariner-route-agent \ 34 | ${SOURCE}/package/await-node-ready.sh ${SOURCE}/bin/${TARGETPLATFORM}/await-node-ready /usr/local/bin/ 35 | 36 | # Wrapper scripts to choose the appropriate iptables 37 | # https://github.com/kubernetes-sigs/iptables-wrappers 38 | COPY --from=builder ${SOURCE}/package/iptables-wrapper-installer.sh /usr/sbin/ 39 | # The sanity checks can fail when building foreign arch images; we know we meet the requirements 40 | RUN /usr/sbin/iptables-wrapper-installer.sh --no-sanity-check 41 | 42 | ENTRYPOINT ["submariner-route-agent.sh"] 43 | -------------------------------------------------------------------------------- /package/await-node-ready.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e -x 3 | 4 | trap "exit 1" SIGTERM SIGINT 5 | 6 | SUBMARINER_VERBOSITY=${SUBMARINER_VERBOSITY:-2} 7 | 8 | if [ "${SUBMARINER_DEBUG}" == "true" ]; then 9 | DEBUG="-v=3" 10 | else 11 | DEBUG="-v=${SUBMARINER_VERBOSITY}" 12 | fi 13 | 14 | exec await-node-ready ${DEBUG} -alsologtostderr 15 | -------------------------------------------------------------------------------- /package/dnf_install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Installs packages using dnf to a named root: 4 | # -a arch - use arch instead of the native arch 5 | # -k - keep the package cache 6 | # -r root - install to the named root instead of /output/base 7 | # -v ver - use the given Fedora version (required) 8 | # 9 | # %arch in the package references will be replaced with the chosen arch 10 | 11 | set -e 12 | 13 | INSTALL_ROOT=/output/base 14 | 15 | # Limit the number of files so that dnf doesn't spend ages processing fds 16 | if [[ $(ulimit -n) -gt 1048576 ]]; then 17 | ulimit -n 1048576 18 | fi 19 | 20 | while getopts a:kr:v: o 21 | do 22 | case "$o" in 23 | a) 24 | ARCH="$OPTARG" 25 | ;; 26 | k) 27 | KEEP_CACHE=true 28 | ;; 29 | r) 30 | INSTALL_ROOT="$OPTARG" 31 | ;; 32 | v) 33 | FEDORA_VERSION="$OPTARG" 34 | ;; 35 | *) 36 | echo "$0 doesn't support $o" >&2 37 | exit 1 38 | ;; 39 | esac 40 | done 41 | shift $((OPTIND - 1)) 42 | 43 | if [[ -n "${ARCH}" ]]; then 44 | # Convert container arch to Fedora arch 45 | ARCH="${ARCH##*/}" 46 | case "${ARCH}" in 47 | amd64) ARCH=x86_64;; 48 | arm64) ARCH=aarch64;; 49 | esac 50 | arch_args="--forcearch ${ARCH}" 51 | else 52 | # This will be used later, but we won't force 53 | ARCH="$(rpm -q --qf "%{arch}" rpm)" 54 | fi 55 | 56 | [[ -z "${FEDORA_VERSION}" ]] && echo I need to know which version of Fedora to install, specify it with -v >&2 && exit 1 57 | 58 | if [[ "${INSTALL_ROOT}" != /output/base ]] && [[ ! -d "${INSTALL_ROOT}" ]] && [[ -d /output/base ]]; then 59 | cp -a /output/base "${INSTALL_ROOT}" 60 | fi 61 | 62 | dnf -y --setopt=install_weak_deps=0 --nodocs --use-host-config ${arch_args} \ 63 | --installroot "${INSTALL_ROOT}" --releasever "${FEDORA_VERSION}" \ 64 | install "${@//\%arch/${ARCH}}" 65 | 66 | [[ "${KEEP_CACHE}" == true ]] || dnf -y ${arch_args} --installroot "${INSTALL_ROOT}" --releasever "${FEDORA_VERSION}" clean all 67 | -------------------------------------------------------------------------------- /package/pluto: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Checks pre-requisites and starts the Pluto daemon, without forking 4 | 5 | set -e 6 | 7 | # These are the ExecStartPre lines from the systemd service definition 8 | /usr/libexec/ipsec/addconn --config /etc/ipsec.conf --checkconfig 9 | /usr/libexec/ipsec/_stackmanager start 10 | /usr/sbin/ipsec --checknss 11 | 12 | # Start the daemon itself with any additional arguments passed in 13 | exec /usr/libexec/ipsec/pluto --leak-detective --config /etc/ipsec.conf --nofork "$@" 14 | -------------------------------------------------------------------------------- /package/submariner-globalnet.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e -x 3 | 4 | trap "exit 1" SIGTERM SIGINT 5 | 6 | SUBMARINER_VERBOSITY=${SUBMARINER_VERBOSITY:-2} 7 | 8 | if [ "${SUBMARINER_DEBUG}" == "true" ]; then 9 | DEBUG="-v=3" 10 | else 11 | DEBUG="-v=${SUBMARINER_VERBOSITY}" 12 | fi 13 | 14 | exec submariner-globalnet ${DEBUG} -alsologtostderr 15 | -------------------------------------------------------------------------------- /package/submariner-route-agent.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e -x 3 | 4 | trap "exit 1" SIGTERM SIGINT 5 | 6 | SUBMARINER_VERBOSITY=${SUBMARINER_VERBOSITY:-2} 7 | 8 | if [ "${SUBMARINER_DEBUG}" == "true" ]; then 9 | DEBUG="-v=3" 10 | else 11 | DEBUG="-v=${SUBMARINER_VERBOSITY}" 12 | fi 13 | 14 | exec submariner-route-agent ${DEBUG} -alsologtostderr 15 | -------------------------------------------------------------------------------- /package/submariner.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e -x 3 | 4 | trap "exit 1" SIGTERM SIGINT 5 | 6 | export CHARON_PID_FILE=/var/run/charon.pid 7 | rm -f ${CHARON_PID_FILE} 8 | 9 | SUBMARINER_VERBOSITY=${SUBMARINER_VERBOSITY:-2} 10 | 11 | if [ "${SUBMARINER_DEBUG}" == "true" ]; then 12 | DEBUG="-v=3" 13 | else 14 | DEBUG="-v=${SUBMARINER_VERBOSITY}" 15 | fi 16 | 17 | [[ "$(cat /proc/sys/net/ipv4/conf/all/send_redirects)" = 0 ]] || echo 0 > /proc/sys/net/ipv4/conf/all/send_redirects 18 | 19 | exec submariner-gateway ${DEBUG} -alsologtostderr 20 | -------------------------------------------------------------------------------- /pkg/apis/submariner.io/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | // +k8s:deepcopy-gen=package,register 19 | 20 | // +groupName=submariner.io 21 | 22 | package v1 23 | -------------------------------------------------------------------------------- /pkg/apis/submariner.io/v1/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package v1 20 | 21 | import ( 22 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 23 | "k8s.io/apimachinery/pkg/runtime" 24 | "k8s.io/apimachinery/pkg/runtime/schema" 25 | ) 26 | 27 | // SchemeGroupVersion is group version used to register these objects. 28 | var SchemeGroupVersion = schema.GroupVersion{Group: "submariner.io", Version: "v1"} 29 | 30 | // Kind takes an unqualified kind and returns back a Group qualified GroupKind. 31 | func Kind(kind string) schema.GroupKind { 32 | return SchemeGroupVersion.WithKind(kind).GroupKind() 33 | } 34 | 35 | // Resource takes an unqualified resource and returns a Group qualified GroupResource. 36 | func Resource(resource string) schema.GroupResource { 37 | return SchemeGroupVersion.WithResource(resource).GroupResource() 38 | } 39 | 40 | var ( 41 | SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) 42 | AddToScheme = SchemeBuilder.AddToScheme 43 | ) 44 | 45 | // Adds the list of known types to Scheme. 46 | func addKnownTypes(scheme *runtime.Scheme) error { 47 | scheme.AddKnownTypes(SchemeGroupVersion, 48 | &Cluster{}, 49 | &ClusterList{}, 50 | &Endpoint{}, 51 | &EndpointList{}, 52 | &Gateway{}, 53 | &GatewayList{}, 54 | &GlobalEgressIP{}, 55 | &GlobalEgressIPList{}, 56 | &ClusterGlobalEgressIP{}, 57 | &ClusterGlobalEgressIPList{}, 58 | &GlobalIngressIP{}, 59 | &GlobalIngressIPList{}, 60 | &GatewayRoute{}, 61 | &GatewayRouteList{}, 62 | &NonGatewayRoute{}, 63 | &NonGatewayRouteList{}, 64 | &RouteAgent{}, 65 | &RouteAgentList{}, 66 | ) 67 | metav1.AddToGroupVersion(scheme, SchemeGroupVersion) 68 | 69 | return nil 70 | } 71 | -------------------------------------------------------------------------------- /pkg/apis/submariner.io/v1/string.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package v1 20 | 21 | import ( 22 | "encoding/json" 23 | "fmt" 24 | ) 25 | 26 | // String method returns a string representation, for human readability. 27 | func (ep *Endpoint) String() string { 28 | bytes, err := json.Marshal(ep) 29 | if err != nil { 30 | return fmt.Sprintf("%#v", ep) 31 | } 32 | 33 | return string(bytes) 34 | } 35 | -------------------------------------------------------------------------------- /pkg/apis/submariner.io/v1/string_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package v1_test 20 | 21 | import ( 22 | "testing" 23 | 24 | . "github.com/onsi/ginkgo/v2" 25 | . "github.com/onsi/gomega" 26 | v1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 27 | ) 28 | 29 | var _ = Describe("Endpoint String", func() { 30 | It("should return a human readable string", func() { 31 | str := (&v1.Endpoint{ 32 | Spec: v1.EndpointSpec{ 33 | ClusterID: "east", 34 | Subnets: []string{"10.0.0.0/24"}, 35 | CableName: "cable-1", 36 | PublicIPs: []string{"1.1.1.1"}, 37 | PrivateIPs: []string{"2.2.2.2"}, 38 | }, 39 | }).String() 40 | 41 | Expect(str).To(ContainSubstring("east")) 42 | Expect(str).To(ContainSubstring("10.0.0.0/24")) 43 | Expect(str).To(ContainSubstring("cable-1")) 44 | Expect(str).To(ContainSubstring("1.1.1.1")) 45 | Expect(str).To(ContainSubstring("2.2.2.2")) 46 | }) 47 | }) 48 | 49 | func TestApiMethods(t *testing.T) { 50 | RegisterFailHandler(Fail) 51 | RunSpecs(t, "V1 Api Method suite") 52 | } 53 | -------------------------------------------------------------------------------- /pkg/await_node_ready/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package main 20 | 21 | import ( 22 | "flag" 23 | 24 | "github.com/submariner-io/admiral/pkg/log" 25 | "github.com/submariner-io/admiral/pkg/log/kzerolog" 26 | admversion "github.com/submariner-io/admiral/pkg/version" 27 | "github.com/submariner-io/submariner/pkg/node" 28 | "github.com/submariner-io/submariner/pkg/versions" 29 | "k8s.io/client-go/kubernetes" 30 | "k8s.io/client-go/tools/clientcmd" 31 | logf "sigs.k8s.io/controller-runtime/pkg/log" 32 | "sigs.k8s.io/controller-runtime/pkg/manager/signals" 33 | ) 34 | 35 | var ( 36 | masterURL string 37 | kubeconfig string 38 | logger = log.Logger{Logger: logf.Log.WithName("main")} 39 | showVersion = false 40 | ) 41 | 42 | func main() { 43 | kzerolog.AddFlags(nil) 44 | flag.Parse() 45 | 46 | admversion.Print("await-node-ready", versions.Submariner()) 47 | 48 | if showVersion { 49 | return 50 | } 51 | 52 | kzerolog.InitK8sLogging() 53 | 54 | versions.Log(&logger) 55 | 56 | logger.Info("Initializing K8s client...") 57 | 58 | ctx := signals.SetupSignalHandler() 59 | 60 | cfg, err := clientcmd.BuildConfigFromFlags(masterURL, kubeconfig) 61 | logger.FatalOnError(err, "Error building kubeconfig") 62 | 63 | k8sClientSet, err := kubernetes.NewForConfig(cfg) 64 | logger.FatalOnError(err, "Error building clientset") 65 | 66 | logger.Info("Awaiting local node ready...") 67 | 68 | node.WaitForLocalNodeReady(ctx, k8sClientSet) 69 | } 70 | -------------------------------------------------------------------------------- /pkg/cable/libreswan/libreswan_suite_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package libreswan_test 20 | 21 | import ( 22 | "flag" 23 | "testing" 24 | 25 | . "github.com/onsi/ginkgo/v2" 26 | . "github.com/onsi/gomega" 27 | "github.com/submariner-io/admiral/pkg/log/kzerolog" 28 | ) 29 | 30 | func init() { 31 | kzerolog.AddFlags(nil) 32 | } 33 | 34 | var _ = BeforeSuite(func() { 35 | flags := flag.NewFlagSet("kzerolog", flag.ExitOnError) 36 | kzerolog.AddFlags(flags) 37 | _ = flags.Parse([]string{"-v=4"}) 38 | 39 | kzerolog.InitK8sLogging() 40 | }) 41 | 42 | func TestLibreswan(t *testing.T) { 43 | RegisterFailHandler(Fail) 44 | RunSpecs(t, "Libreswan Suite") 45 | } 46 | -------------------------------------------------------------------------------- /pkg/cable/wireguard/client.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package wireguard 20 | 21 | import ( 22 | "golang.zx2c4.com/wireguard/wgctrl" 23 | "golang.zx2c4.com/wireguard/wgctrl/wgtypes" 24 | ) 25 | 26 | type Client interface { 27 | ConfigureDevice(name string, cfg wgtypes.Config) error 28 | Device(name string) (*wgtypes.Device, error) 29 | Close() error 30 | } 31 | 32 | var NewClient = func() (Client, error) { 33 | return wgctrl.New() 34 | } 35 | -------------------------------------------------------------------------------- /pkg/cableengine/healthchecker/healthchecker_suite_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package healthchecker_test 20 | 21 | import ( 22 | "testing" 23 | 24 | . "github.com/onsi/ginkgo/v2" 25 | . "github.com/onsi/gomega" 26 | "github.com/submariner-io/admiral/pkg/log/kzerolog" 27 | submarinerv1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 28 | kubeScheme "k8s.io/client-go/kubernetes/scheme" 29 | ) 30 | 31 | func init() { 32 | kzerolog.AddFlags(nil) 33 | } 34 | 35 | var _ = BeforeSuite(func() { 36 | kzerolog.InitK8sLogging() 37 | Expect(submarinerv1.AddToScheme(kubeScheme.Scheme)).To(Succeed()) 38 | }) 39 | 40 | func TestHealthChecker(t *testing.T) { 41 | RegisterFailHandler(Fail) 42 | RunSpecs(t, "Health Checker Suite") 43 | } 44 | -------------------------------------------------------------------------------- /pkg/client/applyconfiguration/internal/internal.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 20 | 21 | package internal 22 | 23 | import ( 24 | fmt "fmt" 25 | sync "sync" 26 | 27 | typed "sigs.k8s.io/structured-merge-diff/v4/typed" 28 | ) 29 | 30 | func Parser() *typed.Parser { 31 | parserOnce.Do(func() { 32 | var err error 33 | parser, err = typed.NewParser(schemaYAML) 34 | if err != nil { 35 | panic(fmt.Sprintf("Failed to parse schema: %v", err)) 36 | } 37 | }) 38 | return parser 39 | } 40 | 41 | var parserOnce sync.Once 42 | var parser *typed.Parser 43 | var schemaYAML = typed.YAMLObject(`types: 44 | - name: __untyped_atomic_ 45 | scalar: untyped 46 | list: 47 | elementType: 48 | namedType: __untyped_atomic_ 49 | elementRelationship: atomic 50 | map: 51 | elementType: 52 | namedType: __untyped_atomic_ 53 | elementRelationship: atomic 54 | - name: __untyped_deduced_ 55 | scalar: untyped 56 | list: 57 | elementType: 58 | namedType: __untyped_atomic_ 59 | elementRelationship: atomic 60 | map: 61 | elementType: 62 | namedType: __untyped_deduced_ 63 | elementRelationship: separable 64 | `) 65 | -------------------------------------------------------------------------------- /pkg/client/applyconfiguration/submariner.io/v1/clusterglobalegressipspec.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | // ClusterGlobalEgressIPSpecApplyConfiguration represents a declarative configuration of the ClusterGlobalEgressIPSpec type for use 24 | // with apply. 25 | type ClusterGlobalEgressIPSpecApplyConfiguration struct { 26 | NumberOfIPs *int `json:"numGlobalIPs,omitempty"` 27 | } 28 | 29 | // ClusterGlobalEgressIPSpecApplyConfiguration constructs a declarative configuration of the ClusterGlobalEgressIPSpec type for use with 30 | // apply. 31 | func ClusterGlobalEgressIPSpec() *ClusterGlobalEgressIPSpecApplyConfiguration { 32 | return &ClusterGlobalEgressIPSpecApplyConfiguration{} 33 | } 34 | 35 | // WithNumberOfIPs sets the NumberOfIPs field in the declarative configuration to the given value 36 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 37 | // If called multiple times, the NumberOfIPs field is set to the value of the last call. 38 | func (b *ClusterGlobalEgressIPSpecApplyConfiguration) WithNumberOfIPs(value int) *ClusterGlobalEgressIPSpecApplyConfiguration { 39 | b.NumberOfIPs = &value 40 | return b 41 | } 42 | -------------------------------------------------------------------------------- /pkg/client/applyconfiguration/submariner.io/v1/globalegressipspec.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | import ( 24 | metav1 "k8s.io/client-go/applyconfigurations/meta/v1" 25 | ) 26 | 27 | // GlobalEgressIPSpecApplyConfiguration represents a declarative configuration of the GlobalEgressIPSpec type for use 28 | // with apply. 29 | type GlobalEgressIPSpecApplyConfiguration struct { 30 | NumberOfIPs *int `json:"numberOfIPs,omitempty"` 31 | PodSelector *metav1.LabelSelectorApplyConfiguration `json:"podSelector,omitempty"` 32 | } 33 | 34 | // GlobalEgressIPSpecApplyConfiguration constructs a declarative configuration of the GlobalEgressIPSpec type for use with 35 | // apply. 36 | func GlobalEgressIPSpec() *GlobalEgressIPSpecApplyConfiguration { 37 | return &GlobalEgressIPSpecApplyConfiguration{} 38 | } 39 | 40 | // WithNumberOfIPs sets the NumberOfIPs field in the declarative configuration to the given value 41 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 42 | // If called multiple times, the NumberOfIPs field is set to the value of the last call. 43 | func (b *GlobalEgressIPSpecApplyConfiguration) WithNumberOfIPs(value int) *GlobalEgressIPSpecApplyConfiguration { 44 | b.NumberOfIPs = &value 45 | return b 46 | } 47 | 48 | // WithPodSelector sets the PodSelector field in the declarative configuration to the given value 49 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 50 | // If called multiple times, the PodSelector field is set to the value of the last call. 51 | func (b *GlobalEgressIPSpecApplyConfiguration) WithPodSelector(value *metav1.LabelSelectorApplyConfiguration) *GlobalEgressIPSpecApplyConfiguration { 52 | b.PodSelector = value 53 | return b 54 | } 55 | -------------------------------------------------------------------------------- /pkg/client/applyconfiguration/submariner.io/v1/globalegressipstatus.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | import ( 24 | metav1 "k8s.io/client-go/applyconfigurations/meta/v1" 25 | ) 26 | 27 | // GlobalEgressIPStatusApplyConfiguration represents a declarative configuration of the GlobalEgressIPStatus type for use 28 | // with apply. 29 | type GlobalEgressIPStatusApplyConfiguration struct { 30 | Conditions []metav1.ConditionApplyConfiguration `json:"conditions,omitempty"` 31 | AllocatedIPs []string `json:"allocatedIPs,omitempty"` 32 | } 33 | 34 | // GlobalEgressIPStatusApplyConfiguration constructs a declarative configuration of the GlobalEgressIPStatus type for use with 35 | // apply. 36 | func GlobalEgressIPStatus() *GlobalEgressIPStatusApplyConfiguration { 37 | return &GlobalEgressIPStatusApplyConfiguration{} 38 | } 39 | 40 | // WithConditions adds the given value to the Conditions field in the declarative configuration 41 | // and returns the receiver, so that objects can be build by chaining "With" function invocations. 42 | // If called multiple times, values provided by each call will be appended to the Conditions field. 43 | func (b *GlobalEgressIPStatusApplyConfiguration) WithConditions(values ...*metav1.ConditionApplyConfiguration) *GlobalEgressIPStatusApplyConfiguration { 44 | for i := range values { 45 | if values[i] == nil { 46 | panic("nil value passed to WithConditions") 47 | } 48 | b.Conditions = append(b.Conditions, *values[i]) 49 | } 50 | return b 51 | } 52 | 53 | // WithAllocatedIPs adds the given value to the AllocatedIPs field in the declarative configuration 54 | // and returns the receiver, so that objects can be build by chaining "With" function invocations. 55 | // If called multiple times, values provided by each call will be appended to the AllocatedIPs field. 56 | func (b *GlobalEgressIPStatusApplyConfiguration) WithAllocatedIPs(values ...string) *GlobalEgressIPStatusApplyConfiguration { 57 | for i := range values { 58 | b.AllocatedIPs = append(b.AllocatedIPs, values[i]) 59 | } 60 | return b 61 | } 62 | -------------------------------------------------------------------------------- /pkg/client/applyconfiguration/submariner.io/v1/globalingressipspec.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | import ( 24 | submarineriov1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 25 | corev1 "k8s.io/api/core/v1" 26 | ) 27 | 28 | // GlobalIngressIPSpecApplyConfiguration represents a declarative configuration of the GlobalIngressIPSpec type for use 29 | // with apply. 30 | type GlobalIngressIPSpecApplyConfiguration struct { 31 | Target *submarineriov1.TargetType `json:"target,omitempty"` 32 | ServiceRef *corev1.LocalObjectReference `json:"serviceRef,omitempty"` 33 | PodRef *corev1.LocalObjectReference `json:"podRef,omitempty"` 34 | } 35 | 36 | // GlobalIngressIPSpecApplyConfiguration constructs a declarative configuration of the GlobalIngressIPSpec type for use with 37 | // apply. 38 | func GlobalIngressIPSpec() *GlobalIngressIPSpecApplyConfiguration { 39 | return &GlobalIngressIPSpecApplyConfiguration{} 40 | } 41 | 42 | // WithTarget sets the Target field in the declarative configuration to the given value 43 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 44 | // If called multiple times, the Target field is set to the value of the last call. 45 | func (b *GlobalIngressIPSpecApplyConfiguration) WithTarget(value submarineriov1.TargetType) *GlobalIngressIPSpecApplyConfiguration { 46 | b.Target = &value 47 | return b 48 | } 49 | 50 | // WithServiceRef sets the ServiceRef field in the declarative configuration to the given value 51 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 52 | // If called multiple times, the ServiceRef field is set to the value of the last call. 53 | func (b *GlobalIngressIPSpecApplyConfiguration) WithServiceRef(value corev1.LocalObjectReference) *GlobalIngressIPSpecApplyConfiguration { 54 | b.ServiceRef = &value 55 | return b 56 | } 57 | 58 | // WithPodRef sets the PodRef field in the declarative configuration to the given value 59 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 60 | // If called multiple times, the PodRef field is set to the value of the last call. 61 | func (b *GlobalIngressIPSpecApplyConfiguration) WithPodRef(value corev1.LocalObjectReference) *GlobalIngressIPSpecApplyConfiguration { 62 | b.PodRef = &value 63 | return b 64 | } 65 | -------------------------------------------------------------------------------- /pkg/client/applyconfiguration/submariner.io/v1/globalingressipstatus.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | import ( 24 | metav1 "k8s.io/client-go/applyconfigurations/meta/v1" 25 | ) 26 | 27 | // GlobalIngressIPStatusApplyConfiguration represents a declarative configuration of the GlobalIngressIPStatus type for use 28 | // with apply. 29 | type GlobalIngressIPStatusApplyConfiguration struct { 30 | Conditions []metav1.ConditionApplyConfiguration `json:"conditions,omitempty"` 31 | AllocatedIP *string `json:"allocatedIP,omitempty"` 32 | } 33 | 34 | // GlobalIngressIPStatusApplyConfiguration constructs a declarative configuration of the GlobalIngressIPStatus type for use with 35 | // apply. 36 | func GlobalIngressIPStatus() *GlobalIngressIPStatusApplyConfiguration { 37 | return &GlobalIngressIPStatusApplyConfiguration{} 38 | } 39 | 40 | // WithConditions adds the given value to the Conditions field in the declarative configuration 41 | // and returns the receiver, so that objects can be build by chaining "With" function invocations. 42 | // If called multiple times, values provided by each call will be appended to the Conditions field. 43 | func (b *GlobalIngressIPStatusApplyConfiguration) WithConditions(values ...*metav1.ConditionApplyConfiguration) *GlobalIngressIPStatusApplyConfiguration { 44 | for i := range values { 45 | if values[i] == nil { 46 | panic("nil value passed to WithConditions") 47 | } 48 | b.Conditions = append(b.Conditions, *values[i]) 49 | } 50 | return b 51 | } 52 | 53 | // WithAllocatedIP sets the AllocatedIP field in the declarative configuration to the given value 54 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. 55 | // If called multiple times, the AllocatedIP field is set to the value of the last call. 56 | func (b *GlobalIngressIPStatusApplyConfiguration) WithAllocatedIP(value string) *GlobalIngressIPStatusApplyConfiguration { 57 | b.AllocatedIP = &value 58 | return b 59 | } 60 | -------------------------------------------------------------------------------- /pkg/client/applyconfiguration/submariner.io/v1/routepolicyspec.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by applyconfiguration-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | // RoutePolicySpecApplyConfiguration represents a declarative configuration of the RoutePolicySpec type for use 24 | // with apply. 25 | type RoutePolicySpecApplyConfiguration struct { 26 | NextHops []string `json:"nextHops,omitempty"` 27 | RemoteCIDRs []string `json:"remoteCIDRs,omitempty"` 28 | } 29 | 30 | // RoutePolicySpecApplyConfiguration constructs a declarative configuration of the RoutePolicySpec type for use with 31 | // apply. 32 | func RoutePolicySpec() *RoutePolicySpecApplyConfiguration { 33 | return &RoutePolicySpecApplyConfiguration{} 34 | } 35 | 36 | // WithNextHops adds the given value to the NextHops field in the declarative configuration 37 | // and returns the receiver, so that objects can be build by chaining "With" function invocations. 38 | // If called multiple times, values provided by each call will be appended to the NextHops field. 39 | func (b *RoutePolicySpecApplyConfiguration) WithNextHops(values ...string) *RoutePolicySpecApplyConfiguration { 40 | for i := range values { 41 | b.NextHops = append(b.NextHops, values[i]) 42 | } 43 | return b 44 | } 45 | 46 | // WithRemoteCIDRs adds the given value to the RemoteCIDRs field in the declarative configuration 47 | // and returns the receiver, so that objects can be build by chaining "With" function invocations. 48 | // If called multiple times, values provided by each call will be appended to the RemoteCIDRs field. 49 | func (b *RoutePolicySpecApplyConfiguration) WithRemoteCIDRs(values ...string) *RoutePolicySpecApplyConfiguration { 50 | for i := range values { 51 | b.RemoteCIDRs = append(b.RemoteCIDRs, values[i]) 52 | } 53 | return b 54 | } 55 | -------------------------------------------------------------------------------- /pkg/client/clientset/versioned/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package has the automatically generated fake clientset. 22 | package fake 23 | -------------------------------------------------------------------------------- /pkg/client/clientset/versioned/fake/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | submarinerv1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 25 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 26 | runtime "k8s.io/apimachinery/pkg/runtime" 27 | schema "k8s.io/apimachinery/pkg/runtime/schema" 28 | serializer "k8s.io/apimachinery/pkg/runtime/serializer" 29 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 30 | ) 31 | 32 | var scheme = runtime.NewScheme() 33 | var codecs = serializer.NewCodecFactory(scheme) 34 | 35 | var localSchemeBuilder = runtime.SchemeBuilder{ 36 | submarinerv1.AddToScheme, 37 | } 38 | 39 | // AddToScheme adds all types of this clientset into the given scheme. This allows composition 40 | // of clientsets, like in: 41 | // 42 | // import ( 43 | // "k8s.io/client-go/kubernetes" 44 | // clientsetscheme "k8s.io/client-go/kubernetes/scheme" 45 | // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" 46 | // ) 47 | // 48 | // kclientset, _ := kubernetes.NewForConfig(c) 49 | // _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) 50 | // 51 | // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types 52 | // correctly. 53 | var AddToScheme = localSchemeBuilder.AddToScheme 54 | 55 | func init() { 56 | v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) 57 | utilruntime.Must(AddToScheme(scheme)) 58 | } 59 | -------------------------------------------------------------------------------- /pkg/client/clientset/versioned/scheme/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package contains the scheme of the automatically generated clientset. 22 | package scheme 23 | -------------------------------------------------------------------------------- /pkg/client/clientset/versioned/scheme/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package scheme 22 | 23 | import ( 24 | submarinerv1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 25 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 26 | runtime "k8s.io/apimachinery/pkg/runtime" 27 | schema "k8s.io/apimachinery/pkg/runtime/schema" 28 | serializer "k8s.io/apimachinery/pkg/runtime/serializer" 29 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 30 | ) 31 | 32 | var Scheme = runtime.NewScheme() 33 | var Codecs = serializer.NewCodecFactory(Scheme) 34 | var ParameterCodec = runtime.NewParameterCodec(Scheme) 35 | var localSchemeBuilder = runtime.SchemeBuilder{ 36 | submarinerv1.AddToScheme, 37 | } 38 | 39 | // AddToScheme adds all types of this clientset into the given scheme. This allows composition 40 | // of clientsets, like in: 41 | // 42 | // import ( 43 | // "k8s.io/client-go/kubernetes" 44 | // clientsetscheme "k8s.io/client-go/kubernetes/scheme" 45 | // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" 46 | // ) 47 | // 48 | // kclientset, _ := kubernetes.NewForConfig(c) 49 | // _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) 50 | // 51 | // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types 52 | // correctly. 53 | var AddToScheme = localSchemeBuilder.AddToScheme 54 | 55 | func init() { 56 | v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) 57 | utilruntime.Must(AddToScheme(Scheme)) 58 | } 59 | -------------------------------------------------------------------------------- /pkg/client/clientset/versioned/typed/submariner.io/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // This package has the automatically generated typed clients. 22 | package v1 23 | -------------------------------------------------------------------------------- /pkg/client/clientset/versioned/typed/submariner.io/v1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | // Package fake has the automatically generated clients. 22 | package fake 23 | -------------------------------------------------------------------------------- /pkg/client/clientset/versioned/typed/submariner.io/v1/fake/fake_cluster.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | v1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 25 | submarineriov1 "github.com/submariner-io/submariner/pkg/client/applyconfiguration/submariner.io/v1" 26 | typedsubmarineriov1 "github.com/submariner-io/submariner/pkg/client/clientset/versioned/typed/submariner.io/v1" 27 | gentype "k8s.io/client-go/gentype" 28 | ) 29 | 30 | // fakeClusters implements ClusterInterface 31 | type fakeClusters struct { 32 | *gentype.FakeClientWithListAndApply[*v1.Cluster, *v1.ClusterList, *submarineriov1.ClusterApplyConfiguration] 33 | Fake *FakeSubmarinerV1 34 | } 35 | 36 | func newFakeClusters(fake *FakeSubmarinerV1, namespace string) typedsubmarineriov1.ClusterInterface { 37 | return &fakeClusters{ 38 | gentype.NewFakeClientWithListAndApply[*v1.Cluster, *v1.ClusterList, *submarineriov1.ClusterApplyConfiguration]( 39 | fake.Fake, 40 | namespace, 41 | v1.SchemeGroupVersion.WithResource("clusters"), 42 | v1.SchemeGroupVersion.WithKind("Cluster"), 43 | func() *v1.Cluster { return &v1.Cluster{} }, 44 | func() *v1.ClusterList { return &v1.ClusterList{} }, 45 | func(dst, src *v1.ClusterList) { dst.ListMeta = src.ListMeta }, 46 | func(list *v1.ClusterList) []*v1.Cluster { return gentype.ToPointerSlice(list.Items) }, 47 | func(list *v1.ClusterList, items []*v1.Cluster) { list.Items = gentype.FromPointerSlice(items) }, 48 | ), 49 | fake, 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /pkg/client/clientset/versioned/typed/submariner.io/v1/fake/fake_clusterglobalegressip.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | v1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 25 | submarineriov1 "github.com/submariner-io/submariner/pkg/client/applyconfiguration/submariner.io/v1" 26 | typedsubmarineriov1 "github.com/submariner-io/submariner/pkg/client/clientset/versioned/typed/submariner.io/v1" 27 | gentype "k8s.io/client-go/gentype" 28 | ) 29 | 30 | // fakeClusterGlobalEgressIPs implements ClusterGlobalEgressIPInterface 31 | type fakeClusterGlobalEgressIPs struct { 32 | *gentype.FakeClientWithListAndApply[*v1.ClusterGlobalEgressIP, *v1.ClusterGlobalEgressIPList, *submarineriov1.ClusterGlobalEgressIPApplyConfiguration] 33 | Fake *FakeSubmarinerV1 34 | } 35 | 36 | func newFakeClusterGlobalEgressIPs(fake *FakeSubmarinerV1, namespace string) typedsubmarineriov1.ClusterGlobalEgressIPInterface { 37 | return &fakeClusterGlobalEgressIPs{ 38 | gentype.NewFakeClientWithListAndApply[*v1.ClusterGlobalEgressIP, *v1.ClusterGlobalEgressIPList, *submarineriov1.ClusterGlobalEgressIPApplyConfiguration]( 39 | fake.Fake, 40 | namespace, 41 | v1.SchemeGroupVersion.WithResource("clusterglobalegressips"), 42 | v1.SchemeGroupVersion.WithKind("ClusterGlobalEgressIP"), 43 | func() *v1.ClusterGlobalEgressIP { return &v1.ClusterGlobalEgressIP{} }, 44 | func() *v1.ClusterGlobalEgressIPList { return &v1.ClusterGlobalEgressIPList{} }, 45 | func(dst, src *v1.ClusterGlobalEgressIPList) { dst.ListMeta = src.ListMeta }, 46 | func(list *v1.ClusterGlobalEgressIPList) []*v1.ClusterGlobalEgressIP { 47 | return gentype.ToPointerSlice(list.Items) 48 | }, 49 | func(list *v1.ClusterGlobalEgressIPList, items []*v1.ClusterGlobalEgressIP) { 50 | list.Items = gentype.FromPointerSlice(items) 51 | }, 52 | ), 53 | fake, 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /pkg/client/clientset/versioned/typed/submariner.io/v1/fake/fake_endpoint.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | v1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 25 | submarineriov1 "github.com/submariner-io/submariner/pkg/client/applyconfiguration/submariner.io/v1" 26 | typedsubmarineriov1 "github.com/submariner-io/submariner/pkg/client/clientset/versioned/typed/submariner.io/v1" 27 | gentype "k8s.io/client-go/gentype" 28 | ) 29 | 30 | // fakeEndpoints implements EndpointInterface 31 | type fakeEndpoints struct { 32 | *gentype.FakeClientWithListAndApply[*v1.Endpoint, *v1.EndpointList, *submarineriov1.EndpointApplyConfiguration] 33 | Fake *FakeSubmarinerV1 34 | } 35 | 36 | func newFakeEndpoints(fake *FakeSubmarinerV1, namespace string) typedsubmarineriov1.EndpointInterface { 37 | return &fakeEndpoints{ 38 | gentype.NewFakeClientWithListAndApply[*v1.Endpoint, *v1.EndpointList, *submarineriov1.EndpointApplyConfiguration]( 39 | fake.Fake, 40 | namespace, 41 | v1.SchemeGroupVersion.WithResource("endpoints"), 42 | v1.SchemeGroupVersion.WithKind("Endpoint"), 43 | func() *v1.Endpoint { return &v1.Endpoint{} }, 44 | func() *v1.EndpointList { return &v1.EndpointList{} }, 45 | func(dst, src *v1.EndpointList) { dst.ListMeta = src.ListMeta }, 46 | func(list *v1.EndpointList) []*v1.Endpoint { return gentype.ToPointerSlice(list.Items) }, 47 | func(list *v1.EndpointList, items []*v1.Endpoint) { list.Items = gentype.FromPointerSlice(items) }, 48 | ), 49 | fake, 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /pkg/client/clientset/versioned/typed/submariner.io/v1/fake/fake_gateway.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | v1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 25 | submarineriov1 "github.com/submariner-io/submariner/pkg/client/applyconfiguration/submariner.io/v1" 26 | typedsubmarineriov1 "github.com/submariner-io/submariner/pkg/client/clientset/versioned/typed/submariner.io/v1" 27 | gentype "k8s.io/client-go/gentype" 28 | ) 29 | 30 | // fakeGateways implements GatewayInterface 31 | type fakeGateways struct { 32 | *gentype.FakeClientWithListAndApply[*v1.Gateway, *v1.GatewayList, *submarineriov1.GatewayApplyConfiguration] 33 | Fake *FakeSubmarinerV1 34 | } 35 | 36 | func newFakeGateways(fake *FakeSubmarinerV1, namespace string) typedsubmarineriov1.GatewayInterface { 37 | return &fakeGateways{ 38 | gentype.NewFakeClientWithListAndApply[*v1.Gateway, *v1.GatewayList, *submarineriov1.GatewayApplyConfiguration]( 39 | fake.Fake, 40 | namespace, 41 | v1.SchemeGroupVersion.WithResource("gateways"), 42 | v1.SchemeGroupVersion.WithKind("Gateway"), 43 | func() *v1.Gateway { return &v1.Gateway{} }, 44 | func() *v1.GatewayList { return &v1.GatewayList{} }, 45 | func(dst, src *v1.GatewayList) { dst.ListMeta = src.ListMeta }, 46 | func(list *v1.GatewayList) []*v1.Gateway { return gentype.ToPointerSlice(list.Items) }, 47 | func(list *v1.GatewayList, items []*v1.Gateway) { list.Items = gentype.FromPointerSlice(items) }, 48 | ), 49 | fake, 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /pkg/client/clientset/versioned/typed/submariner.io/v1/fake/fake_gatewayroute.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | v1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 25 | submarineriov1 "github.com/submariner-io/submariner/pkg/client/applyconfiguration/submariner.io/v1" 26 | typedsubmarineriov1 "github.com/submariner-io/submariner/pkg/client/clientset/versioned/typed/submariner.io/v1" 27 | gentype "k8s.io/client-go/gentype" 28 | ) 29 | 30 | // fakeGatewayRoutes implements GatewayRouteInterface 31 | type fakeGatewayRoutes struct { 32 | *gentype.FakeClientWithListAndApply[*v1.GatewayRoute, *v1.GatewayRouteList, *submarineriov1.GatewayRouteApplyConfiguration] 33 | Fake *FakeSubmarinerV1 34 | } 35 | 36 | func newFakeGatewayRoutes(fake *FakeSubmarinerV1, namespace string) typedsubmarineriov1.GatewayRouteInterface { 37 | return &fakeGatewayRoutes{ 38 | gentype.NewFakeClientWithListAndApply[*v1.GatewayRoute, *v1.GatewayRouteList, *submarineriov1.GatewayRouteApplyConfiguration]( 39 | fake.Fake, 40 | namespace, 41 | v1.SchemeGroupVersion.WithResource("gatewayroutes"), 42 | v1.SchemeGroupVersion.WithKind("GatewayRoute"), 43 | func() *v1.GatewayRoute { return &v1.GatewayRoute{} }, 44 | func() *v1.GatewayRouteList { return &v1.GatewayRouteList{} }, 45 | func(dst, src *v1.GatewayRouteList) { dst.ListMeta = src.ListMeta }, 46 | func(list *v1.GatewayRouteList) []*v1.GatewayRoute { return gentype.ToPointerSlice(list.Items) }, 47 | func(list *v1.GatewayRouteList, items []*v1.GatewayRoute) { 48 | list.Items = gentype.FromPointerSlice(items) 49 | }, 50 | ), 51 | fake, 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /pkg/client/clientset/versioned/typed/submariner.io/v1/fake/fake_globalegressip.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | v1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 25 | submarineriov1 "github.com/submariner-io/submariner/pkg/client/applyconfiguration/submariner.io/v1" 26 | typedsubmarineriov1 "github.com/submariner-io/submariner/pkg/client/clientset/versioned/typed/submariner.io/v1" 27 | gentype "k8s.io/client-go/gentype" 28 | ) 29 | 30 | // fakeGlobalEgressIPs implements GlobalEgressIPInterface 31 | type fakeGlobalEgressIPs struct { 32 | *gentype.FakeClientWithListAndApply[*v1.GlobalEgressIP, *v1.GlobalEgressIPList, *submarineriov1.GlobalEgressIPApplyConfiguration] 33 | Fake *FakeSubmarinerV1 34 | } 35 | 36 | func newFakeGlobalEgressIPs(fake *FakeSubmarinerV1, namespace string) typedsubmarineriov1.GlobalEgressIPInterface { 37 | return &fakeGlobalEgressIPs{ 38 | gentype.NewFakeClientWithListAndApply[*v1.GlobalEgressIP, *v1.GlobalEgressIPList, *submarineriov1.GlobalEgressIPApplyConfiguration]( 39 | fake.Fake, 40 | namespace, 41 | v1.SchemeGroupVersion.WithResource("globalegressips"), 42 | v1.SchemeGroupVersion.WithKind("GlobalEgressIP"), 43 | func() *v1.GlobalEgressIP { return &v1.GlobalEgressIP{} }, 44 | func() *v1.GlobalEgressIPList { return &v1.GlobalEgressIPList{} }, 45 | func(dst, src *v1.GlobalEgressIPList) { dst.ListMeta = src.ListMeta }, 46 | func(list *v1.GlobalEgressIPList) []*v1.GlobalEgressIP { return gentype.ToPointerSlice(list.Items) }, 47 | func(list *v1.GlobalEgressIPList, items []*v1.GlobalEgressIP) { 48 | list.Items = gentype.FromPointerSlice(items) 49 | }, 50 | ), 51 | fake, 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /pkg/client/clientset/versioned/typed/submariner.io/v1/fake/fake_globalingressip.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | v1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 25 | submarineriov1 "github.com/submariner-io/submariner/pkg/client/applyconfiguration/submariner.io/v1" 26 | typedsubmarineriov1 "github.com/submariner-io/submariner/pkg/client/clientset/versioned/typed/submariner.io/v1" 27 | gentype "k8s.io/client-go/gentype" 28 | ) 29 | 30 | // fakeGlobalIngressIPs implements GlobalIngressIPInterface 31 | type fakeGlobalIngressIPs struct { 32 | *gentype.FakeClientWithListAndApply[*v1.GlobalIngressIP, *v1.GlobalIngressIPList, *submarineriov1.GlobalIngressIPApplyConfiguration] 33 | Fake *FakeSubmarinerV1 34 | } 35 | 36 | func newFakeGlobalIngressIPs(fake *FakeSubmarinerV1, namespace string) typedsubmarineriov1.GlobalIngressIPInterface { 37 | return &fakeGlobalIngressIPs{ 38 | gentype.NewFakeClientWithListAndApply[*v1.GlobalIngressIP, *v1.GlobalIngressIPList, *submarineriov1.GlobalIngressIPApplyConfiguration]( 39 | fake.Fake, 40 | namespace, 41 | v1.SchemeGroupVersion.WithResource("globalingressips"), 42 | v1.SchemeGroupVersion.WithKind("GlobalIngressIP"), 43 | func() *v1.GlobalIngressIP { return &v1.GlobalIngressIP{} }, 44 | func() *v1.GlobalIngressIPList { return &v1.GlobalIngressIPList{} }, 45 | func(dst, src *v1.GlobalIngressIPList) { dst.ListMeta = src.ListMeta }, 46 | func(list *v1.GlobalIngressIPList) []*v1.GlobalIngressIP { return gentype.ToPointerSlice(list.Items) }, 47 | func(list *v1.GlobalIngressIPList, items []*v1.GlobalIngressIP) { 48 | list.Items = gentype.FromPointerSlice(items) 49 | }, 50 | ), 51 | fake, 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /pkg/client/clientset/versioned/typed/submariner.io/v1/fake/fake_nongatewayroute.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | v1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 25 | submarineriov1 "github.com/submariner-io/submariner/pkg/client/applyconfiguration/submariner.io/v1" 26 | typedsubmarineriov1 "github.com/submariner-io/submariner/pkg/client/clientset/versioned/typed/submariner.io/v1" 27 | gentype "k8s.io/client-go/gentype" 28 | ) 29 | 30 | // fakeNonGatewayRoutes implements NonGatewayRouteInterface 31 | type fakeNonGatewayRoutes struct { 32 | *gentype.FakeClientWithListAndApply[*v1.NonGatewayRoute, *v1.NonGatewayRouteList, *submarineriov1.NonGatewayRouteApplyConfiguration] 33 | Fake *FakeSubmarinerV1 34 | } 35 | 36 | func newFakeNonGatewayRoutes(fake *FakeSubmarinerV1, namespace string) typedsubmarineriov1.NonGatewayRouteInterface { 37 | return &fakeNonGatewayRoutes{ 38 | gentype.NewFakeClientWithListAndApply[*v1.NonGatewayRoute, *v1.NonGatewayRouteList, *submarineriov1.NonGatewayRouteApplyConfiguration]( 39 | fake.Fake, 40 | namespace, 41 | v1.SchemeGroupVersion.WithResource("nongatewayroutes"), 42 | v1.SchemeGroupVersion.WithKind("NonGatewayRoute"), 43 | func() *v1.NonGatewayRoute { return &v1.NonGatewayRoute{} }, 44 | func() *v1.NonGatewayRouteList { return &v1.NonGatewayRouteList{} }, 45 | func(dst, src *v1.NonGatewayRouteList) { dst.ListMeta = src.ListMeta }, 46 | func(list *v1.NonGatewayRouteList) []*v1.NonGatewayRoute { return gentype.ToPointerSlice(list.Items) }, 47 | func(list *v1.NonGatewayRouteList, items []*v1.NonGatewayRoute) { 48 | list.Items = gentype.FromPointerSlice(items) 49 | }, 50 | ), 51 | fake, 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /pkg/client/clientset/versioned/typed/submariner.io/v1/fake/fake_routeagent.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | v1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 25 | submarineriov1 "github.com/submariner-io/submariner/pkg/client/applyconfiguration/submariner.io/v1" 26 | typedsubmarineriov1 "github.com/submariner-io/submariner/pkg/client/clientset/versioned/typed/submariner.io/v1" 27 | gentype "k8s.io/client-go/gentype" 28 | ) 29 | 30 | // fakeRouteAgents implements RouteAgentInterface 31 | type fakeRouteAgents struct { 32 | *gentype.FakeClientWithListAndApply[*v1.RouteAgent, *v1.RouteAgentList, *submarineriov1.RouteAgentApplyConfiguration] 33 | Fake *FakeSubmarinerV1 34 | } 35 | 36 | func newFakeRouteAgents(fake *FakeSubmarinerV1, namespace string) typedsubmarineriov1.RouteAgentInterface { 37 | return &fakeRouteAgents{ 38 | gentype.NewFakeClientWithListAndApply[*v1.RouteAgent, *v1.RouteAgentList, *submarineriov1.RouteAgentApplyConfiguration]( 39 | fake.Fake, 40 | namespace, 41 | v1.SchemeGroupVersion.WithResource("routeagents"), 42 | v1.SchemeGroupVersion.WithKind("RouteAgent"), 43 | func() *v1.RouteAgent { return &v1.RouteAgent{} }, 44 | func() *v1.RouteAgentList { return &v1.RouteAgentList{} }, 45 | func(dst, src *v1.RouteAgentList) { dst.ListMeta = src.ListMeta }, 46 | func(list *v1.RouteAgentList) []*v1.RouteAgent { return gentype.ToPointerSlice(list.Items) }, 47 | func(list *v1.RouteAgentList, items []*v1.RouteAgent) { list.Items = gentype.FromPointerSlice(items) }, 48 | ), 49 | fake, 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /pkg/client/clientset/versioned/typed/submariner.io/v1/fake/fake_submariner.io_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package fake 22 | 23 | import ( 24 | v1 "github.com/submariner-io/submariner/pkg/client/clientset/versioned/typed/submariner.io/v1" 25 | rest "k8s.io/client-go/rest" 26 | testing "k8s.io/client-go/testing" 27 | ) 28 | 29 | type FakeSubmarinerV1 struct { 30 | *testing.Fake 31 | } 32 | 33 | func (c *FakeSubmarinerV1) Clusters(namespace string) v1.ClusterInterface { 34 | return newFakeClusters(c, namespace) 35 | } 36 | 37 | func (c *FakeSubmarinerV1) ClusterGlobalEgressIPs(namespace string) v1.ClusterGlobalEgressIPInterface { 38 | return newFakeClusterGlobalEgressIPs(c, namespace) 39 | } 40 | 41 | func (c *FakeSubmarinerV1) Endpoints(namespace string) v1.EndpointInterface { 42 | return newFakeEndpoints(c, namespace) 43 | } 44 | 45 | func (c *FakeSubmarinerV1) Gateways(namespace string) v1.GatewayInterface { 46 | return newFakeGateways(c, namespace) 47 | } 48 | 49 | func (c *FakeSubmarinerV1) GatewayRoutes(namespace string) v1.GatewayRouteInterface { 50 | return newFakeGatewayRoutes(c, namespace) 51 | } 52 | 53 | func (c *FakeSubmarinerV1) GlobalEgressIPs(namespace string) v1.GlobalEgressIPInterface { 54 | return newFakeGlobalEgressIPs(c, namespace) 55 | } 56 | 57 | func (c *FakeSubmarinerV1) GlobalIngressIPs(namespace string) v1.GlobalIngressIPInterface { 58 | return newFakeGlobalIngressIPs(c, namespace) 59 | } 60 | 61 | func (c *FakeSubmarinerV1) NonGatewayRoutes(namespace string) v1.NonGatewayRouteInterface { 62 | return newFakeNonGatewayRoutes(c, namespace) 63 | } 64 | 65 | func (c *FakeSubmarinerV1) RouteAgents(namespace string) v1.RouteAgentInterface { 66 | return newFakeRouteAgents(c, namespace) 67 | } 68 | 69 | // RESTClient returns a RESTClient that is used to communicate 70 | // with API server by this client implementation. 71 | func (c *FakeSubmarinerV1) RESTClient() rest.Interface { 72 | var ret *rest.RESTClient 73 | return ret 74 | } 75 | -------------------------------------------------------------------------------- /pkg/client/clientset/versioned/typed/submariner.io/v1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by client-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | type ClusterExpansion interface{} 24 | 25 | type ClusterGlobalEgressIPExpansion interface{} 26 | 27 | type EndpointExpansion interface{} 28 | 29 | type GatewayExpansion interface{} 30 | 31 | type GatewayRouteExpansion interface{} 32 | 33 | type GlobalEgressIPExpansion interface{} 34 | 35 | type GlobalIngressIPExpansion interface{} 36 | 37 | type NonGatewayRouteExpansion interface{} 38 | 39 | type RouteAgentExpansion interface{} 40 | -------------------------------------------------------------------------------- /pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by informer-gen. DO NOT EDIT. 20 | 21 | package internalinterfaces 22 | 23 | import ( 24 | time "time" 25 | 26 | versioned "github.com/submariner-io/submariner/pkg/client/clientset/versioned" 27 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 28 | runtime "k8s.io/apimachinery/pkg/runtime" 29 | cache "k8s.io/client-go/tools/cache" 30 | ) 31 | 32 | // NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer. 33 | type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer 34 | 35 | // SharedInformerFactory a small interface to allow for adding an informer without an import cycle 36 | type SharedInformerFactory interface { 37 | Start(stopCh <-chan struct{}) 38 | InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer 39 | } 40 | 41 | // TweakListOptionsFunc is a function that transforms a v1.ListOptions. 42 | type TweakListOptionsFunc func(*v1.ListOptions) 43 | -------------------------------------------------------------------------------- /pkg/client/informers/externalversions/submariner.io/interface.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by informer-gen. DO NOT EDIT. 20 | 21 | package submariner 22 | 23 | import ( 24 | internalinterfaces "github.com/submariner-io/submariner/pkg/client/informers/externalversions/internalinterfaces" 25 | v1 "github.com/submariner-io/submariner/pkg/client/informers/externalversions/submariner.io/v1" 26 | ) 27 | 28 | // Interface provides access to each of this group's versions. 29 | type Interface interface { 30 | // V1 provides access to shared informers for resources in V1. 31 | V1() v1.Interface 32 | } 33 | 34 | type group struct { 35 | factory internalinterfaces.SharedInformerFactory 36 | namespace string 37 | tweakListOptions internalinterfaces.TweakListOptionsFunc 38 | } 39 | 40 | // New returns a new Interface. 41 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 42 | return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 43 | } 44 | 45 | // V1 returns a new v1.Interface. 46 | func (g *group) V1() v1.Interface { 47 | return v1.New(g.factory, g.namespace, g.tweakListOptions) 48 | } 49 | -------------------------------------------------------------------------------- /pkg/client/listers/submariner.io/v1/cluster.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by lister-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | import ( 24 | submarineriov1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 25 | labels "k8s.io/apimachinery/pkg/labels" 26 | listers "k8s.io/client-go/listers" 27 | cache "k8s.io/client-go/tools/cache" 28 | ) 29 | 30 | // ClusterLister helps list Clusters. 31 | // All objects returned here must be treated as read-only. 32 | type ClusterLister interface { 33 | // List lists all Clusters in the indexer. 34 | // Objects returned here must be treated as read-only. 35 | List(selector labels.Selector) (ret []*submarineriov1.Cluster, err error) 36 | // Clusters returns an object that can list and get Clusters. 37 | Clusters(namespace string) ClusterNamespaceLister 38 | ClusterListerExpansion 39 | } 40 | 41 | // clusterLister implements the ClusterLister interface. 42 | type clusterLister struct { 43 | listers.ResourceIndexer[*submarineriov1.Cluster] 44 | } 45 | 46 | // NewClusterLister returns a new ClusterLister. 47 | func NewClusterLister(indexer cache.Indexer) ClusterLister { 48 | return &clusterLister{listers.New[*submarineriov1.Cluster](indexer, submarineriov1.Resource("cluster"))} 49 | } 50 | 51 | // Clusters returns an object that can list and get Clusters. 52 | func (s *clusterLister) Clusters(namespace string) ClusterNamespaceLister { 53 | return clusterNamespaceLister{listers.NewNamespaced[*submarineriov1.Cluster](s.ResourceIndexer, namespace)} 54 | } 55 | 56 | // ClusterNamespaceLister helps list and get Clusters. 57 | // All objects returned here must be treated as read-only. 58 | type ClusterNamespaceLister interface { 59 | // List lists all Clusters in the indexer for a given namespace. 60 | // Objects returned here must be treated as read-only. 61 | List(selector labels.Selector) (ret []*submarineriov1.Cluster, err error) 62 | // Get retrieves the Cluster from the indexer for a given namespace and name. 63 | // Objects returned here must be treated as read-only. 64 | Get(name string) (*submarineriov1.Cluster, error) 65 | ClusterNamespaceListerExpansion 66 | } 67 | 68 | // clusterNamespaceLister implements the ClusterNamespaceLister 69 | // interface. 70 | type clusterNamespaceLister struct { 71 | listers.ResourceIndexer[*submarineriov1.Cluster] 72 | } 73 | -------------------------------------------------------------------------------- /pkg/client/listers/submariner.io/v1/endpoint.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by lister-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | import ( 24 | submarineriov1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 25 | labels "k8s.io/apimachinery/pkg/labels" 26 | listers "k8s.io/client-go/listers" 27 | cache "k8s.io/client-go/tools/cache" 28 | ) 29 | 30 | // EndpointLister helps list Endpoints. 31 | // All objects returned here must be treated as read-only. 32 | type EndpointLister interface { 33 | // List lists all Endpoints in the indexer. 34 | // Objects returned here must be treated as read-only. 35 | List(selector labels.Selector) (ret []*submarineriov1.Endpoint, err error) 36 | // Endpoints returns an object that can list and get Endpoints. 37 | Endpoints(namespace string) EndpointNamespaceLister 38 | EndpointListerExpansion 39 | } 40 | 41 | // endpointLister implements the EndpointLister interface. 42 | type endpointLister struct { 43 | listers.ResourceIndexer[*submarineriov1.Endpoint] 44 | } 45 | 46 | // NewEndpointLister returns a new EndpointLister. 47 | func NewEndpointLister(indexer cache.Indexer) EndpointLister { 48 | return &endpointLister{listers.New[*submarineriov1.Endpoint](indexer, submarineriov1.Resource("endpoint"))} 49 | } 50 | 51 | // Endpoints returns an object that can list and get Endpoints. 52 | func (s *endpointLister) Endpoints(namespace string) EndpointNamespaceLister { 53 | return endpointNamespaceLister{listers.NewNamespaced[*submarineriov1.Endpoint](s.ResourceIndexer, namespace)} 54 | } 55 | 56 | // EndpointNamespaceLister helps list and get Endpoints. 57 | // All objects returned here must be treated as read-only. 58 | type EndpointNamespaceLister interface { 59 | // List lists all Endpoints in the indexer for a given namespace. 60 | // Objects returned here must be treated as read-only. 61 | List(selector labels.Selector) (ret []*submarineriov1.Endpoint, err error) 62 | // Get retrieves the Endpoint from the indexer for a given namespace and name. 63 | // Objects returned here must be treated as read-only. 64 | Get(name string) (*submarineriov1.Endpoint, error) 65 | EndpointNamespaceListerExpansion 66 | } 67 | 68 | // endpointNamespaceLister implements the EndpointNamespaceLister 69 | // interface. 70 | type endpointNamespaceLister struct { 71 | listers.ResourceIndexer[*submarineriov1.Endpoint] 72 | } 73 | -------------------------------------------------------------------------------- /pkg/client/listers/submariner.io/v1/gateway.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by lister-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | import ( 24 | submarineriov1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 25 | labels "k8s.io/apimachinery/pkg/labels" 26 | listers "k8s.io/client-go/listers" 27 | cache "k8s.io/client-go/tools/cache" 28 | ) 29 | 30 | // GatewayLister helps list Gateways. 31 | // All objects returned here must be treated as read-only. 32 | type GatewayLister interface { 33 | // List lists all Gateways in the indexer. 34 | // Objects returned here must be treated as read-only. 35 | List(selector labels.Selector) (ret []*submarineriov1.Gateway, err error) 36 | // Gateways returns an object that can list and get Gateways. 37 | Gateways(namespace string) GatewayNamespaceLister 38 | GatewayListerExpansion 39 | } 40 | 41 | // gatewayLister implements the GatewayLister interface. 42 | type gatewayLister struct { 43 | listers.ResourceIndexer[*submarineriov1.Gateway] 44 | } 45 | 46 | // NewGatewayLister returns a new GatewayLister. 47 | func NewGatewayLister(indexer cache.Indexer) GatewayLister { 48 | return &gatewayLister{listers.New[*submarineriov1.Gateway](indexer, submarineriov1.Resource("gateway"))} 49 | } 50 | 51 | // Gateways returns an object that can list and get Gateways. 52 | func (s *gatewayLister) Gateways(namespace string) GatewayNamespaceLister { 53 | return gatewayNamespaceLister{listers.NewNamespaced[*submarineriov1.Gateway](s.ResourceIndexer, namespace)} 54 | } 55 | 56 | // GatewayNamespaceLister helps list and get Gateways. 57 | // All objects returned here must be treated as read-only. 58 | type GatewayNamespaceLister interface { 59 | // List lists all Gateways in the indexer for a given namespace. 60 | // Objects returned here must be treated as read-only. 61 | List(selector labels.Selector) (ret []*submarineriov1.Gateway, err error) 62 | // Get retrieves the Gateway from the indexer for a given namespace and name. 63 | // Objects returned here must be treated as read-only. 64 | Get(name string) (*submarineriov1.Gateway, error) 65 | GatewayNamespaceListerExpansion 66 | } 67 | 68 | // gatewayNamespaceLister implements the GatewayNamespaceLister 69 | // interface. 70 | type gatewayNamespaceLister struct { 71 | listers.ResourceIndexer[*submarineriov1.Gateway] 72 | } 73 | -------------------------------------------------------------------------------- /pkg/cni/cni_suite_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package cni_test 20 | 21 | import ( 22 | "flag" 23 | "testing" 24 | 25 | . "github.com/onsi/ginkgo/v2" 26 | . "github.com/onsi/gomega" 27 | "github.com/submariner-io/admiral/pkg/log/kzerolog" 28 | ) 29 | 30 | func init() { 31 | flags := flag.NewFlagSet("kzerolog", flag.ExitOnError) 32 | kzerolog.AddFlags(flags) 33 | _ = flags.Parse([]string{"-v=2"}) 34 | } 35 | 36 | var _ = BeforeSuite(func() { 37 | kzerolog.InitK8sLogging() 38 | }) 39 | 40 | func TestCNI(t *testing.T) { 41 | RegisterFailHandler(Fail) 42 | RunSpecs(t, "CNI Suite") 43 | } 44 | -------------------------------------------------------------------------------- /pkg/cni/plugins.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package cni 20 | 21 | // Supported network plugins. 22 | const ( 23 | Generic = "generic" 24 | Calico = "calico" 25 | CanalFlannel = "canal-flannel" 26 | Flannel = "flannel" 27 | KindNet = "kindnet" 28 | OpenShiftSDN = "OpenShiftSDN" 29 | OVNKubernetes = "OVNKubernetes" 30 | WeaveNet = "weave-net" 31 | ) 32 | 33 | func GetNetworkPlugins() []string { 34 | return []string{Generic, Calico, CanalFlannel, Flannel, KindNet, OpenShiftSDN, OVNKubernetes, WeaveNet} 35 | } 36 | -------------------------------------------------------------------------------- /pkg/controllers/datastoresyncer/gateway_handler.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package datastoresyncer 20 | 21 | import ( 22 | "context" 23 | "net" 24 | 25 | "github.com/submariner-io/admiral/pkg/resource" 26 | submarinerv1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 27 | "github.com/submariner-io/submariner/pkg/globalnet/constants" 28 | "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" 29 | "k8s.io/apimachinery/pkg/runtime" 30 | k8snet "k8s.io/utils/net" 31 | ) 32 | 33 | func (d *DatastoreSyncer) handleCreateOrUpdateGateway(obj runtime.Object, _ int) bool { 34 | globalIP := resource.MustToMeta(obj).GetAnnotations()[constants.SmGlobalIP] 35 | 36 | // Validate that the global IP falls in the global CIDR allocated to the cluster. 37 | if globalIP != "" { 38 | _, ipnet, err := net.ParseCIDR(d.localCluster.Spec.GlobalCIDR[0]) 39 | if err != nil { 40 | // Ideally this will not happen as globalCIDR is expected to be a valid CIDR. 41 | logger.Errorf(err, "Error parsing the GlobalCIDR %q", d.localCluster.Spec.GlobalCIDR) 42 | return false 43 | } 44 | 45 | if ipnet.Contains(net.ParseIP(globalIP)) { 46 | return d.updateLocalEndpointIfNecessary(globalIP) 47 | } 48 | } 49 | 50 | return false 51 | } 52 | 53 | func (d *DatastoreSyncer) areGatewaysEquivalent(obj1, obj2 *unstructured.Unstructured) bool { 54 | existingGlobalIP := obj1.GetAnnotations()[constants.SmGlobalIP] 55 | newGlobalIP := obj2.GetAnnotations()[constants.SmGlobalIP] 56 | 57 | if existingGlobalIP != newGlobalIP { 58 | logger.Infof("Global IP for node %q changed from %q to %q", obj1.GetName(), existingGlobalIP, newGlobalIP) 59 | } 60 | 61 | return existingGlobalIP == newGlobalIP 62 | } 63 | 64 | func (d *DatastoreSyncer) updateLocalEndpointIfNecessary(globalIP string) bool { 65 | spec := d.localEndpoint.Spec() 66 | if spec.GetHealthCheckIP(k8snet.IPv4) != globalIP { 67 | logger.Infof("Updating the endpoint HealthCheckIP to globalIP %q", globalIP) 68 | 69 | err := d.localEndpoint.Update(context.TODO(), func(existing *submarinerv1.EndpointSpec) { 70 | existing.SetHealthCheckIP(globalIP) 71 | }) 72 | if err != nil { 73 | logger.Warningf("Error updating the local submariner Endpoint with HealthcheckIP %s: %v", globalIP, err) 74 | return true 75 | } 76 | } 77 | 78 | return false 79 | } 80 | -------------------------------------------------------------------------------- /pkg/endpoint/local_endpoint_suite_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package endpoint_test 20 | 21 | import ( 22 | "testing" 23 | 24 | . "github.com/onsi/ginkgo/v2" 25 | . "github.com/onsi/gomega" 26 | "github.com/submariner-io/admiral/pkg/log/kzerolog" 27 | submarinerv1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 28 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 29 | "k8s.io/client-go/kubernetes/scheme" 30 | ) 31 | 32 | func init() { 33 | kzerolog.AddFlags(nil) 34 | utilruntime.Must(submarinerv1.AddToScheme(scheme.Scheme)) 35 | } 36 | 37 | var _ = BeforeSuite(func() { 38 | kzerolog.InitK8sLogging() 39 | }) 40 | 41 | func TestEndpoint(t *testing.T) { 42 | RegisterFailHandler(Fail) 43 | RunSpecs(t, "Endpoint Suite") 44 | } 45 | -------------------------------------------------------------------------------- /pkg/endpoint/local_ip.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package endpoint 20 | 21 | import ( 22 | "fmt" 23 | "net" 24 | 25 | "github.com/pkg/errors" 26 | netlinkAPI "github.com/submariner-io/submariner/pkg/netlink" 27 | k8snet "k8s.io/utils/net" 28 | ) 29 | 30 | var ( 31 | familyToDestIP = map[k8snet.IPFamily]string{ 32 | k8snet.IPv4: "8.8.8.8", 33 | k8snet.IPv6: "2001:4860:4860::8888", 34 | } 35 | Dial = net.Dial 36 | ) 37 | 38 | func getLocalIPFromRoutes(family k8snet.IPFamily) (string, error) { 39 | netlink := netlinkAPI.New() 40 | 41 | routes, err := netlink.RouteList(nil, family) 42 | if err != nil { 43 | return "", errors.Wrapf(err, "error listing routes for IPv%v", family) 44 | } 45 | 46 | for i := range routes { 47 | if routes[i].Gw != nil { 48 | return routes[i].Src.String(), nil 49 | } 50 | } 51 | 52 | return "", errors.Errorf("couldn't find route for family %v", family) 53 | } 54 | 55 | func GetLocalIPForDestination(dst string, family k8snet.IPFamily) string { 56 | conn, err := Dial("udp"+string(family), "["+dst+"]:53") 57 | if err == nil { 58 | defer conn.Close() 59 | localAddr := conn.LocalAddr().(*net.UDPAddr) 60 | 61 | return localAddr.IP.String() 62 | } 63 | 64 | // connection failed try fallback method 65 | localIP, err := getLocalIPFromRoutes(family) 66 | logger.FatalOnError(err, fmt.Sprintf("Error getting local IPv%v", family)) 67 | 68 | return localIP 69 | } 70 | 71 | func GetLocalIP(family k8snet.IPFamily) string { 72 | return GetLocalIPForDestination(familyToDestIP[family], family) 73 | } 74 | -------------------------------------------------------------------------------- /pkg/event/controller/controller_suite_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package controller_test 20 | 21 | import ( 22 | "testing" 23 | 24 | . "github.com/onsi/ginkgo/v2" 25 | . "github.com/onsi/gomega" 26 | "github.com/submariner-io/admiral/pkg/log/kzerolog" 27 | submv1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 28 | "k8s.io/client-go/kubernetes/scheme" 29 | ) 30 | 31 | func init() { 32 | kzerolog.AddFlags(nil) 33 | } 34 | 35 | var _ = BeforeSuite(func() { 36 | kzerolog.InitK8sLogging() 37 | Expect(submv1.AddToScheme(scheme.Scheme)).To(Succeed()) 38 | }) 39 | 40 | func TestWatcher(t *testing.T) { 41 | RegisterFailHandler(Fail) 42 | RunSpecs(t, "Event Controller Suite") 43 | } 44 | -------------------------------------------------------------------------------- /pkg/event/controller/endpoint_created.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package controller 20 | 21 | import ( 22 | "strings" 23 | 24 | smv1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 25 | ) 26 | 27 | func (c *handlerController) handleCreatedEndpoint(endpoint *smv1.Endpoint, requeueCount int) bool { 28 | var err error 29 | 30 | if requeueCount > maxRequeues { 31 | logger.Errorf(nil, "Handler %q: Ignoring create event for endpoint %q, as its requeued for more than %d times", 32 | c.handler.GetName(), endpoint.Spec.ClusterID, maxRequeues) 33 | return false 34 | } 35 | 36 | c.syncMutex.Lock() 37 | defer c.syncMutex.Unlock() 38 | 39 | if endpoint.Spec.ClusterID != c.clusterID { 40 | err = c.handleCreatedRemoteEndpoint(endpoint) 41 | } else { 42 | err = c.handleCreatedLocalEndpoint(endpoint) 43 | } 44 | 45 | if err != nil { 46 | logger.Errorf(err, "Handler %q: Error handling created endpoint %q", c.handler.GetName(), endpoint.Name) 47 | } 48 | 49 | return err != nil 50 | } 51 | 52 | func (c *handlerController) handleCreatedLocalEndpoint(endpoint *smv1.Endpoint) error { 53 | if endpoint.Spec.Hostname == c.hostname { 54 | c.handlerState.setIsOnGateway(true) 55 | } 56 | 57 | err := c.handler.LocalEndpointCreated(endpoint) 58 | 59 | if err == nil && !c.handlerState.wasOnGateway && c.handlerState.IsOnGateway() { 60 | logger.Infof("Handler %q: Transitioned to gateway node %q with endpoint private IPs %s", c.handler.GetName(), 61 | c.hostname, strings.Join(endpoint.Spec.PrivateIPs, ",")) 62 | 63 | err = c.handler.TransitionToGateway() 64 | } 65 | 66 | if err == nil { 67 | c.handlerState.wasOnGateway = c.handlerState.IsOnGateway() 68 | } 69 | 70 | return err //nolint:wrapcheck // Let the caller wrap it 71 | } 72 | 73 | func (c *handlerController) handleCreatedRemoteEndpoint(endpoint *smv1.Endpoint) error { 74 | lastProcessedTime, ok := c.remoteEndpointTimeStamp[endpoint.Spec.ClusterID] 75 | 76 | if ok && lastProcessedTime.After(endpoint.CreationTimestamp.Time) { 77 | logger.Infof("Handler %q: Ignoring new remote %#v since a later endpoint was already processed", 78 | c.handler.GetName(), endpoint) 79 | return nil 80 | } 81 | 82 | c.handlerState.remoteEndpoints.Store(endpoint.Name, endpoint) 83 | c.remoteEndpointTimeStamp[endpoint.Spec.ClusterID] = endpoint.CreationTimestamp 84 | 85 | return c.handler.RemoteEndpointCreated(endpoint) //nolint:wrapcheck // Let the caller wrap it 86 | } 87 | -------------------------------------------------------------------------------- /pkg/event/controller/endpoint_removed.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package controller 20 | 21 | import ( 22 | smv1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 23 | ) 24 | 25 | func (c *handlerController) handleRemovedEndpoint(endpoint *smv1.Endpoint, requeueCount int) bool { 26 | if requeueCount > maxRequeues { 27 | logger.Errorf(nil, "Handler %q: Ignoring delete event for endpoint %q, as its requeued for more than %d times", 28 | c.handler.GetName(), endpoint.Spec.ClusterID, maxRequeues) 29 | return false 30 | } 31 | 32 | c.syncMutex.Lock() 33 | defer c.syncMutex.Unlock() 34 | 35 | var err error 36 | if endpoint.Spec.ClusterID != c.clusterID { 37 | err = c.handleRemovedRemoteEndpoint(endpoint) 38 | } else { 39 | err = c.handleRemovedLocalEndpoint(endpoint) 40 | } 41 | 42 | if err != nil { 43 | logger.Errorf(err, "Handler %q: Error handling removed endpoint %q", c.handler.GetName(), endpoint.Name) 44 | } 45 | 46 | return err != nil 47 | } 48 | 49 | func (c *handlerController) handleRemovedLocalEndpoint(endpoint *smv1.Endpoint) error { 50 | if endpoint.Spec.Hostname == c.hostname { 51 | c.handlerState.setIsOnGateway(false) 52 | } 53 | 54 | err := c.handler.LocalEndpointRemoved(endpoint) 55 | 56 | if err == nil && c.handlerState.wasOnGateway && !c.handlerState.IsOnGateway() { 57 | logger.Infof("Handler %q: Transitioned to non-gateway node %q", c.handler.GetName(), endpoint.Spec.Hostname) 58 | 59 | err = c.handler.TransitionToNonGateway() 60 | } 61 | 62 | if err == nil { 63 | c.handlerState.wasOnGateway = c.handlerState.IsOnGateway() 64 | } 65 | 66 | return err //nolint:wrapcheck // Let the caller wrap it 67 | } 68 | 69 | func (c *handlerController) handleRemovedRemoteEndpoint(endpoint *smv1.Endpoint) error { 70 | c.handlerState.remoteEndpoints.Delete(endpoint.Name) 71 | 72 | lastProcessedTime, ok := c.remoteEndpointTimeStamp[endpoint.Spec.ClusterID] 73 | 74 | if ok && lastProcessedTime.After(endpoint.CreationTimestamp.Time) { 75 | return c.handler.StaleRemoteEndpointRemoved(endpoint) //nolint:wrapcheck // Let the caller wrap it 76 | } 77 | 78 | delete(c.remoteEndpointTimeStamp, endpoint.Spec.ClusterID) 79 | 80 | return c.handler.RemoteEndpointRemoved(endpoint) //nolint:wrapcheck // Let the caller wrap it 81 | } 82 | -------------------------------------------------------------------------------- /pkg/event/controller/endpoint_updated.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package controller 20 | 21 | import ( 22 | smv1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 23 | ) 24 | 25 | func (c *handlerController) handleUpdatedEndpoint(endpoint *smv1.Endpoint, requeueCount int) bool { 26 | if requeueCount > maxRequeues { 27 | logger.Errorf(nil, "Handler %q: Ignoring update event for endpoint %q, as it's requeued for more than %d times", 28 | c.handler.GetName(), endpoint.Name, maxRequeues) 29 | return false 30 | } 31 | 32 | c.syncMutex.Lock() 33 | defer c.syncMutex.Unlock() 34 | 35 | var err error 36 | if endpoint.Spec.ClusterID != c.clusterID { 37 | err = c.handleUpdatedRemoteEndpoint(endpoint) 38 | } else { 39 | err = c.handleUpdatedLocalEndpoint(endpoint) 40 | } 41 | 42 | if err != nil { 43 | logger.Errorf(err, "Handler %q: Error handling updated endpoint %q", c.handler.GetName(), endpoint.Name) 44 | } 45 | 46 | return err != nil 47 | } 48 | 49 | func (c *handlerController) handleUpdatedLocalEndpoint(endpoint *smv1.Endpoint) error { 50 | return c.handler.LocalEndpointUpdated(endpoint) //nolint:wrapcheck // Let the caller wrap it 51 | } 52 | 53 | func (c *handlerController) handleUpdatedRemoteEndpoint(endpoint *smv1.Endpoint) error { 54 | c.handlerState.remoteEndpoints.Store(endpoint.Name, endpoint) 55 | return c.handler.RemoteEndpointUpdated(endpoint) //nolint:wrapcheck // Let the caller wrap it 56 | } 57 | -------------------------------------------------------------------------------- /pkg/event/controller/node_handlers.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package controller 20 | 21 | import ( 22 | k8sv1 "k8s.io/api/core/v1" 23 | ) 24 | 25 | func (c *handlerController) handleRemovedNode(node *k8sv1.Node, _ int) bool { 26 | c.syncMutex.Lock() 27 | defer c.syncMutex.Unlock() 28 | 29 | if err := c.nodeHandler.NodeRemoved(node); err != nil { 30 | logger.Error(err, "Handler %q: Error handling removed Node %q", c.handler.GetName(), node.Name) 31 | return true 32 | } 33 | 34 | return false 35 | } 36 | 37 | func (c *handlerController) handleCreatedNode(node *k8sv1.Node, _ int) bool { 38 | c.syncMutex.Lock() 39 | defer c.syncMutex.Unlock() 40 | 41 | if err := c.nodeHandler.NodeCreated(node); err != nil { 42 | logger.Error(err, "Handler %q: Error handling created Node %q", c.handler.GetName(), node.Name) 43 | return true 44 | } 45 | 46 | return false 47 | } 48 | 49 | func (c *handlerController) handleUpdatedNode(node *k8sv1.Node, _ int) bool { 50 | c.syncMutex.Lock() 51 | defer c.syncMutex.Unlock() 52 | 53 | if err := c.nodeHandler.NodeUpdated(node); err != nil { 54 | logger.Error(err, "Handler %q: Error handling updated Node %q", c.handler.GetName(), node.Name) 55 | return true 56 | } 57 | 58 | return false 59 | } 60 | -------------------------------------------------------------------------------- /pkg/event/event_suite_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package event_test 20 | 21 | import ( 22 | "testing" 23 | 24 | . "github.com/onsi/ginkgo/v2" 25 | . "github.com/onsi/gomega" 26 | ) 27 | 28 | func TestEventPackage(t *testing.T) { 29 | RegisterFailHandler(Fail) 30 | RunSpecs(t, "Event suite") 31 | } 32 | -------------------------------------------------------------------------------- /pkg/gateway/gateway_suite_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package gateway_test 20 | 21 | import ( 22 | "testing" 23 | "time" 24 | 25 | . "github.com/onsi/ginkgo/v2" 26 | . "github.com/onsi/gomega" 27 | "github.com/submariner-io/admiral/pkg/log/kzerolog" 28 | submarinerv1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 29 | "github.com/submariner-io/submariner/pkg/cable" 30 | "github.com/submariner-io/submariner/pkg/cable/fake" 31 | "github.com/submariner-io/submariner/pkg/cableengine/syncer" 32 | "github.com/submariner-io/submariner/pkg/endpoint" 33 | "github.com/submariner-io/submariner/pkg/types" 34 | "k8s.io/client-go/kubernetes/scheme" 35 | ) 36 | 37 | func init() { 38 | kzerolog.AddFlags(nil) 39 | } 40 | 41 | var fakeDriver *fake.Driver 42 | 43 | var _ = BeforeSuite(func() { 44 | kzerolog.InitK8sLogging() 45 | Expect(submarinerv1.AddToScheme(scheme.Scheme)).To(Succeed()) 46 | 47 | cable.AddDriver(fake.DriverName, func(_ *endpoint.Local, _ *types.SubmarinerCluster) (cable.Driver, error) { 48 | return fakeDriver, nil 49 | }) 50 | 51 | syncer.GatewayUpdateInterval = 50 * time.Millisecond 52 | }) 53 | 54 | func TestGateway(t *testing.T) { 55 | RegisterFailHandler(Fail) 56 | RunSpecs(t, "Gateway Suite") 57 | } 58 | -------------------------------------------------------------------------------- /pkg/globalnet/constants/constants.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package constants 20 | 21 | const ( 22 | ClusterGlobalEgressIPName = "cluster-egress.submariner.io" 23 | EndpointClonedFrom = "endpoints.submariner.io/cloned-from" 24 | 25 | SmGlobalnetIngressChain = "SUBMARINER-GN-INGRESS" 26 | SmGlobalnetEgressChain = "SUBMARINER-GN-EGRESS" 27 | SmGlobalnetMarkChain = "SUBMARINER-GN-MARK" 28 | 29 | // The following chains are added as part of GN 2.0 implementation. 30 | SmGlobalnetEgressChainForPods = "SM-GN-EGRESS-PODS" 31 | SmGlobalnetEgressChainForHeadlessSvcPods = "SM-GN-EGRESS-HDLS-PODS" 32 | SmGlobalnetEgressChainForHeadlessSvcEPs = "SM-GN-EGRESS-HDLS-EPS" 33 | SmGlobalnetEgressChainForNamespace = "SM-GN-EGRESS-NS" 34 | SmGlobalnetEgressChainForCluster = "SM-GN-EGRESS-CLUSTER" 35 | 36 | NATTable = "nat" 37 | 38 | SmGlobalIP = "submariner.io/globalIp" 39 | ) 40 | -------------------------------------------------------------------------------- /pkg/natdiscovery/listener_internal_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package natdiscovery 20 | 21 | import ( 22 | . "github.com/onsi/ginkgo/v2" 23 | . "github.com/onsi/gomega" 24 | k8snet "k8s.io/utils/net" 25 | ) 26 | 27 | func testListenerLoopExitsOnClose(family k8snet.IPFamily) { 28 | nd := &natDiscovery{} 29 | ended := make(chan struct{}, 1) 30 | 31 | serverConnection, err := createServerConnection(12345, family) 32 | Expect(err).NotTo(HaveOccurred()) 33 | 34 | go func() { 35 | nd.listenerLoop(serverConnection) 36 | close(ended) 37 | }() 38 | 39 | Consistently(ended).ShouldNot(BeClosed()) 40 | 41 | serverConnection.Close() 42 | Eventually(ended).Should(BeClosed()) 43 | } 44 | 45 | var _ = Describe("Listener", func() { 46 | When("the server connection is closed", func() { 47 | It("should exit the listen loop for IPv4", func() { 48 | testListenerLoopExitsOnClose(k8snet.IPv4) 49 | }) 50 | It("should exit the listen loop for IPv6", func() { 51 | testListenerLoopExitsOnClose(k8snet.IPv6) 52 | }) 53 | }) 54 | }) 55 | -------------------------------------------------------------------------------- /pkg/natdiscovery/proto/consts.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package proto 20 | 21 | const ( 22 | DefaultPort = 4490 23 | Version = 1 24 | ) 25 | -------------------------------------------------------------------------------- /pkg/natdiscovery/proto/methods.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package proto 20 | 21 | func (x *SubmarinerNATDiscoveryResponse) GetSenderEndpointID() string { 22 | return x.GetSender().GetEndpointId() 23 | } 24 | 25 | func (x *SubmarinerNATDiscoveryResponse) GetReceiverEndpointID() string { 26 | return x.GetReceiver().GetEndpointId() 27 | } 28 | -------------------------------------------------------------------------------- /pkg/natdiscovery/proto/natdiscovery.proto: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | 20 | syntax = "proto3"; 21 | option go_package = "github.com/submariner-io/submariner/pkg/natdiscovery/proto"; 22 | 23 | message SubmarinerNATDiscoveryMessage { 24 | int32 version = 1; 25 | 26 | oneof message { 27 | SubmarinerNATDiscoveryRequest request = 2; 28 | SubmarinerNATDiscoveryResponse response = 3; 29 | } 30 | } 31 | 32 | message SubmarinerNATDiscoveryRequest { 33 | uint64 request_number = 1; 34 | 35 | EndpointDetails sender = 2; 36 | EndpointDetails receiver = 3; 37 | 38 | // The following information would allow the receiver to identify 39 | // and log if any form of NAT traversal is happening on the path 40 | IPPortPair using_src = 4; 41 | IPPortPair using_dst = 5; 42 | } 43 | 44 | enum ResponseType { 45 | OK = 0; 46 | NAT_DETECTED = 1; 47 | UNKNOWN_DST_CLUSTER = 2; 48 | UNKNOWN_DST_ENDPOINT = 3; 49 | MALFORMED = 4; 50 | } 51 | 52 | message SubmarinerNATDiscoveryResponse { 53 | uint64 request_number = 1; 54 | 55 | ResponseType response = 2; 56 | EndpointDetails sender = 3; 57 | EndpointDetails receiver = 4; 58 | 59 | bool src_ip_nat_detected = 5; 60 | bool src_port_nat_detected = 6; 61 | bool dst_ip_nat_detected = 7; 62 | 63 | // The received SRC IP / SRC port is reported, which will be useful for 64 | // diagnosing corner cases 65 | IPPortPair received_src = 8; 66 | } 67 | 68 | message IPPortPair { 69 | string IP = 1; 70 | int32 port = 2; 71 | } 72 | 73 | message EndpointDetails { 74 | // should we hash this for privacy? a hash can be checked against a known list, but can't be decoded 75 | string cluster_id = 1; 76 | string endpoint_id = 2; 77 | } 78 | -------------------------------------------------------------------------------- /pkg/netlink/network_interface.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package netlink 20 | 21 | import "net" 22 | 23 | type NetworkInterface interface { 24 | Index() int 25 | MTU() int 26 | Name() string 27 | HardwareAddr() net.HardwareAddr 28 | Flags() net.Flags 29 | Addrs() ([]net.Addr, error) 30 | } 31 | 32 | type DefaultNetworkInterface struct { 33 | net.Interface 34 | } 35 | 36 | func (i *DefaultNetworkInterface) Index() int { 37 | return i.Interface.Index 38 | } 39 | 40 | func (i *DefaultNetworkInterface) MTU() int { 41 | return i.Interface.MTU 42 | } 43 | 44 | func (i *DefaultNetworkInterface) Name() string { 45 | return i.Interface.Name 46 | } 47 | 48 | func (i *DefaultNetworkInterface) HardwareAddr() net.HardwareAddr { 49 | return i.Interface.HardwareAddr 50 | } 51 | 52 | func (i *DefaultNetworkInterface) Flags() net.Flags { 53 | return i.Interface.Flags 54 | } 55 | -------------------------------------------------------------------------------- /pkg/node/node_suite_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package node_test 20 | 21 | import ( 22 | "testing" 23 | 24 | . "github.com/onsi/ginkgo/v2" 25 | . "github.com/onsi/gomega" 26 | "github.com/submariner-io/admiral/pkg/log/kzerolog" 27 | ) 28 | 29 | func init() { 30 | kzerolog.AddFlags(nil) 31 | } 32 | 33 | var _ = BeforeSuite(func() { 34 | kzerolog.InitK8sLogging() 35 | }) 36 | 37 | func TestNode(t *testing.T) { 38 | RegisterFailHandler(Fail) 39 | RunSpecs(t, "Node Suite") 40 | } 41 | -------------------------------------------------------------------------------- /pkg/packetfilter/configure/configure.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package configure 20 | 21 | import ( 22 | "strconv" 23 | 24 | "github.com/pkg/errors" 25 | "github.com/submariner-io/admiral/pkg/log" 26 | "github.com/submariner-io/submariner/pkg/packetfilter" 27 | "github.com/submariner-io/submariner/pkg/packetfilter/iptables" 28 | "github.com/submariner-io/submariner/pkg/packetfilter/nftables" 29 | corev1 "k8s.io/api/core/v1" 30 | logf "sigs.k8s.io/controller-runtime/pkg/log" 31 | ) 32 | 33 | const UseNftablesKey = "use-nftables" 34 | 35 | var logger = log.Logger{Logger: logf.Log.WithName("Packetfilter")} 36 | 37 | func DriverFromConfigMap(cm *corev1.ConfigMap) error { 38 | useNftables := false 39 | 40 | if cm != nil { 41 | if value, ok := cm.Data[UseNftablesKey]; ok { 42 | var err error 43 | 44 | useNftables, err = strconv.ParseBool(value) 45 | if err != nil { 46 | return errors.Wrapf(err, "unable to parse %q from ConfigMap %q", UseNftablesKey, cm.Name) 47 | } 48 | } 49 | } 50 | 51 | if useNftables { 52 | logger.Info("Using nftables packet filter driver") 53 | packetfilter.SetNewDriverFn(nftables.New) 54 | } else { 55 | logger.Info("Using iptables packet filter driver") 56 | packetfilter.SetNewDriverFn(iptables.New) 57 | } 58 | 59 | return nil 60 | } 61 | -------------------------------------------------------------------------------- /pkg/packetfilter/iptables/iptables_suite_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package iptables_test 20 | 21 | import ( 22 | "flag" 23 | "testing" 24 | 25 | . "github.com/onsi/ginkgo/v2" 26 | . "github.com/onsi/gomega" 27 | "github.com/submariner-io/admiral/pkg/log/kzerolog" 28 | ) 29 | 30 | var _ = BeforeSuite(func() { 31 | flags := flag.NewFlagSet("kzerolog", flag.ExitOnError) 32 | kzerolog.AddFlags(flags) 33 | _ = flags.Parse([]string{"-v=4"}) 34 | 35 | kzerolog.InitK8sLogging() 36 | }) 37 | 38 | func TestIptables(t *testing.T) { 39 | RegisterFailHandler(Fail) 40 | RunSpecs(t, "IPTables Suite") 41 | } 42 | -------------------------------------------------------------------------------- /pkg/packetfilter/nftables/nftables_suite_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package nftables_test 20 | 21 | import ( 22 | "flag" 23 | "testing" 24 | 25 | . "github.com/onsi/ginkgo/v2" 26 | . "github.com/onsi/gomega" 27 | "github.com/submariner-io/admiral/pkg/log/kzerolog" 28 | ) 29 | 30 | var _ = BeforeSuite(func() { 31 | flags := flag.NewFlagSet("kzerolog", flag.ExitOnError) 32 | kzerolog.AddFlags(flags) 33 | _ = flags.Parse([]string{"-v=4"}) 34 | 35 | kzerolog.InitK8sLogging() 36 | }) 37 | 38 | func TestNftables(t *testing.T) { 39 | RegisterFailHandler(Fail) 40 | RunSpecs(t, "NFTables Suite") 41 | } 42 | -------------------------------------------------------------------------------- /pkg/packetfilter/packetfilter_suite_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package packetfilter_test 20 | 21 | import ( 22 | "flag" 23 | "testing" 24 | 25 | . "github.com/onsi/ginkgo/v2" 26 | . "github.com/onsi/gomega" 27 | "github.com/submariner-io/admiral/pkg/log/kzerolog" 28 | ) 29 | 30 | var _ = BeforeSuite(func() { 31 | flags := flag.NewFlagSet("kzerolog", flag.ExitOnError) 32 | kzerolog.AddFlags(flags) 33 | _ = flags.Parse([]string{"-v=4"}) 34 | 35 | kzerolog.InitK8sLogging() 36 | }) 37 | 38 | func TestPacketFilter(t *testing.T) { 39 | RegisterFailHandler(Fail) 40 | RunSpecs(t, "PacketFilter Suite") 41 | } 42 | -------------------------------------------------------------------------------- /pkg/pinger/fake/pinger.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package fake 20 | 21 | import ( 22 | "sync/atomic" 23 | "time" 24 | 25 | . "github.com/onsi/ginkgo/v2" 26 | . "github.com/onsi/gomega" 27 | "github.com/submariner-io/submariner/pkg/pinger" 28 | ) 29 | 30 | type Pinger struct { 31 | ip string 32 | latencyInfo atomic.Value 33 | start chan struct{} 34 | stop chan struct{} 35 | } 36 | 37 | func NewPinger(ip string) *Pinger { 38 | return &Pinger{ 39 | ip: ip, 40 | start: make(chan struct{}), 41 | stop: make(chan struct{}), 42 | } 43 | } 44 | 45 | func (p *Pinger) Start() { 46 | defer GinkgoRecover() 47 | Expect(p.start).ToNot(BeClosed()) 48 | close(p.start) 49 | } 50 | 51 | func (p *Pinger) Stop() { 52 | defer GinkgoRecover() 53 | Expect(p.stop).ToNot(BeClosed()) 54 | close(p.stop) 55 | } 56 | 57 | func (p *Pinger) GetLatencyInfo() *pinger.LatencyInfo { 58 | o := p.latencyInfo.Load() 59 | if o != nil { 60 | info := o.(pinger.LatencyInfo) 61 | return &info 62 | } 63 | 64 | return nil 65 | } 66 | 67 | func (p *Pinger) SetLatencyInfo(info *pinger.LatencyInfo) { 68 | p.latencyInfo.Store(*info) 69 | } 70 | 71 | func (p *Pinger) GetIP() string { 72 | return p.ip 73 | } 74 | 75 | func (p *Pinger) AwaitStart() { 76 | Eventually(p.start, 5).Should(BeClosed(), "Start was not called") 77 | } 78 | 79 | func (p *Pinger) AwaitNoStart() { 80 | Consistently(p.start, 500*time.Millisecond).ShouldNot(BeClosed(), "Start was unexpectedly called") 81 | } 82 | 83 | func (p *Pinger) AwaitStop() { 84 | Eventually(p.stop, 5).Should(BeClosed(), "Stop was not called") 85 | } 86 | 87 | func (p *Pinger) AwaitNoStop() { 88 | Consistently(p.stop, 500*time.Millisecond).ShouldNot(BeClosed(), "Stop was unexpectedly called") 89 | } 90 | -------------------------------------------------------------------------------- /pkg/pinger/pinger_suite_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package pinger_test 20 | 21 | import ( 22 | "testing" 23 | 24 | . "github.com/onsi/ginkgo/v2" 25 | . "github.com/onsi/gomega" 26 | "github.com/submariner-io/admiral/pkg/log/kzerolog" 27 | ) 28 | 29 | func init() { 30 | kzerolog.AddFlags(nil) 31 | } 32 | 33 | var _ = BeforeSuite(func() { 34 | kzerolog.InitK8sLogging() 35 | }) 36 | 37 | func TestPinger(t *testing.T) { 38 | RegisterFailHandler(Fail) 39 | RunSpecs(t, "Pinger Suite") 40 | } 41 | -------------------------------------------------------------------------------- /pkg/pinger/statistics.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package pinger 20 | 21 | import ( 22 | "math" 23 | ) 24 | 25 | type statistics struct { 26 | previousRtts []int64 27 | sum int64 28 | mean int64 29 | stdDev int64 30 | lastRtt int64 31 | minRtt int64 32 | maxRtt int64 33 | sqrDiff int64 34 | index int64 35 | size int64 36 | } 37 | 38 | func (s *statistics) update(rtt int64) { 39 | s.lastRtt = rtt 40 | 41 | if s.index == s.size { 42 | // Resetting since the incremental SD calculated have an error factor due to truncation which 43 | // could be significant as count increases. 44 | s.index = 2 45 | s.previousRtts[0] = s.previousRtts[s.size-2] 46 | s.previousRtts[1] = s.previousRtts[s.size-1] 47 | s.sum = s.previousRtts[0] + s.previousRtts[1] 48 | s.mean = s.sum / 2 49 | 50 | s.sqrDiff = (s.previousRtts[0]-s.mean)*(s.previousRtts[0]-s.mean) + 51 | (s.previousRtts[1]-s.mean)*(s.previousRtts[1]-s.mean) 52 | } 53 | 54 | if s.index+1 > 1 { 55 | s.previousRtts[s.index] = rtt 56 | if s.minRtt == 0 || s.minRtt > rtt { 57 | s.minRtt = rtt 58 | } 59 | 60 | if s.maxRtt < rtt { 61 | s.maxRtt = rtt 62 | } 63 | 64 | s.sum += rtt 65 | oldMean := s.mean 66 | s.mean = s.sum / (s.index + 1) 67 | 68 | s.sqrDiff += (rtt - oldMean) * (rtt - s.mean) 69 | s.stdDev = int64(math.Sqrt(float64(s.sqrDiff / (s.index + 1)))) 70 | } else { 71 | s.sum = rtt 72 | s.sqrDiff = 0 73 | s.minRtt = rtt 74 | s.maxRtt = rtt 75 | s.mean = rtt 76 | s.sum = rtt 77 | s.previousRtts[s.index] = rtt 78 | s.stdDev = 0 79 | } 80 | 81 | s.index++ 82 | } 83 | -------------------------------------------------------------------------------- /pkg/pinger/statistics_internal_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package pinger 20 | 21 | import ( 22 | . "github.com/onsi/ginkgo/v2" 23 | . "github.com/onsi/gomega" 24 | ) 25 | 26 | var _ = Describe("Statistics", func() { 27 | const ( 28 | testMinRTT int64 = 404351 29 | testMaxRTT int64 = 1048263 30 | testLastRTT int64 = 1044609 31 | testNewMinRTT int64 = 404300 32 | testNewMaxRTT int64 = 1048264 33 | testNewLastRTT int64 = 609555 34 | ) 35 | 36 | When("update is called with a sample space", func() { 37 | It("should correctly compute the statistics", func() { 38 | size := 10 39 | statistics := &statistics{ 40 | size: int64(size), 41 | previousRtts: make([]int64, size), 42 | } 43 | 44 | sampleSpace := [10]int64{testMinRTT, 490406, 530333, 609556, 609650, 685106, 726265, 785707, testMaxRTT, testLastRTT} 45 | expectedMean := int64(693424) 46 | expectedSD := int64(205994) 47 | 48 | for _, v := range sampleSpace { 49 | statistics.update(v) 50 | } 51 | 52 | Expect(statistics.maxRtt).To(Equal(testMaxRTT)) 53 | Expect(statistics.minRtt).To(Equal(testMinRTT)) 54 | Expect(statistics.lastRtt).To(Equal(testLastRTT)) 55 | Expect(statistics.mean).To(Equal(expectedMean)) 56 | Expect(statistics.stdDev).To(Equal(expectedSD)) 57 | 58 | statistics.update(testNewMinRTT) 59 | statistics.update(testNewMaxRTT) 60 | statistics.update(testNewLastRTT) 61 | 62 | newExpectedMean := int64(830998) 63 | newExpectedSD := int64(272450) 64 | 65 | Expect(statistics.maxRtt).To(Equal(testNewMaxRTT)) 66 | Expect(statistics.minRtt).To(Equal(testNewMinRTT)) 67 | Expect(statistics.lastRtt).To(Equal(testNewLastRTT)) 68 | Expect(statistics.mean).To(Equal(newExpectedMean)) 69 | Expect(statistics.stdDev).To(Equal(newExpectedSD)) 70 | }) 71 | }) 72 | }) 73 | -------------------------------------------------------------------------------- /pkg/pod/pod.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package pod 20 | 21 | import ( 22 | "context" 23 | "fmt" 24 | "os" 25 | 26 | "github.com/pkg/errors" 27 | "github.com/submariner-io/admiral/pkg/log" 28 | submV1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 29 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 30 | "k8s.io/apimachinery/pkg/types" 31 | "k8s.io/client-go/kubernetes" 32 | logf "sigs.k8s.io/controller-runtime/pkg/log" 33 | ) 34 | 35 | type GatewayPodInterface interface { 36 | SetHALabels(status submV1.HAStatus) error 37 | } 38 | 39 | type GatewayPod struct { 40 | namespace string 41 | node string 42 | name string 43 | clientset kubernetes.Interface 44 | } 45 | 46 | var logger = log.Logger{Logger: logf.Log.WithName("Pod")} 47 | 48 | func NewGatewayPod(ctx context.Context, k8sClient kubernetes.Interface) (*GatewayPod, error) { 49 | gp := &GatewayPod{ 50 | namespace: os.Getenv("SUBMARINER_NAMESPACE"), 51 | node: os.Getenv("NODE_NAME"), 52 | name: os.Getenv("POD_NAME"), 53 | clientset: k8sClient, 54 | } 55 | 56 | if gp.namespace == "" { 57 | return nil, errors.New("SUBMARINER_NAMESPACE environment variable missing") 58 | } 59 | 60 | if gp.node == "" { 61 | return nil, errors.New("NODE_NAME environment variable missing") 62 | } 63 | 64 | if gp.name == "" { 65 | return nil, errors.New("POD_NAME environment variable missing") 66 | } 67 | 68 | if err := gp.SetHALabels(ctx, submV1.HAStatusPassive); err != nil { 69 | logger.Warningf("Error updating pod label: %s", err) 70 | } 71 | 72 | return gp, nil 73 | } 74 | 75 | const patchFormat = `{"metadata": {"labels": {"gateway.submariner.io/node": "%s", "gateway.submariner.io/status": "%s"}}}` 76 | 77 | func (gp *GatewayPod) SetHALabels(ctx context.Context, status submV1.HAStatus) error { 78 | podsInterface := gp.clientset.CoreV1().Pods(gp.namespace) 79 | patch := fmt.Sprintf(patchFormat, gp.node, status) 80 | 81 | _, err := podsInterface.Patch(ctx, gp.name, types.MergePatchType, []byte(patch), v1.PatchOptions{}) 82 | if err != nil { 83 | return errors.Wrapf(err, "Error patching own pod %q in namespace %q with %s", gp.name, gp.namespace, patch) 84 | } 85 | 86 | return nil 87 | } 88 | -------------------------------------------------------------------------------- /pkg/port/ports.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package port 20 | 21 | const ( 22 | NATTDiscovery = 4490 23 | ExternalTunnel = 4500 24 | IntraClusterVxLAN = 4800 25 | ) 26 | -------------------------------------------------------------------------------- /pkg/routeagent_driver/cabledriver/vxlan_tunnel_cleanup_handler.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package cabledriver 20 | 21 | import ( 22 | "github.com/submariner-io/admiral/pkg/log" 23 | "github.com/submariner-io/submariner/pkg/cable/vxlan" 24 | "github.com/submariner-io/submariner/pkg/event" 25 | "github.com/submariner-io/submariner/pkg/netlink" 26 | logf "sigs.k8s.io/controller-runtime/pkg/log" 27 | ) 28 | 29 | type vxlanCleanup struct { 30 | event.HandlerBase 31 | } 32 | 33 | var logger = log.Logger{Logger: logf.Log.WithName("CableDriver")} 34 | 35 | func NewVXLANCleanup() event.Handler { 36 | return &vxlanCleanup{} 37 | } 38 | 39 | func (h *vxlanCleanup) GetNetworkPlugins() []string { 40 | return []string{event.AnyNetworkPlugin} 41 | } 42 | 43 | func (h *vxlanCleanup) GetName() string { 44 | return "VXLAN cleanup handler" 45 | } 46 | 47 | func (h *vxlanCleanup) TransitionToNonGateway() error { 48 | logger.Infof("Cleaning up the routes") 49 | 50 | return netlink.DeleteIfaceAndAssociatedRoutes(vxlan.VxlanIface, vxlan.TableID) //nolint:wrapcheck // No need to wrap this error 51 | } 52 | -------------------------------------------------------------------------------- /pkg/routeagent_driver/cabledriver/xfrm_cleanup_handler.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package cabledriver 20 | 21 | import ( 22 | "errors" 23 | 24 | "github.com/submariner-io/submariner/pkg/event" 25 | "github.com/submariner-io/submariner/pkg/netlink" 26 | k8snet "k8s.io/utils/net" 27 | ) 28 | 29 | type xrfmCleanup struct { 30 | event.HandlerBase 31 | } 32 | 33 | func NewXRFMCleanupHandler() event.Handler { 34 | return &xrfmCleanup{} 35 | } 36 | 37 | func (h *xrfmCleanup) GetName() string { 38 | return "xfrm" 39 | } 40 | 41 | func (h *xrfmCleanup) GetNetworkPlugins() []string { 42 | return []string{event.AnyNetworkPlugin} 43 | } 44 | 45 | func (h *xrfmCleanup) TransitionToNonGateway() error { 46 | logger.Info("Transitioned to non-Gateway, cleaning up the IPsec xfrm rules") 47 | 48 | errv6 := netlink.DeleteXfrmRules(k8snet.IPv6) 49 | errv4 := netlink.DeleteXfrmRules(k8snet.IPv4) 50 | 51 | return errors.Join(errv6, errv4) 52 | } 53 | -------------------------------------------------------------------------------- /pkg/routeagent_driver/constants/constants.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package constants 20 | 21 | const ( 22 | // IPTable chains used by RouteAgent. 23 | SmPostRoutingChain = "SUBMARINER-POSTROUTING" 24 | SmPostRoutingMssChain = "SUBMARINER-POSTROUTING-MSS" 25 | SmInputChain = "SUBMARINER-INPUT" 26 | SmForwardChain = "SUBMARINER-FORWARD" 27 | PostRoutingChain = "POSTROUTING" 28 | InputChain = "INPUT" 29 | ForwardChain = "FORWARD" 30 | MangleTable = "mangle" 31 | 32 | RouteAgentInterClusterNetworkTableID = 149 33 | 34 | // To support connectivity for Pods with HostNetworking on the GatewayNode, we program 35 | // certain routing rules in table 150. As part of these routes, we set the source-ip of 36 | // the egress traffic to the corresponding CNIInterfaceIP on that host. 37 | RouteAgentHostNetworkTableID = 150 38 | 39 | NATTable = "nat" 40 | FilterTable = "filter" 41 | 42 | OvnTransitSwitchIPAnnotation = "k8s.ovn.org/node-transit-switch-port-ifaddr" 43 | OvnZoneAnnotation = "k8s.ovn.org/zone-name" 44 | ) 45 | -------------------------------------------------------------------------------- /pkg/routeagent_driver/environment/env.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package environment 20 | 21 | type Specification struct { 22 | ClusterID string 23 | Namespace string 24 | ClusterCidr []string 25 | ServiceCidr []string 26 | GlobalCidr []string 27 | ProfilePort int `default:"32782"` 28 | Uninstall bool 29 | } 30 | -------------------------------------------------------------------------------- /pkg/routeagent_driver/handlers/handlers_suite_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package handlers_test 20 | 21 | import ( 22 | "testing" 23 | 24 | . "github.com/onsi/ginkgo/v2" 25 | . "github.com/onsi/gomega" 26 | "github.com/submariner-io/admiral/pkg/log/kzerolog" 27 | submV1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 28 | "k8s.io/client-go/kubernetes/scheme" 29 | ) 30 | 31 | func init() { 32 | kzerolog.AddFlags(nil) 33 | } 34 | 35 | var _ = BeforeSuite(func() { 36 | kzerolog.InitK8sLogging() 37 | Expect(submV1.AddToScheme(scheme.Scheme)).To(Succeed()) 38 | }) 39 | 40 | func TestHandlers(t *testing.T) { 41 | RegisterFailHandler(Fail) 42 | RunSpecs(t, "Handlers Suite") 43 | } 44 | -------------------------------------------------------------------------------- /pkg/routeagent_driver/handlers/healthchecker/health_checker_suite_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package healthchecker_test 20 | 21 | import ( 22 | "testing" 23 | 24 | . "github.com/onsi/ginkgo/v2" 25 | . "github.com/onsi/gomega" 26 | "github.com/submariner-io/admiral/pkg/log/kzerolog" 27 | submarinerv1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 28 | "k8s.io/client-go/kubernetes/scheme" 29 | ) 30 | 31 | func init() { 32 | kzerolog.AddFlags(nil) 33 | } 34 | 35 | var _ = BeforeSuite(func() { 36 | kzerolog.InitK8sLogging() 37 | Expect(submarinerv1.AddToScheme(scheme.Scheme)).To(Succeed()) 38 | }) 39 | 40 | func TestHealthChecker(t *testing.T) { 41 | RegisterFailHandler(Fail) 42 | RunSpecs(t, "RouteAgent Health Checker Suite") 43 | } 44 | -------------------------------------------------------------------------------- /pkg/routeagent_driver/handlers/kubeproxy/constants.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package kubeproxy 20 | 21 | const ( 22 | VxLANIface = "vx-submariner" 23 | VxInterfaceWorker = 0 24 | VxInterfaceGateway = 1 25 | 26 | // Why VxLANVTepNetworkPrefixCIDR is 240.0.0.0/8? 27 | // On VxLAN interfaces we need a unique IPAddress which does not collide with the 28 | // host ip-address. This is going to be tricky as currently there is no specific 29 | // CIDR in K8s that can be used for this purpose. One option is to take this as an 30 | // input from the user (i.e., as a configuration parameter), but we want to avoid 31 | // any additional inputs particularly if there is a way to automate it. 32 | 33 | // So, the approach we are taking is to derive the VxLAN ip from the hostIPAddress 34 | // as shown below. 35 | // For example: Say, the host ipaddress is "192.168.1.100/16", we prepend 240 to the 36 | // host-ip address, derive the vxlan vtepIP (i.e., 240.168.1.100/8) and configure it 37 | // on the VxLAN interface. 38 | 39 | // The reason behind choosing 240 is that "240.0.0.0/4" is a Reserved IPAddress [*] 40 | // which normally will not be assigned on any of the hosts. Also, note that the VxLAN 41 | // IPs are only used within the local cluster and traffic will not leave the cluster 42 | // with the VxLAN ipaddress. 43 | // [*] https://en.wikipedia.org/wiki/Reserved_IP_addresses 44 | 45 | VxLANVTepNetworkPrefixCIDR = "240.0.0.0/8" 46 | 47 | // For IPv6, we use the fd00:100:100::/96 prefix and embed the last 4 bytes of the source IP, 48 | // to the last 4 bytes of the VTEP address. 49 | // For example: private IP fd00:abcd::1234:5678 will be translated to fd00:100:100::1234:5678 . 50 | 51 | VxLANVTepNetworkPrefixCIDRIPv6 = "fd00:100:100::/96" 52 | 53 | SmRouteAgentFilter = "app=submariner-routeagent" 54 | ) 55 | 56 | type Operation int 57 | 58 | const ( 59 | Add Operation = iota 60 | Delete 61 | Flush 62 | ) 63 | -------------------------------------------------------------------------------- /pkg/routeagent_driver/handlers/kubeproxy/gw_transition.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package kubeproxy 20 | 21 | import ( 22 | "github.com/submariner-io/admiral/pkg/log" 23 | netlinkAPI "github.com/submariner-io/submariner/pkg/netlink" 24 | "github.com/submariner-io/submariner/pkg/routeagent_driver/constants" 25 | ) 26 | 27 | func (kp *SyncHandler) TransitionToNonGateway() error { 28 | logger.V(log.DEBUG).Info("The current node is no longer a Gateway") 29 | 30 | kp.cleanVxSubmarinerRoutes() 31 | // If the active Gateway transitions to a new node, we flush the HostNetwork routing table. 32 | kp.updateRoutingRulesForHostNetworkSupport(nil, Flush) 33 | 34 | err := kp.netLink.RuleDelIfPresent(netlinkAPI.NewTableRule(constants.RouteAgentHostNetworkTableID, kp.ipFamily)) 35 | if err != nil { 36 | logger.Errorf(err, "Unable to delete ip rule to table %d on non-Gateway node %s", 37 | constants.RouteAgentHostNetworkTableID, kp.hostname) 38 | } 39 | 40 | return nil 41 | } 42 | 43 | func (kp *SyncHandler) TransitionToGateway() error { 44 | logger.V(log.DEBUG).Info("The current node has become a Gateway") 45 | 46 | kp.cleanVxSubmarinerRoutes() 47 | 48 | logger.Infof("Creating the vxlan interface: %s on the gateway node", kp.vxlanIface) 49 | 50 | kp.activeEndpointHostname = kp.hostname 51 | 52 | err := kp.createVxLANInterface(VxInterfaceGateway, nil) 53 | if err != nil { 54 | logger.Fatalf("Unable to create VxLAN interface on gateway node (%s): %v", kp.hostname, err) 55 | } 56 | 57 | err = kp.netLink.RuleAddIfNotPresent(netlinkAPI.NewTableRule(constants.RouteAgentHostNetworkTableID, kp.ipFamily)) 58 | if err != nil { 59 | logger.Errorf(err, "Unable to add ip rule to table %d on Gateway node %s", 60 | constants.RouteAgentHostNetworkTableID, kp.hostname) 61 | } 62 | 63 | // Add routes to the new endpoint on the GatewayNode. 64 | kp.updateRoutingRulesForHostNetworkSupport(kp.remoteSubnets.UnsortedList(), Add) 65 | 66 | return nil 67 | } 68 | -------------------------------------------------------------------------------- /pkg/routeagent_driver/handlers/kubeproxy/gw_transition_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package kubeproxy_test 20 | 21 | import ( 22 | . "github.com/onsi/ginkgo/v2" 23 | . "github.com/onsi/gomega" 24 | submarinerv1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 25 | "github.com/submariner-io/submariner/pkg/routeagent_driver/constants" 26 | ) 27 | 28 | func testGatewayTransition() { 29 | t := newTestDriver() 30 | 31 | When("transition to gateway", func() { 32 | var localHostEP *submarinerv1.Endpoint 33 | 34 | JustBeforeEach(func() { 35 | t.CreateEndpoint(t.remoteEndpoint) 36 | localHostEP = t.CreateLocalHostEndpoint() 37 | }) 38 | 39 | It("should add the VxLAN interface", func() { 40 | Expect(t.awaitVxlanLink().Group).To(BeNil()) 41 | }) 42 | 43 | It("should add a routing rule for the RouteAgentHostNetworkTableID", func() { 44 | t.netLink.AwaitRule(constants.RouteAgentHostNetworkTableID, "", "") 45 | }) 46 | 47 | It("should add host networking routing rules for the remote subnets", func() { 48 | t.verifyHostNetworkingRoutes() 49 | }) 50 | 51 | Context("and previous VxLAN routes are present", func() { 52 | BeforeEach(func() { 53 | t.addVxLANRoute(remoteIPv4Subnet1) 54 | }) 55 | 56 | It("should remove them", func() { 57 | t.netLink.AwaitNoDstRoutes(vxLanInterfaceIndex, 0, remoteIPv4Subnet1) 58 | }) 59 | }) 60 | 61 | Context("and Node addresses are present", func() { 62 | JustBeforeEach(func() { 63 | t.CreateNode(newNode(nodeIPv4Address1)) 64 | t.CreateNode(newNode(nodeIPv4Address2)) 65 | }) 66 | 67 | It("should add an FDB entry on the VxLAN interface for each address", func() { 68 | t.netLink.AwaitNeighbors(vxLanInterfaceIndex, nodeIPv4Address1, nodeIPv4Address2) 69 | }) 70 | }) 71 | 72 | Context("and then to non-gateway", func() { 73 | JustBeforeEach(func() { 74 | t.netLink.AwaitRule(constants.RouteAgentHostNetworkTableID, "", "") 75 | t.DeleteEndpoint(localHostEP.Name) 76 | }) 77 | 78 | It("should remove the routing rule for the RouteAgentHostNetworkTableID", func() { 79 | t.netLink.AwaitNoRule(constants.RouteAgentHostNetworkTableID, "", "") 80 | }) 81 | 82 | It("should remove host networking routing rules for the remote subnets", func() { 83 | t.verifyNoHostNetworkingRoutes() 84 | }) 85 | }) 86 | }) 87 | } 88 | -------------------------------------------------------------------------------- /pkg/routeagent_driver/handlers/kubeproxy/node_handler.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package kubeproxy 20 | 21 | import ( 22 | "net" 23 | 24 | "github.com/submariner-io/admiral/pkg/log" 25 | k8sV1 "k8s.io/api/core/v1" 26 | k8snet "k8s.io/utils/net" 27 | ) 28 | 29 | func (kp *SyncHandler) NodeCreated(node *k8sV1.Node) error { 30 | logger.V(log.DEBUG).Infof("A Node with name %q and addresses %#v has been added to the cluster", 31 | node.Name, node.Status.Addresses) 32 | 33 | for i, addr := range node.Status.Addresses { 34 | if addr.Type == k8sV1.NodeInternalIP && k8snet.IPFamilyOfString(node.Status.Addresses[i].Address) == kp.ipFamily { 35 | kp.populateRemoteVtepIps(node.Status.Addresses[i].Address, Add) 36 | break 37 | } 38 | } 39 | 40 | return nil 41 | } 42 | 43 | func (kp *SyncHandler) NodeRemoved(node *k8sV1.Node) error { 44 | logger.V(log.DEBUG).Infof("A Node with name %q has been removed", node.Name) 45 | 46 | for i, addr := range node.Status.Addresses { 47 | if addr.Type == k8sV1.NodeInternalIP { 48 | kp.populateRemoteVtepIps(node.Status.Addresses[i].Address, Delete) 49 | break 50 | } 51 | } 52 | 53 | return nil 54 | } 55 | 56 | func (kp *SyncHandler) populateRemoteVtepIps(vtepIP string, operation Operation) { 57 | // The remoteVTEP info is cached on all the routeAgent nodes and is used when there is a Gateway transition. 58 | if operation == Add && !kp.remoteVTEPs.Has(vtepIP) { 59 | kp.remoteVTEPs.Insert(vtepIP) 60 | } else if operation == Delete { 61 | kp.remoteVTEPs.Delete(vtepIP) 62 | } 63 | 64 | isOnGateway := kp.State().IsOnGateway() 65 | 66 | logger.V(log.DEBUG).Infof("populateRemoteVtepIps is called with vtepIP %s, isGatewayNode %t", vtepIP, isOnGateway) 67 | 68 | if isOnGateway && kp.vxlanDevice != nil { 69 | switch operation { 70 | case Add: 71 | if err := kp.vxlanDevice.AddFDB(net.ParseIP(vtepIP), "00:00:00:00:00:00"); err != nil { 72 | logger.Errorf(err, "Failed to add FDB entry on the Gateway Node vxlan iface") 73 | } 74 | case Delete: 75 | if err := kp.vxlanDevice.DelFDB(net.ParseIP(vtepIP), "00:00:00:00:00:00"); err != nil { 76 | logger.Errorf(err, "Failed to delete FDB entry on the Gateway Node vxlan iface") 77 | } 78 | case Flush: 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /pkg/routeagent_driver/handlers/kubeproxy/sync_handler_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package kubeproxy_test 20 | 21 | import ( 22 | . "github.com/onsi/ginkgo/v2" 23 | . "github.com/onsi/gomega" 24 | "github.com/submariner-io/submariner/pkg/routeagent_driver/constants" 25 | "github.com/submariner-io/submariner/pkg/routeagent_driver/handlers/kubeproxy" 26 | corev1 "k8s.io/api/core/v1" 27 | k8snet "k8s.io/utils/net" 28 | ) 29 | 30 | var _ = Describe("SyncHandler", func() { 31 | Describe("Endpoints", testEndpoints) 32 | Describe("Gateway transition", testGatewayTransition) 33 | Describe("Nodes", testNodes) 34 | Describe("Uninstall", testUninstall) 35 | Describe("Dual-stack", testDualStack) 36 | }) 37 | 38 | func testNodes() { 39 | t := newTestDriver() 40 | 41 | var node *corev1.Node 42 | 43 | BeforeEach(func() { 44 | node = newNode(nodeIPv4Address1) 45 | }) 46 | 47 | When("a Node is created and then deleted on a gateway node", func() { 48 | JustBeforeEach(func() { 49 | t.CreateLocalHostEndpoint() 50 | t.CreateNode(node) 51 | }) 52 | 53 | It("should add/remove an FDB entry on the VxLAN interface for each Node address", func() { 54 | t.netLink.AwaitNeighbors(vxLanInterfaceIndex, nodeIPv4Address1) 55 | 56 | t.DeleteNode(node.Name) 57 | t.netLink.AwaitNoNeighbors(vxLanInterfaceIndex, nodeIPv4Address1) 58 | }) 59 | }) 60 | 61 | When("a Node is created on a non-gateway node", func() { 62 | JustBeforeEach(func() { 63 | t.CreateNode(node) 64 | }) 65 | 66 | It("should not add an FDB entry on the VxLAN interface for each Node address", func() { 67 | t.netLink.AwaitNoNeighbors(vxLanInterfaceIndex, nodeIPv4Address1) 68 | }) 69 | }) 70 | } 71 | 72 | func testUninstall() { 73 | t := newTestDriver() 74 | 75 | Context("on Uninstall", func() { 76 | It("should clean up dataplane artifacts", func() { 77 | t.CreateLocalHostEndpoint() 78 | t.netLink.AwaitRule(constants.RouteAgentHostNetworkTableID, "", "") 79 | 80 | Expect(t.handler.Uninstall()).To(Succeed()) 81 | 82 | t.netLink.AwaitNoRule(constants.RouteAgentHostNetworkTableID, "", "") 83 | t.netLink.AwaitNoLink(kubeproxy.GetVxLANInterfaceName(k8snet.IPv4)) 84 | t.verifyNoHostNetworkingRoutes() 85 | }) 86 | }) 87 | } 88 | -------------------------------------------------------------------------------- /pkg/routeagent_driver/handlers/mtu/mtuhandler_suite_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | package mtu_test 19 | 20 | import ( 21 | "testing" 22 | 23 | . "github.com/onsi/ginkgo/v2" 24 | . "github.com/onsi/gomega" 25 | "github.com/submariner-io/admiral/pkg/log/kzerolog" 26 | ) 27 | 28 | func init() { 29 | kzerolog.AddFlags(nil) 30 | } 31 | 32 | var _ = BeforeSuite(func() { 33 | kzerolog.InitK8sLogging() 34 | }) 35 | 36 | func TestMTU(t *testing.T) { 37 | RegisterFailHandler(Fail) 38 | RunSpecs(t, "MTU Handler Suite") 39 | } 40 | -------------------------------------------------------------------------------- /pkg/routeagent_driver/handlers/ovn/constants.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package ovn 20 | 21 | import "time" 22 | 23 | const ( 24 | ovnK8sSubmarinerInterface = "ovn-k8s-sub0" 25 | ovnK8sSubmarinerBridge = "br-submariner" 26 | ovsDBTimeout = 20 * time.Second 27 | ovnCert = "secret://openshift-ovn-kubernetes/ovn-cert/tls.crt" 28 | ovnPrivKey = "secret://openshift-ovn-kubernetes/ovn-cert/tls.key" 29 | ovnCABundle = "configmap://openshift-ovn-kubernetes/ovn-ca/ca-bundle.crt" 30 | ovnKubeService = "ovnkube-db" 31 | defaultOVNUnixSocket = "unix:/var/run/openvswitch/ovnnb_db.sock" 32 | defaultOVNOpenshiftUnixSocket = "unix:/var/run/ovn-ic/ovnnb_db.sock" 33 | ovnNBDBDefaultPort = 6641 34 | defaultOpenshiftOVNNBDB = "ssl:ovnkube-db.openshift-ovn-kubernetes.svc.cluster.local:9641" 35 | ovnPodLabel = "app=ovnkube-node" 36 | ) 37 | -------------------------------------------------------------------------------- /pkg/routeagent_driver/handlers/ovn/env.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package ovn 20 | 21 | import ( 22 | "os" 23 | ) 24 | 25 | func getOVNPrivKeyPath() string { 26 | return getEnvOr("OVN_PK", ovnPrivKey) 27 | } 28 | 29 | func getOVNCertPath() string { 30 | return getEnvOr("OVN_CERT", ovnCert) 31 | } 32 | 33 | func getOVNCaBundlePath() string { 34 | return getEnvOr("OVN_CA", ovnCABundle) 35 | } 36 | 37 | func getEnvOr(key, defaultValue string) string { 38 | s := os.Getenv(key) 39 | if s == "" { 40 | logger.Infof("Using default value %q for %q", defaultValue, key) 41 | return defaultValue 42 | } 43 | 44 | return s 45 | } 46 | -------------------------------------------------------------------------------- /pkg/routeagent_driver/handlers/ovn/subnets.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package ovn 20 | 21 | import "k8s.io/utils/set" 22 | 23 | func (ovn *Handler) getRemoteSubnets() set.Set[string] { 24 | endpointSubnets := set.New[string]() 25 | 26 | endpoints := ovn.State().GetRemoteEndpoints() 27 | for i := range endpoints { 28 | for _, subnet := range endpoints[i].Spec.Subnets { 29 | endpointSubnets.Insert(subnet) 30 | } 31 | } 32 | 33 | return endpointSubnets 34 | } 35 | -------------------------------------------------------------------------------- /pkg/routeagent_driver/handlers/ovn/transit_switch_ip.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package ovn 20 | 21 | import ( 22 | "context" 23 | "os" 24 | "sync/atomic" 25 | 26 | "github.com/pkg/errors" 27 | nodeutil "github.com/submariner-io/submariner/pkg/node" 28 | "github.com/submariner-io/submariner/pkg/routeagent_driver/constants" 29 | corev1 "k8s.io/api/core/v1" 30 | "k8s.io/client-go/kubernetes" 31 | ) 32 | 33 | type TransitSwitchIPGetter interface { 34 | Get() string 35 | } 36 | 37 | type TransitSwitchIP interface { 38 | TransitSwitchIPGetter 39 | Init(ctx context.Context, k8sClient kubernetes.Interface) error 40 | UpdateFrom(node *corev1.Node) (bool, error) 41 | } 42 | 43 | type transitSwitchIPImpl struct { 44 | value atomic.Value 45 | } 46 | 47 | func NewTransitSwitchIP() TransitSwitchIP { 48 | t := &transitSwitchIPImpl{} 49 | t.value.Store("") 50 | 51 | return t 52 | } 53 | 54 | func (t *transitSwitchIPImpl) Get() string { 55 | return t.value.Load().(string) 56 | } 57 | 58 | func (t *transitSwitchIPImpl) Init(ctx context.Context, k8sClient kubernetes.Interface) error { 59 | node, err := nodeutil.GetLocalNode(ctx, k8sClient) 60 | if err != nil { 61 | return errors.Wrap(err, "error getting the local node") 62 | } 63 | 64 | _, err = t.UpdateFrom(node) 65 | 66 | return err 67 | } 68 | 69 | func (t *transitSwitchIPImpl) UpdateFrom(node *corev1.Node) (bool, error) { 70 | if node.Name != os.Getenv("NODE_NAME") { 71 | return false, nil 72 | } 73 | 74 | value, ok := node.Annotations[constants.OvnTransitSwitchIPAnnotation] 75 | if !ok { 76 | logger.Infof("No transit switch IP configured on node %q", node.Name) 77 | return false, nil 78 | } 79 | 80 | transitSwitchIP, err := jsonToIP(value) 81 | if err != nil { 82 | return false, errors.Wrapf(err, "error parsing the transit switch IP") 83 | } 84 | 85 | return transitSwitchIP != t.value.Swap(transitSwitchIP), nil 86 | } 87 | -------------------------------------------------------------------------------- /pkg/routeagent_driver/handlers/ovn/utils.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package ovn 20 | 21 | import ( 22 | "encoding/json" 23 | "fmt" 24 | "net" 25 | 26 | "github.com/pkg/errors" 27 | subMNetLink "github.com/submariner-io/submariner/pkg/netlink" 28 | k8snet "k8s.io/utils/net" 29 | ) 30 | 31 | func getNextHopOnK8sMgmtIntf(family k8snet.IPFamily) (string, error) { 32 | netLink := subMNetLink.New() 33 | 34 | link, err := netLink.LinkByName(OVNK8sMgmntIntfName) 35 | if err != nil { 36 | return "", errors.Wrapf(err, "failed to retrieve link by name %q", OVNK8sMgmntIntfName) 37 | } 38 | 39 | addrs, err := netLink.AddrList(link, family) 40 | if err != nil { 41 | return "", errors.Wrapf(err, "failed to retrieve %v addresses for link %q", family, OVNK8sMgmntIntfName) 42 | } 43 | 44 | for _, addr := range addrs { 45 | if addr.IPNet != nil { 46 | return addr.IPNet.IP.String(), nil 47 | } 48 | } 49 | 50 | return "", errors.Errorf("no %v address found on interface %q", family, OVNK8sMgmntIntfName) 51 | } 52 | 53 | func jsonToIP(jsonData string) (string, error) { 54 | var data map[string]string 55 | 56 | err := json.Unmarshal([]byte(jsonData), &data) 57 | if err != nil { 58 | return "", errors.Wrapf(err, "error unmarshalling the json ip") 59 | } 60 | 61 | ipStr, found := data["ipv4"] 62 | if !found { 63 | return "", errors.New("json data does not contain an 'ipv4' field") 64 | } 65 | 66 | ip, _, err := net.ParseCIDR(ipStr) 67 | if err != nil { 68 | return "", fmt.Errorf("invalid IP CIDR address: %s", ipStr) 69 | } 70 | 71 | return ip.String(), nil 72 | } 73 | -------------------------------------------------------------------------------- /pkg/types/types.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package types 20 | 21 | import ( 22 | subv1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 23 | "github.com/submariner-io/submariner/pkg/cidr" 24 | k8snet "k8s.io/utils/net" 25 | ) 26 | 27 | type SubmarinerCluster struct { 28 | ID string `json:"id"` 29 | Spec subv1.ClusterSpec `json:"spec"` 30 | } 31 | 32 | type SubmarinerEndpoint struct { 33 | Spec subv1.EndpointSpec `json:"spec"` 34 | } 35 | 36 | type SubmarinerSpecification struct { 37 | ClusterCidr []string 38 | GlobalCidr []string 39 | ServiceCidr []string 40 | Broker string 41 | CableDriver string 42 | ClusterID string 43 | Namespace string 44 | PublicIP string 45 | Token string 46 | Debug bool 47 | NATEnabled bool 48 | HealthCheckEnabled bool `default:"true"` 49 | Uninstall bool 50 | HaltOnCertError bool `split_words:"true"` 51 | HealthCheckInterval int 52 | HealthCheckMaxPacketLossCount int 53 | MetricsPort int `default:"32780"` 54 | } 55 | 56 | func (subSpec *SubmarinerSpecification) GetIPFamilies() []k8snet.IPFamily { 57 | return cidr.ExtractIPFamilies(subSpec.ClusterCidr) 58 | } 59 | -------------------------------------------------------------------------------- /pkg/versions/version.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package versions 20 | 21 | import ( 22 | "runtime" 23 | 24 | "github.com/submariner-io/admiral/pkg/log" 25 | ) 26 | 27 | var ( 28 | version = "devel" 29 | gitCommitHash string 30 | gitCommitDate string 31 | ) 32 | 33 | func Log(logger *log.Logger) { 34 | logger.Info("Go Version: " + runtime.Version()) 35 | logger.Info("Go Arch: " + runtime.GOARCH) 36 | logger.Info("Git Commit Hash: " + gitCommitHash) 37 | logger.Info("Git Commit Date: " + gitCommitDate) 38 | } 39 | 40 | // Submariner returns the version info of submariner. 41 | func Submariner() string { 42 | return version 43 | } 44 | -------------------------------------------------------------------------------- /scripts/boilerplate.go.txt: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | -------------------------------------------------------------------------------- /scripts/codegen: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | source "${SCRIPTS_DIR}"/lib/debug_functions 5 | 6 | # Clone the upstream script in a temporary directory 7 | CODEGEN_SCRIPT_DIR=$(mktemp -d) 8 | # shellcheck disable=SC2064 # We want this to be expanded now 9 | trap "rm -rf $CODEGEN_SCRIPT_DIR" EXIT 10 | CODEGEN_SCRIPT="${CODEGEN_SCRIPT_DIR}/kube_codegen.sh" 11 | CODEGEN_RELEASE_TAG=$(go -C tools list -m -f '{{.Version}}' k8s.io/code-generator) 12 | git clone --branch "$CODEGEN_RELEASE_TAG" https://github.com/kubernetes/code-generator "${CODEGEN_SCRIPT_DIR}" 13 | 14 | # shellcheck disable=SC2034 # DEBUG_PRINT is used in the debug trap 15 | DEBUG_PRINT= 16 | # shellcheck disable=SC1090 # No need to lint a third-party script 17 | . "${CODEGEN_SCRIPT}" 18 | kube::codegen::gen_helpers \ 19 | --boilerplate scripts/boilerplate.go.txt \ 20 | pkg/apis 21 | kube::codegen::gen_client \ 22 | --output-dir pkg/client \ 23 | --output-pkg github.com/submariner-io/submariner/pkg/client \ 24 | --boilerplate scripts/boilerplate.go.txt \ 25 | --with-applyconfig \ 26 | --with-watch \ 27 | --one-input-api submariner.io \ 28 | pkg/apis 29 | -------------------------------------------------------------------------------- /scripts/e2e/external/hook: -------------------------------------------------------------------------------- 1 | # shellcheck shell=bash 2 | # shellcheck source=scripts/e2e/external/hook 3 | source "${BASH_SOURCE%/*}"/utils 4 | 5 | ### Hook functions ### 6 | function pre_deploy() { 7 | # Do external-specific setup for K8s cluster and external container 8 | setup_external 9 | 10 | # Add external CIDRs to default CIDRs declared in declare_cidrs 11 | add_external_cidrs 12 | 13 | # Set flag to pass CIDR arguments on deploy 14 | # shellcheck disable=SC2034 15 | PASS_CIDR_ARGS=true 16 | } 17 | 18 | function post_cleanup() { 19 | # Delete external test container on pseudo-ext network 20 | delete_container "${EXTERNAL_APP}" 21 | 22 | # Delete pseudo-ext docker network 23 | delete_container_network "${EXTERNAL_NET}" 24 | } 25 | -------------------------------------------------------------------------------- /sonar-project.properties: -------------------------------------------------------------------------------- 1 | sonar.projectKey=submariner-io_submariner 2 | sonar.projectName=submariner 3 | sonar.organization=submariner-io 4 | sonar.sources=. 5 | sonar.exclusions=**/vendor/**,**/*_test.go,**/test/**,**/fake/**,**/client/**,**/natdiscovery/proto/natdiscovery.pb.go,**/netlink/**,**/event/testing/**,**/zz_generated.deepcopy.go,**/apis/**/register.go,main.go,**/main.go 6 | sonar.tests=. 7 | sonar.test.inclusions=**/*_test.go,**/test/**,**/fake/** 8 | sonar.test.exclusions=**/vendor/**,**/client/** 9 | sonar.go.tests.reportPaths=**/junit.xml 10 | sonar.go.coverage.reportPaths=**/unit.coverprofile 11 | -------------------------------------------------------------------------------- /staticcheck.conf: -------------------------------------------------------------------------------- 1 | initialisms = ["inherit", "CNI", "IPAM", "IPSec", "NAT", "NATT"] -------------------------------------------------------------------------------- /test/e2e/compliance/fips.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package compliance 20 | 21 | import ( 22 | "fmt" 23 | 24 | . "github.com/onsi/ginkgo/v2" 25 | . "github.com/onsi/gomega" 26 | "github.com/submariner-io/shipyard/test/e2e/framework" 27 | subFramework "github.com/submariner-io/submariner/test/e2e/framework" 28 | ) 29 | 30 | const TestLabel = "compliance" 31 | 32 | var _ = Describe("FIPS", Label(TestLabel), func() { 33 | f := subFramework.NewFramework("fips-gateway-status") 34 | 35 | When("FIPS mode is enabled for the active gateway node", func() { 36 | It("should use FIPS mode in the libreswan cable driver", func() { 37 | testFIPSGatewayStatus(f) 38 | }) 39 | }) 40 | }) 41 | 42 | func testFIPSGatewayStatus(f *subFramework.Framework) { 43 | framework.By(fmt.Sprintln("Find a cluster with FIPS enabled")) 44 | 45 | fipsCluster := f.FindFIPSEnabledCluster() 46 | 47 | if fipsCluster == -1 { 48 | framework.Skipf("No cluster found with FIPS enabled, skipping the test...") 49 | } 50 | 51 | fipsClusterName := framework.TestContext.ClusterIDs[fipsCluster] 52 | framework.By(fmt.Sprintf("Found enabled FIPS on cluster %q", fipsClusterName)) 53 | 54 | submEndpoint := f.AwaitSubmarinerEndpoint(fipsCluster, subFramework.NoopCheckEndpoint) 55 | 56 | if submEndpoint.Spec.Backend != "libreswan" { 57 | framework.Skipf("Cluster %q is not using the libreswan cable driver, skipping the test...", fipsClusterName) 58 | } 59 | 60 | framework.By(fmt.Sprintf("Locate active gateway pod on cluster %q", fipsClusterName)) 61 | 62 | gwPod := f.AwaitActiveGatewayPod(fipsCluster, nil) 63 | Expect(gwPod).ToNot(BeNil(), "Did not find an active gateway pod") 64 | 65 | f.TestGatewayNodeFIPSMode(fipsCluster, gwPod.Name) 66 | } 67 | -------------------------------------------------------------------------------- /test/e2e/e2e_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package e2e_test 20 | 21 | import ( 22 | "testing" 23 | 24 | "github.com/submariner-io/shipyard/test/e2e" 25 | _ "github.com/submariner-io/submariner/test/e2e/cluster" 26 | _ "github.com/submariner-io/submariner/test/e2e/compliance" 27 | _ "github.com/submariner-io/submariner/test/e2e/dataplane" 28 | _ "github.com/submariner-io/submariner/test/e2e/redundancy" 29 | ) 30 | 31 | func TestE2E(t *testing.T) { 32 | e2e.RunE2ETests(t) 33 | } 34 | -------------------------------------------------------------------------------- /test/e2e/framework/framework.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package framework 20 | 21 | import ( 22 | . "github.com/onsi/gomega" 23 | "github.com/submariner-io/admiral/pkg/log/kzerolog" 24 | "github.com/submariner-io/shipyard/test/e2e/framework" 25 | submarinerv1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 26 | submarinerClientset "github.com/submariner-io/submariner/pkg/client/clientset/versioned" 27 | "github.com/submariner-io/submariner/pkg/client/informers/externalversions" 28 | "k8s.io/client-go/kubernetes/scheme" 29 | "k8s.io/client-go/tools/cache" 30 | ) 31 | 32 | // Framework supports common operations used by e2e tests; it will keep a client & a namespace for you. 33 | type Framework struct { 34 | *framework.Framework 35 | } 36 | 37 | var SubmarinerClients []*submarinerClientset.Clientset 38 | 39 | func init() { 40 | framework.AddBeforeSuite(beforeSuite) 41 | } 42 | 43 | // NewFramework creates a test framework. 44 | func NewFramework(baseName string) *Framework { 45 | return &Framework{Framework: framework.NewFramework(baseName)} 46 | } 47 | 48 | func beforeSuite() { 49 | kzerolog.InitK8sLogging() 50 | 51 | framework.By("Creating submariner clients") 52 | 53 | err := submarinerv1.AddToScheme(scheme.Scheme) 54 | Expect(err).ToNot(HaveOccurred()) 55 | 56 | for _, restConfig := range framework.RestConfigs { 57 | SubmarinerClients = append(SubmarinerClients, createSubmarinerClient(restConfig)) 58 | } 59 | 60 | framework.DetectGlobalnet() 61 | err = framework.InitNumClusterNodes() 62 | Expect(err).ToNot(HaveOccurred()) 63 | } 64 | 65 | func (f *Framework) GetGatewayInformer(cluster framework.ClusterIndex) (cache.SharedIndexInformer, chan struct{}) { 66 | stopCh := make(chan struct{}) 67 | informerFactory := externalversions.NewSharedInformerFactory(SubmarinerClients[cluster], 0) 68 | informer := informerFactory.Submariner().V1().Gateways().Informer() 69 | 70 | go informer.Run(stopCh) 71 | Expect(cache.WaitForCacheSync(stopCh, informer.HasSynced)).To(BeTrue()) 72 | 73 | return informer, stopCh 74 | } 75 | -------------------------------------------------------------------------------- /test/e2e/framework/gateways.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package framework 20 | 21 | import ( 22 | . "github.com/onsi/gomega" 23 | "github.com/submariner-io/shipyard/test/e2e/framework" 24 | submarinerv1 "github.com/submariner-io/submariner/pkg/apis/submariner.io/v1" 25 | "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" 26 | "k8s.io/apimachinery/pkg/runtime" 27 | ) 28 | 29 | func (f *Framework) AwaitGatewayWithStatus(cluster framework.ClusterIndex, name string, 30 | status submarinerv1.HAStatus, 31 | ) *submarinerv1.Gateway { 32 | return toGateway(f.Framework.AwaitGatewayWithStatus(cluster, name, string(status))) 33 | } 34 | 35 | func (f *Framework) AwaitGatewaysWithStatus(cluster framework.ClusterIndex, status submarinerv1.HAStatus) []submarinerv1.Gateway { 36 | return toGateways(f.Framework.AwaitGatewaysWithStatus(cluster, string(status))) 37 | } 38 | 39 | func (f *Framework) AwaitGatewayFullyConnected(cluster framework.ClusterIndex, name string) *submarinerv1.Gateway { 40 | return toGateway(f.Framework.AwaitGatewayFullyConnected(cluster, name)) 41 | } 42 | 43 | func (f *Framework) GetGatewaysWithHAStatus(cluster framework.ClusterIndex, status submarinerv1.HAStatus) []submarinerv1.Gateway { 44 | return toGateways(f.Framework.GetGatewaysWithHAStatus(cluster, string(status))) 45 | } 46 | 47 | func FindClusterWithSingleGateway() framework.ClusterIndex { 48 | for cluster := range framework.TestContext.ClusterIDs { 49 | gatewayNodes := framework.FindGatewayNodes(framework.ClusterIndex(cluster)) 50 | if len(gatewayNodes) == 1 { 51 | return framework.ClusterIndex(cluster) 52 | } 53 | } 54 | 55 | return -1 56 | } 57 | 58 | func toGateway(from *unstructured.Unstructured) *submarinerv1.Gateway { 59 | to := &submarinerv1.Gateway{} 60 | Expect(runtime.DefaultUnstructuredConverter.FromUnstructured(from.Object, to)).To(Succeed()) 61 | 62 | return to 63 | } 64 | 65 | func toGateways(from []unstructured.Unstructured) []submarinerv1.Gateway { 66 | gateways := make([]submarinerv1.Gateway, len(from)) 67 | for i := range from { 68 | gateways[i] = *toGateway(&from[i]) 69 | } 70 | 71 | return gateways 72 | } 73 | -------------------------------------------------------------------------------- /test/external/e2e_external_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | 4 | Copyright Contributors to the Submariner project. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package external_test 20 | 21 | import ( 22 | "testing" 23 | 24 | "github.com/submariner-io/shipyard/test/e2e" 25 | _ "github.com/submariner-io/submariner/test/external/dataplane" 26 | ) 27 | 28 | func TestE2E(t *testing.T) { 29 | e2e.RunE2ETests(t) 30 | } 31 | -------------------------------------------------------------------------------- /tools/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/submariner-io/submariner/tools 2 | 3 | go 1.23.0 4 | 5 | require ( 6 | github.com/uw-labs/lichen v0.1.7 7 | k8s.io/code-generator v0.32.1 8 | ) 9 | 10 | require ( 11 | github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect 12 | github.com/emicklei/go-restful/v3 v3.11.0 // indirect 13 | github.com/go-logr/logr v1.4.2 // indirect 14 | github.com/go-openapi/jsonpointer v0.21.0 // indirect 15 | github.com/go-openapi/jsonreference v0.20.2 // indirect 16 | github.com/go-openapi/swag v0.23.0 // indirect 17 | github.com/golang/protobuf v1.5.4 // indirect 18 | github.com/google/gnostic-models v0.6.8 // indirect 19 | github.com/google/gofuzz v1.2.0 // indirect 20 | github.com/google/licenseclassifier v0.0.0-20201113175434-78a70215ca36 // indirect 21 | github.com/hashicorp/errwrap v1.0.0 // indirect 22 | github.com/hashicorp/go-multierror v1.1.1 // indirect 23 | github.com/josharian/intern v1.0.0 // indirect 24 | github.com/json-iterator/go v1.1.12 // indirect 25 | github.com/lucasb-eyer/go-colorful v1.2.0 // indirect 26 | github.com/mailru/easyjson v0.7.7 // indirect 27 | github.com/mattn/go-isatty v0.0.14 // indirect 28 | github.com/mattn/go-runewidth v0.0.13 // indirect 29 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect 30 | github.com/modern-go/reflect2 v1.0.2 // indirect 31 | github.com/muesli/termenv v0.11.0 // indirect 32 | github.com/rivo/uniseg v0.2.0 // indirect 33 | github.com/russross/blackfriday/v2 v2.1.0 // indirect 34 | github.com/sergi/go-diff v1.0.0 // indirect 35 | github.com/spf13/pflag v1.0.5 // indirect 36 | github.com/urfave/cli/v2 v2.4.0 // indirect 37 | golang.org/x/mod v0.21.0 // indirect 38 | golang.org/x/sync v0.8.0 // indirect 39 | golang.org/x/sys v0.26.0 // indirect 40 | golang.org/x/text v0.19.0 // indirect 41 | golang.org/x/tools v0.26.0 // indirect 42 | google.golang.org/protobuf v1.35.1 // indirect 43 | gopkg.in/yaml.v2 v2.4.0 // indirect 44 | gopkg.in/yaml.v3 v3.0.1 // indirect 45 | k8s.io/gengo/v2 v2.0.0-20240911193312-2b36238f13e9 // indirect 46 | k8s.io/klog/v2 v2.130.1 // indirect 47 | k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect 48 | sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect 49 | sigs.k8s.io/yaml v1.4.0 // indirect 50 | ) 51 | -------------------------------------------------------------------------------- /tools/tools.go: -------------------------------------------------------------------------------- 1 | //go:build tools 2 | // +build tools 3 | 4 | /* 5 | SPDX-License-Identifier: Apache-2.0 6 | 7 | Copyright Contributors to the Submariner project. 8 | 9 | Licensed under the Apache License, Version 2.0 (the "License"); 10 | you may not use this file except in compliance with the License. 11 | You may obtain a copy of the License at 12 | 13 | http://www.apache.org/licenses/LICENSE-2.0 14 | 15 | Unless required by applicable law or agreed to in writing, software 16 | distributed under the License is distributed on an "AS IS" BASIS, 17 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | See the License for the specific language governing permissions and 19 | limitations under the License. 20 | */ 21 | 22 | // Place any runtime dependencies as imports in this file. 23 | // Go modules will be forced to download and install them. 24 | 25 | package tools 26 | 27 | import ( 28 | _ "github.com/uw-labs/lichen" 29 | _ "k8s.io/code-generator" 30 | ) 31 | --------------------------------------------------------------------------------