From 6a9b2d8a7dc5211f482214d48d38ade3714603f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=A5=96=E5=BB=BA?= Date: Thu, 5 Jan 2023 09:32:53 +0800 Subject: [PATCH] release-1.10: refactor e2e (#2213) --- .github/workflows/build-arm64-image.yaml | 36 +- .github/workflows/build-dpdk-image.yaml | 2 +- .github/workflows/build-kube-ovn-base.yaml | 6 +- .github/workflows/build-x86-image.yaml | 1405 ++++++----------- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/lint.yaml | 8 +- .gitignore | 2 - Makefile | 493 +++--- cmd/pinger/pinger.go | 7 +- cmd/speaker/speaker.go | 7 +- dist/images/install.sh | 1 + go.mod | 5 +- go.sum | 6 - .../clientset/versioned/fake/register.go | 14 +- .../clientset/versioned/scheme/register.go | 14 +- .../listers/clientset/versioned/clientset.go | 121 -- pkg/client/listers/clientset/versioned/doc.go | 20 - .../versioned/fake/clientset_generated.go | 85 - .../listers/clientset/versioned/fake/doc.go | 20 - .../clientset/versioned/fake/register.go | 56 - .../listers/clientset/versioned/scheme/doc.go | 20 - .../clientset/versioned/scheme/register.go | 56 - .../versioned/typed/kubeovn/v1/doc.go | 20 - .../versioned/typed/kubeovn/v1/fake/doc.go | 20 - .../typed/kubeovn/v1/fake/fake_htbqos.go | 122 -- .../typed/kubeovn/v1/fake/fake_ip.go | 122 -- .../kubeovn/v1/fake/fake_iptablesdnatrule.go | 133 -- .../typed/kubeovn/v1/fake/fake_iptableseip.go | 133 -- .../kubeovn/v1/fake/fake_iptablesfiprule.go | 133 -- .../kubeovn/v1/fake/fake_iptablessnatrule.go | 133 -- .../kubeovn/v1/fake/fake_kubeovn_client.go | 108 -- .../typed/kubeovn/v1/fake/fake_ovneip.go | 133 -- .../typed/kubeovn/v1/fake/fake_ovnfip.go | 133 -- .../typed/kubeovn/v1/fake/fake_ovnsnatrule.go | 133 -- .../kubeovn/v1/fake/fake_providernetwork.go | 133 -- .../kubeovn/v1/fake/fake_securitygroup.go | 133 -- .../typed/kubeovn/v1/fake/fake_subnet.go | 133 -- .../kubeovn/v1/fake/fake_switchlbrule.go | 133 -- .../typed/kubeovn/v1/fake/fake_vip.go | 133 -- .../typed/kubeovn/v1/fake/fake_vlan.go | 133 -- .../typed/kubeovn/v1/fake/fake_vpc.go | 133 -- .../typed/kubeovn/v1/fake/fake_vpcdns.go | 133 -- .../kubeovn/v1/fake/fake_vpcnatgateway.go | 122 -- .../typed/kubeovn/v1/generated_expansion.go | 55 - .../versioned/typed/kubeovn/v1/htbqos.go | 168 -- .../versioned/typed/kubeovn/v1/ip.go | 168 -- .../typed/kubeovn/v1/iptablesdnatrule.go | 184 --- .../versioned/typed/kubeovn/v1/iptableseip.go | 184 --- .../typed/kubeovn/v1/iptablesfiprule.go | 184 --- .../typed/kubeovn/v1/iptablessnatrule.go | 184 --- .../typed/kubeovn/v1/kubeovn_client.go | 192 --- .../versioned/typed/kubeovn/v1/ovneip.go | 184 --- .../versioned/typed/kubeovn/v1/ovnfip.go | 184 --- .../versioned/typed/kubeovn/v1/ovnsnatrule.go | 184 --- .../typed/kubeovn/v1/providernetwork.go | 184 --- .../typed/kubeovn/v1/securitygroup.go | 184 --- .../versioned/typed/kubeovn/v1/subnet.go | 184 --- .../typed/kubeovn/v1/switchlbrule.go | 184 --- .../versioned/typed/kubeovn/v1/vip.go | 184 --- .../versioned/typed/kubeovn/v1/vlan.go | 184 --- .../versioned/typed/kubeovn/v1/vpc.go | 184 --- .../versioned/typed/kubeovn/v1/vpcdns.go | 184 --- .../typed/kubeovn/v1/vpcnatgateway.go | 168 -- .../informers/externalversions/factory.go | 180 --- .../informers/externalversions/generic.go | 96 -- .../internalinterfaces/factory_interfaces.go | 40 - .../externalversions/kubeovn/interface.go | 46 - .../externalversions/kubeovn/v1/htbqos.go | 89 -- .../externalversions/kubeovn/v1/interface.go | 164 -- .../externalversions/kubeovn/v1/ip.go | 89 -- .../kubeovn/v1/iptablesdnatrule.go | 89 -- .../kubeovn/v1/iptableseip.go | 89 -- .../kubeovn/v1/iptablesfiprule.go | 89 -- .../kubeovn/v1/iptablessnatrule.go | 89 -- .../externalversions/kubeovn/v1/ovneip.go | 89 -- .../externalversions/kubeovn/v1/ovnfip.go | 89 -- .../kubeovn/v1/ovnsnatrule.go | 89 -- .../kubeovn/v1/providernetwork.go | 89 -- .../kubeovn/v1/securitygroup.go | 89 -- .../externalversions/kubeovn/v1/subnet.go | 89 -- .../kubeovn/v1/switchlbrule.go | 89 -- .../externalversions/kubeovn/v1/vip.go | 89 -- .../externalversions/kubeovn/v1/vlan.go | 89 -- .../externalversions/kubeovn/v1/vpc.go | 89 -- .../externalversions/kubeovn/v1/vpcdns.go | 89 -- .../kubeovn/v1/vpcnatgateway.go | 89 -- .../listers/kubeovn/v1/expansion_generated.go | 91 -- .../listers/listers/kubeovn/v1/htbqos.go | 65 - pkg/client/listers/listers/kubeovn/v1/ip.go | 65 - .../listers/kubeovn/v1/iptablesdnatrule.go | 65 - .../listers/listers/kubeovn/v1/iptableseip.go | 65 - .../listers/kubeovn/v1/iptablesfiprule.go | 65 - .../listers/kubeovn/v1/iptablessnatrule.go | 65 - .../listers/listers/kubeovn/v1/ovneip.go | 65 - .../listers/listers/kubeovn/v1/ovnfip.go | 65 - .../listers/listers/kubeovn/v1/ovnsnatrule.go | 65 - .../listers/kubeovn/v1/providernetwork.go | 65 - .../listers/kubeovn/v1/securitygroup.go | 65 - .../listers/listers/kubeovn/v1/subnet.go | 65 - .../listers/kubeovn/v1/switchlbrule.go | 65 - pkg/client/listers/listers/kubeovn/v1/vip.go | 65 - pkg/client/listers/listers/kubeovn/v1/vlan.go | 65 - pkg/client/listers/listers/kubeovn/v1/vpc.go | 65 - .../listers/listers/kubeovn/v1/vpcdns.go | 65 - .../listers/kubeovn/v1/vpcnatgateway.go | 65 - pkg/daemon/gateway_windows.go | 4 +- pkg/ovn_leader_checker/ovn.go | 6 +- test/e2e-ebpf/e2e_ebpf_suite_test.go | 124 -- test/e2e-ovnic/e2e_suite_test.go | 98 -- .../e2e-underlay-single-nic/e2e_suite_test.go | 45 - test/e2e-underlay-single-nic/kubectl-ko/ko.go | 41 - .../e2e-underlay-single-nic/node/network.json | 0 test/e2e-underlay-single-nic/node/node.go | 228 --- test/e2e/e2e_suite_test.go | 350 ---- test/e2e/framework/framework.go | 388 ----- test/e2e/ip/static_ip.go | 350 ---- test/e2e/kubectl-ko/ko.go | 108 -- test/e2e/network.json | 0 test/e2e/node/node.go | 35 - test/e2e/qos/qos.go | 330 ---- test/e2e/service/service.go | 357 ----- test/e2e/subnet/normal.go | 686 -------- test/e2e/underlay/underlay.go | 865 ---------- yamls/kind.yaml.j2 | 29 +- yamls/ovn-dpdk.yaml | 29 - yamls/ovn-ha.yaml | 29 - 126 files changed, 851 insertions(+), 15046 deletions(-) delete mode 100644 pkg/client/listers/clientset/versioned/clientset.go delete mode 100644 pkg/client/listers/clientset/versioned/doc.go delete mode 100644 pkg/client/listers/clientset/versioned/fake/clientset_generated.go delete mode 100644 pkg/client/listers/clientset/versioned/fake/doc.go delete mode 100644 pkg/client/listers/clientset/versioned/fake/register.go delete mode 100644 pkg/client/listers/clientset/versioned/scheme/doc.go delete mode 100644 pkg/client/listers/clientset/versioned/scheme/register.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/doc.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/doc.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_htbqos.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_ip.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_iptablesdnatrule.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_iptableseip.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_iptablesfiprule.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_iptablessnatrule.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_kubeovn_client.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_ovneip.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_ovnfip.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_ovnsnatrule.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_providernetwork.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_securitygroup.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_subnet.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_switchlbrule.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_vip.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_vlan.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_vpc.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_vpcdns.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_vpcnatgateway.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/generated_expansion.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/htbqos.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/ip.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/iptablesdnatrule.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/iptableseip.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/iptablesfiprule.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/iptablessnatrule.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/kubeovn_client.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/ovneip.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/ovnfip.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/ovnsnatrule.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/providernetwork.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/securitygroup.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/subnet.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/switchlbrule.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/vip.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/vlan.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/vpc.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/vpcdns.go delete mode 100644 pkg/client/listers/clientset/versioned/typed/kubeovn/v1/vpcnatgateway.go delete mode 100644 pkg/client/listers/informers/externalversions/factory.go delete mode 100644 pkg/client/listers/informers/externalversions/generic.go delete mode 100644 pkg/client/listers/informers/externalversions/internalinterfaces/factory_interfaces.go delete mode 100644 pkg/client/listers/informers/externalversions/kubeovn/interface.go delete mode 100644 pkg/client/listers/informers/externalversions/kubeovn/v1/htbqos.go delete mode 100644 pkg/client/listers/informers/externalversions/kubeovn/v1/interface.go delete mode 100644 pkg/client/listers/informers/externalversions/kubeovn/v1/ip.go delete mode 100644 pkg/client/listers/informers/externalversions/kubeovn/v1/iptablesdnatrule.go delete mode 100644 pkg/client/listers/informers/externalversions/kubeovn/v1/iptableseip.go delete mode 100644 pkg/client/listers/informers/externalversions/kubeovn/v1/iptablesfiprule.go delete mode 100644 pkg/client/listers/informers/externalversions/kubeovn/v1/iptablessnatrule.go delete mode 100644 pkg/client/listers/informers/externalversions/kubeovn/v1/ovneip.go delete mode 100644 pkg/client/listers/informers/externalversions/kubeovn/v1/ovnfip.go delete mode 100644 pkg/client/listers/informers/externalversions/kubeovn/v1/ovnsnatrule.go delete mode 100644 pkg/client/listers/informers/externalversions/kubeovn/v1/providernetwork.go delete mode 100644 pkg/client/listers/informers/externalversions/kubeovn/v1/securitygroup.go delete mode 100644 pkg/client/listers/informers/externalversions/kubeovn/v1/subnet.go delete mode 100644 pkg/client/listers/informers/externalversions/kubeovn/v1/switchlbrule.go delete mode 100644 pkg/client/listers/informers/externalversions/kubeovn/v1/vip.go delete mode 100644 pkg/client/listers/informers/externalversions/kubeovn/v1/vlan.go delete mode 100644 pkg/client/listers/informers/externalversions/kubeovn/v1/vpc.go delete mode 100644 pkg/client/listers/informers/externalversions/kubeovn/v1/vpcdns.go delete mode 100644 pkg/client/listers/informers/externalversions/kubeovn/v1/vpcnatgateway.go delete mode 100644 pkg/client/listers/listers/kubeovn/v1/expansion_generated.go delete mode 100644 pkg/client/listers/listers/kubeovn/v1/htbqos.go delete mode 100644 pkg/client/listers/listers/kubeovn/v1/ip.go delete mode 100644 pkg/client/listers/listers/kubeovn/v1/iptablesdnatrule.go delete mode 100644 pkg/client/listers/listers/kubeovn/v1/iptableseip.go delete mode 100644 pkg/client/listers/listers/kubeovn/v1/iptablesfiprule.go delete mode 100644 pkg/client/listers/listers/kubeovn/v1/iptablessnatrule.go delete mode 100644 pkg/client/listers/listers/kubeovn/v1/ovneip.go delete mode 100644 pkg/client/listers/listers/kubeovn/v1/ovnfip.go delete mode 100644 pkg/client/listers/listers/kubeovn/v1/ovnsnatrule.go delete mode 100644 pkg/client/listers/listers/kubeovn/v1/providernetwork.go delete mode 100644 pkg/client/listers/listers/kubeovn/v1/securitygroup.go delete mode 100644 pkg/client/listers/listers/kubeovn/v1/subnet.go delete mode 100644 pkg/client/listers/listers/kubeovn/v1/switchlbrule.go delete mode 100644 pkg/client/listers/listers/kubeovn/v1/vip.go delete mode 100644 pkg/client/listers/listers/kubeovn/v1/vlan.go delete mode 100644 pkg/client/listers/listers/kubeovn/v1/vpc.go delete mode 100644 pkg/client/listers/listers/kubeovn/v1/vpcdns.go delete mode 100644 pkg/client/listers/listers/kubeovn/v1/vpcnatgateway.go delete mode 100644 test/e2e-ebpf/e2e_ebpf_suite_test.go delete mode 100644 test/e2e-ovnic/e2e_suite_test.go delete mode 100644 test/e2e-underlay-single-nic/e2e_suite_test.go delete mode 100644 test/e2e-underlay-single-nic/kubectl-ko/ko.go delete mode 100644 test/e2e-underlay-single-nic/node/network.json delete mode 100644 test/e2e-underlay-single-nic/node/node.go delete mode 100644 test/e2e/e2e_suite_test.go delete mode 100644 test/e2e/framework/framework.go delete mode 100644 test/e2e/ip/static_ip.go delete mode 100644 test/e2e/kubectl-ko/ko.go delete mode 100644 test/e2e/network.json delete mode 100644 test/e2e/node/node.go delete mode 100644 test/e2e/qos/qos.go delete mode 100644 test/e2e/service/service.go delete mode 100644 test/e2e/subnet/normal.go delete mode 100644 test/e2e/underlay/underlay.go diff --git a/.github/workflows/build-arm64-image.yaml b/.github/workflows/build-arm64-image.yaml index 6afe83927ce..decb13ae6a8 100644 --- a/.github/workflows/build-arm64-image.yaml +++ b/.github/workflows/build-arm64-image.yaml @@ -3,6 +3,7 @@ on: pull_request: branches: - master + - release-* paths-ignore: - 'docs/**' - '**.md' @@ -14,24 +15,25 @@ on: - 'docs/**' - '**.md' +concurrency: + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: true + env: - GO_VERSION: '1.18' + GO_VERSION: '1.19' jobs: build: name: Build arm64 - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - - name: Set up Go 1.x - uses: actions/setup-go@v3 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 with: go-version: '${{ env.GO_VERSION }}' check-latest: true id: go - - name: Check out code into the Go module directory - uses: actions/checkout@v3 - - name: Set up QEMU uses: docker/setup-qemu-action@v2 with: @@ -40,21 +42,17 @@ jobs: - name: Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Go Build Cache - uses: actions/cache@v3 - with: - path: /home/runner/.cache/go-build - key: ${{ runner.os }}-arm64-go-build-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-arm64-go-build- + - name: Export Go full version + run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV" - - name: Go Mod Cache + - name: Go Cache uses: actions/cache@v3 with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-arm64-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-arm64-go- + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-${{ env.GO_FULL_VER }}-arm64-${{ hashFiles('**/go.sum') }} + restore-keys: ${{ runner.os }}-${{ env.GO_FULL_VER }}-arm64- - name: Build run: | diff --git a/.github/workflows/build-dpdk-image.yaml b/.github/workflows/build-dpdk-image.yaml index e2b8b19ed06..bcdc6affdc1 100644 --- a/.github/workflows/build-dpdk-image.yaml +++ b/.github/workflows/build-dpdk-image.yaml @@ -4,7 +4,7 @@ on: workflow_dispatch jobs: build: name: Build DPDK - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Check out code uses: actions/checkout@v3 diff --git a/.github/workflows/build-kube-ovn-base.yaml b/.github/workflows/build-kube-ovn-base.yaml index 79428889511..18f2d86ddee 100644 --- a/.github/workflows/build-kube-ovn-base.yaml +++ b/.github/workflows/build-kube-ovn-base.yaml @@ -4,7 +4,7 @@ on: workflow_dispatch jobs: build-amd64: name: Build AMD64 - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Check out code into the Go module directory uses: actions/checkout@v3 @@ -25,7 +25,7 @@ jobs: build-arm64: name: Build ARM64 - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Check out code into the Go module directory uses: actions/checkout@v3 @@ -55,7 +55,7 @@ jobs: - build-arm64 - build-amd64 name: push - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Check out code into the Go module directory uses: actions/checkout@v3 diff --git a/.github/workflows/build-x86-image.yaml b/.github/workflows/build-x86-image.yaml index 980f3ccbe6f..9d512f472c9 100644 --- a/.github/workflows/build-x86-image.yaml +++ b/.github/workflows/build-x86-image.yaml @@ -4,6 +4,7 @@ on: pull_request: branches: - master + - release-* paths-ignore: - 'docs/**' - '**.md' @@ -15,1226 +16,810 @@ on: - 'docs/**' - '**.md' +concurrency: + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: true + env: - GO_VERSION: '1.18' - GOSEC_VERSION: '2.12.0' + GO_VERSION: '1.19' + GOSEC_VERSION: '2.14.0' KIND_VERSION: v0.17.0 HELM_VERSION: v3.10.1 jobs: - build: - name: Build x86 - runs-on: ubuntu-20.04 + build-kube-ovn: + name: Build kube-ovn + runs-on: ubuntu-22.04 steps: - - name: Set up Go 1.x - uses: actions/setup-go@v3 + - uses: actions/checkout@v3 + - uses: docker/setup-buildx-action@v2 + - uses: actions/setup-go@v3 with: go-version: '${{ env.GO_VERSION }}' check-latest: true id: go - - name: Check out code into the Go module directory - uses: actions/checkout@v3 - - - name: Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Go Build Cache - uses: actions/cache@v3 - with: - path: /home/runner/.cache/go-build - key: ${{ runner.os }}-go-x86-build-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go-x86-build- + - name: Export Go full version + run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV" - - name: Go Mod Cache + - name: Go cache uses: actions/cache@v3 with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-${{ env.GO_FULL_VER }}-x86-${{ hashFiles('**/go.sum') }} + restore-keys: ${{ runner.os }}-${{ env.GO_FULL_VER }}-x86- - name: Unit test run: | - go install github.com/onsi/ginkgo/ginkgo@latest + go install -mod=mod github.com/onsi/ginkgo/ginkgo make ut - name: Install gosec - run: | - curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $(go env GOPATH)/bin 'v${{ env.GOSEC_VERSION }}' + run: curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $(go env GOPATH)/bin 'v${{ env.GOSEC_VERSION }}' - name: Build run: | go mod tidy - make release - make tar + git diff --exit-code + make lint + make image-kube-ovn + make tar-kube-ovn - - name: Upload kube-ovn image to artifact + - name: Upload images to artifact uses: actions/upload-artifact@v3 with: name: kube-ovn path: kube-ovn.tar - - name: Upload vpc-nat-gateway image to artifact + build-vpc-nat-gateway: + name: Build vpc-nat-gateway + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - uses: docker/setup-buildx-action@v2 + + - name: Build + run: | + make image-vpc-nat-gateway + make tar-vpc-nat-gateway + + - name: Upload image to artifact uses: actions/upload-artifact@v3 with: name: vpc-nat-gateway path: vpc-nat-gateway.tar + build-centos-compile: + name: Build centos-compile + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - uses: docker/setup-buildx-action@v2 + + - name: Build + run: | + make image-centos-compile + make tar-centos-compile + - name: Upload centos7-compile image to artifact uses: actions/upload-artifact@v3 with: name: centos7-compile path: centos7-compile.tar -# - name: Upload centos8-compile image to artifact -# uses: actions/upload-artifact@v3 -# with: -# name: centos8-compile -# path: centos8-compile.tar - - single-e2e: - needs: build - name: 1-master-e2e - runs-on: ubuntu-20.04 - timeout-minutes: 45 + # - name: Upload centos8-compile image to artifact + # uses: actions/upload-artifact@v3 + # with: + # name: centos8-compile + # path: centos8-compile.tar + + k8s-conformance-e2e: + name: Kubernetes Conformance E2E + needs: build-kube-ovn + runs-on: ubuntu-22.04 + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + ip-family: + - ipv4 + - ipv6 + - dual + mode: + - overlay + - underlay steps: - - name: Check out code - uses: actions/checkout@v3 - - - name: Install Kind - run: | - curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 - chmod +x ./kind - sudo mv kind /usr/local/bin + - uses: actions/checkout@v3 - - name: Init Kind - run: | - sudo pip3 install j2cli - sudo pip3 install "j2cli[yaml]" - sudo PATH=~/.local/bin:$PATH make kind-init + - name: Create the default branch directory + run: mkdir -p test/e2e/source - - name: Download image - uses: actions/download-artifact@v3 + - name: Check out the default branch + uses: actions/checkout@v3 with: - name: kube-ovn + ref: ${{ github.event.repository.default_branch }} + fetch-depth: 1 + path: test/e2e/source - - name: Load Image + - name: Export E2E directory run: | - docker load --input kube-ovn.tar + if [ '${{ github.base_ref || github.ref_name }}' = '${{ github.event.repository.default_branch }}' ]; then + echo "E2E_DIR=." >> "$GITHUB_ENV" + else + echo "E2E_DIR=test/e2e/source" >> "$GITHUB_ENV" + fi - - name: Install Kube-OVN - run: sudo make kind-install + - name: Remove DNS search domain + run: | + sudo sed -i '/^search/d' /etc/resolv.conf + sudo systemctl restart docker - - name: Set up Go 1.x - uses: actions/setup-go@v3 + - uses: actions/setup-go@v3 with: go-version: '${{ env.GO_VERSION }}' check-latest: true id: go - - name: Run E2E - run: | - go install github.com/onsi/ginkgo/ginkgo@latest - sudo kubectl cluster-info - sudo cp -r /root/.kube/ /home/runner/.kube/ - sudo chmod -R 777 /home/runner/.kube/ - make e2e + - name: Export Go full version + run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV" - - name: Cleanup - run: | - sh -c 'while :; do if [ $(kubectl get --no-headers subnet | wc -l) -eq 2 ]; then break; fi; sleep 5; done' - sh dist/images/cleanup.sh - - single-iptables-e2e: - needs: build - name: 1-master-iptables-e2e - runs-on: ubuntu-20.04 - timeout-minutes: 45 - steps: - - name: Check out code - uses: actions/checkout@v3 + - name: Go cache + uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles('${{ env.E2E_DIR }}/**/go.sum') }} + restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86- + + - name: Build e2e binaries + working-directory: ${{ env.E2E_DIR }} + run: make e2e-compile - - name: Install Kind + - name: Install kind run: | curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 chmod +x ./kind sudo mv kind /usr/local/bin - - name: Init Kind - run: | - sudo pip3 install j2cli - sudo pip3 install "j2cli[yaml]" - sudo PATH=~/.local/bin:$PATH make kind-init-iptables - - name: Download image uses: actions/download-artifact@v3 with: name: kube-ovn - - name: Load Image - run: | - docker load --input kube-ovn.tar - - - name: Install Kube-OVN - run: sudo make kind-install + - name: Load image + run: docker load --input kube-ovn.tar - - name: Set up Go 1.x - uses: actions/setup-go@v3 - with: - go-version: '${{ env.GO_VERSION }}' - check-latest: true - id: go - - - name: Run E2E - run: | - go install github.com/onsi/ginkgo/ginkgo@latest - sudo kubectl cluster-info - sudo cp -r /root/.kube/ /home/runner/.kube/ - sudo chmod -R 777 /home/runner/.kube/ - make e2e - - - name: Cleanup - run: | - sh -c 'while :; do if [ $(kubectl get --no-headers subnet | wc -l) -eq 2 ]; then break; fi; sleep 5; done' - sh dist/images/cleanup.sh - - single-vlan-e2e: - needs: build - name: 1-master-vlan-e2e - runs-on: ubuntu-20.04 - timeout-minutes: 45 - steps: - - name: Check out code - uses: actions/checkout@v3 - - - name: Install Kind - run: | - curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 - chmod +x ./kind - sudo mv kind /usr/local/bin - - - name: Init Kind + - name: Create kind cluster run: | sudo pip3 install j2cli sudo pip3 install "j2cli[yaml]" - sudo PATH=~/.local/bin:$PATH make kind-init - - - name: Download image - uses: actions/download-artifact@v3 - with: - name: kube-ovn - - - name: Load Image - run: | - docker load --input kube-ovn.tar + sudo PATH=~/.local/bin:$PATH make kind-init-${{ matrix.ip-family }} + sudo cp -r /root/.kube/ ~/.kube/ + sudo chown -R $(id -un). ~/.kube/ - name: Install Kube-OVN - run: sudo make kind-install - - - name: Set up Go 1.x - uses: actions/setup-go@v3 - with: - go-version: '${{ env.GO_VERSION }}' - check-latest: true - id: go + run: make kind-install-${{ matrix.mode }}-${{ matrix.ip-family }} - name: Run E2E - run: | - go install github.com/onsi/ginkgo/ginkgo@latest - sudo kubectl cluster-info - sudo cp -r /root/.kube/ /home/runner/.kube/ - sudo chmod -R 777 /home/runner/.kube/ - make e2e-vlan - - - name: Cleanup - run: | - sh -c 'while :; do if [ $(kubectl get --no-headers subnet | wc -l) -eq 2 ]; then break; fi; sleep 5; done' - sh dist/images/cleanup.sh - - single-underlay-e2e-single-nic: - needs: build - name: 1-master-underlay-e2e-single-nic - runs-on: ubuntu-20.04 - timeout-minutes: 45 + working-directory: ${{ env.E2E_DIR }} + env: + E2E_BRANCH: ${{ matrix.branch }} + E2E_IP_FAMILY: ${{ matrix.ip-family }} + E2E_NETWORK_MODE: ${{ matrix.mode }} + run: make k8s-conformance-e2e + + k8s-netpol-e2e: + name: Kubernetes Network Policy E2E + needs: build-kube-ovn + runs-on: ubuntu-22.04 + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + ip-family: + - ipv4 + - ipv6 + - dual steps: - - name: Check out code - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Install Kind - run: | - curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 - chmod +x ./kind - sudo mv kind /usr/local/bin + - name: Create the default branch directory + run: mkdir -p test/e2e/source - - name: Init Kind - run: | - sudo pip3 install j2cli - sudo pip3 install "j2cli[yaml]" - sudo PATH=~/.local/bin:$PATH make kind-init - - - name: Download image - uses: actions/download-artifact@v3 + - name: Check out the default branch + uses: actions/checkout@v3 with: - name: kube-ovn + ref: ${{ github.event.repository.default_branch }} + fetch-depth: 1 + path: test/e2e/source - - name: Load Image + - name: Export E2E directory run: | - docker load --input kube-ovn.tar + if [ '${{ github.base_ref || github.ref_name }}' = '${{ github.event.repository.default_branch }}' ]; then + echo "E2E_DIR=." >> "$GITHUB_ENV" + else + echo "E2E_DIR=test/e2e/source" >> "$GITHUB_ENV" + fi - - name: Install Kube-OVN - run: sudo make kind-install-underlay + - name: Remove DNS search domain + run: | + sudo sed -i '/^search/d' /etc/resolv.conf + sudo systemctl restart docker - - name: Set up Go 1.x - uses: actions/setup-go@v3 + - uses: actions/setup-go@v3 with: go-version: '${{ env.GO_VERSION }}' check-latest: true id: go - - name: Run E2E - run: | - go install github.com/onsi/ginkgo/ginkgo@latest - sudo kubectl cluster-info - sudo cp -r /root/.kube/ /home/runner/.kube/ - sudo chmod -R 777 /home/runner/.kube/ - make e2e-underlay-single-nic - - - name: Run networkpolicy E2E - working-directory: test/networkpolicy-cyclonus/ - run: | - sudo cp -r /root/.kube/ /home/runner/.kube/ - sudo chmod -R 777 /home/runner/.kube/ - bash ./start-test.sh + - name: Export Go full version + run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV" - - name: Cleanup - run: | - sh -c 'while :; do if [ $(kubectl get --no-headers subnet | wc -l) -eq 2 ]; then break; fi; sleep 5; done' - sh dist/images/cleanup.sh + - name: Go cache + uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles('${{ env.E2E_DIR }}/**/go.sum') }} + restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86- - - name: Check Node Network - run: | - sh -c ' - set -e - kubectl get no --no-headers | awk "{print \$1}" | while read node; do - docker inspect $node -f "{{.NetworkSettings.Networks.kind.IPAddress}}" - done | while read ip; do - docker run --rm --network kind kubeovn/kube-ovn:$(cat VERSION) ping -c1 -w1 $ip - done - kubectl get no --no-headers | awk "{print \$1}" | while read node; do - docker inspect $node -f "{{.NetworkSettings.Networks.kind.GlobalIPv6Address}}" - done | while read ip; do - docker run --rm --network kind kubeovn/kube-ovn:$(cat VERSION) ping6 -c1 -w1 $ip - done - ' - - single-node-e2e: - needs: build - name: 1-node-e2e - runs-on: ubuntu-20.04 - timeout-minutes: 45 - steps: - - name: Check out code - uses: actions/checkout@v3 + - name: Build e2e binaries + working-directory: ${{ env.E2E_DIR }} + run: make e2e-compile - - name: Install Kind + - name: Install kind run: | curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 chmod +x ./kind sudo mv kind /usr/local/bin - - name: Init Kind - run: | - sudo pip3 install j2cli - sudo pip3 install "j2cli[yaml]" - sudo PATH=~/.local/bin:$PATH make kind-init-single - - name: Download image uses: actions/download-artifact@v3 with: name: kube-ovn - - name: Load Image + - name: Load image + run: docker load --input kube-ovn.tar + + - name: Create kind cluster run: | - docker load --input kube-ovn.tar + sudo pip3 install j2cli + sudo pip3 install "j2cli[yaml]" + sudo PATH=~/.local/bin:$PATH make kind-init-${{ matrix.ip-family }} + sudo cp -r /root/.kube/ ~/.kube/ + sudo chown -R $(id -un). ~/.kube/ - name: Install Kube-OVN - run: sudo make kind-install-single - - - name: Set up Go 1.x - uses: actions/setup-go@v3 - with: - go-version: '${{ env.GO_VERSION }}' - check-latest: true - id: go + run: make kind-install-${{ matrix.ip-family }} - name: Run E2E - run: | - go install github.com/onsi/ginkgo/ginkgo@latest - sudo kubectl cluster-info - sudo cp -r /root/.kube/ /home/runner/.kube/ - sudo chmod -R 777 /home/runner/.kube/ - make e2e - - - name: Cleanup - run: | - sh -c 'while :; do if [ $(kubectl get --no-headers subnet | wc -l) -eq 2 ]; then break; fi; sleep 5; done' - sh dist/images/cleanup.sh - - ha-e2e: - needs: build - name: 3-master-e2e - runs-on: ubuntu-20.04 - timeout-minutes: 45 + working-directory: ${{ env.E2E_DIR }} + run: make k8s-netpol-e2e + + cyclonus-netpol-e2e: + name: Cyclonus Network Policy E2E + needs: build-kube-ovn + runs-on: ubuntu-22.04 + timeout-minutes: 30 + strategy: + fail-fast: false + matrix: + ip-family: + - ipv4 + - ipv6 + - dual steps: - - name: Check out code + - uses: actions/checkout@v3 + + - name: Create the default branch directory + run: mkdir -p test/e2e/source + + - name: Check out the default branch uses: actions/checkout@v3 + with: + ref: ${{ github.event.repository.default_branch }} + fetch-depth: 1 + path: test/e2e/source - - name: Install Kind + - name: Export E2E directory + run: | + if [ '${{ github.base_ref || github.ref_name }}' = '${{ github.event.repository.default_branch }}' ]; then + echo "E2E_DIR=." >> "$GITHUB_ENV" + else + echo "E2E_DIR=test/e2e/source" >> "$GITHUB_ENV" + fi + + - name: Install kind run: | curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 chmod +x ./kind sudo mv kind /usr/local/bin - - name: Init Kind - run: | - sudo pip3 install j2cli - sudo pip3 install "j2cli[yaml]" - sudo PATH=~/.local/bin:$PATH make kind-init-ha - - name: Download image uses: actions/download-artifact@v3 with: name: kube-ovn - - name: Load Image + - name: Load image + run: docker load --input kube-ovn.tar + + - name: Create kind cluster run: | - docker load --input kube-ovn.tar + sudo pip3 install j2cli + sudo pip3 install "j2cli[yaml]" + sudo PATH=~/.local/bin:$PATH make kind-init-${{ matrix.ip-family }} + sudo cp -r /root/.kube/ ~/.kube/ + sudo chown -R $(id -un). ~/.kube/ - name: Install Kube-OVN - run: | - sudo make kind-install - sudo kubectl patch subnet ovn-default --type merge \ - -p '{"spec":{"gatewayType": "centralized", "gatewayNode": "kube-ovn-control-plane"}}' - sudo kubectl -n kube-system patch svc kube-ovn-pinger --type merge \ - -p '{"spec":{"type": "NodePort", "externalTrafficPolicy": "Local"}}' - - - name: Set up Go 1.x - uses: actions/setup-go@v3 - with: - go-version: '${{ env.GO_VERSION }}' - check-latest: true - id: go + run: make kind-install-${{ matrix.ip-family }} - name: Run E2E - run: | - go install github.com/onsi/ginkgo/ginkgo@latest - sudo kubectl cluster-info - sudo cp -r /root/.kube/ /home/runner/.kube/ - sudo chmod -R 777 /home/runner/.kube/ - make e2e - - - name: Run networkpolicy E2E - working-directory: test/networkpolicy-cyclonus/ - run: | - sudo cp -r /root/.kube/ /home/runner/.kube/ - sudo chmod -R 777 /home/runner/.kube/ - bash ./start-test.sh - - - name: Cleanup - run: | - sh -c 'while :; do if [ $(kubectl get --no-headers subnet | wc -l) -eq 2 ]; then break; fi; sleep 5; done' - sh dist/images/cleanup.sh - - ipv6-e2e: - needs: build - name: ipv6-e2e - runs-on: ubuntu-20.04 - timeout-minutes: 45 + working-directory: ${{ env.E2E_DIR }} + run: make cyclonus-netpol-e2e + + kube-ovn-conformance-e2e: + name: Kube-OVN Conformance E2E + needs: build-kube-ovn + runs-on: ubuntu-22.04 + timeout-minutes: 30 + strategy: + fail-fast: false + matrix: + ip-family: + - ipv4 + - ipv6 + - dual + mode: + - overlay + - underlay steps: - - name: Check out code - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Install Kind - run: | - curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 - chmod +x ./kind - sudo mv kind /usr/local/bin - - - name: Init Kind - run: | - sudo pip3 install j2cli - sudo pip3 install "j2cli[yaml]" - sudo PATH=~/.local/bin:$PATH make kind-init-ipv6 + - name: Create the default branch directory + run: mkdir -p test/e2e/source - - name: Download image - uses: actions/download-artifact@v3 + - name: Check out the default branch + uses: actions/checkout@v3 with: - name: kube-ovn + ref: ${{ github.event.repository.default_branch }} + fetch-depth: 1 + path: test/e2e/source - - name: Load Image + - name: Export E2E directory run: | - docker load --input kube-ovn.tar - - - name: Install Kube-OVN - run: sudo make kind-install-ipv6 + if [ '${{ github.base_ref || github.ref_name }}' = '${{ github.event.repository.default_branch }}' ]; then + echo "E2E_DIR=." >> "$GITHUB_ENV" + else + echo "E2E_DIR=test/e2e/source" >> "$GITHUB_ENV" + fi - - name: Set up Go 1.x - uses: actions/setup-go@v3 + - uses: actions/setup-go@v3 with: go-version: '${{ env.GO_VERSION }}' check-latest: true id: go - - name: Run E2E - run: | - go install github.com/onsi/ginkgo/ginkgo@latest - sudo kubectl cluster-info - sudo cp -r /root/.kube/ /home/runner/.kube/ - sudo chmod -R 777 /home/runner/.kube/ - make e2e-ipv6 - - - name: Run networkpolicy E2E - working-directory: test/networkpolicy-cyclonus/ - run: | - sudo cp -r /root/.kube/ /home/runner/.kube/ - sudo chmod -R 777 /home/runner/.kube/ - bash ./start-test.sh + - name: Export Go full version + run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV" - - name: Cleanup - run: | - sh -c 'while :; do if [ $(kubectl get --no-headers subnet | wc -l) -eq 2 ]; then break; fi; sleep 5; done' - sh dist/images/cleanup.sh - - ipv6-vlan-e2e: - needs: build - name: ipv6-vlan-e2e - runs-on: ubuntu-20.04 - timeout-minutes: 45 - steps: - - name: Check out code - uses: actions/checkout@v3 + - name: Go cache + uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles('${{ env.E2E_DIR }}/**/go.sum') }} + restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86- - - name: Install Kind + - name: Build e2e binaries + working-directory: ${{ env.E2E_DIR }} + run: make e2e-compile + + - name: Install kind run: | curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 chmod +x ./kind sudo mv kind /usr/local/bin - - name: Init Kind - run: | - sudo pip3 install j2cli - sudo pip3 install "j2cli[yaml]" - sudo PATH=~/.local/bin:$PATH make kind-init-ipv6 - - name: Download image uses: actions/download-artifact@v3 with: name: kube-ovn - - name: Load Image + - name: Load image + run: docker load --input kube-ovn.tar + + - name: Create kind cluster run: | - docker load --input kube-ovn.tar + sudo pip3 install j2cli + sudo pip3 install "j2cli[yaml]" + sudo PATH=~/.local/bin:$PATH make kind-init-${{ matrix.ip-family }} + sudo cp -r /root/.kube/ ~/.kube/ + sudo chown -R $(id -un). ~/.kube/ - name: Install Kube-OVN - run: sudo make kind-install-ipv6 - - - name: Set up Go 1.x - uses: actions/setup-go@v3 - with: - go-version: '${{ env.GO_VERSION }}' - check-latest: true - id: go + run: make kind-install-${{ matrix.mode }}-${{ matrix.ip-family }} - name: Run E2E - run: | - go install github.com/onsi/ginkgo/ginkgo@latest - sudo kubectl cluster-info - sudo cp -r /root/.kube/ /home/runner/.kube/ - sudo chmod -R 777 /home/runner/.kube/ - make e2e-vlan-ipv6 + working-directory: ${{ env.E2E_DIR }} + env: + E2E_BRANCH: ${{ github.base_ref || github.ref_name }} + E2E_IP_FAMILY: ${{ matrix.ip-family }} + E2E_NETWORK_MODE: ${{ matrix.mode }} + run: make kube-ovn-conformance-e2e - name: Cleanup - run: | - sh -c 'while :; do if [ $(kubectl get --no-headers subnet | wc -l) -eq 2 ]; then break; fi; sleep 5; done' - sh dist/images/cleanup.sh - - ipv6-underlay-e2e-single-nic: - needs: build - name: ipv6-underlay-e2e-single-nic - runs-on: ubuntu-20.04 - timeout-minutes: 45 + run: sh dist/images/cleanup.sh + + kube-ovn-ic-conformance-e2e: + name: Kube-OVN IC Conformance E2E + needs: build-kube-ovn + runs-on: ubuntu-22.04 + timeout-minutes: 30 steps: - - name: Check out code - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Install Kind - run: | - curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 - chmod +x ./kind - sudo mv kind /usr/local/bin + - name: Create the default branch directory + run: mkdir -p test/e2e/source - - name: Init Kind - run: | - sudo pip3 install j2cli - sudo pip3 install "j2cli[yaml]" - sudo PATH=~/.local/bin:$PATH make kind-init-ipv6 - - - name: Download image - uses: actions/download-artifact@v3 + - name: Check out the default branch + uses: actions/checkout@v3 with: - name: kube-ovn + ref: ${{ github.event.repository.default_branch }} + fetch-depth: 1 + path: test/e2e/source - - name: Load Image + - name: Export E2E directory run: | - docker load --input kube-ovn.tar + if [ '${{ github.base_ref || github.ref_name }}' = '${{ github.event.repository.default_branch }}' ]; then + echo "E2E_DIR=." >> "$GITHUB_ENV" + else + echo "E2E_DIR=test/e2e/source" >> "$GITHUB_ENV" + fi - - name: Install Kube-OVN - run: sudo make kind-install-underlay-ipv6 - - - name: Set up Go 1.x - uses: actions/setup-go@v3 + - uses: actions/setup-go@v3 with: go-version: '${{ env.GO_VERSION }}' check-latest: true id: go - - name: Run E2E - run: | - go install github.com/onsi/ginkgo/ginkgo@latest - sudo kubectl cluster-info - sudo cp -r /root/.kube/ /home/runner/.kube/ - sudo chmod -R 777 /home/runner/.kube/ - make e2e-underlay-single-nic - - - name: Run networkpolicy E2E - working-directory: test/networkpolicy-cyclonus/ - run: | - sudo cp -r /root/.kube/ /home/runner/.kube/ - sudo chmod -R 777 /home/runner/.kube/ - bash ./start-test.sh - - - name: Cleanup - run: | - sh -c 'while :; do if [ $(kubectl get --no-headers subnet | wc -l) -eq 2 ]; then break; fi; sleep 5; done' - sh dist/images/cleanup.sh + - name: Go cache + uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles('${{ env.E2E_DIR }}/**/go.sum') }} + restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86- - - name: Check Node Network - run: | - sh -c ' - set -e - kubectl get no --no-headers | awk "{print \$1}" | while read node; do - docker inspect $node -f "{{.NetworkSettings.Networks.kind.IPAddress}}" - done | while read ip; do - docker run --rm --network kind kubeovn/kube-ovn:$(cat VERSION) ping -c1 -w1 $ip - done - kubectl get no --no-headers | awk "{print \$1}" | while read node; do - docker inspect $node -f "{{.NetworkSettings.Networks.kind.GlobalIPv6Address}}" - done | while read ip; do - docker run --rm --network kind kubeovn/kube-ovn:$(cat VERSION) ping6 -c1 -w1 $ip - done - ' - - dual-stack-e2e: - needs: build - name: dual-stack-e2e - runs-on: ubuntu-20.04 - timeout-minutes: 45 - steps: - - name: Check out code - uses: actions/checkout@v3 + - name: Build e2e binaries + working-directory: ${{ env.E2E_DIR }} + run: make e2e-compile - - name: Install Kind + - name: Install kind run: | curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 chmod +x ./kind sudo mv kind /usr/local/bin - - name: Init Kind - run: | - sudo pip3 install j2cli - sudo pip3 install "j2cli[yaml]" - sudo PATH=~/.local/bin:$PATH make kind-init-dual - - name: Download image uses: actions/download-artifact@v3 with: name: kube-ovn - - name: Load Image + - name: Load image + run: docker load --input kube-ovn.tar + + - name: Create kind clusters run: | - docker load --input kube-ovn.tar + sudo pip3 install j2cli + sudo pip3 install "j2cli[yaml]" + sudo PATH=~/.local/bin:$PATH make kind-init-ovn-ic + sudo cp -r /root/.kube/ ~/.kube/ + sudo chown -R $(id -un). ~/.kube/ - name: Install Kube-OVN - run: sudo make kind-install-dual - - - name: Set up Go 1.x - uses: actions/setup-go@v3 - with: - go-version: '${{ env.GO_VERSION }}' - check-latest: true - id: go + run: make kind-install-ovn-ic - name: Run E2E - run: | - go install github.com/onsi/ginkgo/ginkgo@latest - sudo kubectl cluster-info - sudo cp -r /root/.kube/ /home/runner/.kube/ - sudo chmod -R 777 /home/runner/.kube/ - make e2e - - - name: Run networkpolicy E2E - working-directory: test/networkpolicy-cyclonus/ - run: | - sudo cp -r /root/.kube/ /home/runner/.kube/ - sudo chmod -R 777 /home/runner/.kube/ - bash ./start-test.sh - - - name: Cleanup - run: | - sh -c 'while :; do if [ $(kubectl get --no-headers subnet | wc -l) -eq 2 ]; then break; fi; sleep 5; done' - sh dist/images/cleanup.sh - - dual-stack-underlay-e2e-single-nic: - needs: build - name: dual-stack-underlay-e2e-single-nic - runs-on: ubuntu-20.04 - timeout-minutes: 45 + working-directory: ${{ env.E2E_DIR }} + run: make kube-ovn-ic-conformance-e2e + + ha-installation-test: + needs: build-kube-ovn + name: HA Installation Test + runs-on: ubuntu-22.04 + timeout-minutes: 30 steps: - - name: Check out code - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Install Kind + - name: Install kind run: | curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 chmod +x ./kind sudo mv kind /usr/local/bin - - name: Init Kind - run: | - sudo pip3 install j2cli - sudo pip3 install "j2cli[yaml]" - sudo PATH=~/.local/bin:$PATH make kind-init-dual - - name: Download image uses: actions/download-artifact@v3 with: name: kube-ovn - - name: Load Image + - name: Load image + run: docker load --input kube-ovn.tar + + - name: Create kind cluster run: | - docker load --input kube-ovn.tar + sudo pip3 install j2cli + sudo pip3 install "j2cli[yaml]" + sudo PATH=~/.local/bin:$PATH make kind-init-ha + sudo cp -r /root/.kube/ ~/.kube/ + sudo chown -R $(id -un). ~/.kube/ - name: Install Kube-OVN - run: sudo make kind-install-underlay-dual - - - name: Set up Go 1.x - uses: actions/setup-go@v3 - with: - go-version: '${{ env.GO_VERSION }}' - check-latest: true - id: go - - - name: Run E2E - run: | - go install github.com/onsi/ginkgo/ginkgo@latest - sudo kubectl cluster-info - sudo cp -r /root/.kube/ /home/runner/.kube/ - sudo chmod -R 777 /home/runner/.kube/ - make e2e-underlay-single-nic - - - name: Run networkpolicy E2E - working-directory: test/networkpolicy-cyclonus/ - run: | - sudo cp -r /root/.kube/ /home/runner/.kube/ - sudo chmod -R 777 /home/runner/.kube/ - bash ./start-test.sh + run: sudo ENABLE_SSL=true make kind-install - name: Cleanup - run: | - sh -c 'while :; do if [ $(kubectl get --no-headers subnet | wc -l) -eq 2 ]; then break; fi; sleep 5; done' - sh dist/images/cleanup.sh + run: sh dist/images/cleanup.sh - - name: Check Node Network - run: | - sh -c ' - set -e - kubectl get no --no-headers | awk "{print \$1}" | while read node; do - docker inspect $node -f "{{.NetworkSettings.Networks.kind.IPAddress}}" - done | while read ip; do - docker run --rm --network kind kubeovn/kube-ovn:$(cat VERSION) ping -c1 -w1 $ip - done - kubectl get no --no-headers | awk "{print \$1}" | while read node; do - docker inspect $node -f "{{.NetworkSettings.Networks.kind.GlobalIPv6Address}}" - done | while read ip; do - docker run --rm --network kind kubeovn/kube-ovn:$(cat VERSION) ping6 -c1 -w1 $ip - done - ' - - dual-stack-underlay-logical-gw-e2e: - needs: build - name: dual-stack-underlay-logical-gateway-e2e - runs-on: ubuntu-20.04 - timeout-minutes: 45 + underlay-logical-gateway-installation-test: + needs: build-kube-ovn + name: Underlay Logical Gateway Installation Test + runs-on: ubuntu-22.04 + timeout-minutes: 30 steps: - - name: Check out code - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Install Kind + - name: Install kind run: | curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 chmod +x ./kind sudo mv kind /usr/local/bin - - name: Init Kind - run: | - sudo pip3 install j2cli - sudo pip3 install "j2cli[yaml]" - sudo PATH=~/.local/bin:$PATH make kind-init-dual - - name: Download image uses: actions/download-artifact@v3 with: name: kube-ovn - - name: Load Image + - name: Load image + run: docker load --input kube-ovn.tar + + - name: Create kind cluster run: | - docker load --input kube-ovn.tar + sudo pip3 install j2cli + sudo pip3 install "j2cli[yaml]" + sudo PATH=~/.local/bin:$PATH make kind-init-dual + sudo cp -r /root/.kube/ ~/.kube/ + sudo chown -R $(id -un). ~/.kube/ - name: Install Kube-OVN - run: sudo make kind-install-underlay-logical-gateway-dual - - - name: Set up Go 1.x - uses: actions/setup-go@v3 - with: - go-version: '${{ env.GO_VERSION }}' - check-latest: true - id: go - - - name: Run E2E - run: | - go install github.com/onsi/ginkgo/ginkgo@latest - sudo kubectl cluster-info - sudo cp -r /root/.kube/ /home/runner/.kube/ - sudo chmod -R 777 /home/runner/.kube/ - make e2e - - - name: Run networkpolicy E2E - working-directory: test/networkpolicy-cyclonus/ - run: | - sudo cp -r /root/.kube/ /home/runner/.kube/ - sudo chmod -R 777 /home/runner/.kube/ - bash ./start-test.sh + run: make kind-install-underlay-logical-gateway-dual - name: Cleanup - run: | - sh -c 'while :; do if [ $(kubectl get --no-headers subnet | wc -l) -eq 2 ]; then break; fi; sleep 5; done' - sh dist/images/cleanup.sh + run: sh dist/images/cleanup.sh - - name: Check Node Network - run: | - sh -c ' - set -e - kubectl get no --no-headers | awk "{print \$1}" | while read node; do - docker inspect $node -f "{{.NetworkSettings.Networks.kind.IPAddress}}" - done | while read ip; do - docker run --rm --network kind kubeovn/kube-ovn:$(cat VERSION) ping -c1 -w1 $ip - done - kubectl get no --no-headers | awk "{print \$1}" | while read node; do - docker inspect $node -f "{{.NetworkSettings.Networks.kind.GlobalIPv6Address}}" - done | while read ip; do - docker run --rm --network kind kubeovn/kube-ovn:$(cat VERSION) ping6 -c1 -w1 $ip - done - ' - - no-lb-e2e: - needs: build - name: disable-loadbalancer-e2e - runs-on: ubuntu-20.04 - timeout-minutes: 45 + no-ovn-lb-test: + needs: build-kube-ovn + name: Disable OVN LB Test + runs-on: ubuntu-22.04 + timeout-minutes: 30 steps: - - name: Check out code - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Install Kind + - name: Install kind run: | curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 chmod +x ./kind sudo mv kind /usr/local/bin - - name: Init Kind - run: | - sudo pip3 install j2cli - sudo pip3 install "j2cli[yaml]" - sudo PATH=~/.local/bin:$PATH make kind-init - - name: Download image uses: actions/download-artifact@v3 with: name: kube-ovn - - name: Load Image + - name: Load image + run: docker load --input kube-ovn.tar + + - name: Create kind cluster run: | - docker load --input kube-ovn.tar + sudo pip3 install j2cli + sudo pip3 install "j2cli[yaml]" + sudo PATH=~/.local/bin:$PATH make kind-init + sudo cp -r /root/.kube/ ~/.kube/ + sudo chown -R $(id -un). ~/.kube/ - name: Install Kube-OVN without LoadBalancer - run: sudo make kind-install - - - name: Set up Go 1.x - uses: actions/setup-go@v3 - with: - go-version: '${{ env.GO_VERSION }}' - check-latest: true - id: go - - - name: Run E2E - run: | - go install github.com/onsi/ginkgo/ginkgo@latest - sudo kubectl cluster-info - sudo cp -r /root/.kube/ /home/runner/.kube/ - sudo chmod -R 777 /home/runner/.kube/ - make e2e + env: + ENABLE_LB: "false" + run: make kind-install - name: Cleanup - run: | - sh -c 'while :; do if [ $(kubectl get --no-headers subnet | wc -l) -eq 2 ]; then break; fi; sleep 5; done' - sh dist/images/cleanup.sh - - no-lb-iptables-e2e: - needs: build - name: disable-loadbalancer-iptables-e2e - runs-on: ubuntu-20.04 - timeout-minutes: 45 + run: sh dist/images/cleanup.sh + + no-np-test: + needs: build-kube-ovn + name: Disable Network Policy Test + runs-on: ubuntu-22.04 + timeout-minutes: 30 steps: - - name: Check out code - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Install Kind + - name: Install kind run: | curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 chmod +x ./kind sudo mv kind /usr/local/bin - - name: Init Kind - run: | - sudo pip3 install j2cli - sudo pip3 install "j2cli[yaml]" - sudo PATH=~/.local/bin:$PATH make kind-init-iptables - - name: Download image uses: actions/download-artifact@v3 with: name: kube-ovn - - name: Load Image - run: | - docker load --input kube-ovn.tar + - name: Load image + run: docker load --input kube-ovn.tar - - name: Install Kube-OVN without LoadBalancer - run: sudo make kind-install - - - name: Set up Go 1.x - uses: actions/setup-go@v3 - with: - go-version: '${{ env.GO_VERSION }}' - check-latest: true - id: go - - - name: Run E2E - run: | - go install github.com/onsi/ginkgo/ginkgo@latest - sudo kubectl cluster-info - sudo cp -r /root/.kube/ /home/runner/.kube/ - sudo chmod -R 777 /home/runner/.kube/ - make e2e - - - name: Cleanup - run: | - sh -c 'while :; do if [ $(kubectl get --no-headers subnet | wc -l) -eq 2 ]; then break; fi; sleep 5; done' - sh dist/images/cleanup.sh - - no-np-e2e: - needs: build - name: disable-network-policy-e2e - runs-on: ubuntu-20.04 - timeout-minutes: 45 - steps: - - name: Check out code - uses: actions/checkout@v3 - - - name: Install Kind - run: | - curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 - chmod +x ./kind - sudo mv kind /usr/local/bin - - - name: Init Kind + - name: Create kind cluster run: | sudo pip3 install j2cli sudo pip3 install "j2cli[yaml]" sudo PATH=~/.local/bin:$PATH make kind-init - - - name: Download image - uses: actions/download-artifact@v3 - with: - name: kube-ovn - - - name: Load Image - run: | - docker load --input kube-ovn.tar + sudo cp -r /root/.kube/ ~/.kube/ + sudo chown -R $(id -un). ~/.kube/ - name: Install Kube-OVN - run: sudo ENABLE_NP=false make kind-install - - - name: Set up Go 1.x - uses: actions/setup-go@v3 - with: - go-version: '${{ env.GO_VERSION }}' - check-latest: true - id: go - - - name: Run E2E - run: | - go install github.com/onsi/ginkgo/ginkgo@latest - sudo kubectl cluster-info - sudo cp -r /root/.kube/ /home/runner/.kube/ - sudo chmod -R 777 /home/runner/.kube/ - make e2e + env: + ENABLE_NP: "false" + run: make kind-install - name: Cleanup - run: | - sh -c 'while :; do if [ $(kubectl get --no-headers subnet | wc -l) -eq 2 ]; then break; fi; sleep 5; done' - sh dist/images/cleanup.sh - - multus-e2e: - needs: build - name: multus-e2e - runs-on: ubuntu-20.04 - timeout-minutes: 45 + run: sh dist/images/cleanup.sh + + installation-compatibility-test: + needs: build-kube-ovn + name: Installation Compatibility Test + runs-on: ubuntu-22.04 + timeout-minutes: 10 steps: - - name: Check out code - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Install Kind + - name: Install kind run: | curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 chmod +x ./kind sudo mv kind /usr/local/bin - - name: Init Kind - run: | - sudo pip3 install j2cli - sudo pip3 install "j2cli[yaml]" - sudo PATH=~/.local/bin:$PATH make kind-init - - name: Download image uses: actions/download-artifact@v3 with: name: kube-ovn - - name: Load Image - run: | - docker load --input kube-ovn.tar - - - name: Install Kube-OVN & Multus - run: sudo make kind-install-multus + - name: Load image + run: docker load --input kube-ovn.tar - - name: Set up Go 1.x - uses: actions/setup-go@v3 - with: - go-version: '${{ env.GO_VERSION }}' - check-latest: true - id: go - - - name: Run E2E - uses: nick-invision/retry@v2 - with: - timeout_minutes: 10 - max_attempts: 2 - shell: bash - command: | - go install github.com/onsi/ginkgo/ginkgo@latest - sudo kubectl cluster-info - sudo cp -r /root/.kube/ /home/runner/.kube/ - sudo chmod -R 777 /home/runner/.kube/ - make e2e - - ovnic-e2e: - needs: build - name: 1-master-ovnic-e2e - runs-on: ubuntu-20.04 - timeout-minutes: 45 - steps: - - name: Check out code - uses: actions/checkout@v3 - - - name: Install Kind - run: | - curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 - chmod +x ./kind - sudo mv kind /usr/local/bin - - - name: Init Kind + - name: Create kind cluster run: | sudo pip3 install j2cli sudo pip3 install "j2cli[yaml]" - sudo PATH=~/.local/bin:$PATH make kind-init-cluster - - - name: Download image - uses: actions/download-artifact@v3 - with: - name: kube-ovn - - - name: Load Image - run: | - docker load --input kube-ovn.tar + sudo PATH=~/.local/bin:$PATH k8s_version=v1.23.13 make kind-init + sudo cp -r /root/.kube/ ~/.kube/ + sudo chown -R $(id -un). ~/.kube/ - name: Install Kube-OVN - run: | - sudo PATH=~/.local/bin:$PATH make kind-install-cluster - sudo PATH=~/.local/bin:$PATH make kind-install-ic - - - name: Set up Go 1.x - uses: actions/setup-go@v3 - with: - go-version: '${{ env.GO_VERSION }}' - check-latest: true - id: go - - - name: Run E2E - run: | - go install github.com/onsi/ginkgo/ginkgo@latest - sudo kubectl cluster-info - sudo cp -r /root/.kube/ /home/runner/.kube/ - sudo chmod -R 777 /home/runner/.kube/ - make e2e-ovn-ic + run: make kind-install - name: Cleanup - run: | - sh -c 'while :; do if [ $(kubectl get --no-headers subnet | wc -l) -eq 2 ]; then break; fi; sleep 5; done' - sh dist/images/cleanup.sh - - cilium-e2e: - needs: build - name: 1-master-cilium-e2e - runs-on: ubuntu-20.04 - timeout-minutes: 45 + run: sh dist/images/cleanup.sh + + cilium-chaining-e2e: + needs: build-kube-ovn + name: Cilium Chaining E2E + runs-on: ubuntu-22.04 + timeout-minutes: 30 steps: - - name: Check out code - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - uses: azure/setup-helm@v3 with: version: '${{ env.HELM_VERSION }}' - - name: Install Kind - run: | - curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 - chmod +x ./kind - sudo mv kind /usr/local/bin - - - name: Init Kind - run: | - sudo pip3 install j2cli - sudo pip3 install "j2cli[yaml]" - sudo PATH=~/.local/bin:$PATH make kind-init-cilium + - name: Create the default branch directory + run: mkdir -p test/e2e/source - - name: Download image - uses: actions/download-artifact@v3 + - name: Check out the default branch + uses: actions/checkout@v3 with: - name: kube-ovn + ref: ${{ github.event.repository.default_branch }} + fetch-depth: 1 + path: test/e2e/source - - name: Load Image + - name: Export E2E directory run: | - docker load --input kube-ovn.tar + if [ '${{ github.base_ref || github.ref_name }}' = '${{ github.event.repository.default_branch }}' ]; then + echo "E2E_DIR=." >> "$GITHUB_ENV" + else + echo "E2E_DIR=test/e2e/source" >> "$GITHUB_ENV" + fi - - name: Install Kube-OVN - run: sudo PATH=~/.local/bin:$PATH make kind-install-cilium + - name: Remove DNS search domain + run: | + sudo sed -i '/^search/d' /etc/resolv.conf + sudo systemctl restart docker - - name: Set up Go 1.x - uses: actions/setup-go@v3 + - uses: actions/setup-go@v3 with: go-version: '${{ env.GO_VERSION }}' check-latest: true id: go - - name: Run E2E - run: | - go install github.com/onsi/ginkgo/ginkgo@latest - sudo kubectl cluster-info - sudo cp -r /root/.kube/ /home/runner/.kube/ - sudo chmod -R 777 /home/runner/.kube/ - docker exec kube-ovn-control-plane bash -c "ls -al /etc/cni/net.d/" - kubectl get pods -A - make e2e-ovn-ebpf + - name: Export Go full version + run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV" - - name: Cleanup - run: | - sudo sh dist/images/cleanup.sh + - name: Go cache + uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles('${{ env.E2E_DIR }}/**/go.sum') }} + restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86- - installation-compatibility-e2e: - needs: build - name: installation-compatibility-e2e - runs-on: ubuntu-20.04 - timeout-minutes: 10 - steps: - - name: Check out code - uses: actions/checkout@v3 + - name: Build e2e binaries + working-directory: ${{ env.E2E_DIR }} + run: make e2e-compile - - name: Install Kind + - name: Install kind run: | curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 chmod +x ./kind sudo mv kind /usr/local/bin - - name: Init Kind - run: | - sudo pip3 install j2cli - sudo pip3 install "j2cli[yaml]" - sudo PATH=~/.local/bin:$PATH k8s_version=v1.23.13 make kind-init - - name: Download image uses: actions/download-artifact@v3 with: name: kube-ovn - - name: Load Image + - name: Load image + run: docker load --input kube-ovn.tar + + - name: Create kind cluster run: | - docker load --input kube-ovn.tar + sudo pip3 install j2cli + sudo pip3 install "j2cli[yaml]" + sudo PATH=~/.local/bin:$PATH make kind-init + sudo cp -r /root/.kube/ ~/.kube/ + sudo chown -R $(id -un). ~/.kube/ - name: Install Kube-OVN - run: sudo PATH=~/.local/bin:$PATH make kind-install + run: make kind-install + + - name: Run E2E + working-directory: ${{ env.E2E_DIR }} + run: make k8s-conformance-e2e - name: Cleanup - run: | - sudo sh dist/images/cleanup.sh + run: sh dist/images/cleanup.sh push: needs: - - single-e2e - - single-iptables-e2e - - single-vlan-e2e - - single-underlay-e2e-single-nic - - single-node-e2e - - ha-e2e - - ipv6-e2e - - ipv6-vlan-e2e - - ipv6-underlay-e2e-single-nic - - dual-stack-e2e - - dual-stack-underlay-logical-gw-e2e - - dual-stack-underlay-e2e-single-nic - - no-lb-e2e - - no-lb-iptables-e2e - - no-np-e2e - - multus-e2e - - ovnic-e2e - - cilium-e2e - - installation-compatibility-e2e + - build-centos-compile + - k8s-conformance-e2e + # - k8s-netpol-e2e + # - cyclonus-netpol-e2e + - kube-ovn-conformance-e2e + - kube-ovn-ic-conformance-e2e + - ha-installation-test + - underlay-logical-gateway-installation-test + - installation-compatibility-test + - no-ovn-lb-test + - no-np-test + - cilium-chaining-e2e name: push - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - - name: Check out code - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - name: Download kube-ovn image uses: actions/download-artifact@v3 @@ -1251,12 +836,12 @@ jobs: with: name: centos7-compile -# - name: Download centos8-compile image -# uses: actions/download-artifact@v3 -# with: -# name: centos8-compile + # - name: Download centos8-compile image + # uses: actions/download-artifact@v3 + # with: + # name: centos8-compile - - name: Load Image + - name: Load image run: | docker load --input kube-ovn.tar docker load --input vpc-nat-gateway.tar @@ -1299,4 +884,4 @@ jobs: docker push kubeovn/centos7-compile:$TAG-x86 docker push kubeovn/centos7-compile-dev:$TAG-x86 # docker push kubeovn/centos8-compile:$TAG-x86 - # docker push kubeovn/centos8-compile-dev:$TAG-x86 + # docker push kubeovn/centos8-compile-dev:$TAG-x86 \ No newline at end of file diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b233c52b3da..7425bd54aa7 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -17,7 +17,7 @@ on: jobs: analyze: name: Analyze - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: fail-fast: false diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 615792e32e5..f8089572381 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -8,13 +8,17 @@ on: - main pull_request: +concurrency: + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: true + env: - GO_VERSION: '1.18' + GO_VERSION: '1.19' jobs: golangci: name: lint - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 diff --git a/.gitignore b/.gitignore index e7d07ddf950..c922c8fd667 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,4 @@ kube-ovn.tar vpc-nat-gateway.tar image-amd64.tar image-arm64.tar -install-underlay.sh test/**/*.test -install-multi.sh diff --git a/Makefile b/Makefile index a381eb2a205..ca174b5c0a7 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,4 @@ -GO_VERSION = 1.18 -SHELL=/bin/bash +SHELL = /bin/bash REGISTRY = kubeovn DEV_TAG = dev @@ -13,9 +12,16 @@ CONTROL_PLANE_TAINTS = node-role.kubernetes.io/master node-role.kubernetes.io/co MULTUS_IMAGE = ghcr.io/k8snetworkplumbingwg/multus-cni:stable MULTUS_YAML = https://raw.githubusercontent.com/k8snetworkplumbingwg/multus-cni/master/deployments/multus-daemonset.yml -CILIUM_VERSION = 1.10.9 +CILIUM_VERSION = 1.11.6 CILIUM_IMAGE_REPO = quay.io/cilium/cilium +VPC_NAT_GW_IMG = $(REGISTRY)/vpc-nat-gateway:$(RELEASE_TAG) + +E2E_NETWORK = bridge +ifneq ($(VLAN_ID),) + E2E_NETWORK = kube-ovn-vlan +endif + # ARCH could be amd64,arm64 ARCH = amd64 @@ -36,19 +42,9 @@ build-go-arm: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -buildmode=pie -o $(CURDIR)/dist/images/kube-ovn-cmd -ldflags $(GOLDFLAGS) -v ./cmd CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -buildmode=pie -o $(CURDIR)/dist/images/kube-ovn-webhook -ldflags $(GOLDFLAGS) -v ./cmd/webhook -.PHONY: build-bin -build-bin: - docker run --rm -e GOOS=linux -e GOCACHE=/tmp -e GOARCH=$(ARCH) -e GOPROXY=https://goproxy.cn \ - -u $(shell id -u):$(shell id -g) \ - -v $(CURDIR):/go/src/github.com/kubeovn/kube-ovn:ro \ - -v $(CURDIR)/dist:/go/src/github.com/kubeovn/kube-ovn/dist/ \ - golang:$(GO_VERSION) /bin/bash -c '\ - cd /go/src/github.com/kubeovn/kube-ovn && \ - make build-go ' - -.PHONY: build-dev-images -build-dev-images: build-bin - docker build -t $(REGISTRY)/kube-ovn:$(DEV_TAG) --build-arg ARCH=amd64 -f dist/images/Dockerfile dist/images/ +.PHONY: build-dev +build-dev: build-go + docker build --build-arg ARCH=amd64 -t $(REGISTRY)/kube-ovn:$(DEV_TAG) -f dist/images/Dockerfile dist/images/ .PHONY: build-dpdk build-dpdk: @@ -67,14 +63,21 @@ base-amd64-dpdk: base-arm64: docker buildx build --platform linux/arm64 --build-arg ARCH=arm64 -t $(REGISTRY)/kube-ovn-base:$(RELEASE_TAG)-arm64 -o type=docker -f dist/images/Dockerfile.base dist/images/ -.PHONY: release -release: build-go +.PHONY: image-kube-ovn +image-kube-ovn: build-go docker buildx build --platform linux/amd64 --build-arg ARCH=amd64 -t $(REGISTRY)/kube-ovn:$(RELEASE_TAG) -o type=docker -f dist/images/Dockerfile dist/images/ - docker buildx build --platform linux/amd64 --build-arg ARCH=amd64 -t $(REGISTRY)/kube-ovn:$(RELEASE_TAG)-no-avx512 -o type=docker -f dist/images/Dockerfile.no-avx512 dist/images/ - docker buildx build --platform linux/amd64 --build-arg ARCH=amd64 -t $(REGISTRY)/kube-ovn:$(RELEASE_TAG)-dpdk -o type=docker -f dist/images/Dockerfile.dpdk dist/images/ + +.PHONY: image-vpc-nat-gateway +image-vpc-nat-gateway: docker buildx build --platform linux/amd64 --build-arg ARCH=amd64 -t $(REGISTRY)/vpc-nat-gateway:$(RELEASE_TAG) -o type=docker -f dist/images/vpcnatgateway/Dockerfile dist/images/vpcnatgateway + +.PHONY: image-centos-compile +image-centos-compile: docker buildx build --platform linux/amd64 --build-arg ARCH=amd64 -t $(REGISTRY)/centos7-compile:$(RELEASE_TAG) -o type=docker -f dist/images/compile/centos7/Dockerfile fastpath/ -# docker buildx build --platform linux/amd64 --build-arg ARCH=amd64 -t $(REGISTRY)/centos8-compile:$(RELEASE_TAG) -o type=docker -f dist/images/compile/centos8/Dockerfile fastpath/ + # docker buildx build --platform linux/amd64 --build-arg ARCH=amd64 -t $(REGISTRY)/centos8-compile:$(RELEASE_TAG) -o type=docker -f dist/images/compile/centos8/Dockerfile fastpath/ + +.PHONY: release +release: lint image-kube-ovn image-vpc-nat-gateway .PHONY: release-arm release-arm: build-go-arm @@ -89,12 +92,21 @@ push-dev: push-release: release docker push $(REGISTRY)/kube-ovn:$(RELEASE_TAG) -.PHONY: tar -tar: - docker save $(REGISTRY)/kube-ovn:$(RELEASE_TAG) $(REGISTRY)/kube-ovn:$(RELEASE_TAG)-no-avx512 -o kube-ovn.tar +.PHONY: tar-kube-ovn +tar-kube-ovn: + docker save $(REGISTRY)/kube-ovn:$(RELEASE_TAG) -o kube-ovn.tar + +.PHONY: tar-vpc-nat-gateway +tar-vpc-nat-gateway: docker save $(REGISTRY)/vpc-nat-gateway:$(RELEASE_TAG) -o vpc-nat-gateway.tar + +.PHONY: tar-centos-compile +tar-centos-compile: docker save $(REGISTRY)/centos7-compile:$(RELEASE_TAG) -o centos7-compile.tar -# docker save $(REGISTRY)/centos8-compile:$(RELEASE_TAG) -o centos8-compile.tar + # docker save $(REGISTRY)/centos8-compile:$(RELEASE_TAG) -o centos8-compile.tar + +.PHONY: tar +tar: tar-kube-ovn tar-vpc-nat-gateway tar-centos-compile .PHONY: base-tar-amd64 base-tar-amd64: @@ -108,64 +120,139 @@ base-tar-amd64-dpdk: base-tar-arm64: docker save $(REGISTRY)/kube-ovn-base:$(RELEASE_TAG)-arm64 -o image-arm64.tar -.PHONY: kind-init -kind-init: kind-clean - kube_proxy_mode=ipvs ip_family=ipv4 ha=false single=false j2 yamls/kind.yaml.j2 -o yamls/kind.yaml - kind create cluster --config yamls/kind.yaml --name kube-ovn +define docker_ensure_image_exists + @if ! docker images --format "{{.Repository}}:{{.Tag}}" | grep "^$(1)$$" >/dev/null; then \ + docker pull "$(1)"; \ + fi +endef + +define docker_rm_container + @docker ps -a -f name="$(1)" --format "{{.ID}}" | while read c; do docker rm -f $$c; done +endef + +define docker_network_info + $(eval VAR_PREFIX = $(shell echo $(1) | tr '[:lower:]' '[:upper:]')) + $(eval $(VAR_PREFIX)_IPV4_SUBNET = $(shell docker network inspect $(1) -f "{{(index .IPAM.Config 0).Subnet}}")) + $(eval $(VAR_PREFIX)_IPV6_SUBNET = $(shell docker network inspect $(1) -f "{{(index .IPAM.Config 1).Subnet}}")) + $(eval $(VAR_PREFIX)_IPV4_GATEWAY = $(shell docker network inspect $(1) -f "{{(index .IPAM.Config 0).Gateway}}")) + $(eval $(VAR_PREFIX)_IPV6_GATEWAY = $(shell docker network inspect $(1) -f "{{(index .IPAM.Config 1).Gateway}}")) + $(eval $(VAR_PREFIX)_IPV6_GATEWAY := $(shell docker exec kube-ovn-control-plane ip -6 route show default | awk '{print $$3}')) + $(eval $(VAR_PREFIX)_IPV4_EXCLUDE_IPS = $(shell docker network inspect $(1) -f '{{range .Containers}},{{index (split .IPv4Address "/") 0}}{{end}}' | sed 's/^,//')) + $(eval $(VAR_PREFIX)_IPV6_EXCLUDE_IPS = $(shell docker network inspect $(1) -f '{{range .Containers}},{{index (split .IPv6Address "/") 0}}{{end}}' | sed 's/^,//')) +endef + +define docker_create_vlan_network + $(eval VLAN_NETWORK_ID = $(shell docker network ls -f name=$(E2E_NETWORK) --format '{{.ID}}')) + @if [ ! -z "$(VLAN_ID)" -a -z "$(VLAN_NETWORK_ID)" ]; then \ + docker network create --attachable -d bridge \ + --ipv6 --subnet fc00:adb1:b29b:608d::/64 --gateway fc00:adb1:b29b:608d::1 \ + -o com.docker.network.bridge.enable_ip_masquerade=true \ + -o com.docker.network.driver.mtu=1500 $(E2E_NETWORK); \ + fi +endef + +define docker_config_bridge + @set -e; \ + docker network ls --format "{{.Name}}" | grep '^$(1)$$' >/dev/null || exit 0; \ + set -o pipefail; \ + default=$$(docker network inspect $(1) -f '{{index .Options "com.docker.network.bridge.default_bridge"}}'); \ + br="docker0"; \ + [ "$$default" != "true" ] && br="br-$$(docker network inspect $(1) -f "{{.Id}}" | head -c 12)"; \ + docker run --rm --privileged --network=host $(REGISTRY)/kube-ovn:$(RELEASE_TAG) bash -ec '\ + for brif in $$(ls /sys/class/net/'$$br'/brif); do \ + echo $(2) > /sys/class/net/'$$br'/brif/$$brif/hairpin_mode; \ + done'; \ + if [ -z "$(3)" ]; then \ + docker run --rm --privileged --network=host $(REGISTRY)/kube-ovn:$(RELEASE_TAG) bash -ec '\ + echo 0 > /sys/class/net/'$$br'/bridge/vlan_filtering; \ + '; \ + else \ + docker run --rm --privileged --network=host $(REGISTRY)/kube-ovn:$(RELEASE_TAG) bash -ec '\ + echo 1 > /sys/class/net/'$$br'/bridge/vlan_filtering; \ + bridge vlan show | awk "/^'$$br'/{print \$$2; while (getline > 0) {\ + if (\$$0 ~ /^[[:blank:]]/) {print \$$1} else {exit 0} }\ + }" | while read vid; do \ + bridge vlan del vid $$vid dev '$$br' self; \ + done; \ + bridge vlan add vid $(3) dev '$$br' pvid untagged self; \ + for brif in $$(ls /sys/class/net/'$$br'/brif); do \ + bridge vlan show | awk "/^$$brif/{print \$$2; while (getline > 0) {\ + if (\$$0 ~ /^[[:blank:]]/) {print \$$1} else {exit 0} }\ + }" | while read vid; do \ + bridge vlan del vid $$vid dev $$brif; \ + done; \ + bridge vlan add vid $(3) dev $$brif; \ + done'; \ + fi +endef + +define kind_create_cluster + kind create cluster --config $(1) --name $(2) + kubectl delete --ignore-not-found sc standard + kubectl delete --ignore-not-found -n local-path-storage deploy local-path-provisioner kubectl describe no +endef -.PHONY: kind-init-cluster -kind-init-cluster: kind-clean-cluster - kube_proxy_mode=ipvs ip_family=ipv4 ha=false single=true j2 yamls/kind.yaml.j2 -o yamls/kind.yaml - kind create cluster --config yamls/kind.yaml --name kube-ovn - kind create cluster --config yamls/kind.yaml --name kube-ovn1 - kubectl config use-context kind-kube-ovn - kubectl get no - kubectl config use-context kind-kube-ovn1 - kubectl get no +define kind_load_image + kind load docker-image --name $(1) $(2) +endef + +.PHONY: kind-generate-config +kind-generate-config: + j2 yamls/kind.yaml.j2 -o yamls/kind.yaml + +.PHONY: kind-disable-hairpin +kind-disable-hairpin: + $(call docker_config_bridge,kind,0,) + +.PHONY: kind-enable-hairpin +kind-enable-hairpin: + $(call docker_config_bridge,kind,1,) + +.PHONY: kind-create +kind-create: + $(call kind_create_cluster,yamls/kind.yaml,kube-ovn) + +.PHONY: kind-init +kind-init: kind-init-ipv4 + +.PHONY: kind-init-ipv4 +kind-init-ipv4: kind-clean + @$(MAKE) kind-generate-config + @$(MAKE) kind-create + +.PHONY: kind-init-ovn-ic +kind-init-ovn-ic: kind-clean-ovn-ic kind-init-single + @single=true $(MAKE) kind-generate-config + $(call kind_create_cluster,yamls/kind.yaml,kube-ovn1) .PHONY: kind-init-iptables -kind-init-iptables: kind-clean - kube_proxy_mode=iptables ip_family=ipv4 ha=false single=false j2 yamls/kind.yaml.j2 -o yamls/kind.yaml - kind create cluster --config yamls/kind.yaml --name kube-ovn - kubectl describe no +kind-init-iptables: + @kube_proxy_mode=iptables $(MAKE) kind-init .PHONY: kind-init-ha -kind-init-ha: kind-clean - kube_proxy_mode=ipvs ip_family=ipv4 ha=true single=false j2 yamls/kind.yaml.j2 -o yamls/kind.yaml - kind create cluster --config yamls/kind.yaml --name kube-ovn - kubectl describe no +kind-init-ha: + @ha=true $(MAKE) kind-init .PHONY: kind-init-single -kind-init-single: kind-clean - kube_proxy_mode=ipvs ip_family=ipv4 ha=false single=true j2 yamls/kind.yaml.j2 -o yamls/kind.yaml - kind create cluster --config yamls/kind.yaml --name kube-ovn - kubectl describe no +kind-init-single: + @single=true $(MAKE) kind-init .PHONY: kind-init-ipv6 -kind-init-ipv6: kind-clean - kube_proxy_mode=ipvs ip_family=ipv6 ha=false single=false j2 yamls/kind.yaml.j2 -o yamls/kind.yaml - kind create cluster --config yamls/kind.yaml --name kube-ovn - kubectl describe no +kind-init-ipv6: + @ip_family=ipv6 $(MAKE) kind-init .PHONY: kind-init-dual -kind-init-dual: kind-clean - kube_proxy_mode=ipvs ip_family=dual ha=false single=false j2 yamls/kind.yaml.j2 -o yamls/kind.yaml - kind create cluster --config yamls/kind.yaml --name kube-ovn - kubectl describe no - docker exec kube-ovn-worker sysctl -w net.ipv6.conf.all.disable_ipv6=0 - docker exec kube-ovn-control-plane sysctl -w net.ipv6.conf.all.disable_ipv6=0 +kind-init-dual: + @ip_family=dual $(MAKE) kind-init .PHONY: kind-init-cilium -kind-init-cilium: kind-clean - kind delete cluster --name=kube-ovn - kube_proxy_mode=none ip_family=ipv4 ha=false single=false j2 yamls/kind.yaml.j2 -o yamls/kind.yaml - kind create cluster --config yamls/kind.yaml --name kube-ovn - kubectl describe no +kind-init-cilium: + @kube_proxy_mode=iptables $(MAKE) kind-init .PHONY: kind-load-image kind-load-image: - kind load docker-image --name kube-ovn $(REGISTRY)/kube-ovn:$(RELEASE_TAG) + $(call kind_load_image,kube-ovn,$(REGISTRY)/kube-ovn:$(RELEASE_TAG)) .PHONY: kind-untaint-control-plane kind-untaint-control-plane: @@ -179,124 +266,156 @@ kind-untaint-control-plane: done .PHONY: kind-install -kind-install: kind-load-image kind-untaint-control-plane - ENABLE_SSL=true dist/images/install.sh +kind-install: kind-load-image + kubectl config use-context kind-kube-ovn + @$(MAKE) kind-untaint-control-plane + bash dist/images/install.sh kubectl describe no -.PHONY: kind-install-cluster -kind-install-cluster: kind-load-image - kind load docker-image --name kube-ovn1 $(REGISTRY)/kube-ovn:$(RELEASE_TAG) +.PHONY: kind-install-dev +kind-install-dev: + $(call kind_load_image,kube-ovn,$(REGISTRY)/kube-ovn:$(DEV_TAG)) kubectl config use-context kind-kube-ovn - ENABLE_SSL=true dist/images/install.sh - kubectl describe no + @$(MAKE) kind-untaint-control-plane + sed 's/VERSION=.*/VERSION=$(DEV_TAG)/' dist/images/install.sh | bash + +.PHONY: kind-install-ipv4 +kind-install-ipv4: kind-install-overlay-ipv4 + +.PHONY: kind-install-overlay-ipv4 +kind-install-overlay-ipv4: kind-install + +.PHONY: kind-install-ovn-ic +kind-install-ovn-ic: kind-load-image kind-install + $(call kind_load_image,kube-ovn1,$(REGISTRY)/kube-ovn:$(RELEASE_TAG)) kubectl config use-context kind-kube-ovn1 sed -e 's/10.16.0/10.18.0/g' \ -e 's/10.96.0/10.98.0/g' \ -e 's/100.64.0/100.68.0/g' \ - dist/images/install.sh > install-multi.sh - ENABLE_SSL=true bash install-multi.sh + dist/images/install.sh | \ + bash kubectl describe no + docker run -d --name ovn-ic-db --network kind $(REGISTRY)/kube-ovn:$(RELEASE_TAG) bash start-ic-db.sh + @set -e; \ + ic_db_host=$$(docker inspect ovn-ic-db -f "{{.NetworkSettings.Networks.kind.IPAddress}}"); \ + zone=az0 ic_db_host=$$ic_db_host gateway_node_name=kube-ovn-control-plane j2 yamls/ovn-ic.yaml.j2 -o ovn-ic-0.yaml; \ + zone=az1 ic_db_host=$$ic_db_host gateway_node_name=kube-ovn1-control-plane j2 yamls/ovn-ic.yaml.j2 -o ovn-ic-1.yaml; \ + zone=az1111 ic_db_host=$$ic_db_host gateway_node_name=kube-ovn1-control-plane j2 yamls/ovn-ic.yaml.j2 -o /tmp/ovn-ic-1-alter.yaml + kubectl config use-context kind-kube-ovn + kubectl apply -f ovn-ic-0.yaml + sleep 6 + kubectl -n kube-system get pods | grep ovs-ovn | awk '{print $$1}' | xargs kubectl -n kube-system delete pod + kubectl config use-context kind-kube-ovn1 + kubectl apply -f ovn-ic-1.yaml + sleep 6 + kubectl -n kube-system get pods | grep ovs-ovn | awk '{print $$1}' | xargs kubectl -n kube-system delete pod + .PHONY: kind-install-underlay -kind-install-underlay: kind-load-image kind-untaint-control-plane - $(eval SUBNET = $(shell docker network inspect kind -f "{{(index .IPAM.Config 0).Subnet}}")) - $(eval GATEWAY = $(shell docker network inspect kind -f "{{(index .IPAM.Config 0).Gateway}}")) - $(eval EXCLUDE_IPS = $(shell docker network inspect kind -f '{{range .Containers}},{{index (split .IPv4Address "/") 0}}{{end}}' | sed 's/^,//')) - @sed -e 's@^[[:space:]]*POD_CIDR=.*@POD_CIDR="$(SUBNET)"@' \ - -e 's@^[[:space:]]*POD_GATEWAY=.*@POD_GATEWAY="$(GATEWAY)"@' \ - -e 's@^[[:space:]]*EXCLUDE_IPS=.*@EXCLUDE_IPS="$(EXCLUDE_IPS)"@' \ +kind-install-underlay: kind-install-underlay-ipv4 + +.PHONY: kind-install-underlay-hairpin +kind-install-underlay-hairpin: kind-install-underlay-hairpin-ipv4 + +.PHONY: kind-install-underlay-ipv4 +kind-install-underlay-ipv4: kind-disable-hairpin kind-load-image kind-untaint-control-plane + $(call docker_network_info,kind) + @sed -e 's@^[[:space:]]*POD_CIDR=.*@POD_CIDR="$(KIND_IPV4_SUBNET)"@' \ + -e 's@^[[:space:]]*POD_GATEWAY=.*@POD_GATEWAY="$(KIND_IPV4_GATEWAY)"@' \ + -e 's@^[[:space:]]*EXCLUDE_IPS=.*@EXCLUDE_IPS="$(KIND_IPV4_EXCLUDE_IPS)"@' \ -e 's@^VLAN_ID=.*@VLAN_ID="0"@' \ - dist/images/install.sh > install-underlay.sh - ENABLE_SSL=true ENABLE_VLAN=true VLAN_NIC=eth0 bash install-underlay.sh + dist/images/install.sh | \ + ENABLE_VLAN=true VLAN_NIC=eth0 bash kubectl describe no -.PHONY: kind-install-single -kind-install-single: kind-load-image - ENABLE_SSL=true dist/images/install.sh +.PHONY: kind-install-underlay-hairpin-ipv4 +kind-install-underlay-hairpin-ipv4: kind-enable-hairpin kind-load-image kind-untaint-control-plane + $(call docker_network_info,kind) + @sed -e 's@^[[:space:]]*POD_CIDR=.*@POD_CIDR="$(KIND_IPV4_SUBNET)"@' \ + -e 's@^[[:space:]]*POD_GATEWAY=.*@POD_GATEWAY="$(KIND_IPV4_GATEWAY)"@' \ + -e 's@^[[:space:]]*EXCLUDE_IPS=.*@EXCLUDE_IPS="$(KIND_IPV4_EXCLUDE_IPS)"@' \ + -e 's@^VLAN_ID=.*@VLAN_ID="0"@' \ + dist/images/install.sh | \ + ENABLE_VLAN=true VLAN_NIC=eth0 bash kubectl describe no .PHONY: kind-install-ipv6 -kind-install-ipv6: kind-load-image kind-untaint-control-plane - ENABLE_SSL=true IPV6=true dist/images/install.sh +kind-install-ipv6: kind-install-overlay-ipv6 + +.PHONY: kind-install-overlay-ipv6 +kind-install-overlay-ipv6: + IPV6=true $(MAKE) kind-install .PHONY: kind-install-underlay-ipv6 -kind-install-underlay-ipv6: kind-load-image kind-untaint-control-plane - $(eval SUBNET = $(shell docker network inspect kind -f "{{(index .IPAM.Config 1).Subnet}}")) - $(eval GATEWAY = $(shell docker exec kube-ovn-control-plane ip -6 route show default | awk '{print $$3}')) - $(eval EXCLUDE_IPS = $(shell docker network inspect kind -f '{{range .Containers}},{{index (split .IPv6Address "/") 0}}{{end}}' | sed 's/^,//')) - @sed -e 's@^[[:space:]]*POD_CIDR=.*@POD_CIDR="$(SUBNET)"@' \ - -e 's@^[[:space:]]*POD_GATEWAY=.*@POD_GATEWAY="$(GATEWAY)"@' \ - -e 's@^[[:space:]]*EXCLUDE_IPS=.*@EXCLUDE_IPS="$(EXCLUDE_IPS)"@' \ +kind-install-underlay-ipv6: kind-disable-hairpin kind-load-image kind-untaint-control-plane + $(call docker_network_info,kind) + @sed -e 's@^[[:space:]]*POD_CIDR=.*@POD_CIDR="$(KIND_IPV6_SUBNET)"@' \ + -e 's@^[[:space:]]*POD_GATEWAY=.*@POD_GATEWAY="$(KIND_IPV6_GATEWAY)"@' \ + -e 's@^[[:space:]]*EXCLUDE_IPS=.*@EXCLUDE_IPS="$(KIND_IPV6_EXCLUDE_IPS)"@' \ -e 's@^VLAN_ID=.*@VLAN_ID="0"@' \ - dist/images/install.sh > install-underlay.sh - ENABLE_SSL=true IPV6=true ENABLE_VLAN=true VLAN_NIC=eth0 bash install-underlay.sh + dist/images/install.sh | \ + IPV6=true ENABLE_VLAN=true VLAN_NIC=eth0 bash + +.PHONY: kind-install-underlay-hairpin-ipv6 +kind-install-underlay-hairpin-ipv6: kind-enable-hairpin kind-load-image kind-untaint-control-plane + $(call docker_network_info,kind) + @sed -e 's@^[[:space:]]*POD_CIDR=.*@POD_CIDR="$(KIND_IPV6_SUBNET)"@' \ + -e 's@^[[:space:]]*POD_GATEWAY=.*@POD_GATEWAY="$(KIND_IPV6_GATEWAY)"@' \ + -e 's@^[[:space:]]*EXCLUDE_IPS=.*@EXCLUDE_IPS="$(KIND_IPV6_EXCLUDE_IPS)"@' \ + -e 's@^VLAN_ID=.*@VLAN_ID="0"@' \ + dist/images/install.sh | \ + IPV6=true ENABLE_VLAN=true VLAN_NIC=eth0 bash .PHONY: kind-install-dual -kind-install-dual: kind-load-image kind-untaint-control-plane - ENABLE_SSL=true DUAL_STACK=true dist/images/install.sh - kubectl describe no +kind-install-dual: kind-install-overlay-dual + +.PHONY: kind-install-overlay-dual +kind-install-overlay-dual: + DUAL_STACK=true $(MAKE) kind-install .PHONY: kind-install-underlay-dual -kind-install-underlay-dual: kind-load-image kind-untaint-control-plane - $(eval IPV4_SUBNET = $(shell docker network inspect kind -f "{{(index .IPAM.Config 0).Subnet}}")) - $(eval IPV6_SUBNET = $(shell docker network inspect kind -f "{{(index .IPAM.Config 1).Subnet}}")) - $(eval IPV4_GATEWAY = $(shell docker network inspect kind -f "{{(index .IPAM.Config 0).Gateway}}")) - $(eval IPV6_GATEWAY = $(shell docker exec kube-ovn-control-plane ip -6 route show default | awk '{print $$3}')) - $(eval IPV4_EXCLUDE_IPS = $(shell docker network inspect kind -f '{{range .Containers}},{{index (split .IPv4Address "/") 0}}{{end}}' | sed 's/^,//')) - $(eval IPV6_EXCLUDE_IPS = $(shell docker network inspect kind -f '{{range .Containers}},{{index (split .IPv6Address "/") 0}}{{end}}' | sed 's/^,//')) - @sed -e 's@^[[:space:]]*POD_CIDR=.*@POD_CIDR="$(IPV4_SUBNET),$(IPV6_SUBNET)"@' \ - -e 's@^[[:space:]]*POD_GATEWAY=.*@POD_GATEWAY="$(IPV4_GATEWAY),$(IPV6_GATEWAY)"@' \ - -e 's@^[[:space:]]*EXCLUDE_IPS=.*@EXCLUDE_IPS="$(IPV4_EXCLUDE_IPS),$(IPV6_EXCLUDE_IPS)"@' \ +kind-install-underlay-dual: kind-disable-hairpin kind-load-image kind-untaint-control-plane + $(call docker_network_info,kind) + @sed -e 's@^[[:space:]]*POD_CIDR=.*@POD_CIDR="$(KIND_IPV4_SUBNET),$(KIND_IPV6_SUBNET)"@' \ + -e 's@^[[:space:]]*POD_GATEWAY=.*@POD_GATEWAY="$(KIND_IPV4_GATEWAY),$(KIND_IPV6_GATEWAY)"@' \ + -e 's@^[[:space:]]*EXCLUDE_IPS=.*@EXCLUDE_IPS="$(KIND_IPV4_EXCLUDE_IPS),$(KIND_IPV6_EXCLUDE_IPS)"@' \ + -e 's@^VLAN_ID=.*@VLAN_ID="0"@' \ + dist/images/install.sh | \ + DUAL_STACK=true ENABLE_VLAN=true VLAN_NIC=eth0 bash + +.PHONY: kind-install-underlay-hairpin-dual +kind-install-underlay-hairpin-dual: kind-enable-hairpin kind-load-image kind-untaint-control-plane + $(call docker_network_info,kind) + @sed -e 's@^[[:space:]]*POD_CIDR=.*@POD_CIDR="$(KIND_IPV4_SUBNET),$(KIND_IPV6_SUBNET)"@' \ + -e 's@^[[:space:]]*POD_GATEWAY=.*@POD_GATEWAY="$(KIND_IPV4_GATEWAY),$(KIND_IPV6_GATEWAY)"@' \ + -e 's@^[[:space:]]*EXCLUDE_IPS=.*@EXCLUDE_IPS="$(KIND_IPV4_EXCLUDE_IPS),$(KIND_IPV6_EXCLUDE_IPS)"@' \ -e 's@^VLAN_ID=.*@VLAN_ID="0"@' \ - dist/images/install.sh > install-underlay.sh - ENABLE_SSL=true DUAL_STACK=true ENABLE_VLAN=true VLAN_NIC=eth0 bash install-underlay.sh + dist/images/install.sh | \ + DUAL_STACK=true ENABLE_VLAN=true VLAN_NIC=eth0 bash .PHONY: kind-install-underlay-logical-gateway-dual -kind-install-underlay-logical-gateway-dual: kind-load-image kind-untaint-control-plane - $(eval IPV4_SUBNET = $(shell docker network inspect kind -f "{{(index .IPAM.Config 0).Subnet}}")) - $(eval IPV6_SUBNET = $(shell docker network inspect kind -f "{{(index .IPAM.Config 1).Subnet}}")) - $(eval IPV4_GATEWAY = $(shell docker network inspect kind -f "{{(index .IPAM.Config 0).Gateway}}")) - $(eval IPV6_GATEWAY = $(shell docker exec kube-ovn-control-plane ip -6 route show default | awk '{print $$3}')) - $(eval IPV4_EXCLUDE_IPS = $(shell docker network inspect kind -f '{{range .Containers}},{{index (split .IPv4Address "/") 0}}{{end}}' | sed 's/^,//')) - $(eval IPV6_EXCLUDE_IPS = $(shell docker network inspect kind -f '{{range .Containers}},{{index (split .IPv6Address "/") 0}}{{end}}' | sed 's/^,//')) - @sed -e 's@^[[:space:]]*POD_CIDR=.*@POD_CIDR="$(IPV4_SUBNET),$(IPV6_SUBNET)"@' \ - -e 's@^[[:space:]]*POD_GATEWAY=.*@POD_GATEWAY="$(IPV4_GATEWAY)9,$(IPV6_GATEWAY)f"@' \ - -e 's@^[[:space:]]*EXCLUDE_IPS=.*@EXCLUDE_IPS="$(IPV4_EXCLUDE_IPS),$(IPV6_EXCLUDE_IPS)"@' \ +kind-install-underlay-logical-gateway-dual: kind-disable-hairpin kind-load-image kind-untaint-control-plane + $(call docker_network_info,kind) + @sed -e 's@^[[:space:]]*POD_CIDR=.*@POD_CIDR="$(KIND_IPV4_SUBNET),$(KIND_IPV6_SUBNET)"@' \ + -e 's@^[[:space:]]*POD_GATEWAY=.*@POD_GATEWAY="$(KIND_IPV4_GATEWAY)9,$(KIND_IPV6_GATEWAY)f"@' \ + -e 's@^[[:space:]]*EXCLUDE_IPS=.*@EXCLUDE_IPS="$(KIND_IPV4_GATEWAY),$(KIND_IPV4_EXCLUDE_IPS),$(KIND_IPV6_GATEWAY),$(KIND_IPV6_EXCLUDE_IPS)"@' \ -e 's@^VLAN_ID=.*@VLAN_ID="0"@' \ - dist/images/install.sh > install-underlay.sh - ENABLE_SSL=true DUAL_STACK=true ENABLE_VLAN=true VLAN_NIC=eth0 LOGICAL_GATEWAY=true bash install-underlay.sh + dist/images/install.sh | \ + DUAL_STACK=true ENABLE_VLAN=true \ + VLAN_NIC=eth0 LOGICAL_GATEWAY=true bash .PHONY: kind-install-multus -kind-install-multus: kind-load-image kind-untaint-control-plane - if ! docker images --format "{{.Repository}}:{{.Tag}}" | grep -qw "^$(MULTUS_IMAGE)$$"; then \ - docker pull "$(MULTUS_IMAGE)"; \ - fi - kind load docker-image --name kube-ovn "$(MULTUS_IMAGE)" +kind-install-multus: + $(call docker_ensure_image_exists,$(MULTUS_IMAGE)) + $(call kind_load_image,kube-ovn,$(MULTUS_IMAGE)) kubectl apply -f "$(MULTUS_YAML)" kubectl -n kube-system rollout status ds kube-multus-ds - kind load docker-image --name kube-ovn $(REGISTRY)/kube-ovn:$(RELEASE_TAG) - ENABLE_SSL=true CNI_CONFIG_PRIORITY=10 dist/images/install.sh - kubectl describe no - -.PHONY: kind-install-ic -kind-install-ic: - docker run -d --name ovn-ic-db --network kind $(REGISTRY)/kube-ovn:$(RELEASE_TAG) bash start-ic-db.sh - @set -e; \ - ic_db_host=$$(docker inspect ovn-ic-db -f "{{.NetworkSettings.Networks.kind.IPAddress}}"); \ - zone=az0 ic_db_host=$$ic_db_host gateway_node_name=kube-ovn-control-plane j2 yamls/ovn-ic.yaml.j2 -o ovn-ic-0.yaml; \ - zone=az1 ic_db_host=$$ic_db_host gateway_node_name=kube-ovn1-control-plane j2 yamls/ovn-ic.yaml.j2 -o ovn-ic-1.yaml - kubectl config use-context kind-kube-ovn - kubectl apply -f ovn-ic-0.yaml - kubectl config use-context kind-kube-ovn1 - kubectl apply -f ovn-ic-1.yaml .PHONY: kind-install-cilium kind-install-cilium: kind-load-image kind-untaint-control-plane $(eval KUBERNETES_SERVICE_HOST = $(shell kubectl get nodes kube-ovn-control-plane -o jsonpath='{.status.addresses[0].address}')) - if ! docker images --format "{{.Repository}}:{{.Tag}}" | grep -qw "^$(CILIUM_IMAGE_REPO):v$(CILIUM_VERSION)$$"; then \ - docker pull "$(CILIUM_IMAGE_REPO):v$(CILIUM_VERSION)"; \ - fi - kind load docker-image --name kube-ovn "$(CILIUM_IMAGE_REPO):v$(CILIUM_VERSION)" + $(call docker_ensure_image_exists,$(CILIUM_IMAGE_REPO):v$(CILIUM_VERSION)) + $(call kind_load_image,kube-ovn,$(CILIUM_IMAGE_REPO):v$(CILIUM_VERSION)) kubectl apply -f yamls/chaining.yaml helm repo add cilium https://helm.cilium.io/ helm install cilium cilium/cilium \ @@ -307,20 +426,19 @@ kind-install-cilium: kind-load-image kind-untaint-control-plane --set tunnel=disabled \ --set enableIPv4Masquerade=false \ --set enableIdentityMark=false \ - --set kubeProxyReplacement=strict \ --set cni.chainingMode=generic-veth \ --set cni.customConf=true \ --set cni.configMap=cni-configuration kubectl -n kube-system rollout status ds cilium --timeout 300s - ENABLE_SSL=true ENABLE_LB=false ENABLE_NP=false WITHOUT_KUBE_PROXY=true bash dist/images/install.sh + bash dist/images/cilium.sh + ENABLE_LB=false ENABLE_NP=false WITHOUT_KUBE_PROXY=true CNI_CONFIG_PRIORITY=10 bash dist/images/install.sh kubectl describe no .PHONY: kind-reload -kind-reload: kind-load-image +kind-reload: kind-reload-ovs kubectl delete pod -n kube-system -l app=kube-ovn-controller kubectl delete pod -n kube-system -l app=kube-ovn-cni kubectl delete pod -n kube-system -l app=kube-ovn-pinger - kubectl delete pod -n kube-system -l app=ovs .PHONY: kind-reload-ovs kind-reload-ovs: kind-load-image @@ -329,13 +447,11 @@ kind-reload-ovs: kind-load-image .PHONY: kind-clean kind-clean: kind delete cluster --name=kube-ovn - docker ps -a -f name=kube-ovn-e2e --format "{{.ID}}" | while read c; do docker rm -f $$c; done -.PHONY: kind-clean-cluster -kind-clean-cluster: - kind delete cluster --name=kube-ovn +.PHONY: kind-clean-ovn-ic +kind-clean-ovn-ic: kind-clean + $(call docker_rm_container,ovn-ic-db) kind delete cluster --name=kube-ovn1 - docker ps -a -f name=ovn-ic-db --format "{{.ID}}" | while read c; do docker rm -f $$c; done .PHONY: uninstall uninstall: @@ -366,66 +482,6 @@ scan: ut: ginkgo -mod=mod -progress -reportPassed --slowSpecThreshold=60 test/unittest -.PHONY: e2e -e2e: - $(eval NODE_COUNT = $(shell kind get nodes --name kube-ovn | wc -l)) - $(eval NETWORK_BRIDGE = $(shell docker inspect -f '{{json .NetworkSettings.Networks.bridge}}' kube-ovn-control-plane)) - @if docker ps -a --format 'table {{.Names}}' | grep -q '^kube-ovn-e2e$$'; then \ - docker rm -f kube-ovn-e2e; \ - fi - docker run -d --name kube-ovn-e2e --network kind --cap-add=NET_ADMIN $(REGISTRY)/kube-ovn:$(RELEASE_TAG) sleep infinity - @if [ '$(NETWORK_BRIDGE)' = 'null' ]; then \ - kind get nodes --name kube-ovn | while read node; do \ - docker network connect bridge $$node; \ - done; \ - fi - - @if [ -n "$$VLAN_ID" ]; then \ - kind get nodes --name kube-ovn | while read node; do \ - docker cp test/kind-vlan.sh $$node:/kind-vlan.sh; \ - docker exec $$node sh -c "VLAN_ID=$$VLAN_ID sh /kind-vlan.sh"; \ - done; \ - fi - - @echo "{" > test/e2e/network.json - @i=0; kind get nodes --name kube-ovn | while read node; do \ - i=$$((i+1)); \ - printf '"%s": ' "$$node" >> test/e2e/network.json; \ - docker inspect -f "{{json .NetworkSettings.Networks.bridge}}" "$$node" >> test/e2e/network.json; \ - if [ $$i -ne $(NODE_COUNT) ]; then echo "," >> test/e2e/network.json; fi; \ - done - @echo "}" >> test/e2e/network.json - - @if [ ! -n "$$(docker images -q kubeovn/pause:3.2 2>/dev/null)" ]; then docker pull kubeovn/pause:3.2; fi - kind load docker-image --name kube-ovn kubeovn/pause:3.2 - ginkgo -mod=mod -progress -reportPassed --slowSpecThreshold=60 test/e2e - -.PHONY: e2e-ipv6 -e2e-ipv6: - @IPV6=true $(MAKE) e2e - -.PHONY: e2e-vlan -e2e-vlan: - @VLAN_ID=100 $(MAKE) e2e - -.PHONY: e2e-vlan-ipv6 -e2e-vlan-ipv6: - @IPV6=true $(MAKE) e2e-vlan - -.PHONY: e2e-underlay-single-nic -e2e-underlay-single-nic: - @docker inspect -f '{{json .NetworkSettings.Networks.kind}}' kube-ovn-control-plane > test/e2e-underlay-single-nic/node/network.json - ginkgo -mod=mod -progress -reportPassed --slowSpecThreshold=60 test/e2e-underlay-single-nic - -.PHONY: e2e-ovn-ic -e2e-ovn-ic: - ginkgo -mod=mod -progress -reportPassed --slowSpecThreshold=60 test/e2e-ovnic - -.PHONY: e2e-ovn-ebpf -e2e-ovn-ebpf: - docker run -d --name kube-ovn-e2e --network kind --cap-add=NET_ADMIN $(REGISTRY)/kube-ovn:$(RELEASE_TAG) sleep infinity - ginkgo -mod=mod -progress -reportPassed --slowSpecThreshold=60 test/e2e-ebpf - .PHONY: clean clean: $(RM) dist/images/kube-ovn dist/images/kube-ovn-cmd @@ -434,4 +490,3 @@ clean: $(RM) ovn-ic-0.yaml ovn-ic-1.yaml $(RM) kube-ovn.tar vpc-nat-gateway.tar image-amd64.tar image-arm64.tar $(RM) test/e2e/ovnnb_db.* test/e2e/ovnsb_db.* - $(RM) install-underlay.sh diff --git a/cmd/pinger/pinger.go b/cmd/pinger/pinger.go index 321d2ef3e96..c7abedeb8ea 100644 --- a/cmd/pinger/pinger.go +++ b/cmd/pinger/pinger.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" _ "net/http/pprof" // #nosec + "time" "github.com/prometheus/client_golang/prometheus/promhttp" "k8s.io/klog/v2" @@ -26,7 +27,11 @@ func CmdMain() { if config.Mode == "server" { http.Handle("/metrics", promhttp.Handler()) go func() { - klog.Fatal(http.ListenAndServe(fmt.Sprintf("0.0.0.0:%d", config.Port), nil)) + server := &http.Server{ + Addr: fmt.Sprintf("0.0.0.0:%d", config.Port), + ReadHeaderTimeout: 3 * time.Second, + } + util.LogFatalAndExit(server.ListenAndServe(), "failed to listen and serve on %s", server.Addr) }() } e := pinger.NewExporter(config) diff --git a/cmd/speaker/speaker.go b/cmd/speaker/speaker.go index c8de521284b..c4a2a832e49 100644 --- a/cmd/speaker/speaker.go +++ b/cmd/speaker/speaker.go @@ -3,6 +3,7 @@ package speaker import ( "fmt" "net/http" + "time" "github.com/prometheus/client_golang/prometheus/promhttp" "k8s.io/klog/v2" @@ -27,7 +28,11 @@ func CmdMain() { go func() { http.Handle("/metrics", promhttp.Handler()) - klog.Fatal(http.ListenAndServe(fmt.Sprintf("0.0.0.0:%d", config.PprofPort), nil)) + server := &http.Server{ + Addr: fmt.Sprintf("0.0.0.0:%d", config.PprofPort), + ReadHeaderTimeout: 3 * time.Second, + } + util.LogFatalAndExit(server.ListenAndServe(), "failed to listen and serve on %s", server.Addr) }() ctl.Run(stopCh) diff --git a/dist/images/install.sh b/dist/images/install.sh index 3024504a752..5aad9445144 100755 --- a/dist/images/install.sh +++ b/dist/images/install.sh @@ -204,6 +204,7 @@ echo "" echo "[Step 2/6] Install OVN components" addresses=$(kubectl get no -lkube-ovn/role=master --no-headers -o wide | awk '{print $6}' | tr \\n ',') +count=$(kubectl get no -lkube-ovn/role=master --no-headers | wc -l) echo "Install OVN DB in $addresses" cat < kube-ovn-crd.yaml diff --git a/go.mod b/go.mod index 62b81f3cc8b..e0ccb23f4ca 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/kubeovn/kube-ovn -go 1.18 +go 1.19 require ( github.com/Mellanox/sriovnet v1.1.0 @@ -144,11 +144,8 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/apiextensions-apiserver v0.24.2 // indirect - k8s.io/cluster-bootstrap v0.24.2 // indirect k8s.io/component-base v0.24.2 // indirect - k8s.io/component-helpers v0.24.2 // indirect k8s.io/kube-openapi v0.0.0-20220627174259-011e075b9cb8 // indirect - k8s.io/kube-proxy v0.24.2 // indirect kubevirt.io/api v0.54.0 // indirect kubevirt.io/containerized-data-importer-api v1.51.0 // indirect kubevirt.io/controller-lifecycle-operator-sdk/api v0.2.4 // indirect diff --git a/go.sum b/go.sum index dc9f391a4dd..53b4386cf86 100644 --- a/go.sum +++ b/go.sum @@ -383,7 +383,6 @@ github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TT github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.8.0+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68= github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v1.4.2-0.20190924003213-a8608b5b67c7/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v20.10.12+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= @@ -993,7 +992,6 @@ github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1 github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1.0.20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= @@ -1970,18 +1968,15 @@ k8s.io/apiextensions-apiserver v0.24.2 h1:/4NEQHKlEz1MlaK/wHT5KMKC9UKYz6NZz6JE6o k8s.io/apiextensions-apiserver v0.24.2/go.mod h1:e5t2GMFVngUEHUd0wuCJzw8YDwZoqZfJiGOW6mm2hLQ= k8s.io/apimachinery v0.24.2 h1:5QlH9SL2C8KMcrNJPor+LbXVTaZRReml7svPEh4OKDM= k8s.io/apimachinery v0.24.2/go.mod h1:82Bi4sCzVBdpYjyI4jY6aHX+YCUchUIrZrXKedjd2UM= -k8s.io/apiserver v0.24.2 h1:orxipm5elPJSkkFNlwH9ClqaKEDJJA3yR2cAAlCnyj4= k8s.io/apiserver v0.24.2/go.mod h1:pSuKzr3zV+L+MWqsEo0kHHYwCo77AT5qXbFXP2jbvFI= k8s.io/cli-runtime v0.24.2/go.mod h1:1LIhKL2RblkhfG4v5lZEt7FtgFG5mVb8wqv5lE9m5qY= k8s.io/client-go v0.24.2 h1:CoXFSf8if+bLEbinDqN9ePIDGzcLtqhfd6jpfnwGOFA= k8s.io/client-go v0.24.2/go.mod h1:zg4Xaoo+umDsfCWr4fCnmLEtQXyCNXCvJuSsglNcV30= k8s.io/cloud-provider v0.24.2/go.mod h1:a7jyWjizk+IKbcIf8+mX2cj3NvpRv9ZyGdXDyb8UEkI= -k8s.io/cluster-bootstrap v0.24.2 h1:p177dIhDst4INUWBZgTnqSad8oJiUdKo0cLLVU24AzE= k8s.io/cluster-bootstrap v0.24.2/go.mod h1:eIHV338K03vBm3u/ROZiNXxWJ4AJRoTR9PEUhcTvYkg= k8s.io/code-generator v0.24.2/go.mod h1:dpVhs00hTuTdTY6jvVxvTFCk6gSMrtfRydbhZwHI15w= k8s.io/component-base v0.24.2 h1:kwpQdoSfbcH+8MPN4tALtajLDfSfYxBDYlXobNWI6OU= k8s.io/component-base v0.24.2/go.mod h1:ucHwW76dajvQ9B7+zecZAP3BVqvrHoOxm8olHEg0nmM= -k8s.io/component-helpers v0.24.2 h1:gtXmI/TjVINtkAdZn7m5p8+Vd0Mk4d1q8kwJMMLBdwY= k8s.io/component-helpers v0.24.2/go.mod h1:TRQPBQKfmqkmV6c0HAmUs8cXVNYYYLsXy4zu8eODi9g= k8s.io/controller-manager v0.24.2/go.mod h1:hpwCof4KxP4vrw/M5QiVxU6Zmmggmr1keGXtjGHF+vc= k8s.io/cri-api v0.24.2/go.mod h1:t3tImFtGeStN+ES69bQUX9sFg67ek38BM9YIJhMmuig= @@ -2010,7 +2005,6 @@ k8s.io/kube-openapi v0.0.0-20220124234850-424119656bbf/go.mod h1:sX9MT8g7NVZM5lV k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42/go.mod h1:Z/45zLw8lUo4wdiUkI+v/ImEGAvu3WatcZl3lPMR4Rk= k8s.io/kube-openapi v0.0.0-20220627174259-011e075b9cb8 h1:yEQKdMCjzAOvGeiTwG4hO/hNVNtDOuUFvMUZ0OlaIzs= k8s.io/kube-openapi v0.0.0-20220627174259-011e075b9cb8/go.mod h1:mbJ+NSUoAhuR14N0S63bPkh8MGVSo3VYSGZtH/mfMe0= -k8s.io/kube-proxy v0.24.2 h1:5gPyk/wQIIuc6TfyjWsvGqquECN9jTebg//VZhOXAF8= k8s.io/kube-proxy v0.24.2/go.mod h1:bozS2ufl/Ns6s40Ue34eV7rqyLVygi5usSmCgW7rFU8= k8s.io/kube-scheduler v0.24.2/go.mod h1:DRa+aeXKSYUUOHHIc/9EcaO9+FW5FydaOfPSvaSW5Ko= k8s.io/kubectl v0.24.2/go.mod h1:+HIFJc0bA6Tzu5O/YcuUt45APAxnNL8LeMuXwoiGsPg= diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index b3ce6953078..fa092d649c1 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -37,14 +37,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) // -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index d2742d37ae8..0aa2b12abff 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -37,14 +37,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) // -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. diff --git a/pkg/client/listers/clientset/versioned/clientset.go b/pkg/client/listers/clientset/versioned/clientset.go deleted file mode 100644 index 4dfab592983..00000000000 --- a/pkg/client/listers/clientset/versioned/clientset.go +++ /dev/null @@ -1,121 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package versioned - -import ( - "fmt" - "net/http" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned/typed/kubeovn/v1" - discovery "k8s.io/client-go/discovery" - rest "k8s.io/client-go/rest" - flowcontrol "k8s.io/client-go/util/flowcontrol" -) - -type Interface interface { - Discovery() discovery.DiscoveryInterface - KubeovnV1() kubeovnv1.KubeovnV1Interface -} - -// Clientset contains the clients for groups. Each group has exactly one -// version included in a Clientset. -type Clientset struct { - *discovery.DiscoveryClient - kubeovnV1 *kubeovnv1.KubeovnV1Client -} - -// KubeovnV1 retrieves the KubeovnV1Client -func (c *Clientset) KubeovnV1() kubeovnv1.KubeovnV1Interface { - return c.kubeovnV1 -} - -// Discovery retrieves the DiscoveryClient -func (c *Clientset) Discovery() discovery.DiscoveryInterface { - if c == nil { - return nil - } - return c.DiscoveryClient -} - -// NewForConfig creates a new Clientset for the given config. -// If config's RateLimiter is not set and QPS and Burst are acceptable, -// NewForConfig will generate a rate-limiter in configShallowCopy. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*Clientset, error) { - configShallowCopy := *c - - if configShallowCopy.UserAgent == "" { - configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent() - } - - // share the transport between all clients - httpClient, err := rest.HTTPClientFor(&configShallowCopy) - if err != nil { - return nil, err - } - - return NewForConfigAndClient(&configShallowCopy, httpClient) -} - -// NewForConfigAndClient creates a new Clientset for the given config and http client. -// Note the http client provided takes precedence over the configured transport values. -// If config's RateLimiter is not set and QPS and Burst are acceptable, -// NewForConfigAndClient will generate a rate-limiter in configShallowCopy. -func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, error) { - configShallowCopy := *c - if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { - if configShallowCopy.Burst <= 0 { - return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") - } - configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) - } - - var cs Clientset - var err error - cs.kubeovnV1, err = kubeovnv1.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - - cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - return &cs, nil -} - -// NewForConfigOrDie creates a new Clientset for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *Clientset { - cs, err := NewForConfig(c) - if err != nil { - panic(err) - } - return cs -} - -// New creates a new Clientset for the given RESTClient. -func New(c rest.Interface) *Clientset { - var cs Clientset - cs.kubeovnV1 = kubeovnv1.New(c) - - cs.DiscoveryClient = discovery.NewDiscoveryClient(c) - return &cs -} diff --git a/pkg/client/listers/clientset/versioned/doc.go b/pkg/client/listers/clientset/versioned/doc.go deleted file mode 100644 index 41721ca52d4..00000000000 --- a/pkg/client/listers/clientset/versioned/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated clientset. -package versioned diff --git a/pkg/client/listers/clientset/versioned/fake/clientset_generated.go b/pkg/client/listers/clientset/versioned/fake/clientset_generated.go deleted file mode 100644 index 164d4abfa66..00000000000 --- a/pkg/client/listers/clientset/versioned/fake/clientset_generated.go +++ /dev/null @@ -1,85 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - clientset "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned" - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned/typed/kubeovn/v1" - fakekubeovnv1 "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned/typed/kubeovn/v1/fake" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/watch" - "k8s.io/client-go/discovery" - fakediscovery "k8s.io/client-go/discovery/fake" - "k8s.io/client-go/testing" -) - -// NewSimpleClientset returns a clientset that will respond with the provided objects. -// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, -// without applying any validations and/or defaults. It shouldn't be considered a replacement -// for a real clientset and is mostly useful in simple unit tests. -func NewSimpleClientset(objects ...runtime.Object) *Clientset { - o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) - for _, obj := range objects { - if err := o.Add(obj); err != nil { - panic(err) - } - } - - cs := &Clientset{tracker: o} - cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} - cs.AddReactor("*", "*", testing.ObjectReaction(o)) - cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { - gvr := action.GetResource() - ns := action.GetNamespace() - watch, err := o.Watch(gvr, ns) - if err != nil { - return false, nil, err - } - return true, watch, nil - }) - - return cs -} - -// Clientset implements clientset.Interface. Meant to be embedded into a -// struct to get a default implementation. This makes faking out just the method -// you want to test easier. -type Clientset struct { - testing.Fake - discovery *fakediscovery.FakeDiscovery - tracker testing.ObjectTracker -} - -func (c *Clientset) Discovery() discovery.DiscoveryInterface { - return c.discovery -} - -func (c *Clientset) Tracker() testing.ObjectTracker { - return c.tracker -} - -var ( - _ clientset.Interface = &Clientset{} - _ testing.FakeClient = &Clientset{} -) - -// KubeovnV1 retrieves the KubeovnV1Client -func (c *Clientset) KubeovnV1() kubeovnv1.KubeovnV1Interface { - return &fakekubeovnv1.FakeKubeovnV1{Fake: &c.Fake} -} diff --git a/pkg/client/listers/clientset/versioned/fake/doc.go b/pkg/client/listers/clientset/versioned/fake/doc.go deleted file mode 100644 index 9b99e716709..00000000000 --- a/pkg/client/listers/clientset/versioned/fake/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated fake clientset. -package fake diff --git a/pkg/client/listers/clientset/versioned/fake/register.go b/pkg/client/listers/clientset/versioned/fake/register.go deleted file mode 100644 index fa092d649c1..00000000000 --- a/pkg/client/listers/clientset/versioned/fake/register.go +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" -) - -var scheme = runtime.NewScheme() -var codecs = serializer.NewCodecFactory(scheme) - -var localSchemeBuilder = runtime.SchemeBuilder{ - kubeovnv1.AddToScheme, -} - -// AddToScheme adds all types of this clientset into the given scheme. This allows composition -// of clientsets, like in: -// -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) -// -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) -// -// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types -// correctly. -var AddToScheme = localSchemeBuilder.AddToScheme - -func init() { - v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) - utilruntime.Must(AddToScheme(scheme)) -} diff --git a/pkg/client/listers/clientset/versioned/scheme/doc.go b/pkg/client/listers/clientset/versioned/scheme/doc.go deleted file mode 100644 index 7dc3756168f..00000000000 --- a/pkg/client/listers/clientset/versioned/scheme/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package contains the scheme of the automatically generated clientset. -package scheme diff --git a/pkg/client/listers/clientset/versioned/scheme/register.go b/pkg/client/listers/clientset/versioned/scheme/register.go deleted file mode 100644 index 0aa2b12abff..00000000000 --- a/pkg/client/listers/clientset/versioned/scheme/register.go +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package scheme - -import ( - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" -) - -var Scheme = runtime.NewScheme() -var Codecs = serializer.NewCodecFactory(Scheme) -var ParameterCodec = runtime.NewParameterCodec(Scheme) -var localSchemeBuilder = runtime.SchemeBuilder{ - kubeovnv1.AddToScheme, -} - -// AddToScheme adds all types of this clientset into the given scheme. This allows composition -// of clientsets, like in: -// -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) -// -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) -// -// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types -// correctly. -var AddToScheme = localSchemeBuilder.AddToScheme - -func init() { - v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) - utilruntime.Must(AddToScheme(Scheme)) -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/doc.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/doc.go deleted file mode 100644 index 3af5d054f10..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated typed clients. -package v1 diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/doc.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/doc.go deleted file mode 100644 index 16f44399065..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// Package fake has the automatically generated clients. -package fake diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_htbqos.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_htbqos.go deleted file mode 100644 index da95cb21262..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_htbqos.go +++ /dev/null @@ -1,122 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeHtbQoses implements HtbQosInterface -type FakeHtbQoses struct { - Fake *FakeKubeovnV1 -} - -var htbqosesResource = schema.GroupVersionResource{Group: "kubeovn.io", Version: "v1", Resource: "htbqoses"} - -var htbqosesKind = schema.GroupVersionKind{Group: "kubeovn.io", Version: "v1", Kind: "HtbQos"} - -// Get takes name of the htbQos, and returns the corresponding htbQos object, and an error if there is any. -func (c *FakeHtbQoses) Get(ctx context.Context, name string, options v1.GetOptions) (result *kubeovnv1.HtbQos, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(htbqosesResource, name), &kubeovnv1.HtbQos{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.HtbQos), err -} - -// List takes label and field selectors, and returns the list of HtbQoses that match those selectors. -func (c *FakeHtbQoses) List(ctx context.Context, opts v1.ListOptions) (result *kubeovnv1.HtbQosList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(htbqosesResource, htbqosesKind, opts), &kubeovnv1.HtbQosList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &kubeovnv1.HtbQosList{ListMeta: obj.(*kubeovnv1.HtbQosList).ListMeta} - for _, item := range obj.(*kubeovnv1.HtbQosList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested htbQoses. -func (c *FakeHtbQoses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(htbqosesResource, opts)) -} - -// Create takes the representation of a htbQos and creates it. Returns the server's representation of the htbQos, and an error, if there is any. -func (c *FakeHtbQoses) Create(ctx context.Context, htbQos *kubeovnv1.HtbQos, opts v1.CreateOptions) (result *kubeovnv1.HtbQos, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(htbqosesResource, htbQos), &kubeovnv1.HtbQos{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.HtbQos), err -} - -// Update takes the representation of a htbQos and updates it. Returns the server's representation of the htbQos, and an error, if there is any. -func (c *FakeHtbQoses) Update(ctx context.Context, htbQos *kubeovnv1.HtbQos, opts v1.UpdateOptions) (result *kubeovnv1.HtbQos, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(htbqosesResource, htbQos), &kubeovnv1.HtbQos{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.HtbQos), err -} - -// Delete takes name of the htbQos and deletes it. Returns an error if one occurs. -func (c *FakeHtbQoses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(htbqosesResource, name, opts), &kubeovnv1.HtbQos{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeHtbQoses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(htbqosesResource, listOpts) - - _, err := c.Fake.Invokes(action, &kubeovnv1.HtbQosList{}) - return err -} - -// Patch applies the patch and returns the patched htbQos. -func (c *FakeHtbQoses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *kubeovnv1.HtbQos, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(htbqosesResource, name, pt, data, subresources...), &kubeovnv1.HtbQos{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.HtbQos), err -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_ip.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_ip.go deleted file mode 100644 index 4ea825e77ee..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_ip.go +++ /dev/null @@ -1,122 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeIPs implements IPInterface -type FakeIPs struct { - Fake *FakeKubeovnV1 -} - -var ipsResource = schema.GroupVersionResource{Group: "kubeovn.io", Version: "v1", Resource: "ips"} - -var ipsKind = schema.GroupVersionKind{Group: "kubeovn.io", Version: "v1", Kind: "IP"} - -// Get takes name of the iP, and returns the corresponding iP object, and an error if there is any. -func (c *FakeIPs) Get(ctx context.Context, name string, options v1.GetOptions) (result *kubeovnv1.IP, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(ipsResource, name), &kubeovnv1.IP{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.IP), err -} - -// List takes label and field selectors, and returns the list of IPs that match those selectors. -func (c *FakeIPs) List(ctx context.Context, opts v1.ListOptions) (result *kubeovnv1.IPList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(ipsResource, ipsKind, opts), &kubeovnv1.IPList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &kubeovnv1.IPList{ListMeta: obj.(*kubeovnv1.IPList).ListMeta} - for _, item := range obj.(*kubeovnv1.IPList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested iPs. -func (c *FakeIPs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(ipsResource, opts)) -} - -// Create takes the representation of a iP and creates it. Returns the server's representation of the iP, and an error, if there is any. -func (c *FakeIPs) Create(ctx context.Context, iP *kubeovnv1.IP, opts v1.CreateOptions) (result *kubeovnv1.IP, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(ipsResource, iP), &kubeovnv1.IP{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.IP), err -} - -// Update takes the representation of a iP and updates it. Returns the server's representation of the iP, and an error, if there is any. -func (c *FakeIPs) Update(ctx context.Context, iP *kubeovnv1.IP, opts v1.UpdateOptions) (result *kubeovnv1.IP, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(ipsResource, iP), &kubeovnv1.IP{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.IP), err -} - -// Delete takes name of the iP and deletes it. Returns an error if one occurs. -func (c *FakeIPs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(ipsResource, name, opts), &kubeovnv1.IP{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeIPs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(ipsResource, listOpts) - - _, err := c.Fake.Invokes(action, &kubeovnv1.IPList{}) - return err -} - -// Patch applies the patch and returns the patched iP. -func (c *FakeIPs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *kubeovnv1.IP, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(ipsResource, name, pt, data, subresources...), &kubeovnv1.IP{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.IP), err -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_iptablesdnatrule.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_iptablesdnatrule.go deleted file mode 100644 index 76526eff581..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_iptablesdnatrule.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeIptablesDnatRules implements IptablesDnatRuleInterface -type FakeIptablesDnatRules struct { - Fake *FakeKubeovnV1 -} - -var iptablesdnatrulesResource = schema.GroupVersionResource{Group: "kubeovn.io", Version: "v1", Resource: "iptables-dnat-rules"} - -var iptablesdnatrulesKind = schema.GroupVersionKind{Group: "kubeovn.io", Version: "v1", Kind: "IptablesDnatRule"} - -// Get takes name of the iptablesDnatRule, and returns the corresponding iptablesDnatRule object, and an error if there is any. -func (c *FakeIptablesDnatRules) Get(ctx context.Context, name string, options v1.GetOptions) (result *kubeovnv1.IptablesDnatRule, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(iptablesdnatrulesResource, name), &kubeovnv1.IptablesDnatRule{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.IptablesDnatRule), err -} - -// List takes label and field selectors, and returns the list of IptablesDnatRules that match those selectors. -func (c *FakeIptablesDnatRules) List(ctx context.Context, opts v1.ListOptions) (result *kubeovnv1.IptablesDnatRuleList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(iptablesdnatrulesResource, iptablesdnatrulesKind, opts), &kubeovnv1.IptablesDnatRuleList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &kubeovnv1.IptablesDnatRuleList{ListMeta: obj.(*kubeovnv1.IptablesDnatRuleList).ListMeta} - for _, item := range obj.(*kubeovnv1.IptablesDnatRuleList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested iptablesDnatRules. -func (c *FakeIptablesDnatRules) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(iptablesdnatrulesResource, opts)) -} - -// Create takes the representation of a iptablesDnatRule and creates it. Returns the server's representation of the iptablesDnatRule, and an error, if there is any. -func (c *FakeIptablesDnatRules) Create(ctx context.Context, iptablesDnatRule *kubeovnv1.IptablesDnatRule, opts v1.CreateOptions) (result *kubeovnv1.IptablesDnatRule, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(iptablesdnatrulesResource, iptablesDnatRule), &kubeovnv1.IptablesDnatRule{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.IptablesDnatRule), err -} - -// Update takes the representation of a iptablesDnatRule and updates it. Returns the server's representation of the iptablesDnatRule, and an error, if there is any. -func (c *FakeIptablesDnatRules) Update(ctx context.Context, iptablesDnatRule *kubeovnv1.IptablesDnatRule, opts v1.UpdateOptions) (result *kubeovnv1.IptablesDnatRule, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(iptablesdnatrulesResource, iptablesDnatRule), &kubeovnv1.IptablesDnatRule{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.IptablesDnatRule), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeIptablesDnatRules) UpdateStatus(ctx context.Context, iptablesDnatRule *kubeovnv1.IptablesDnatRule, opts v1.UpdateOptions) (*kubeovnv1.IptablesDnatRule, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(iptablesdnatrulesResource, "status", iptablesDnatRule), &kubeovnv1.IptablesDnatRule{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.IptablesDnatRule), err -} - -// Delete takes name of the iptablesDnatRule and deletes it. Returns an error if one occurs. -func (c *FakeIptablesDnatRules) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(iptablesdnatrulesResource, name, opts), &kubeovnv1.IptablesDnatRule{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeIptablesDnatRules) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(iptablesdnatrulesResource, listOpts) - - _, err := c.Fake.Invokes(action, &kubeovnv1.IptablesDnatRuleList{}) - return err -} - -// Patch applies the patch and returns the patched iptablesDnatRule. -func (c *FakeIptablesDnatRules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *kubeovnv1.IptablesDnatRule, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(iptablesdnatrulesResource, name, pt, data, subresources...), &kubeovnv1.IptablesDnatRule{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.IptablesDnatRule), err -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_iptableseip.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_iptableseip.go deleted file mode 100644 index 3634fa55370..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_iptableseip.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeIptablesEIPs implements IptablesEIPInterface -type FakeIptablesEIPs struct { - Fake *FakeKubeovnV1 -} - -var iptableseipsResource = schema.GroupVersionResource{Group: "kubeovn.io", Version: "v1", Resource: "iptables-eips"} - -var iptableseipsKind = schema.GroupVersionKind{Group: "kubeovn.io", Version: "v1", Kind: "IptablesEIP"} - -// Get takes name of the iptablesEIP, and returns the corresponding iptablesEIP object, and an error if there is any. -func (c *FakeIptablesEIPs) Get(ctx context.Context, name string, options v1.GetOptions) (result *kubeovnv1.IptablesEIP, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(iptableseipsResource, name), &kubeovnv1.IptablesEIP{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.IptablesEIP), err -} - -// List takes label and field selectors, and returns the list of IptablesEIPs that match those selectors. -func (c *FakeIptablesEIPs) List(ctx context.Context, opts v1.ListOptions) (result *kubeovnv1.IptablesEIPList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(iptableseipsResource, iptableseipsKind, opts), &kubeovnv1.IptablesEIPList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &kubeovnv1.IptablesEIPList{ListMeta: obj.(*kubeovnv1.IptablesEIPList).ListMeta} - for _, item := range obj.(*kubeovnv1.IptablesEIPList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested iptablesEIPs. -func (c *FakeIptablesEIPs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(iptableseipsResource, opts)) -} - -// Create takes the representation of a iptablesEIP and creates it. Returns the server's representation of the iptablesEIP, and an error, if there is any. -func (c *FakeIptablesEIPs) Create(ctx context.Context, iptablesEIP *kubeovnv1.IptablesEIP, opts v1.CreateOptions) (result *kubeovnv1.IptablesEIP, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(iptableseipsResource, iptablesEIP), &kubeovnv1.IptablesEIP{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.IptablesEIP), err -} - -// Update takes the representation of a iptablesEIP and updates it. Returns the server's representation of the iptablesEIP, and an error, if there is any. -func (c *FakeIptablesEIPs) Update(ctx context.Context, iptablesEIP *kubeovnv1.IptablesEIP, opts v1.UpdateOptions) (result *kubeovnv1.IptablesEIP, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(iptableseipsResource, iptablesEIP), &kubeovnv1.IptablesEIP{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.IptablesEIP), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeIptablesEIPs) UpdateStatus(ctx context.Context, iptablesEIP *kubeovnv1.IptablesEIP, opts v1.UpdateOptions) (*kubeovnv1.IptablesEIP, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(iptableseipsResource, "status", iptablesEIP), &kubeovnv1.IptablesEIP{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.IptablesEIP), err -} - -// Delete takes name of the iptablesEIP and deletes it. Returns an error if one occurs. -func (c *FakeIptablesEIPs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(iptableseipsResource, name, opts), &kubeovnv1.IptablesEIP{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeIptablesEIPs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(iptableseipsResource, listOpts) - - _, err := c.Fake.Invokes(action, &kubeovnv1.IptablesEIPList{}) - return err -} - -// Patch applies the patch and returns the patched iptablesEIP. -func (c *FakeIptablesEIPs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *kubeovnv1.IptablesEIP, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(iptableseipsResource, name, pt, data, subresources...), &kubeovnv1.IptablesEIP{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.IptablesEIP), err -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_iptablesfiprule.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_iptablesfiprule.go deleted file mode 100644 index 9728282aaa8..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_iptablesfiprule.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeIptablesFIPRules implements IptablesFIPRuleInterface -type FakeIptablesFIPRules struct { - Fake *FakeKubeovnV1 -} - -var iptablesfiprulesResource = schema.GroupVersionResource{Group: "kubeovn.io", Version: "v1", Resource: "iptables-fip-rules"} - -var iptablesfiprulesKind = schema.GroupVersionKind{Group: "kubeovn.io", Version: "v1", Kind: "IptablesFIPRule"} - -// Get takes name of the iptablesFIPRule, and returns the corresponding iptablesFIPRule object, and an error if there is any. -func (c *FakeIptablesFIPRules) Get(ctx context.Context, name string, options v1.GetOptions) (result *kubeovnv1.IptablesFIPRule, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(iptablesfiprulesResource, name), &kubeovnv1.IptablesFIPRule{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.IptablesFIPRule), err -} - -// List takes label and field selectors, and returns the list of IptablesFIPRules that match those selectors. -func (c *FakeIptablesFIPRules) List(ctx context.Context, opts v1.ListOptions) (result *kubeovnv1.IptablesFIPRuleList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(iptablesfiprulesResource, iptablesfiprulesKind, opts), &kubeovnv1.IptablesFIPRuleList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &kubeovnv1.IptablesFIPRuleList{ListMeta: obj.(*kubeovnv1.IptablesFIPRuleList).ListMeta} - for _, item := range obj.(*kubeovnv1.IptablesFIPRuleList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested iptablesFIPRules. -func (c *FakeIptablesFIPRules) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(iptablesfiprulesResource, opts)) -} - -// Create takes the representation of a iptablesFIPRule and creates it. Returns the server's representation of the iptablesFIPRule, and an error, if there is any. -func (c *FakeIptablesFIPRules) Create(ctx context.Context, iptablesFIPRule *kubeovnv1.IptablesFIPRule, opts v1.CreateOptions) (result *kubeovnv1.IptablesFIPRule, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(iptablesfiprulesResource, iptablesFIPRule), &kubeovnv1.IptablesFIPRule{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.IptablesFIPRule), err -} - -// Update takes the representation of a iptablesFIPRule and updates it. Returns the server's representation of the iptablesFIPRule, and an error, if there is any. -func (c *FakeIptablesFIPRules) Update(ctx context.Context, iptablesFIPRule *kubeovnv1.IptablesFIPRule, opts v1.UpdateOptions) (result *kubeovnv1.IptablesFIPRule, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(iptablesfiprulesResource, iptablesFIPRule), &kubeovnv1.IptablesFIPRule{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.IptablesFIPRule), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeIptablesFIPRules) UpdateStatus(ctx context.Context, iptablesFIPRule *kubeovnv1.IptablesFIPRule, opts v1.UpdateOptions) (*kubeovnv1.IptablesFIPRule, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(iptablesfiprulesResource, "status", iptablesFIPRule), &kubeovnv1.IptablesFIPRule{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.IptablesFIPRule), err -} - -// Delete takes name of the iptablesFIPRule and deletes it. Returns an error if one occurs. -func (c *FakeIptablesFIPRules) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(iptablesfiprulesResource, name, opts), &kubeovnv1.IptablesFIPRule{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeIptablesFIPRules) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(iptablesfiprulesResource, listOpts) - - _, err := c.Fake.Invokes(action, &kubeovnv1.IptablesFIPRuleList{}) - return err -} - -// Patch applies the patch and returns the patched iptablesFIPRule. -func (c *FakeIptablesFIPRules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *kubeovnv1.IptablesFIPRule, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(iptablesfiprulesResource, name, pt, data, subresources...), &kubeovnv1.IptablesFIPRule{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.IptablesFIPRule), err -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_iptablessnatrule.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_iptablessnatrule.go deleted file mode 100644 index dfda17aba80..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_iptablessnatrule.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeIptablesSnatRules implements IptablesSnatRuleInterface -type FakeIptablesSnatRules struct { - Fake *FakeKubeovnV1 -} - -var iptablessnatrulesResource = schema.GroupVersionResource{Group: "kubeovn.io", Version: "v1", Resource: "iptables-snat-rules"} - -var iptablessnatrulesKind = schema.GroupVersionKind{Group: "kubeovn.io", Version: "v1", Kind: "IptablesSnatRule"} - -// Get takes name of the iptablesSnatRule, and returns the corresponding iptablesSnatRule object, and an error if there is any. -func (c *FakeIptablesSnatRules) Get(ctx context.Context, name string, options v1.GetOptions) (result *kubeovnv1.IptablesSnatRule, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(iptablessnatrulesResource, name), &kubeovnv1.IptablesSnatRule{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.IptablesSnatRule), err -} - -// List takes label and field selectors, and returns the list of IptablesSnatRules that match those selectors. -func (c *FakeIptablesSnatRules) List(ctx context.Context, opts v1.ListOptions) (result *kubeovnv1.IptablesSnatRuleList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(iptablessnatrulesResource, iptablessnatrulesKind, opts), &kubeovnv1.IptablesSnatRuleList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &kubeovnv1.IptablesSnatRuleList{ListMeta: obj.(*kubeovnv1.IptablesSnatRuleList).ListMeta} - for _, item := range obj.(*kubeovnv1.IptablesSnatRuleList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested iptablesSnatRules. -func (c *FakeIptablesSnatRules) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(iptablessnatrulesResource, opts)) -} - -// Create takes the representation of a iptablesSnatRule and creates it. Returns the server's representation of the iptablesSnatRule, and an error, if there is any. -func (c *FakeIptablesSnatRules) Create(ctx context.Context, iptablesSnatRule *kubeovnv1.IptablesSnatRule, opts v1.CreateOptions) (result *kubeovnv1.IptablesSnatRule, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(iptablessnatrulesResource, iptablesSnatRule), &kubeovnv1.IptablesSnatRule{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.IptablesSnatRule), err -} - -// Update takes the representation of a iptablesSnatRule and updates it. Returns the server's representation of the iptablesSnatRule, and an error, if there is any. -func (c *FakeIptablesSnatRules) Update(ctx context.Context, iptablesSnatRule *kubeovnv1.IptablesSnatRule, opts v1.UpdateOptions) (result *kubeovnv1.IptablesSnatRule, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(iptablessnatrulesResource, iptablesSnatRule), &kubeovnv1.IptablesSnatRule{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.IptablesSnatRule), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeIptablesSnatRules) UpdateStatus(ctx context.Context, iptablesSnatRule *kubeovnv1.IptablesSnatRule, opts v1.UpdateOptions) (*kubeovnv1.IptablesSnatRule, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(iptablessnatrulesResource, "status", iptablesSnatRule), &kubeovnv1.IptablesSnatRule{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.IptablesSnatRule), err -} - -// Delete takes name of the iptablesSnatRule and deletes it. Returns an error if one occurs. -func (c *FakeIptablesSnatRules) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(iptablessnatrulesResource, name, opts), &kubeovnv1.IptablesSnatRule{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeIptablesSnatRules) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(iptablessnatrulesResource, listOpts) - - _, err := c.Fake.Invokes(action, &kubeovnv1.IptablesSnatRuleList{}) - return err -} - -// Patch applies the patch and returns the patched iptablesSnatRule. -func (c *FakeIptablesSnatRules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *kubeovnv1.IptablesSnatRule, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(iptablessnatrulesResource, name, pt, data, subresources...), &kubeovnv1.IptablesSnatRule{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.IptablesSnatRule), err -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_kubeovn_client.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_kubeovn_client.go deleted file mode 100644 index 554c72654e0..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_kubeovn_client.go +++ /dev/null @@ -1,108 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1 "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned/typed/kubeovn/v1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeKubeovnV1 struct { - *testing.Fake -} - -func (c *FakeKubeovnV1) HtbQoses() v1.HtbQosInterface { - return &FakeHtbQoses{c} -} - -func (c *FakeKubeovnV1) IPs() v1.IPInterface { - return &FakeIPs{c} -} - -func (c *FakeKubeovnV1) IptablesDnatRules() v1.IptablesDnatRuleInterface { - return &FakeIptablesDnatRules{c} -} - -func (c *FakeKubeovnV1) IptablesEIPs() v1.IptablesEIPInterface { - return &FakeIptablesEIPs{c} -} - -func (c *FakeKubeovnV1) IptablesFIPRules() v1.IptablesFIPRuleInterface { - return &FakeIptablesFIPRules{c} -} - -func (c *FakeKubeovnV1) IptablesSnatRules() v1.IptablesSnatRuleInterface { - return &FakeIptablesSnatRules{c} -} - -func (c *FakeKubeovnV1) OvnEips() v1.OvnEipInterface { - return &FakeOvnEips{c} -} - -func (c *FakeKubeovnV1) OvnFips() v1.OvnFipInterface { - return &FakeOvnFips{c} -} - -func (c *FakeKubeovnV1) OvnSnatRules() v1.OvnSnatRuleInterface { - return &FakeOvnSnatRules{c} -} - -func (c *FakeKubeovnV1) ProviderNetworks() v1.ProviderNetworkInterface { - return &FakeProviderNetworks{c} -} - -func (c *FakeKubeovnV1) SecurityGroups() v1.SecurityGroupInterface { - return &FakeSecurityGroups{c} -} - -func (c *FakeKubeovnV1) Subnets() v1.SubnetInterface { - return &FakeSubnets{c} -} - -func (c *FakeKubeovnV1) SwitchLBRules() v1.SwitchLBRuleInterface { - return &FakeSwitchLBRules{c} -} - -func (c *FakeKubeovnV1) Vips() v1.VipInterface { - return &FakeVips{c} -} - -func (c *FakeKubeovnV1) Vlans() v1.VlanInterface { - return &FakeVlans{c} -} - -func (c *FakeKubeovnV1) Vpcs() v1.VpcInterface { - return &FakeVpcs{c} -} - -func (c *FakeKubeovnV1) VpcDnses() v1.VpcDnsInterface { - return &FakeVpcDnses{c} -} - -func (c *FakeKubeovnV1) VpcNatGateways() v1.VpcNatGatewayInterface { - return &FakeVpcNatGateways{c} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeKubeovnV1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_ovneip.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_ovneip.go deleted file mode 100644 index 7c57fbc93d1..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_ovneip.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeOvnEips implements OvnEipInterface -type FakeOvnEips struct { - Fake *FakeKubeovnV1 -} - -var ovneipsResource = schema.GroupVersionResource{Group: "kubeovn.io", Version: "v1", Resource: "ovn-eips"} - -var ovneipsKind = schema.GroupVersionKind{Group: "kubeovn.io", Version: "v1", Kind: "OvnEip"} - -// Get takes name of the ovnEip, and returns the corresponding ovnEip object, and an error if there is any. -func (c *FakeOvnEips) Get(ctx context.Context, name string, options v1.GetOptions) (result *kubeovnv1.OvnEip, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(ovneipsResource, name), &kubeovnv1.OvnEip{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.OvnEip), err -} - -// List takes label and field selectors, and returns the list of OvnEips that match those selectors. -func (c *FakeOvnEips) List(ctx context.Context, opts v1.ListOptions) (result *kubeovnv1.OvnEipList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(ovneipsResource, ovneipsKind, opts), &kubeovnv1.OvnEipList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &kubeovnv1.OvnEipList{ListMeta: obj.(*kubeovnv1.OvnEipList).ListMeta} - for _, item := range obj.(*kubeovnv1.OvnEipList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ovnEips. -func (c *FakeOvnEips) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(ovneipsResource, opts)) -} - -// Create takes the representation of a ovnEip and creates it. Returns the server's representation of the ovnEip, and an error, if there is any. -func (c *FakeOvnEips) Create(ctx context.Context, ovnEip *kubeovnv1.OvnEip, opts v1.CreateOptions) (result *kubeovnv1.OvnEip, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(ovneipsResource, ovnEip), &kubeovnv1.OvnEip{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.OvnEip), err -} - -// Update takes the representation of a ovnEip and updates it. Returns the server's representation of the ovnEip, and an error, if there is any. -func (c *FakeOvnEips) Update(ctx context.Context, ovnEip *kubeovnv1.OvnEip, opts v1.UpdateOptions) (result *kubeovnv1.OvnEip, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(ovneipsResource, ovnEip), &kubeovnv1.OvnEip{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.OvnEip), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeOvnEips) UpdateStatus(ctx context.Context, ovnEip *kubeovnv1.OvnEip, opts v1.UpdateOptions) (*kubeovnv1.OvnEip, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(ovneipsResource, "status", ovnEip), &kubeovnv1.OvnEip{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.OvnEip), err -} - -// Delete takes name of the ovnEip and deletes it. Returns an error if one occurs. -func (c *FakeOvnEips) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(ovneipsResource, name, opts), &kubeovnv1.OvnEip{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeOvnEips) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(ovneipsResource, listOpts) - - _, err := c.Fake.Invokes(action, &kubeovnv1.OvnEipList{}) - return err -} - -// Patch applies the patch and returns the patched ovnEip. -func (c *FakeOvnEips) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *kubeovnv1.OvnEip, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(ovneipsResource, name, pt, data, subresources...), &kubeovnv1.OvnEip{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.OvnEip), err -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_ovnfip.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_ovnfip.go deleted file mode 100644 index e62c1df7a6f..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_ovnfip.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeOvnFips implements OvnFipInterface -type FakeOvnFips struct { - Fake *FakeKubeovnV1 -} - -var ovnfipsResource = schema.GroupVersionResource{Group: "kubeovn.io", Version: "v1", Resource: "ovn-fips"} - -var ovnfipsKind = schema.GroupVersionKind{Group: "kubeovn.io", Version: "v1", Kind: "OvnFip"} - -// Get takes name of the ovnFip, and returns the corresponding ovnFip object, and an error if there is any. -func (c *FakeOvnFips) Get(ctx context.Context, name string, options v1.GetOptions) (result *kubeovnv1.OvnFip, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(ovnfipsResource, name), &kubeovnv1.OvnFip{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.OvnFip), err -} - -// List takes label and field selectors, and returns the list of OvnFips that match those selectors. -func (c *FakeOvnFips) List(ctx context.Context, opts v1.ListOptions) (result *kubeovnv1.OvnFipList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(ovnfipsResource, ovnfipsKind, opts), &kubeovnv1.OvnFipList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &kubeovnv1.OvnFipList{ListMeta: obj.(*kubeovnv1.OvnFipList).ListMeta} - for _, item := range obj.(*kubeovnv1.OvnFipList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ovnFips. -func (c *FakeOvnFips) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(ovnfipsResource, opts)) -} - -// Create takes the representation of a ovnFip and creates it. Returns the server's representation of the ovnFip, and an error, if there is any. -func (c *FakeOvnFips) Create(ctx context.Context, ovnFip *kubeovnv1.OvnFip, opts v1.CreateOptions) (result *kubeovnv1.OvnFip, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(ovnfipsResource, ovnFip), &kubeovnv1.OvnFip{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.OvnFip), err -} - -// Update takes the representation of a ovnFip and updates it. Returns the server's representation of the ovnFip, and an error, if there is any. -func (c *FakeOvnFips) Update(ctx context.Context, ovnFip *kubeovnv1.OvnFip, opts v1.UpdateOptions) (result *kubeovnv1.OvnFip, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(ovnfipsResource, ovnFip), &kubeovnv1.OvnFip{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.OvnFip), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeOvnFips) UpdateStatus(ctx context.Context, ovnFip *kubeovnv1.OvnFip, opts v1.UpdateOptions) (*kubeovnv1.OvnFip, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(ovnfipsResource, "status", ovnFip), &kubeovnv1.OvnFip{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.OvnFip), err -} - -// Delete takes name of the ovnFip and deletes it. Returns an error if one occurs. -func (c *FakeOvnFips) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(ovnfipsResource, name, opts), &kubeovnv1.OvnFip{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeOvnFips) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(ovnfipsResource, listOpts) - - _, err := c.Fake.Invokes(action, &kubeovnv1.OvnFipList{}) - return err -} - -// Patch applies the patch and returns the patched ovnFip. -func (c *FakeOvnFips) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *kubeovnv1.OvnFip, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(ovnfipsResource, name, pt, data, subresources...), &kubeovnv1.OvnFip{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.OvnFip), err -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_ovnsnatrule.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_ovnsnatrule.go deleted file mode 100644 index 174716cea12..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_ovnsnatrule.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeOvnSnatRules implements OvnSnatRuleInterface -type FakeOvnSnatRules struct { - Fake *FakeKubeovnV1 -} - -var ovnsnatrulesResource = schema.GroupVersionResource{Group: "kubeovn.io", Version: "v1", Resource: "ovn-snat-rules"} - -var ovnsnatrulesKind = schema.GroupVersionKind{Group: "kubeovn.io", Version: "v1", Kind: "OvnSnatRule"} - -// Get takes name of the ovnSnatRule, and returns the corresponding ovnSnatRule object, and an error if there is any. -func (c *FakeOvnSnatRules) Get(ctx context.Context, name string, options v1.GetOptions) (result *kubeovnv1.OvnSnatRule, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(ovnsnatrulesResource, name), &kubeovnv1.OvnSnatRule{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.OvnSnatRule), err -} - -// List takes label and field selectors, and returns the list of OvnSnatRules that match those selectors. -func (c *FakeOvnSnatRules) List(ctx context.Context, opts v1.ListOptions) (result *kubeovnv1.OvnSnatRuleList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(ovnsnatrulesResource, ovnsnatrulesKind, opts), &kubeovnv1.OvnSnatRuleList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &kubeovnv1.OvnSnatRuleList{ListMeta: obj.(*kubeovnv1.OvnSnatRuleList).ListMeta} - for _, item := range obj.(*kubeovnv1.OvnSnatRuleList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ovnSnatRules. -func (c *FakeOvnSnatRules) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(ovnsnatrulesResource, opts)) -} - -// Create takes the representation of a ovnSnatRule and creates it. Returns the server's representation of the ovnSnatRule, and an error, if there is any. -func (c *FakeOvnSnatRules) Create(ctx context.Context, ovnSnatRule *kubeovnv1.OvnSnatRule, opts v1.CreateOptions) (result *kubeovnv1.OvnSnatRule, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(ovnsnatrulesResource, ovnSnatRule), &kubeovnv1.OvnSnatRule{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.OvnSnatRule), err -} - -// Update takes the representation of a ovnSnatRule and updates it. Returns the server's representation of the ovnSnatRule, and an error, if there is any. -func (c *FakeOvnSnatRules) Update(ctx context.Context, ovnSnatRule *kubeovnv1.OvnSnatRule, opts v1.UpdateOptions) (result *kubeovnv1.OvnSnatRule, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(ovnsnatrulesResource, ovnSnatRule), &kubeovnv1.OvnSnatRule{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.OvnSnatRule), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeOvnSnatRules) UpdateStatus(ctx context.Context, ovnSnatRule *kubeovnv1.OvnSnatRule, opts v1.UpdateOptions) (*kubeovnv1.OvnSnatRule, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(ovnsnatrulesResource, "status", ovnSnatRule), &kubeovnv1.OvnSnatRule{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.OvnSnatRule), err -} - -// Delete takes name of the ovnSnatRule and deletes it. Returns an error if one occurs. -func (c *FakeOvnSnatRules) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(ovnsnatrulesResource, name, opts), &kubeovnv1.OvnSnatRule{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeOvnSnatRules) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(ovnsnatrulesResource, listOpts) - - _, err := c.Fake.Invokes(action, &kubeovnv1.OvnSnatRuleList{}) - return err -} - -// Patch applies the patch and returns the patched ovnSnatRule. -func (c *FakeOvnSnatRules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *kubeovnv1.OvnSnatRule, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(ovnsnatrulesResource, name, pt, data, subresources...), &kubeovnv1.OvnSnatRule{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.OvnSnatRule), err -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_providernetwork.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_providernetwork.go deleted file mode 100644 index ef7b5b6831f..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_providernetwork.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeProviderNetworks implements ProviderNetworkInterface -type FakeProviderNetworks struct { - Fake *FakeKubeovnV1 -} - -var providernetworksResource = schema.GroupVersionResource{Group: "kubeovn.io", Version: "v1", Resource: "provider-networks"} - -var providernetworksKind = schema.GroupVersionKind{Group: "kubeovn.io", Version: "v1", Kind: "ProviderNetwork"} - -// Get takes name of the providerNetwork, and returns the corresponding providerNetwork object, and an error if there is any. -func (c *FakeProviderNetworks) Get(ctx context.Context, name string, options v1.GetOptions) (result *kubeovnv1.ProviderNetwork, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(providernetworksResource, name), &kubeovnv1.ProviderNetwork{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.ProviderNetwork), err -} - -// List takes label and field selectors, and returns the list of ProviderNetworks that match those selectors. -func (c *FakeProviderNetworks) List(ctx context.Context, opts v1.ListOptions) (result *kubeovnv1.ProviderNetworkList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(providernetworksResource, providernetworksKind, opts), &kubeovnv1.ProviderNetworkList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &kubeovnv1.ProviderNetworkList{ListMeta: obj.(*kubeovnv1.ProviderNetworkList).ListMeta} - for _, item := range obj.(*kubeovnv1.ProviderNetworkList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested providerNetworks. -func (c *FakeProviderNetworks) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(providernetworksResource, opts)) -} - -// Create takes the representation of a providerNetwork and creates it. Returns the server's representation of the providerNetwork, and an error, if there is any. -func (c *FakeProviderNetworks) Create(ctx context.Context, providerNetwork *kubeovnv1.ProviderNetwork, opts v1.CreateOptions) (result *kubeovnv1.ProviderNetwork, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(providernetworksResource, providerNetwork), &kubeovnv1.ProviderNetwork{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.ProviderNetwork), err -} - -// Update takes the representation of a providerNetwork and updates it. Returns the server's representation of the providerNetwork, and an error, if there is any. -func (c *FakeProviderNetworks) Update(ctx context.Context, providerNetwork *kubeovnv1.ProviderNetwork, opts v1.UpdateOptions) (result *kubeovnv1.ProviderNetwork, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(providernetworksResource, providerNetwork), &kubeovnv1.ProviderNetwork{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.ProviderNetwork), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeProviderNetworks) UpdateStatus(ctx context.Context, providerNetwork *kubeovnv1.ProviderNetwork, opts v1.UpdateOptions) (*kubeovnv1.ProviderNetwork, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(providernetworksResource, "status", providerNetwork), &kubeovnv1.ProviderNetwork{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.ProviderNetwork), err -} - -// Delete takes name of the providerNetwork and deletes it. Returns an error if one occurs. -func (c *FakeProviderNetworks) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(providernetworksResource, name, opts), &kubeovnv1.ProviderNetwork{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeProviderNetworks) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(providernetworksResource, listOpts) - - _, err := c.Fake.Invokes(action, &kubeovnv1.ProviderNetworkList{}) - return err -} - -// Patch applies the patch and returns the patched providerNetwork. -func (c *FakeProviderNetworks) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *kubeovnv1.ProviderNetwork, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(providernetworksResource, name, pt, data, subresources...), &kubeovnv1.ProviderNetwork{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.ProviderNetwork), err -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_securitygroup.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_securitygroup.go deleted file mode 100644 index 58690a1c8ee..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_securitygroup.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeSecurityGroups implements SecurityGroupInterface -type FakeSecurityGroups struct { - Fake *FakeKubeovnV1 -} - -var securitygroupsResource = schema.GroupVersionResource{Group: "kubeovn.io", Version: "v1", Resource: "security-groups"} - -var securitygroupsKind = schema.GroupVersionKind{Group: "kubeovn.io", Version: "v1", Kind: "SecurityGroup"} - -// Get takes name of the securityGroup, and returns the corresponding securityGroup object, and an error if there is any. -func (c *FakeSecurityGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *kubeovnv1.SecurityGroup, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(securitygroupsResource, name), &kubeovnv1.SecurityGroup{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.SecurityGroup), err -} - -// List takes label and field selectors, and returns the list of SecurityGroups that match those selectors. -func (c *FakeSecurityGroups) List(ctx context.Context, opts v1.ListOptions) (result *kubeovnv1.SecurityGroupList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(securitygroupsResource, securitygroupsKind, opts), &kubeovnv1.SecurityGroupList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &kubeovnv1.SecurityGroupList{ListMeta: obj.(*kubeovnv1.SecurityGroupList).ListMeta} - for _, item := range obj.(*kubeovnv1.SecurityGroupList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested securityGroups. -func (c *FakeSecurityGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(securitygroupsResource, opts)) -} - -// Create takes the representation of a securityGroup and creates it. Returns the server's representation of the securityGroup, and an error, if there is any. -func (c *FakeSecurityGroups) Create(ctx context.Context, securityGroup *kubeovnv1.SecurityGroup, opts v1.CreateOptions) (result *kubeovnv1.SecurityGroup, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(securitygroupsResource, securityGroup), &kubeovnv1.SecurityGroup{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.SecurityGroup), err -} - -// Update takes the representation of a securityGroup and updates it. Returns the server's representation of the securityGroup, and an error, if there is any. -func (c *FakeSecurityGroups) Update(ctx context.Context, securityGroup *kubeovnv1.SecurityGroup, opts v1.UpdateOptions) (result *kubeovnv1.SecurityGroup, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(securitygroupsResource, securityGroup), &kubeovnv1.SecurityGroup{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.SecurityGroup), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeSecurityGroups) UpdateStatus(ctx context.Context, securityGroup *kubeovnv1.SecurityGroup, opts v1.UpdateOptions) (*kubeovnv1.SecurityGroup, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(securitygroupsResource, "status", securityGroup), &kubeovnv1.SecurityGroup{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.SecurityGroup), err -} - -// Delete takes name of the securityGroup and deletes it. Returns an error if one occurs. -func (c *FakeSecurityGroups) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(securitygroupsResource, name, opts), &kubeovnv1.SecurityGroup{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeSecurityGroups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(securitygroupsResource, listOpts) - - _, err := c.Fake.Invokes(action, &kubeovnv1.SecurityGroupList{}) - return err -} - -// Patch applies the patch and returns the patched securityGroup. -func (c *FakeSecurityGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *kubeovnv1.SecurityGroup, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(securitygroupsResource, name, pt, data, subresources...), &kubeovnv1.SecurityGroup{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.SecurityGroup), err -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_subnet.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_subnet.go deleted file mode 100644 index 18c7512188a..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_subnet.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeSubnets implements SubnetInterface -type FakeSubnets struct { - Fake *FakeKubeovnV1 -} - -var subnetsResource = schema.GroupVersionResource{Group: "kubeovn.io", Version: "v1", Resource: "subnets"} - -var subnetsKind = schema.GroupVersionKind{Group: "kubeovn.io", Version: "v1", Kind: "Subnet"} - -// Get takes name of the subnet, and returns the corresponding subnet object, and an error if there is any. -func (c *FakeSubnets) Get(ctx context.Context, name string, options v1.GetOptions) (result *kubeovnv1.Subnet, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(subnetsResource, name), &kubeovnv1.Subnet{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.Subnet), err -} - -// List takes label and field selectors, and returns the list of Subnets that match those selectors. -func (c *FakeSubnets) List(ctx context.Context, opts v1.ListOptions) (result *kubeovnv1.SubnetList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(subnetsResource, subnetsKind, opts), &kubeovnv1.SubnetList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &kubeovnv1.SubnetList{ListMeta: obj.(*kubeovnv1.SubnetList).ListMeta} - for _, item := range obj.(*kubeovnv1.SubnetList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested subnets. -func (c *FakeSubnets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(subnetsResource, opts)) -} - -// Create takes the representation of a subnet and creates it. Returns the server's representation of the subnet, and an error, if there is any. -func (c *FakeSubnets) Create(ctx context.Context, subnet *kubeovnv1.Subnet, opts v1.CreateOptions) (result *kubeovnv1.Subnet, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(subnetsResource, subnet), &kubeovnv1.Subnet{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.Subnet), err -} - -// Update takes the representation of a subnet and updates it. Returns the server's representation of the subnet, and an error, if there is any. -func (c *FakeSubnets) Update(ctx context.Context, subnet *kubeovnv1.Subnet, opts v1.UpdateOptions) (result *kubeovnv1.Subnet, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(subnetsResource, subnet), &kubeovnv1.Subnet{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.Subnet), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeSubnets) UpdateStatus(ctx context.Context, subnet *kubeovnv1.Subnet, opts v1.UpdateOptions) (*kubeovnv1.Subnet, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(subnetsResource, "status", subnet), &kubeovnv1.Subnet{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.Subnet), err -} - -// Delete takes name of the subnet and deletes it. Returns an error if one occurs. -func (c *FakeSubnets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(subnetsResource, name, opts), &kubeovnv1.Subnet{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeSubnets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(subnetsResource, listOpts) - - _, err := c.Fake.Invokes(action, &kubeovnv1.SubnetList{}) - return err -} - -// Patch applies the patch and returns the patched subnet. -func (c *FakeSubnets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *kubeovnv1.Subnet, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(subnetsResource, name, pt, data, subresources...), &kubeovnv1.Subnet{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.Subnet), err -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_switchlbrule.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_switchlbrule.go deleted file mode 100644 index 237d3447795..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_switchlbrule.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeSwitchLBRules implements SwitchLBRuleInterface -type FakeSwitchLBRules struct { - Fake *FakeKubeovnV1 -} - -var switchlbrulesResource = schema.GroupVersionResource{Group: "kubeovn.io", Version: "v1", Resource: "switch-lb-rules"} - -var switchlbrulesKind = schema.GroupVersionKind{Group: "kubeovn.io", Version: "v1", Kind: "SwitchLBRule"} - -// Get takes name of the switchLBRule, and returns the corresponding switchLBRule object, and an error if there is any. -func (c *FakeSwitchLBRules) Get(ctx context.Context, name string, options v1.GetOptions) (result *kubeovnv1.SwitchLBRule, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(switchlbrulesResource, name), &kubeovnv1.SwitchLBRule{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.SwitchLBRule), err -} - -// List takes label and field selectors, and returns the list of SwitchLBRules that match those selectors. -func (c *FakeSwitchLBRules) List(ctx context.Context, opts v1.ListOptions) (result *kubeovnv1.SwitchLBRuleList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(switchlbrulesResource, switchlbrulesKind, opts), &kubeovnv1.SwitchLBRuleList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &kubeovnv1.SwitchLBRuleList{ListMeta: obj.(*kubeovnv1.SwitchLBRuleList).ListMeta} - for _, item := range obj.(*kubeovnv1.SwitchLBRuleList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested switchLBRules. -func (c *FakeSwitchLBRules) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(switchlbrulesResource, opts)) -} - -// Create takes the representation of a switchLBRule and creates it. Returns the server's representation of the switchLBRule, and an error, if there is any. -func (c *FakeSwitchLBRules) Create(ctx context.Context, switchLBRule *kubeovnv1.SwitchLBRule, opts v1.CreateOptions) (result *kubeovnv1.SwitchLBRule, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(switchlbrulesResource, switchLBRule), &kubeovnv1.SwitchLBRule{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.SwitchLBRule), err -} - -// Update takes the representation of a switchLBRule and updates it. Returns the server's representation of the switchLBRule, and an error, if there is any. -func (c *FakeSwitchLBRules) Update(ctx context.Context, switchLBRule *kubeovnv1.SwitchLBRule, opts v1.UpdateOptions) (result *kubeovnv1.SwitchLBRule, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(switchlbrulesResource, switchLBRule), &kubeovnv1.SwitchLBRule{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.SwitchLBRule), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeSwitchLBRules) UpdateStatus(ctx context.Context, switchLBRule *kubeovnv1.SwitchLBRule, opts v1.UpdateOptions) (*kubeovnv1.SwitchLBRule, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(switchlbrulesResource, "status", switchLBRule), &kubeovnv1.SwitchLBRule{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.SwitchLBRule), err -} - -// Delete takes name of the switchLBRule and deletes it. Returns an error if one occurs. -func (c *FakeSwitchLBRules) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(switchlbrulesResource, name, opts), &kubeovnv1.SwitchLBRule{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeSwitchLBRules) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(switchlbrulesResource, listOpts) - - _, err := c.Fake.Invokes(action, &kubeovnv1.SwitchLBRuleList{}) - return err -} - -// Patch applies the patch and returns the patched switchLBRule. -func (c *FakeSwitchLBRules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *kubeovnv1.SwitchLBRule, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(switchlbrulesResource, name, pt, data, subresources...), &kubeovnv1.SwitchLBRule{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.SwitchLBRule), err -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_vip.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_vip.go deleted file mode 100644 index 3329206a3ec..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_vip.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeVips implements VipInterface -type FakeVips struct { - Fake *FakeKubeovnV1 -} - -var vipsResource = schema.GroupVersionResource{Group: "kubeovn.io", Version: "v1", Resource: "vips"} - -var vipsKind = schema.GroupVersionKind{Group: "kubeovn.io", Version: "v1", Kind: "Vip"} - -// Get takes name of the vip, and returns the corresponding vip object, and an error if there is any. -func (c *FakeVips) Get(ctx context.Context, name string, options v1.GetOptions) (result *kubeovnv1.Vip, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(vipsResource, name), &kubeovnv1.Vip{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.Vip), err -} - -// List takes label and field selectors, and returns the list of Vips that match those selectors. -func (c *FakeVips) List(ctx context.Context, opts v1.ListOptions) (result *kubeovnv1.VipList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(vipsResource, vipsKind, opts), &kubeovnv1.VipList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &kubeovnv1.VipList{ListMeta: obj.(*kubeovnv1.VipList).ListMeta} - for _, item := range obj.(*kubeovnv1.VipList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested vips. -func (c *FakeVips) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(vipsResource, opts)) -} - -// Create takes the representation of a vip and creates it. Returns the server's representation of the vip, and an error, if there is any. -func (c *FakeVips) Create(ctx context.Context, vip *kubeovnv1.Vip, opts v1.CreateOptions) (result *kubeovnv1.Vip, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(vipsResource, vip), &kubeovnv1.Vip{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.Vip), err -} - -// Update takes the representation of a vip and updates it. Returns the server's representation of the vip, and an error, if there is any. -func (c *FakeVips) Update(ctx context.Context, vip *kubeovnv1.Vip, opts v1.UpdateOptions) (result *kubeovnv1.Vip, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(vipsResource, vip), &kubeovnv1.Vip{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.Vip), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeVips) UpdateStatus(ctx context.Context, vip *kubeovnv1.Vip, opts v1.UpdateOptions) (*kubeovnv1.Vip, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(vipsResource, "status", vip), &kubeovnv1.Vip{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.Vip), err -} - -// Delete takes name of the vip and deletes it. Returns an error if one occurs. -func (c *FakeVips) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(vipsResource, name, opts), &kubeovnv1.Vip{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeVips) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(vipsResource, listOpts) - - _, err := c.Fake.Invokes(action, &kubeovnv1.VipList{}) - return err -} - -// Patch applies the patch and returns the patched vip. -func (c *FakeVips) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *kubeovnv1.Vip, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(vipsResource, name, pt, data, subresources...), &kubeovnv1.Vip{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.Vip), err -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_vlan.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_vlan.go deleted file mode 100644 index 3b4b9749c2c..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_vlan.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeVlans implements VlanInterface -type FakeVlans struct { - Fake *FakeKubeovnV1 -} - -var vlansResource = schema.GroupVersionResource{Group: "kubeovn.io", Version: "v1", Resource: "vlans"} - -var vlansKind = schema.GroupVersionKind{Group: "kubeovn.io", Version: "v1", Kind: "Vlan"} - -// Get takes name of the vlan, and returns the corresponding vlan object, and an error if there is any. -func (c *FakeVlans) Get(ctx context.Context, name string, options v1.GetOptions) (result *kubeovnv1.Vlan, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(vlansResource, name), &kubeovnv1.Vlan{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.Vlan), err -} - -// List takes label and field selectors, and returns the list of Vlans that match those selectors. -func (c *FakeVlans) List(ctx context.Context, opts v1.ListOptions) (result *kubeovnv1.VlanList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(vlansResource, vlansKind, opts), &kubeovnv1.VlanList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &kubeovnv1.VlanList{ListMeta: obj.(*kubeovnv1.VlanList).ListMeta} - for _, item := range obj.(*kubeovnv1.VlanList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested vlans. -func (c *FakeVlans) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(vlansResource, opts)) -} - -// Create takes the representation of a vlan and creates it. Returns the server's representation of the vlan, and an error, if there is any. -func (c *FakeVlans) Create(ctx context.Context, vlan *kubeovnv1.Vlan, opts v1.CreateOptions) (result *kubeovnv1.Vlan, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(vlansResource, vlan), &kubeovnv1.Vlan{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.Vlan), err -} - -// Update takes the representation of a vlan and updates it. Returns the server's representation of the vlan, and an error, if there is any. -func (c *FakeVlans) Update(ctx context.Context, vlan *kubeovnv1.Vlan, opts v1.UpdateOptions) (result *kubeovnv1.Vlan, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(vlansResource, vlan), &kubeovnv1.Vlan{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.Vlan), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeVlans) UpdateStatus(ctx context.Context, vlan *kubeovnv1.Vlan, opts v1.UpdateOptions) (*kubeovnv1.Vlan, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(vlansResource, "status", vlan), &kubeovnv1.Vlan{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.Vlan), err -} - -// Delete takes name of the vlan and deletes it. Returns an error if one occurs. -func (c *FakeVlans) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(vlansResource, name, opts), &kubeovnv1.Vlan{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeVlans) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(vlansResource, listOpts) - - _, err := c.Fake.Invokes(action, &kubeovnv1.VlanList{}) - return err -} - -// Patch applies the patch and returns the patched vlan. -func (c *FakeVlans) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *kubeovnv1.Vlan, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(vlansResource, name, pt, data, subresources...), &kubeovnv1.Vlan{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.Vlan), err -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_vpc.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_vpc.go deleted file mode 100644 index 5bfc6a70f7c..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_vpc.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeVpcs implements VpcInterface -type FakeVpcs struct { - Fake *FakeKubeovnV1 -} - -var vpcsResource = schema.GroupVersionResource{Group: "kubeovn.io", Version: "v1", Resource: "vpcs"} - -var vpcsKind = schema.GroupVersionKind{Group: "kubeovn.io", Version: "v1", Kind: "Vpc"} - -// Get takes name of the vpc, and returns the corresponding vpc object, and an error if there is any. -func (c *FakeVpcs) Get(ctx context.Context, name string, options v1.GetOptions) (result *kubeovnv1.Vpc, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(vpcsResource, name), &kubeovnv1.Vpc{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.Vpc), err -} - -// List takes label and field selectors, and returns the list of Vpcs that match those selectors. -func (c *FakeVpcs) List(ctx context.Context, opts v1.ListOptions) (result *kubeovnv1.VpcList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(vpcsResource, vpcsKind, opts), &kubeovnv1.VpcList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &kubeovnv1.VpcList{ListMeta: obj.(*kubeovnv1.VpcList).ListMeta} - for _, item := range obj.(*kubeovnv1.VpcList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested vpcs. -func (c *FakeVpcs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(vpcsResource, opts)) -} - -// Create takes the representation of a vpc and creates it. Returns the server's representation of the vpc, and an error, if there is any. -func (c *FakeVpcs) Create(ctx context.Context, vpc *kubeovnv1.Vpc, opts v1.CreateOptions) (result *kubeovnv1.Vpc, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(vpcsResource, vpc), &kubeovnv1.Vpc{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.Vpc), err -} - -// Update takes the representation of a vpc and updates it. Returns the server's representation of the vpc, and an error, if there is any. -func (c *FakeVpcs) Update(ctx context.Context, vpc *kubeovnv1.Vpc, opts v1.UpdateOptions) (result *kubeovnv1.Vpc, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(vpcsResource, vpc), &kubeovnv1.Vpc{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.Vpc), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeVpcs) UpdateStatus(ctx context.Context, vpc *kubeovnv1.Vpc, opts v1.UpdateOptions) (*kubeovnv1.Vpc, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(vpcsResource, "status", vpc), &kubeovnv1.Vpc{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.Vpc), err -} - -// Delete takes name of the vpc and deletes it. Returns an error if one occurs. -func (c *FakeVpcs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(vpcsResource, name, opts), &kubeovnv1.Vpc{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeVpcs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(vpcsResource, listOpts) - - _, err := c.Fake.Invokes(action, &kubeovnv1.VpcList{}) - return err -} - -// Patch applies the patch and returns the patched vpc. -func (c *FakeVpcs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *kubeovnv1.Vpc, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(vpcsResource, name, pt, data, subresources...), &kubeovnv1.Vpc{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.Vpc), err -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_vpcdns.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_vpcdns.go deleted file mode 100644 index 69127f7e2c4..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_vpcdns.go +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeVpcDnses implements VpcDnsInterface -type FakeVpcDnses struct { - Fake *FakeKubeovnV1 -} - -var vpcdnsesResource = schema.GroupVersionResource{Group: "kubeovn.io", Version: "v1", Resource: "vpc-dnses"} - -var vpcdnsesKind = schema.GroupVersionKind{Group: "kubeovn.io", Version: "v1", Kind: "VpcDns"} - -// Get takes name of the vpcDns, and returns the corresponding vpcDns object, and an error if there is any. -func (c *FakeVpcDnses) Get(ctx context.Context, name string, options v1.GetOptions) (result *kubeovnv1.VpcDns, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(vpcdnsesResource, name), &kubeovnv1.VpcDns{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.VpcDns), err -} - -// List takes label and field selectors, and returns the list of VpcDnses that match those selectors. -func (c *FakeVpcDnses) List(ctx context.Context, opts v1.ListOptions) (result *kubeovnv1.VpcDnsList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(vpcdnsesResource, vpcdnsesKind, opts), &kubeovnv1.VpcDnsList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &kubeovnv1.VpcDnsList{ListMeta: obj.(*kubeovnv1.VpcDnsList).ListMeta} - for _, item := range obj.(*kubeovnv1.VpcDnsList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested vpcDnses. -func (c *FakeVpcDnses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(vpcdnsesResource, opts)) -} - -// Create takes the representation of a vpcDns and creates it. Returns the server's representation of the vpcDns, and an error, if there is any. -func (c *FakeVpcDnses) Create(ctx context.Context, vpcDns *kubeovnv1.VpcDns, opts v1.CreateOptions) (result *kubeovnv1.VpcDns, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(vpcdnsesResource, vpcDns), &kubeovnv1.VpcDns{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.VpcDns), err -} - -// Update takes the representation of a vpcDns and updates it. Returns the server's representation of the vpcDns, and an error, if there is any. -func (c *FakeVpcDnses) Update(ctx context.Context, vpcDns *kubeovnv1.VpcDns, opts v1.UpdateOptions) (result *kubeovnv1.VpcDns, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(vpcdnsesResource, vpcDns), &kubeovnv1.VpcDns{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.VpcDns), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeVpcDnses) UpdateStatus(ctx context.Context, vpcDns *kubeovnv1.VpcDns, opts v1.UpdateOptions) (*kubeovnv1.VpcDns, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(vpcdnsesResource, "status", vpcDns), &kubeovnv1.VpcDns{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.VpcDns), err -} - -// Delete takes name of the vpcDns and deletes it. Returns an error if one occurs. -func (c *FakeVpcDnses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(vpcdnsesResource, name, opts), &kubeovnv1.VpcDns{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeVpcDnses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(vpcdnsesResource, listOpts) - - _, err := c.Fake.Invokes(action, &kubeovnv1.VpcDnsList{}) - return err -} - -// Patch applies the patch and returns the patched vpcDns. -func (c *FakeVpcDnses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *kubeovnv1.VpcDns, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(vpcdnsesResource, name, pt, data, subresources...), &kubeovnv1.VpcDns{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.VpcDns), err -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_vpcnatgateway.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_vpcnatgateway.go deleted file mode 100644 index 2125b85d99e..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/fake/fake_vpcnatgateway.go +++ /dev/null @@ -1,122 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeVpcNatGateways implements VpcNatGatewayInterface -type FakeVpcNatGateways struct { - Fake *FakeKubeovnV1 -} - -var vpcnatgatewaysResource = schema.GroupVersionResource{Group: "kubeovn.io", Version: "v1", Resource: "vpc-nat-gateways"} - -var vpcnatgatewaysKind = schema.GroupVersionKind{Group: "kubeovn.io", Version: "v1", Kind: "VpcNatGateway"} - -// Get takes name of the vpcNatGateway, and returns the corresponding vpcNatGateway object, and an error if there is any. -func (c *FakeVpcNatGateways) Get(ctx context.Context, name string, options v1.GetOptions) (result *kubeovnv1.VpcNatGateway, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(vpcnatgatewaysResource, name), &kubeovnv1.VpcNatGateway{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.VpcNatGateway), err -} - -// List takes label and field selectors, and returns the list of VpcNatGateways that match those selectors. -func (c *FakeVpcNatGateways) List(ctx context.Context, opts v1.ListOptions) (result *kubeovnv1.VpcNatGatewayList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(vpcnatgatewaysResource, vpcnatgatewaysKind, opts), &kubeovnv1.VpcNatGatewayList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &kubeovnv1.VpcNatGatewayList{ListMeta: obj.(*kubeovnv1.VpcNatGatewayList).ListMeta} - for _, item := range obj.(*kubeovnv1.VpcNatGatewayList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested vpcNatGateways. -func (c *FakeVpcNatGateways) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(vpcnatgatewaysResource, opts)) -} - -// Create takes the representation of a vpcNatGateway and creates it. Returns the server's representation of the vpcNatGateway, and an error, if there is any. -func (c *FakeVpcNatGateways) Create(ctx context.Context, vpcNatGateway *kubeovnv1.VpcNatGateway, opts v1.CreateOptions) (result *kubeovnv1.VpcNatGateway, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(vpcnatgatewaysResource, vpcNatGateway), &kubeovnv1.VpcNatGateway{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.VpcNatGateway), err -} - -// Update takes the representation of a vpcNatGateway and updates it. Returns the server's representation of the vpcNatGateway, and an error, if there is any. -func (c *FakeVpcNatGateways) Update(ctx context.Context, vpcNatGateway *kubeovnv1.VpcNatGateway, opts v1.UpdateOptions) (result *kubeovnv1.VpcNatGateway, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(vpcnatgatewaysResource, vpcNatGateway), &kubeovnv1.VpcNatGateway{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.VpcNatGateway), err -} - -// Delete takes name of the vpcNatGateway and deletes it. Returns an error if one occurs. -func (c *FakeVpcNatGateways) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(vpcnatgatewaysResource, name, opts), &kubeovnv1.VpcNatGateway{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeVpcNatGateways) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(vpcnatgatewaysResource, listOpts) - - _, err := c.Fake.Invokes(action, &kubeovnv1.VpcNatGatewayList{}) - return err -} - -// Patch applies the patch and returns the patched vpcNatGateway. -func (c *FakeVpcNatGateways) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *kubeovnv1.VpcNatGateway, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(vpcnatgatewaysResource, name, pt, data, subresources...), &kubeovnv1.VpcNatGateway{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.VpcNatGateway), err -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/generated_expansion.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/generated_expansion.go deleted file mode 100644 index 2aab46affd0..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/generated_expansion.go +++ /dev/null @@ -1,55 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -type HtbQosExpansion interface{} - -type IPExpansion interface{} - -type IptablesDnatRuleExpansion interface{} - -type IptablesEIPExpansion interface{} - -type IptablesFIPRuleExpansion interface{} - -type IptablesSnatRuleExpansion interface{} - -type OvnEipExpansion interface{} - -type OvnFipExpansion interface{} - -type OvnSnatRuleExpansion interface{} - -type ProviderNetworkExpansion interface{} - -type SecurityGroupExpansion interface{} - -type SubnetExpansion interface{} - -type SwitchLBRuleExpansion interface{} - -type VipExpansion interface{} - -type VlanExpansion interface{} - -type VpcExpansion interface{} - -type VpcDnsExpansion interface{} - -type VpcNatGatewayExpansion interface{} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/htbqos.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/htbqos.go deleted file mode 100644 index bd7077c4743..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/htbqos.go +++ /dev/null @@ -1,168 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - scheme "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// HtbQosesGetter has a method to return a HtbQosInterface. -// A group's client should implement this interface. -type HtbQosesGetter interface { - HtbQoses() HtbQosInterface -} - -// HtbQosInterface has methods to work with HtbQos resources. -type HtbQosInterface interface { - Create(ctx context.Context, htbQos *v1.HtbQos, opts metav1.CreateOptions) (*v1.HtbQos, error) - Update(ctx context.Context, htbQos *v1.HtbQos, opts metav1.UpdateOptions) (*v1.HtbQos, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.HtbQos, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.HtbQosList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.HtbQos, err error) - HtbQosExpansion -} - -// htbQoses implements HtbQosInterface -type htbQoses struct { - client rest.Interface -} - -// newHtbQoses returns a HtbQoses -func newHtbQoses(c *KubeovnV1Client) *htbQoses { - return &htbQoses{ - client: c.RESTClient(), - } -} - -// Get takes name of the htbQos, and returns the corresponding htbQos object, and an error if there is any. -func (c *htbQoses) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.HtbQos, err error) { - result = &v1.HtbQos{} - err = c.client.Get(). - Resource("htbqoses"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of HtbQoses that match those selectors. -func (c *htbQoses) List(ctx context.Context, opts metav1.ListOptions) (result *v1.HtbQosList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.HtbQosList{} - err = c.client.Get(). - Resource("htbqoses"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested htbQoses. -func (c *htbQoses) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("htbqoses"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a htbQos and creates it. Returns the server's representation of the htbQos, and an error, if there is any. -func (c *htbQoses) Create(ctx context.Context, htbQos *v1.HtbQos, opts metav1.CreateOptions) (result *v1.HtbQos, err error) { - result = &v1.HtbQos{} - err = c.client.Post(). - Resource("htbqoses"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(htbQos). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a htbQos and updates it. Returns the server's representation of the htbQos, and an error, if there is any. -func (c *htbQoses) Update(ctx context.Context, htbQos *v1.HtbQos, opts metav1.UpdateOptions) (result *v1.HtbQos, err error) { - result = &v1.HtbQos{} - err = c.client.Put(). - Resource("htbqoses"). - Name(htbQos.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(htbQos). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the htbQos and deletes it. Returns an error if one occurs. -func (c *htbQoses) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("htbqoses"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *htbQoses) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("htbqoses"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched htbQos. -func (c *htbQoses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.HtbQos, err error) { - result = &v1.HtbQos{} - err = c.client.Patch(pt). - Resource("htbqoses"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/ip.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/ip.go deleted file mode 100644 index 53015e82f54..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/ip.go +++ /dev/null @@ -1,168 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - scheme "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// IPsGetter has a method to return a IPInterface. -// A group's client should implement this interface. -type IPsGetter interface { - IPs() IPInterface -} - -// IPInterface has methods to work with IP resources. -type IPInterface interface { - Create(ctx context.Context, iP *v1.IP, opts metav1.CreateOptions) (*v1.IP, error) - Update(ctx context.Context, iP *v1.IP, opts metav1.UpdateOptions) (*v1.IP, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.IP, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.IPList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.IP, err error) - IPExpansion -} - -// iPs implements IPInterface -type iPs struct { - client rest.Interface -} - -// newIPs returns a IPs -func newIPs(c *KubeovnV1Client) *iPs { - return &iPs{ - client: c.RESTClient(), - } -} - -// Get takes name of the iP, and returns the corresponding iP object, and an error if there is any. -func (c *iPs) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.IP, err error) { - result = &v1.IP{} - err = c.client.Get(). - Resource("ips"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of IPs that match those selectors. -func (c *iPs) List(ctx context.Context, opts metav1.ListOptions) (result *v1.IPList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.IPList{} - err = c.client.Get(). - Resource("ips"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested iPs. -func (c *iPs) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("ips"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a iP and creates it. Returns the server's representation of the iP, and an error, if there is any. -func (c *iPs) Create(ctx context.Context, iP *v1.IP, opts metav1.CreateOptions) (result *v1.IP, err error) { - result = &v1.IP{} - err = c.client.Post(). - Resource("ips"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iP). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a iP and updates it. Returns the server's representation of the iP, and an error, if there is any. -func (c *iPs) Update(ctx context.Context, iP *v1.IP, opts metav1.UpdateOptions) (result *v1.IP, err error) { - result = &v1.IP{} - err = c.client.Put(). - Resource("ips"). - Name(iP.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iP). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the iP and deletes it. Returns an error if one occurs. -func (c *iPs) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("ips"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *iPs) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("ips"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched iP. -func (c *iPs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.IP, err error) { - result = &v1.IP{} - err = c.client.Patch(pt). - Resource("ips"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/iptablesdnatrule.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/iptablesdnatrule.go deleted file mode 100644 index b2088e59d5e..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/iptablesdnatrule.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - scheme "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// IptablesDnatRulesGetter has a method to return a IptablesDnatRuleInterface. -// A group's client should implement this interface. -type IptablesDnatRulesGetter interface { - IptablesDnatRules() IptablesDnatRuleInterface -} - -// IptablesDnatRuleInterface has methods to work with IptablesDnatRule resources. -type IptablesDnatRuleInterface interface { - Create(ctx context.Context, iptablesDnatRule *v1.IptablesDnatRule, opts metav1.CreateOptions) (*v1.IptablesDnatRule, error) - Update(ctx context.Context, iptablesDnatRule *v1.IptablesDnatRule, opts metav1.UpdateOptions) (*v1.IptablesDnatRule, error) - UpdateStatus(ctx context.Context, iptablesDnatRule *v1.IptablesDnatRule, opts metav1.UpdateOptions) (*v1.IptablesDnatRule, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.IptablesDnatRule, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.IptablesDnatRuleList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.IptablesDnatRule, err error) - IptablesDnatRuleExpansion -} - -// iptablesDnatRules implements IptablesDnatRuleInterface -type iptablesDnatRules struct { - client rest.Interface -} - -// newIptablesDnatRules returns a IptablesDnatRules -func newIptablesDnatRules(c *KubeovnV1Client) *iptablesDnatRules { - return &iptablesDnatRules{ - client: c.RESTClient(), - } -} - -// Get takes name of the iptablesDnatRule, and returns the corresponding iptablesDnatRule object, and an error if there is any. -func (c *iptablesDnatRules) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.IptablesDnatRule, err error) { - result = &v1.IptablesDnatRule{} - err = c.client.Get(). - Resource("iptables-dnat-rules"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of IptablesDnatRules that match those selectors. -func (c *iptablesDnatRules) List(ctx context.Context, opts metav1.ListOptions) (result *v1.IptablesDnatRuleList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.IptablesDnatRuleList{} - err = c.client.Get(). - Resource("iptables-dnat-rules"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested iptablesDnatRules. -func (c *iptablesDnatRules) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("iptables-dnat-rules"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a iptablesDnatRule and creates it. Returns the server's representation of the iptablesDnatRule, and an error, if there is any. -func (c *iptablesDnatRules) Create(ctx context.Context, iptablesDnatRule *v1.IptablesDnatRule, opts metav1.CreateOptions) (result *v1.IptablesDnatRule, err error) { - result = &v1.IptablesDnatRule{} - err = c.client.Post(). - Resource("iptables-dnat-rules"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iptablesDnatRule). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a iptablesDnatRule and updates it. Returns the server's representation of the iptablesDnatRule, and an error, if there is any. -func (c *iptablesDnatRules) Update(ctx context.Context, iptablesDnatRule *v1.IptablesDnatRule, opts metav1.UpdateOptions) (result *v1.IptablesDnatRule, err error) { - result = &v1.IptablesDnatRule{} - err = c.client.Put(). - Resource("iptables-dnat-rules"). - Name(iptablesDnatRule.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iptablesDnatRule). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *iptablesDnatRules) UpdateStatus(ctx context.Context, iptablesDnatRule *v1.IptablesDnatRule, opts metav1.UpdateOptions) (result *v1.IptablesDnatRule, err error) { - result = &v1.IptablesDnatRule{} - err = c.client.Put(). - Resource("iptables-dnat-rules"). - Name(iptablesDnatRule.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iptablesDnatRule). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the iptablesDnatRule and deletes it. Returns an error if one occurs. -func (c *iptablesDnatRules) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("iptables-dnat-rules"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *iptablesDnatRules) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("iptables-dnat-rules"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched iptablesDnatRule. -func (c *iptablesDnatRules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.IptablesDnatRule, err error) { - result = &v1.IptablesDnatRule{} - err = c.client.Patch(pt). - Resource("iptables-dnat-rules"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/iptableseip.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/iptableseip.go deleted file mode 100644 index 607ad8e9928..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/iptableseip.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - scheme "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// IptablesEIPsGetter has a method to return a IptablesEIPInterface. -// A group's client should implement this interface. -type IptablesEIPsGetter interface { - IptablesEIPs() IptablesEIPInterface -} - -// IptablesEIPInterface has methods to work with IptablesEIP resources. -type IptablesEIPInterface interface { - Create(ctx context.Context, iptablesEIP *v1.IptablesEIP, opts metav1.CreateOptions) (*v1.IptablesEIP, error) - Update(ctx context.Context, iptablesEIP *v1.IptablesEIP, opts metav1.UpdateOptions) (*v1.IptablesEIP, error) - UpdateStatus(ctx context.Context, iptablesEIP *v1.IptablesEIP, opts metav1.UpdateOptions) (*v1.IptablesEIP, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.IptablesEIP, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.IptablesEIPList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.IptablesEIP, err error) - IptablesEIPExpansion -} - -// iptablesEIPs implements IptablesEIPInterface -type iptablesEIPs struct { - client rest.Interface -} - -// newIptablesEIPs returns a IptablesEIPs -func newIptablesEIPs(c *KubeovnV1Client) *iptablesEIPs { - return &iptablesEIPs{ - client: c.RESTClient(), - } -} - -// Get takes name of the iptablesEIP, and returns the corresponding iptablesEIP object, and an error if there is any. -func (c *iptablesEIPs) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.IptablesEIP, err error) { - result = &v1.IptablesEIP{} - err = c.client.Get(). - Resource("iptables-eips"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of IptablesEIPs that match those selectors. -func (c *iptablesEIPs) List(ctx context.Context, opts metav1.ListOptions) (result *v1.IptablesEIPList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.IptablesEIPList{} - err = c.client.Get(). - Resource("iptables-eips"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested iptablesEIPs. -func (c *iptablesEIPs) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("iptables-eips"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a iptablesEIP and creates it. Returns the server's representation of the iptablesEIP, and an error, if there is any. -func (c *iptablesEIPs) Create(ctx context.Context, iptablesEIP *v1.IptablesEIP, opts metav1.CreateOptions) (result *v1.IptablesEIP, err error) { - result = &v1.IptablesEIP{} - err = c.client.Post(). - Resource("iptables-eips"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iptablesEIP). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a iptablesEIP and updates it. Returns the server's representation of the iptablesEIP, and an error, if there is any. -func (c *iptablesEIPs) Update(ctx context.Context, iptablesEIP *v1.IptablesEIP, opts metav1.UpdateOptions) (result *v1.IptablesEIP, err error) { - result = &v1.IptablesEIP{} - err = c.client.Put(). - Resource("iptables-eips"). - Name(iptablesEIP.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iptablesEIP). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *iptablesEIPs) UpdateStatus(ctx context.Context, iptablesEIP *v1.IptablesEIP, opts metav1.UpdateOptions) (result *v1.IptablesEIP, err error) { - result = &v1.IptablesEIP{} - err = c.client.Put(). - Resource("iptables-eips"). - Name(iptablesEIP.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iptablesEIP). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the iptablesEIP and deletes it. Returns an error if one occurs. -func (c *iptablesEIPs) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("iptables-eips"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *iptablesEIPs) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("iptables-eips"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched iptablesEIP. -func (c *iptablesEIPs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.IptablesEIP, err error) { - result = &v1.IptablesEIP{} - err = c.client.Patch(pt). - Resource("iptables-eips"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/iptablesfiprule.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/iptablesfiprule.go deleted file mode 100644 index 2cc7fef6cd4..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/iptablesfiprule.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - scheme "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// IptablesFIPRulesGetter has a method to return a IptablesFIPRuleInterface. -// A group's client should implement this interface. -type IptablesFIPRulesGetter interface { - IptablesFIPRules() IptablesFIPRuleInterface -} - -// IptablesFIPRuleInterface has methods to work with IptablesFIPRule resources. -type IptablesFIPRuleInterface interface { - Create(ctx context.Context, iptablesFIPRule *v1.IptablesFIPRule, opts metav1.CreateOptions) (*v1.IptablesFIPRule, error) - Update(ctx context.Context, iptablesFIPRule *v1.IptablesFIPRule, opts metav1.UpdateOptions) (*v1.IptablesFIPRule, error) - UpdateStatus(ctx context.Context, iptablesFIPRule *v1.IptablesFIPRule, opts metav1.UpdateOptions) (*v1.IptablesFIPRule, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.IptablesFIPRule, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.IptablesFIPRuleList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.IptablesFIPRule, err error) - IptablesFIPRuleExpansion -} - -// iptablesFIPRules implements IptablesFIPRuleInterface -type iptablesFIPRules struct { - client rest.Interface -} - -// newIptablesFIPRules returns a IptablesFIPRules -func newIptablesFIPRules(c *KubeovnV1Client) *iptablesFIPRules { - return &iptablesFIPRules{ - client: c.RESTClient(), - } -} - -// Get takes name of the iptablesFIPRule, and returns the corresponding iptablesFIPRule object, and an error if there is any. -func (c *iptablesFIPRules) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.IptablesFIPRule, err error) { - result = &v1.IptablesFIPRule{} - err = c.client.Get(). - Resource("iptables-fip-rules"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of IptablesFIPRules that match those selectors. -func (c *iptablesFIPRules) List(ctx context.Context, opts metav1.ListOptions) (result *v1.IptablesFIPRuleList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.IptablesFIPRuleList{} - err = c.client.Get(). - Resource("iptables-fip-rules"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested iptablesFIPRules. -func (c *iptablesFIPRules) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("iptables-fip-rules"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a iptablesFIPRule and creates it. Returns the server's representation of the iptablesFIPRule, and an error, if there is any. -func (c *iptablesFIPRules) Create(ctx context.Context, iptablesFIPRule *v1.IptablesFIPRule, opts metav1.CreateOptions) (result *v1.IptablesFIPRule, err error) { - result = &v1.IptablesFIPRule{} - err = c.client.Post(). - Resource("iptables-fip-rules"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iptablesFIPRule). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a iptablesFIPRule and updates it. Returns the server's representation of the iptablesFIPRule, and an error, if there is any. -func (c *iptablesFIPRules) Update(ctx context.Context, iptablesFIPRule *v1.IptablesFIPRule, opts metav1.UpdateOptions) (result *v1.IptablesFIPRule, err error) { - result = &v1.IptablesFIPRule{} - err = c.client.Put(). - Resource("iptables-fip-rules"). - Name(iptablesFIPRule.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iptablesFIPRule). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *iptablesFIPRules) UpdateStatus(ctx context.Context, iptablesFIPRule *v1.IptablesFIPRule, opts metav1.UpdateOptions) (result *v1.IptablesFIPRule, err error) { - result = &v1.IptablesFIPRule{} - err = c.client.Put(). - Resource("iptables-fip-rules"). - Name(iptablesFIPRule.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iptablesFIPRule). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the iptablesFIPRule and deletes it. Returns an error if one occurs. -func (c *iptablesFIPRules) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("iptables-fip-rules"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *iptablesFIPRules) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("iptables-fip-rules"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched iptablesFIPRule. -func (c *iptablesFIPRules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.IptablesFIPRule, err error) { - result = &v1.IptablesFIPRule{} - err = c.client.Patch(pt). - Resource("iptables-fip-rules"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/iptablessnatrule.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/iptablessnatrule.go deleted file mode 100644 index 576d1fbb92c..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/iptablessnatrule.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - scheme "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// IptablesSnatRulesGetter has a method to return a IptablesSnatRuleInterface. -// A group's client should implement this interface. -type IptablesSnatRulesGetter interface { - IptablesSnatRules() IptablesSnatRuleInterface -} - -// IptablesSnatRuleInterface has methods to work with IptablesSnatRule resources. -type IptablesSnatRuleInterface interface { - Create(ctx context.Context, iptablesSnatRule *v1.IptablesSnatRule, opts metav1.CreateOptions) (*v1.IptablesSnatRule, error) - Update(ctx context.Context, iptablesSnatRule *v1.IptablesSnatRule, opts metav1.UpdateOptions) (*v1.IptablesSnatRule, error) - UpdateStatus(ctx context.Context, iptablesSnatRule *v1.IptablesSnatRule, opts metav1.UpdateOptions) (*v1.IptablesSnatRule, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.IptablesSnatRule, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.IptablesSnatRuleList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.IptablesSnatRule, err error) - IptablesSnatRuleExpansion -} - -// iptablesSnatRules implements IptablesSnatRuleInterface -type iptablesSnatRules struct { - client rest.Interface -} - -// newIptablesSnatRules returns a IptablesSnatRules -func newIptablesSnatRules(c *KubeovnV1Client) *iptablesSnatRules { - return &iptablesSnatRules{ - client: c.RESTClient(), - } -} - -// Get takes name of the iptablesSnatRule, and returns the corresponding iptablesSnatRule object, and an error if there is any. -func (c *iptablesSnatRules) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.IptablesSnatRule, err error) { - result = &v1.IptablesSnatRule{} - err = c.client.Get(). - Resource("iptables-snat-rules"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of IptablesSnatRules that match those selectors. -func (c *iptablesSnatRules) List(ctx context.Context, opts metav1.ListOptions) (result *v1.IptablesSnatRuleList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.IptablesSnatRuleList{} - err = c.client.Get(). - Resource("iptables-snat-rules"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested iptablesSnatRules. -func (c *iptablesSnatRules) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("iptables-snat-rules"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a iptablesSnatRule and creates it. Returns the server's representation of the iptablesSnatRule, and an error, if there is any. -func (c *iptablesSnatRules) Create(ctx context.Context, iptablesSnatRule *v1.IptablesSnatRule, opts metav1.CreateOptions) (result *v1.IptablesSnatRule, err error) { - result = &v1.IptablesSnatRule{} - err = c.client.Post(). - Resource("iptables-snat-rules"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iptablesSnatRule). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a iptablesSnatRule and updates it. Returns the server's representation of the iptablesSnatRule, and an error, if there is any. -func (c *iptablesSnatRules) Update(ctx context.Context, iptablesSnatRule *v1.IptablesSnatRule, opts metav1.UpdateOptions) (result *v1.IptablesSnatRule, err error) { - result = &v1.IptablesSnatRule{} - err = c.client.Put(). - Resource("iptables-snat-rules"). - Name(iptablesSnatRule.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iptablesSnatRule). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *iptablesSnatRules) UpdateStatus(ctx context.Context, iptablesSnatRule *v1.IptablesSnatRule, opts metav1.UpdateOptions) (result *v1.IptablesSnatRule, err error) { - result = &v1.IptablesSnatRule{} - err = c.client.Put(). - Resource("iptables-snat-rules"). - Name(iptablesSnatRule.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(iptablesSnatRule). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the iptablesSnatRule and deletes it. Returns an error if one occurs. -func (c *iptablesSnatRules) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("iptables-snat-rules"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *iptablesSnatRules) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("iptables-snat-rules"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched iptablesSnatRule. -func (c *iptablesSnatRules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.IptablesSnatRule, err error) { - result = &v1.IptablesSnatRule{} - err = c.client.Patch(pt). - Resource("iptables-snat-rules"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/kubeovn_client.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/kubeovn_client.go deleted file mode 100644 index 86dad154b9e..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/kubeovn_client.go +++ /dev/null @@ -1,192 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "net/http" - - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" -) - -type KubeovnV1Interface interface { - RESTClient() rest.Interface - HtbQosesGetter - IPsGetter - IptablesDnatRulesGetter - IptablesEIPsGetter - IptablesFIPRulesGetter - IptablesSnatRulesGetter - OvnEipsGetter - OvnFipsGetter - OvnSnatRulesGetter - ProviderNetworksGetter - SecurityGroupsGetter - SubnetsGetter - SwitchLBRulesGetter - VipsGetter - VlansGetter - VpcsGetter - VpcDnsesGetter - VpcNatGatewaysGetter -} - -// KubeovnV1Client is used to interact with features provided by the kubeovn.io group. -type KubeovnV1Client struct { - restClient rest.Interface -} - -func (c *KubeovnV1Client) HtbQoses() HtbQosInterface { - return newHtbQoses(c) -} - -func (c *KubeovnV1Client) IPs() IPInterface { - return newIPs(c) -} - -func (c *KubeovnV1Client) IptablesDnatRules() IptablesDnatRuleInterface { - return newIptablesDnatRules(c) -} - -func (c *KubeovnV1Client) IptablesEIPs() IptablesEIPInterface { - return newIptablesEIPs(c) -} - -func (c *KubeovnV1Client) IptablesFIPRules() IptablesFIPRuleInterface { - return newIptablesFIPRules(c) -} - -func (c *KubeovnV1Client) IptablesSnatRules() IptablesSnatRuleInterface { - return newIptablesSnatRules(c) -} - -func (c *KubeovnV1Client) OvnEips() OvnEipInterface { - return newOvnEips(c) -} - -func (c *KubeovnV1Client) OvnFips() OvnFipInterface { - return newOvnFips(c) -} - -func (c *KubeovnV1Client) OvnSnatRules() OvnSnatRuleInterface { - return newOvnSnatRules(c) -} - -func (c *KubeovnV1Client) ProviderNetworks() ProviderNetworkInterface { - return newProviderNetworks(c) -} - -func (c *KubeovnV1Client) SecurityGroups() SecurityGroupInterface { - return newSecurityGroups(c) -} - -func (c *KubeovnV1Client) Subnets() SubnetInterface { - return newSubnets(c) -} - -func (c *KubeovnV1Client) SwitchLBRules() SwitchLBRuleInterface { - return newSwitchLBRules(c) -} - -func (c *KubeovnV1Client) Vips() VipInterface { - return newVips(c) -} - -func (c *KubeovnV1Client) Vlans() VlanInterface { - return newVlans(c) -} - -func (c *KubeovnV1Client) Vpcs() VpcInterface { - return newVpcs(c) -} - -func (c *KubeovnV1Client) VpcDnses() VpcDnsInterface { - return newVpcDnses(c) -} - -func (c *KubeovnV1Client) VpcNatGateways() VpcNatGatewayInterface { - return newVpcNatGateways(c) -} - -// NewForConfig creates a new KubeovnV1Client for the given config. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*KubeovnV1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - httpClient, err := rest.HTTPClientFor(&config) - if err != nil { - return nil, err - } - return NewForConfigAndClient(&config, httpClient) -} - -// NewForConfigAndClient creates a new KubeovnV1Client for the given config and http client. -// Note the http client provided takes precedence over the configured transport values. -func NewForConfigAndClient(c *rest.Config, h *http.Client) (*KubeovnV1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientForConfigAndClient(&config, h) - if err != nil { - return nil, err - } - return &KubeovnV1Client{client}, nil -} - -// NewForConfigOrDie creates a new KubeovnV1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *KubeovnV1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new KubeovnV1Client for the given RESTClient. -func New(c rest.Interface) *KubeovnV1Client { - return &KubeovnV1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/apis" - config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() - - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *KubeovnV1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/ovneip.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/ovneip.go deleted file mode 100644 index 509d0492cac..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/ovneip.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - scheme "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// OvnEipsGetter has a method to return a OvnEipInterface. -// A group's client should implement this interface. -type OvnEipsGetter interface { - OvnEips() OvnEipInterface -} - -// OvnEipInterface has methods to work with OvnEip resources. -type OvnEipInterface interface { - Create(ctx context.Context, ovnEip *v1.OvnEip, opts metav1.CreateOptions) (*v1.OvnEip, error) - Update(ctx context.Context, ovnEip *v1.OvnEip, opts metav1.UpdateOptions) (*v1.OvnEip, error) - UpdateStatus(ctx context.Context, ovnEip *v1.OvnEip, opts metav1.UpdateOptions) (*v1.OvnEip, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.OvnEip, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.OvnEipList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.OvnEip, err error) - OvnEipExpansion -} - -// ovnEips implements OvnEipInterface -type ovnEips struct { - client rest.Interface -} - -// newOvnEips returns a OvnEips -func newOvnEips(c *KubeovnV1Client) *ovnEips { - return &ovnEips{ - client: c.RESTClient(), - } -} - -// Get takes name of the ovnEip, and returns the corresponding ovnEip object, and an error if there is any. -func (c *ovnEips) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.OvnEip, err error) { - result = &v1.OvnEip{} - err = c.client.Get(). - Resource("ovn-eips"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of OvnEips that match those selectors. -func (c *ovnEips) List(ctx context.Context, opts metav1.ListOptions) (result *v1.OvnEipList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.OvnEipList{} - err = c.client.Get(). - Resource("ovn-eips"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ovnEips. -func (c *ovnEips) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("ovn-eips"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ovnEip and creates it. Returns the server's representation of the ovnEip, and an error, if there is any. -func (c *ovnEips) Create(ctx context.Context, ovnEip *v1.OvnEip, opts metav1.CreateOptions) (result *v1.OvnEip, err error) { - result = &v1.OvnEip{} - err = c.client.Post(). - Resource("ovn-eips"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ovnEip). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ovnEip and updates it. Returns the server's representation of the ovnEip, and an error, if there is any. -func (c *ovnEips) Update(ctx context.Context, ovnEip *v1.OvnEip, opts metav1.UpdateOptions) (result *v1.OvnEip, err error) { - result = &v1.OvnEip{} - err = c.client.Put(). - Resource("ovn-eips"). - Name(ovnEip.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ovnEip). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *ovnEips) UpdateStatus(ctx context.Context, ovnEip *v1.OvnEip, opts metav1.UpdateOptions) (result *v1.OvnEip, err error) { - result = &v1.OvnEip{} - err = c.client.Put(). - Resource("ovn-eips"). - Name(ovnEip.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ovnEip). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ovnEip and deletes it. Returns an error if one occurs. -func (c *ovnEips) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("ovn-eips"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ovnEips) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("ovn-eips"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ovnEip. -func (c *ovnEips) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.OvnEip, err error) { - result = &v1.OvnEip{} - err = c.client.Patch(pt). - Resource("ovn-eips"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/ovnfip.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/ovnfip.go deleted file mode 100644 index 0f20cebdfe0..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/ovnfip.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - scheme "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// OvnFipsGetter has a method to return a OvnFipInterface. -// A group's client should implement this interface. -type OvnFipsGetter interface { - OvnFips() OvnFipInterface -} - -// OvnFipInterface has methods to work with OvnFip resources. -type OvnFipInterface interface { - Create(ctx context.Context, ovnFip *v1.OvnFip, opts metav1.CreateOptions) (*v1.OvnFip, error) - Update(ctx context.Context, ovnFip *v1.OvnFip, opts metav1.UpdateOptions) (*v1.OvnFip, error) - UpdateStatus(ctx context.Context, ovnFip *v1.OvnFip, opts metav1.UpdateOptions) (*v1.OvnFip, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.OvnFip, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.OvnFipList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.OvnFip, err error) - OvnFipExpansion -} - -// ovnFips implements OvnFipInterface -type ovnFips struct { - client rest.Interface -} - -// newOvnFips returns a OvnFips -func newOvnFips(c *KubeovnV1Client) *ovnFips { - return &ovnFips{ - client: c.RESTClient(), - } -} - -// Get takes name of the ovnFip, and returns the corresponding ovnFip object, and an error if there is any. -func (c *ovnFips) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.OvnFip, err error) { - result = &v1.OvnFip{} - err = c.client.Get(). - Resource("ovn-fips"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of OvnFips that match those selectors. -func (c *ovnFips) List(ctx context.Context, opts metav1.ListOptions) (result *v1.OvnFipList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.OvnFipList{} - err = c.client.Get(). - Resource("ovn-fips"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ovnFips. -func (c *ovnFips) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("ovn-fips"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ovnFip and creates it. Returns the server's representation of the ovnFip, and an error, if there is any. -func (c *ovnFips) Create(ctx context.Context, ovnFip *v1.OvnFip, opts metav1.CreateOptions) (result *v1.OvnFip, err error) { - result = &v1.OvnFip{} - err = c.client.Post(). - Resource("ovn-fips"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ovnFip). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ovnFip and updates it. Returns the server's representation of the ovnFip, and an error, if there is any. -func (c *ovnFips) Update(ctx context.Context, ovnFip *v1.OvnFip, opts metav1.UpdateOptions) (result *v1.OvnFip, err error) { - result = &v1.OvnFip{} - err = c.client.Put(). - Resource("ovn-fips"). - Name(ovnFip.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ovnFip). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *ovnFips) UpdateStatus(ctx context.Context, ovnFip *v1.OvnFip, opts metav1.UpdateOptions) (result *v1.OvnFip, err error) { - result = &v1.OvnFip{} - err = c.client.Put(). - Resource("ovn-fips"). - Name(ovnFip.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ovnFip). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ovnFip and deletes it. Returns an error if one occurs. -func (c *ovnFips) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("ovn-fips"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ovnFips) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("ovn-fips"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ovnFip. -func (c *ovnFips) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.OvnFip, err error) { - result = &v1.OvnFip{} - err = c.client.Patch(pt). - Resource("ovn-fips"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/ovnsnatrule.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/ovnsnatrule.go deleted file mode 100644 index 93bb2c01b12..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/ovnsnatrule.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - scheme "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// OvnSnatRulesGetter has a method to return a OvnSnatRuleInterface. -// A group's client should implement this interface. -type OvnSnatRulesGetter interface { - OvnSnatRules() OvnSnatRuleInterface -} - -// OvnSnatRuleInterface has methods to work with OvnSnatRule resources. -type OvnSnatRuleInterface interface { - Create(ctx context.Context, ovnSnatRule *v1.OvnSnatRule, opts metav1.CreateOptions) (*v1.OvnSnatRule, error) - Update(ctx context.Context, ovnSnatRule *v1.OvnSnatRule, opts metav1.UpdateOptions) (*v1.OvnSnatRule, error) - UpdateStatus(ctx context.Context, ovnSnatRule *v1.OvnSnatRule, opts metav1.UpdateOptions) (*v1.OvnSnatRule, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.OvnSnatRule, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.OvnSnatRuleList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.OvnSnatRule, err error) - OvnSnatRuleExpansion -} - -// ovnSnatRules implements OvnSnatRuleInterface -type ovnSnatRules struct { - client rest.Interface -} - -// newOvnSnatRules returns a OvnSnatRules -func newOvnSnatRules(c *KubeovnV1Client) *ovnSnatRules { - return &ovnSnatRules{ - client: c.RESTClient(), - } -} - -// Get takes name of the ovnSnatRule, and returns the corresponding ovnSnatRule object, and an error if there is any. -func (c *ovnSnatRules) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.OvnSnatRule, err error) { - result = &v1.OvnSnatRule{} - err = c.client.Get(). - Resource("ovn-snat-rules"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of OvnSnatRules that match those selectors. -func (c *ovnSnatRules) List(ctx context.Context, opts metav1.ListOptions) (result *v1.OvnSnatRuleList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.OvnSnatRuleList{} - err = c.client.Get(). - Resource("ovn-snat-rules"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ovnSnatRules. -func (c *ovnSnatRules) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("ovn-snat-rules"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ovnSnatRule and creates it. Returns the server's representation of the ovnSnatRule, and an error, if there is any. -func (c *ovnSnatRules) Create(ctx context.Context, ovnSnatRule *v1.OvnSnatRule, opts metav1.CreateOptions) (result *v1.OvnSnatRule, err error) { - result = &v1.OvnSnatRule{} - err = c.client.Post(). - Resource("ovn-snat-rules"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ovnSnatRule). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ovnSnatRule and updates it. Returns the server's representation of the ovnSnatRule, and an error, if there is any. -func (c *ovnSnatRules) Update(ctx context.Context, ovnSnatRule *v1.OvnSnatRule, opts metav1.UpdateOptions) (result *v1.OvnSnatRule, err error) { - result = &v1.OvnSnatRule{} - err = c.client.Put(). - Resource("ovn-snat-rules"). - Name(ovnSnatRule.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ovnSnatRule). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *ovnSnatRules) UpdateStatus(ctx context.Context, ovnSnatRule *v1.OvnSnatRule, opts metav1.UpdateOptions) (result *v1.OvnSnatRule, err error) { - result = &v1.OvnSnatRule{} - err = c.client.Put(). - Resource("ovn-snat-rules"). - Name(ovnSnatRule.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ovnSnatRule). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ovnSnatRule and deletes it. Returns an error if one occurs. -func (c *ovnSnatRules) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("ovn-snat-rules"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ovnSnatRules) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("ovn-snat-rules"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ovnSnatRule. -func (c *ovnSnatRules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.OvnSnatRule, err error) { - result = &v1.OvnSnatRule{} - err = c.client.Patch(pt). - Resource("ovn-snat-rules"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/providernetwork.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/providernetwork.go deleted file mode 100644 index fcef8da37fa..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/providernetwork.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - scheme "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// ProviderNetworksGetter has a method to return a ProviderNetworkInterface. -// A group's client should implement this interface. -type ProviderNetworksGetter interface { - ProviderNetworks() ProviderNetworkInterface -} - -// ProviderNetworkInterface has methods to work with ProviderNetwork resources. -type ProviderNetworkInterface interface { - Create(ctx context.Context, providerNetwork *v1.ProviderNetwork, opts metav1.CreateOptions) (*v1.ProviderNetwork, error) - Update(ctx context.Context, providerNetwork *v1.ProviderNetwork, opts metav1.UpdateOptions) (*v1.ProviderNetwork, error) - UpdateStatus(ctx context.Context, providerNetwork *v1.ProviderNetwork, opts metav1.UpdateOptions) (*v1.ProviderNetwork, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ProviderNetwork, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.ProviderNetworkList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ProviderNetwork, err error) - ProviderNetworkExpansion -} - -// providerNetworks implements ProviderNetworkInterface -type providerNetworks struct { - client rest.Interface -} - -// newProviderNetworks returns a ProviderNetworks -func newProviderNetworks(c *KubeovnV1Client) *providerNetworks { - return &providerNetworks{ - client: c.RESTClient(), - } -} - -// Get takes name of the providerNetwork, and returns the corresponding providerNetwork object, and an error if there is any. -func (c *providerNetworks) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ProviderNetwork, err error) { - result = &v1.ProviderNetwork{} - err = c.client.Get(). - Resource("provider-networks"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ProviderNetworks that match those selectors. -func (c *providerNetworks) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ProviderNetworkList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.ProviderNetworkList{} - err = c.client.Get(). - Resource("provider-networks"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested providerNetworks. -func (c *providerNetworks) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("provider-networks"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a providerNetwork and creates it. Returns the server's representation of the providerNetwork, and an error, if there is any. -func (c *providerNetworks) Create(ctx context.Context, providerNetwork *v1.ProviderNetwork, opts metav1.CreateOptions) (result *v1.ProviderNetwork, err error) { - result = &v1.ProviderNetwork{} - err = c.client.Post(). - Resource("provider-networks"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(providerNetwork). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a providerNetwork and updates it. Returns the server's representation of the providerNetwork, and an error, if there is any. -func (c *providerNetworks) Update(ctx context.Context, providerNetwork *v1.ProviderNetwork, opts metav1.UpdateOptions) (result *v1.ProviderNetwork, err error) { - result = &v1.ProviderNetwork{} - err = c.client.Put(). - Resource("provider-networks"). - Name(providerNetwork.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(providerNetwork). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *providerNetworks) UpdateStatus(ctx context.Context, providerNetwork *v1.ProviderNetwork, opts metav1.UpdateOptions) (result *v1.ProviderNetwork, err error) { - result = &v1.ProviderNetwork{} - err = c.client.Put(). - Resource("provider-networks"). - Name(providerNetwork.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(providerNetwork). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the providerNetwork and deletes it. Returns an error if one occurs. -func (c *providerNetworks) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("provider-networks"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *providerNetworks) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("provider-networks"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched providerNetwork. -func (c *providerNetworks) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ProviderNetwork, err error) { - result = &v1.ProviderNetwork{} - err = c.client.Patch(pt). - Resource("provider-networks"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/securitygroup.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/securitygroup.go deleted file mode 100644 index 391baf47c56..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/securitygroup.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - scheme "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// SecurityGroupsGetter has a method to return a SecurityGroupInterface. -// A group's client should implement this interface. -type SecurityGroupsGetter interface { - SecurityGroups() SecurityGroupInterface -} - -// SecurityGroupInterface has methods to work with SecurityGroup resources. -type SecurityGroupInterface interface { - Create(ctx context.Context, securityGroup *v1.SecurityGroup, opts metav1.CreateOptions) (*v1.SecurityGroup, error) - Update(ctx context.Context, securityGroup *v1.SecurityGroup, opts metav1.UpdateOptions) (*v1.SecurityGroup, error) - UpdateStatus(ctx context.Context, securityGroup *v1.SecurityGroup, opts metav1.UpdateOptions) (*v1.SecurityGroup, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.SecurityGroup, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.SecurityGroupList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.SecurityGroup, err error) - SecurityGroupExpansion -} - -// securityGroups implements SecurityGroupInterface -type securityGroups struct { - client rest.Interface -} - -// newSecurityGroups returns a SecurityGroups -func newSecurityGroups(c *KubeovnV1Client) *securityGroups { - return &securityGroups{ - client: c.RESTClient(), - } -} - -// Get takes name of the securityGroup, and returns the corresponding securityGroup object, and an error if there is any. -func (c *securityGroups) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.SecurityGroup, err error) { - result = &v1.SecurityGroup{} - err = c.client.Get(). - Resource("security-groups"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of SecurityGroups that match those selectors. -func (c *securityGroups) List(ctx context.Context, opts metav1.ListOptions) (result *v1.SecurityGroupList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.SecurityGroupList{} - err = c.client.Get(). - Resource("security-groups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested securityGroups. -func (c *securityGroups) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("security-groups"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a securityGroup and creates it. Returns the server's representation of the securityGroup, and an error, if there is any. -func (c *securityGroups) Create(ctx context.Context, securityGroup *v1.SecurityGroup, opts metav1.CreateOptions) (result *v1.SecurityGroup, err error) { - result = &v1.SecurityGroup{} - err = c.client.Post(). - Resource("security-groups"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(securityGroup). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a securityGroup and updates it. Returns the server's representation of the securityGroup, and an error, if there is any. -func (c *securityGroups) Update(ctx context.Context, securityGroup *v1.SecurityGroup, opts metav1.UpdateOptions) (result *v1.SecurityGroup, err error) { - result = &v1.SecurityGroup{} - err = c.client.Put(). - Resource("security-groups"). - Name(securityGroup.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(securityGroup). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *securityGroups) UpdateStatus(ctx context.Context, securityGroup *v1.SecurityGroup, opts metav1.UpdateOptions) (result *v1.SecurityGroup, err error) { - result = &v1.SecurityGroup{} - err = c.client.Put(). - Resource("security-groups"). - Name(securityGroup.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(securityGroup). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the securityGroup and deletes it. Returns an error if one occurs. -func (c *securityGroups) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("security-groups"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *securityGroups) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("security-groups"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched securityGroup. -func (c *securityGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.SecurityGroup, err error) { - result = &v1.SecurityGroup{} - err = c.client.Patch(pt). - Resource("security-groups"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/subnet.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/subnet.go deleted file mode 100644 index a1638ef10f5..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/subnet.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - scheme "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// SubnetsGetter has a method to return a SubnetInterface. -// A group's client should implement this interface. -type SubnetsGetter interface { - Subnets() SubnetInterface -} - -// SubnetInterface has methods to work with Subnet resources. -type SubnetInterface interface { - Create(ctx context.Context, subnet *v1.Subnet, opts metav1.CreateOptions) (*v1.Subnet, error) - Update(ctx context.Context, subnet *v1.Subnet, opts metav1.UpdateOptions) (*v1.Subnet, error) - UpdateStatus(ctx context.Context, subnet *v1.Subnet, opts metav1.UpdateOptions) (*v1.Subnet, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Subnet, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.SubnetList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Subnet, err error) - SubnetExpansion -} - -// subnets implements SubnetInterface -type subnets struct { - client rest.Interface -} - -// newSubnets returns a Subnets -func newSubnets(c *KubeovnV1Client) *subnets { - return &subnets{ - client: c.RESTClient(), - } -} - -// Get takes name of the subnet, and returns the corresponding subnet object, and an error if there is any. -func (c *subnets) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Subnet, err error) { - result = &v1.Subnet{} - err = c.client.Get(). - Resource("subnets"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Subnets that match those selectors. -func (c *subnets) List(ctx context.Context, opts metav1.ListOptions) (result *v1.SubnetList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.SubnetList{} - err = c.client.Get(). - Resource("subnets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested subnets. -func (c *subnets) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("subnets"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a subnet and creates it. Returns the server's representation of the subnet, and an error, if there is any. -func (c *subnets) Create(ctx context.Context, subnet *v1.Subnet, opts metav1.CreateOptions) (result *v1.Subnet, err error) { - result = &v1.Subnet{} - err = c.client.Post(). - Resource("subnets"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(subnet). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a subnet and updates it. Returns the server's representation of the subnet, and an error, if there is any. -func (c *subnets) Update(ctx context.Context, subnet *v1.Subnet, opts metav1.UpdateOptions) (result *v1.Subnet, err error) { - result = &v1.Subnet{} - err = c.client.Put(). - Resource("subnets"). - Name(subnet.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(subnet). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *subnets) UpdateStatus(ctx context.Context, subnet *v1.Subnet, opts metav1.UpdateOptions) (result *v1.Subnet, err error) { - result = &v1.Subnet{} - err = c.client.Put(). - Resource("subnets"). - Name(subnet.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(subnet). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the subnet and deletes it. Returns an error if one occurs. -func (c *subnets) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("subnets"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *subnets) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("subnets"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched subnet. -func (c *subnets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Subnet, err error) { - result = &v1.Subnet{} - err = c.client.Patch(pt). - Resource("subnets"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/switchlbrule.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/switchlbrule.go deleted file mode 100644 index 537deb6a187..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/switchlbrule.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - scheme "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// SwitchLBRulesGetter has a method to return a SwitchLBRuleInterface. -// A group's client should implement this interface. -type SwitchLBRulesGetter interface { - SwitchLBRules() SwitchLBRuleInterface -} - -// SwitchLBRuleInterface has methods to work with SwitchLBRule resources. -type SwitchLBRuleInterface interface { - Create(ctx context.Context, switchLBRule *v1.SwitchLBRule, opts metav1.CreateOptions) (*v1.SwitchLBRule, error) - Update(ctx context.Context, switchLBRule *v1.SwitchLBRule, opts metav1.UpdateOptions) (*v1.SwitchLBRule, error) - UpdateStatus(ctx context.Context, switchLBRule *v1.SwitchLBRule, opts metav1.UpdateOptions) (*v1.SwitchLBRule, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.SwitchLBRule, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.SwitchLBRuleList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.SwitchLBRule, err error) - SwitchLBRuleExpansion -} - -// switchLBRules implements SwitchLBRuleInterface -type switchLBRules struct { - client rest.Interface -} - -// newSwitchLBRules returns a SwitchLBRules -func newSwitchLBRules(c *KubeovnV1Client) *switchLBRules { - return &switchLBRules{ - client: c.RESTClient(), - } -} - -// Get takes name of the switchLBRule, and returns the corresponding switchLBRule object, and an error if there is any. -func (c *switchLBRules) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.SwitchLBRule, err error) { - result = &v1.SwitchLBRule{} - err = c.client.Get(). - Resource("switch-lb-rules"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of SwitchLBRules that match those selectors. -func (c *switchLBRules) List(ctx context.Context, opts metav1.ListOptions) (result *v1.SwitchLBRuleList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.SwitchLBRuleList{} - err = c.client.Get(). - Resource("switch-lb-rules"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested switchLBRules. -func (c *switchLBRules) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("switch-lb-rules"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a switchLBRule and creates it. Returns the server's representation of the switchLBRule, and an error, if there is any. -func (c *switchLBRules) Create(ctx context.Context, switchLBRule *v1.SwitchLBRule, opts metav1.CreateOptions) (result *v1.SwitchLBRule, err error) { - result = &v1.SwitchLBRule{} - err = c.client.Post(). - Resource("switch-lb-rules"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(switchLBRule). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a switchLBRule and updates it. Returns the server's representation of the switchLBRule, and an error, if there is any. -func (c *switchLBRules) Update(ctx context.Context, switchLBRule *v1.SwitchLBRule, opts metav1.UpdateOptions) (result *v1.SwitchLBRule, err error) { - result = &v1.SwitchLBRule{} - err = c.client.Put(). - Resource("switch-lb-rules"). - Name(switchLBRule.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(switchLBRule). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *switchLBRules) UpdateStatus(ctx context.Context, switchLBRule *v1.SwitchLBRule, opts metav1.UpdateOptions) (result *v1.SwitchLBRule, err error) { - result = &v1.SwitchLBRule{} - err = c.client.Put(). - Resource("switch-lb-rules"). - Name(switchLBRule.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(switchLBRule). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the switchLBRule and deletes it. Returns an error if one occurs. -func (c *switchLBRules) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("switch-lb-rules"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *switchLBRules) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("switch-lb-rules"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched switchLBRule. -func (c *switchLBRules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.SwitchLBRule, err error) { - result = &v1.SwitchLBRule{} - err = c.client.Patch(pt). - Resource("switch-lb-rules"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/vip.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/vip.go deleted file mode 100644 index b355e6079bc..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/vip.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - scheme "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// VipsGetter has a method to return a VipInterface. -// A group's client should implement this interface. -type VipsGetter interface { - Vips() VipInterface -} - -// VipInterface has methods to work with Vip resources. -type VipInterface interface { - Create(ctx context.Context, vip *v1.Vip, opts metav1.CreateOptions) (*v1.Vip, error) - Update(ctx context.Context, vip *v1.Vip, opts metav1.UpdateOptions) (*v1.Vip, error) - UpdateStatus(ctx context.Context, vip *v1.Vip, opts metav1.UpdateOptions) (*v1.Vip, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Vip, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.VipList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Vip, err error) - VipExpansion -} - -// vips implements VipInterface -type vips struct { - client rest.Interface -} - -// newVips returns a Vips -func newVips(c *KubeovnV1Client) *vips { - return &vips{ - client: c.RESTClient(), - } -} - -// Get takes name of the vip, and returns the corresponding vip object, and an error if there is any. -func (c *vips) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Vip, err error) { - result = &v1.Vip{} - err = c.client.Get(). - Resource("vips"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Vips that match those selectors. -func (c *vips) List(ctx context.Context, opts metav1.ListOptions) (result *v1.VipList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.VipList{} - err = c.client.Get(). - Resource("vips"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested vips. -func (c *vips) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("vips"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a vip and creates it. Returns the server's representation of the vip, and an error, if there is any. -func (c *vips) Create(ctx context.Context, vip *v1.Vip, opts metav1.CreateOptions) (result *v1.Vip, err error) { - result = &v1.Vip{} - err = c.client.Post(). - Resource("vips"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vip). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a vip and updates it. Returns the server's representation of the vip, and an error, if there is any. -func (c *vips) Update(ctx context.Context, vip *v1.Vip, opts metav1.UpdateOptions) (result *v1.Vip, err error) { - result = &v1.Vip{} - err = c.client.Put(). - Resource("vips"). - Name(vip.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vip). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *vips) UpdateStatus(ctx context.Context, vip *v1.Vip, opts metav1.UpdateOptions) (result *v1.Vip, err error) { - result = &v1.Vip{} - err = c.client.Put(). - Resource("vips"). - Name(vip.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vip). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the vip and deletes it. Returns an error if one occurs. -func (c *vips) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("vips"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *vips) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("vips"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched vip. -func (c *vips) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Vip, err error) { - result = &v1.Vip{} - err = c.client.Patch(pt). - Resource("vips"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/vlan.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/vlan.go deleted file mode 100644 index 64e91699707..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/vlan.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - scheme "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// VlansGetter has a method to return a VlanInterface. -// A group's client should implement this interface. -type VlansGetter interface { - Vlans() VlanInterface -} - -// VlanInterface has methods to work with Vlan resources. -type VlanInterface interface { - Create(ctx context.Context, vlan *v1.Vlan, opts metav1.CreateOptions) (*v1.Vlan, error) - Update(ctx context.Context, vlan *v1.Vlan, opts metav1.UpdateOptions) (*v1.Vlan, error) - UpdateStatus(ctx context.Context, vlan *v1.Vlan, opts metav1.UpdateOptions) (*v1.Vlan, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Vlan, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.VlanList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Vlan, err error) - VlanExpansion -} - -// vlans implements VlanInterface -type vlans struct { - client rest.Interface -} - -// newVlans returns a Vlans -func newVlans(c *KubeovnV1Client) *vlans { - return &vlans{ - client: c.RESTClient(), - } -} - -// Get takes name of the vlan, and returns the corresponding vlan object, and an error if there is any. -func (c *vlans) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Vlan, err error) { - result = &v1.Vlan{} - err = c.client.Get(). - Resource("vlans"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Vlans that match those selectors. -func (c *vlans) List(ctx context.Context, opts metav1.ListOptions) (result *v1.VlanList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.VlanList{} - err = c.client.Get(). - Resource("vlans"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested vlans. -func (c *vlans) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("vlans"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a vlan and creates it. Returns the server's representation of the vlan, and an error, if there is any. -func (c *vlans) Create(ctx context.Context, vlan *v1.Vlan, opts metav1.CreateOptions) (result *v1.Vlan, err error) { - result = &v1.Vlan{} - err = c.client.Post(). - Resource("vlans"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vlan). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a vlan and updates it. Returns the server's representation of the vlan, and an error, if there is any. -func (c *vlans) Update(ctx context.Context, vlan *v1.Vlan, opts metav1.UpdateOptions) (result *v1.Vlan, err error) { - result = &v1.Vlan{} - err = c.client.Put(). - Resource("vlans"). - Name(vlan.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vlan). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *vlans) UpdateStatus(ctx context.Context, vlan *v1.Vlan, opts metav1.UpdateOptions) (result *v1.Vlan, err error) { - result = &v1.Vlan{} - err = c.client.Put(). - Resource("vlans"). - Name(vlan.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vlan). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the vlan and deletes it. Returns an error if one occurs. -func (c *vlans) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("vlans"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *vlans) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("vlans"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched vlan. -func (c *vlans) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Vlan, err error) { - result = &v1.Vlan{} - err = c.client.Patch(pt). - Resource("vlans"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/vpc.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/vpc.go deleted file mode 100644 index 788500624fd..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/vpc.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - scheme "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// VpcsGetter has a method to return a VpcInterface. -// A group's client should implement this interface. -type VpcsGetter interface { - Vpcs() VpcInterface -} - -// VpcInterface has methods to work with Vpc resources. -type VpcInterface interface { - Create(ctx context.Context, vpc *v1.Vpc, opts metav1.CreateOptions) (*v1.Vpc, error) - Update(ctx context.Context, vpc *v1.Vpc, opts metav1.UpdateOptions) (*v1.Vpc, error) - UpdateStatus(ctx context.Context, vpc *v1.Vpc, opts metav1.UpdateOptions) (*v1.Vpc, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Vpc, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.VpcList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Vpc, err error) - VpcExpansion -} - -// vpcs implements VpcInterface -type vpcs struct { - client rest.Interface -} - -// newVpcs returns a Vpcs -func newVpcs(c *KubeovnV1Client) *vpcs { - return &vpcs{ - client: c.RESTClient(), - } -} - -// Get takes name of the vpc, and returns the corresponding vpc object, and an error if there is any. -func (c *vpcs) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Vpc, err error) { - result = &v1.Vpc{} - err = c.client.Get(). - Resource("vpcs"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Vpcs that match those selectors. -func (c *vpcs) List(ctx context.Context, opts metav1.ListOptions) (result *v1.VpcList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.VpcList{} - err = c.client.Get(). - Resource("vpcs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested vpcs. -func (c *vpcs) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("vpcs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a vpc and creates it. Returns the server's representation of the vpc, and an error, if there is any. -func (c *vpcs) Create(ctx context.Context, vpc *v1.Vpc, opts metav1.CreateOptions) (result *v1.Vpc, err error) { - result = &v1.Vpc{} - err = c.client.Post(). - Resource("vpcs"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vpc). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a vpc and updates it. Returns the server's representation of the vpc, and an error, if there is any. -func (c *vpcs) Update(ctx context.Context, vpc *v1.Vpc, opts metav1.UpdateOptions) (result *v1.Vpc, err error) { - result = &v1.Vpc{} - err = c.client.Put(). - Resource("vpcs"). - Name(vpc.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vpc). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *vpcs) UpdateStatus(ctx context.Context, vpc *v1.Vpc, opts metav1.UpdateOptions) (result *v1.Vpc, err error) { - result = &v1.Vpc{} - err = c.client.Put(). - Resource("vpcs"). - Name(vpc.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vpc). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the vpc and deletes it. Returns an error if one occurs. -func (c *vpcs) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("vpcs"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *vpcs) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("vpcs"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched vpc. -func (c *vpcs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Vpc, err error) { - result = &v1.Vpc{} - err = c.client.Patch(pt). - Resource("vpcs"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/vpcdns.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/vpcdns.go deleted file mode 100644 index a5190ce56af..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/vpcdns.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - scheme "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// VpcDnsesGetter has a method to return a VpcDnsInterface. -// A group's client should implement this interface. -type VpcDnsesGetter interface { - VpcDnses() VpcDnsInterface -} - -// VpcDnsInterface has methods to work with VpcDns resources. -type VpcDnsInterface interface { - Create(ctx context.Context, vpcDns *v1.VpcDns, opts metav1.CreateOptions) (*v1.VpcDns, error) - Update(ctx context.Context, vpcDns *v1.VpcDns, opts metav1.UpdateOptions) (*v1.VpcDns, error) - UpdateStatus(ctx context.Context, vpcDns *v1.VpcDns, opts metav1.UpdateOptions) (*v1.VpcDns, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.VpcDns, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.VpcDnsList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.VpcDns, err error) - VpcDnsExpansion -} - -// vpcDnses implements VpcDnsInterface -type vpcDnses struct { - client rest.Interface -} - -// newVpcDnses returns a VpcDnses -func newVpcDnses(c *KubeovnV1Client) *vpcDnses { - return &vpcDnses{ - client: c.RESTClient(), - } -} - -// Get takes name of the vpcDns, and returns the corresponding vpcDns object, and an error if there is any. -func (c *vpcDnses) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.VpcDns, err error) { - result = &v1.VpcDns{} - err = c.client.Get(). - Resource("vpc-dnses"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VpcDnses that match those selectors. -func (c *vpcDnses) List(ctx context.Context, opts metav1.ListOptions) (result *v1.VpcDnsList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.VpcDnsList{} - err = c.client.Get(). - Resource("vpc-dnses"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested vpcDnses. -func (c *vpcDnses) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("vpc-dnses"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a vpcDns and creates it. Returns the server's representation of the vpcDns, and an error, if there is any. -func (c *vpcDnses) Create(ctx context.Context, vpcDns *v1.VpcDns, opts metav1.CreateOptions) (result *v1.VpcDns, err error) { - result = &v1.VpcDns{} - err = c.client.Post(). - Resource("vpc-dnses"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vpcDns). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a vpcDns and updates it. Returns the server's representation of the vpcDns, and an error, if there is any. -func (c *vpcDnses) Update(ctx context.Context, vpcDns *v1.VpcDns, opts metav1.UpdateOptions) (result *v1.VpcDns, err error) { - result = &v1.VpcDns{} - err = c.client.Put(). - Resource("vpc-dnses"). - Name(vpcDns.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vpcDns). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *vpcDnses) UpdateStatus(ctx context.Context, vpcDns *v1.VpcDns, opts metav1.UpdateOptions) (result *v1.VpcDns, err error) { - result = &v1.VpcDns{} - err = c.client.Put(). - Resource("vpc-dnses"). - Name(vpcDns.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vpcDns). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the vpcDns and deletes it. Returns an error if one occurs. -func (c *vpcDnses) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("vpc-dnses"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *vpcDnses) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("vpc-dnses"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched vpcDns. -func (c *vpcDnses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.VpcDns, err error) { - result = &v1.VpcDns{} - err = c.client.Patch(pt). - Resource("vpc-dnses"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/vpcnatgateway.go b/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/vpcnatgateway.go deleted file mode 100644 index 03d08658f38..00000000000 --- a/pkg/client/listers/clientset/versioned/typed/kubeovn/v1/vpcnatgateway.go +++ /dev/null @@ -1,168 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - scheme "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// VpcNatGatewaysGetter has a method to return a VpcNatGatewayInterface. -// A group's client should implement this interface. -type VpcNatGatewaysGetter interface { - VpcNatGateways() VpcNatGatewayInterface -} - -// VpcNatGatewayInterface has methods to work with VpcNatGateway resources. -type VpcNatGatewayInterface interface { - Create(ctx context.Context, vpcNatGateway *v1.VpcNatGateway, opts metav1.CreateOptions) (*v1.VpcNatGateway, error) - Update(ctx context.Context, vpcNatGateway *v1.VpcNatGateway, opts metav1.UpdateOptions) (*v1.VpcNatGateway, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.VpcNatGateway, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.VpcNatGatewayList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.VpcNatGateway, err error) - VpcNatGatewayExpansion -} - -// vpcNatGateways implements VpcNatGatewayInterface -type vpcNatGateways struct { - client rest.Interface -} - -// newVpcNatGateways returns a VpcNatGateways -func newVpcNatGateways(c *KubeovnV1Client) *vpcNatGateways { - return &vpcNatGateways{ - client: c.RESTClient(), - } -} - -// Get takes name of the vpcNatGateway, and returns the corresponding vpcNatGateway object, and an error if there is any. -func (c *vpcNatGateways) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.VpcNatGateway, err error) { - result = &v1.VpcNatGateway{} - err = c.client.Get(). - Resource("vpc-nat-gateways"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of VpcNatGateways that match those selectors. -func (c *vpcNatGateways) List(ctx context.Context, opts metav1.ListOptions) (result *v1.VpcNatGatewayList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.VpcNatGatewayList{} - err = c.client.Get(). - Resource("vpc-nat-gateways"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested vpcNatGateways. -func (c *vpcNatGateways) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("vpc-nat-gateways"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a vpcNatGateway and creates it. Returns the server's representation of the vpcNatGateway, and an error, if there is any. -func (c *vpcNatGateways) Create(ctx context.Context, vpcNatGateway *v1.VpcNatGateway, opts metav1.CreateOptions) (result *v1.VpcNatGateway, err error) { - result = &v1.VpcNatGateway{} - err = c.client.Post(). - Resource("vpc-nat-gateways"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vpcNatGateway). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a vpcNatGateway and updates it. Returns the server's representation of the vpcNatGateway, and an error, if there is any. -func (c *vpcNatGateways) Update(ctx context.Context, vpcNatGateway *v1.VpcNatGateway, opts metav1.UpdateOptions) (result *v1.VpcNatGateway, err error) { - result = &v1.VpcNatGateway{} - err = c.client.Put(). - Resource("vpc-nat-gateways"). - Name(vpcNatGateway.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(vpcNatGateway). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the vpcNatGateway and deletes it. Returns an error if one occurs. -func (c *vpcNatGateways) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("vpc-nat-gateways"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *vpcNatGateways) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("vpc-nat-gateways"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched vpcNatGateway. -func (c *vpcNatGateways) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.VpcNatGateway, err error) { - result = &v1.VpcNatGateway{} - err = c.client.Patch(pt). - Resource("vpc-nat-gateways"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/listers/informers/externalversions/factory.go b/pkg/client/listers/informers/externalversions/factory.go deleted file mode 100644 index baba604c99f..00000000000 --- a/pkg/client/listers/informers/externalversions/factory.go +++ /dev/null @@ -1,180 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package externalversions - -import ( - reflect "reflect" - sync "sync" - time "time" - - versioned "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned" - internalinterfaces "github.com/kubeovn/kube-ovn/pkg/client/informers/externalversions/internalinterfaces" - kubeovn "github.com/kubeovn/kube-ovn/pkg/client/informers/externalversions/kubeovn" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - cache "k8s.io/client-go/tools/cache" -) - -// SharedInformerOption defines the functional option type for SharedInformerFactory. -type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory - -type sharedInformerFactory struct { - client versioned.Interface - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc - lock sync.Mutex - defaultResync time.Duration - customResync map[reflect.Type]time.Duration - - informers map[reflect.Type]cache.SharedIndexInformer - // startedInformers is used for tracking which informers have been started. - // This allows Start() to be called multiple times safely. - startedInformers map[reflect.Type]bool -} - -// WithCustomResyncConfig sets a custom resync period for the specified informer types. -func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - for k, v := range resyncConfig { - factory.customResync[reflect.TypeOf(k)] = v - } - return factory - } -} - -// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory. -func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.tweakListOptions = tweakListOptions - return factory - } -} - -// WithNamespace limits the SharedInformerFactory to the specified namespace. -func WithNamespace(namespace string) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.namespace = namespace - return factory - } -} - -// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. -func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { - return NewSharedInformerFactoryWithOptions(client, defaultResync) -} - -// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory. -// Listers obtained via this SharedInformerFactory will be subject to the same filters -// as specified here. -// Deprecated: Please use NewSharedInformerFactoryWithOptions instead -func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory { - return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions)) -} - -// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. -func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { - factory := &sharedInformerFactory{ - client: client, - namespace: v1.NamespaceAll, - defaultResync: defaultResync, - informers: make(map[reflect.Type]cache.SharedIndexInformer), - startedInformers: make(map[reflect.Type]bool), - customResync: make(map[reflect.Type]time.Duration), - } - - // Apply all options - for _, opt := range options { - factory = opt(factory) - } - - return factory -} - -// Start initializes all requested informers. -func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { - f.lock.Lock() - defer f.lock.Unlock() - - for informerType, informer := range f.informers { - if !f.startedInformers[informerType] { - go informer.Run(stopCh) - f.startedInformers[informerType] = true - } - } -} - -// WaitForCacheSync waits for all started informers' cache were synced. -func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { - informers := func() map[reflect.Type]cache.SharedIndexInformer { - f.lock.Lock() - defer f.lock.Unlock() - - informers := map[reflect.Type]cache.SharedIndexInformer{} - for informerType, informer := range f.informers { - if f.startedInformers[informerType] { - informers[informerType] = informer - } - } - return informers - }() - - res := map[reflect.Type]bool{} - for informType, informer := range informers { - res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) - } - return res -} - -// InternalInformerFor returns the SharedIndexInformer for obj using an internal -// client. -func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { - f.lock.Lock() - defer f.lock.Unlock() - - informerType := reflect.TypeOf(obj) - informer, exists := f.informers[informerType] - if exists { - return informer - } - - resyncPeriod, exists := f.customResync[informerType] - if !exists { - resyncPeriod = f.defaultResync - } - - informer = newFunc(f.client, resyncPeriod) - f.informers[informerType] = informer - - return informer -} - -// SharedInformerFactory provides shared informers for resources in all known -// API group versions. -type SharedInformerFactory interface { - internalinterfaces.SharedInformerFactory - ForResource(resource schema.GroupVersionResource) (GenericInformer, error) - WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool - - Kubeovn() kubeovn.Interface -} - -func (f *sharedInformerFactory) Kubeovn() kubeovn.Interface { - return kubeovn.New(f, f.namespace, f.tweakListOptions) -} diff --git a/pkg/client/listers/informers/externalversions/generic.go b/pkg/client/listers/informers/externalversions/generic.go deleted file mode 100644 index 5a9cf825907..00000000000 --- a/pkg/client/listers/informers/externalversions/generic.go +++ /dev/null @@ -1,96 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package externalversions - -import ( - "fmt" - - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - schema "k8s.io/apimachinery/pkg/runtime/schema" - cache "k8s.io/client-go/tools/cache" -) - -// GenericInformer is type of SharedIndexInformer which will locate and delegate to other -// sharedInformers based on type -type GenericInformer interface { - Informer() cache.SharedIndexInformer - Lister() cache.GenericLister -} - -type genericInformer struct { - informer cache.SharedIndexInformer - resource schema.GroupResource -} - -// Informer returns the SharedIndexInformer. -func (f *genericInformer) Informer() cache.SharedIndexInformer { - return f.informer -} - -// Lister returns the GenericLister. -func (f *genericInformer) Lister() cache.GenericLister { - return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) -} - -// ForResource gives generic access to a shared informer of the matching type -// TODO extend this to unknown resources with a client pool -func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { - switch resource { - // Group=kubeovn.io, Version=v1 - case v1.SchemeGroupVersion.WithResource("htbqoses"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Kubeovn().V1().HtbQoses().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("ips"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Kubeovn().V1().IPs().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("iptables-dnat-rules"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Kubeovn().V1().IptablesDnatRules().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("iptables-eips"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Kubeovn().V1().IptablesEIPs().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("iptables-fip-rules"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Kubeovn().V1().IptablesFIPRules().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("iptables-snat-rules"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Kubeovn().V1().IptablesSnatRules().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("ovn-eips"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Kubeovn().V1().OvnEips().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("ovn-fips"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Kubeovn().V1().OvnFips().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("ovn-snat-rules"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Kubeovn().V1().OvnSnatRules().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("provider-networks"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Kubeovn().V1().ProviderNetworks().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("security-groups"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Kubeovn().V1().SecurityGroups().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("subnets"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Kubeovn().V1().Subnets().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("switch-lb-rules"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Kubeovn().V1().SwitchLBRules().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("vips"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Kubeovn().V1().Vips().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("vlans"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Kubeovn().V1().Vlans().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("vpcs"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Kubeovn().V1().Vpcs().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("vpc-dnses"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Kubeovn().V1().VpcDnses().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("vpc-nat-gateways"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Kubeovn().V1().VpcNatGateways().Informer()}, nil - - } - - return nil, fmt.Errorf("no informer found for %v", resource) -} diff --git a/pkg/client/listers/informers/externalversions/internalinterfaces/factory_interfaces.go b/pkg/client/listers/informers/externalversions/internalinterfaces/factory_interfaces.go deleted file mode 100644 index 801e5805f23..00000000000 --- a/pkg/client/listers/informers/externalversions/internalinterfaces/factory_interfaces.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package internalinterfaces - -import ( - time "time" - - versioned "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - cache "k8s.io/client-go/tools/cache" -) - -// NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer. -type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer - -// SharedInformerFactory a small interface to allow for adding an informer without an import cycle -type SharedInformerFactory interface { - Start(stopCh <-chan struct{}) - InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer -} - -// TweakListOptionsFunc is a function that transforms a v1.ListOptions. -type TweakListOptionsFunc func(*v1.ListOptions) diff --git a/pkg/client/listers/informers/externalversions/kubeovn/interface.go b/pkg/client/listers/informers/externalversions/kubeovn/interface.go deleted file mode 100644 index 4068b949381..00000000000 --- a/pkg/client/listers/informers/externalversions/kubeovn/interface.go +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package kubeovn - -import ( - internalinterfaces "github.com/kubeovn/kube-ovn/pkg/client/informers/externalversions/internalinterfaces" - v1 "github.com/kubeovn/kube-ovn/pkg/client/informers/externalversions/kubeovn/v1" -) - -// Interface provides access to each of this group's versions. -type Interface interface { - // V1 provides access to shared informers for resources in V1. - V1() v1.Interface -} - -type group struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// V1 returns a new v1.Interface. -func (g *group) V1() v1.Interface { - return v1.New(g.factory, g.namespace, g.tweakListOptions) -} diff --git a/pkg/client/listers/informers/externalversions/kubeovn/v1/htbqos.go b/pkg/client/listers/informers/externalversions/kubeovn/v1/htbqos.go deleted file mode 100644 index 3560b8f2aa9..00000000000 --- a/pkg/client/listers/informers/externalversions/kubeovn/v1/htbqos.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - versioned "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned" - internalinterfaces "github.com/kubeovn/kube-ovn/pkg/client/informers/externalversions/internalinterfaces" - v1 "github.com/kubeovn/kube-ovn/pkg/client/listers/kubeovn/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// HtbQosInformer provides access to a shared informer and lister for -// HtbQoses. -type HtbQosInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.HtbQosLister -} - -type htbQosInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewHtbQosInformer constructs a new informer for HtbQos type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewHtbQosInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredHtbQosInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredHtbQosInformer constructs a new informer for HtbQos type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredHtbQosInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().HtbQoses().List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().HtbQoses().Watch(context.TODO(), options) - }, - }, - &kubeovnv1.HtbQos{}, - resyncPeriod, - indexers, - ) -} - -func (f *htbQosInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredHtbQosInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *htbQosInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&kubeovnv1.HtbQos{}, f.defaultInformer) -} - -func (f *htbQosInformer) Lister() v1.HtbQosLister { - return v1.NewHtbQosLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/listers/informers/externalversions/kubeovn/v1/interface.go b/pkg/client/listers/informers/externalversions/kubeovn/v1/interface.go deleted file mode 100644 index 14af985943c..00000000000 --- a/pkg/client/listers/informers/externalversions/kubeovn/v1/interface.go +++ /dev/null @@ -1,164 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - internalinterfaces "github.com/kubeovn/kube-ovn/pkg/client/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // HtbQoses returns a HtbQosInformer. - HtbQoses() HtbQosInformer - // IPs returns a IPInformer. - IPs() IPInformer - // IptablesDnatRules returns a IptablesDnatRuleInformer. - IptablesDnatRules() IptablesDnatRuleInformer - // IptablesEIPs returns a IptablesEIPInformer. - IptablesEIPs() IptablesEIPInformer - // IptablesFIPRules returns a IptablesFIPRuleInformer. - IptablesFIPRules() IptablesFIPRuleInformer - // IptablesSnatRules returns a IptablesSnatRuleInformer. - IptablesSnatRules() IptablesSnatRuleInformer - // OvnEips returns a OvnEipInformer. - OvnEips() OvnEipInformer - // OvnFips returns a OvnFipInformer. - OvnFips() OvnFipInformer - // OvnSnatRules returns a OvnSnatRuleInformer. - OvnSnatRules() OvnSnatRuleInformer - // ProviderNetworks returns a ProviderNetworkInformer. - ProviderNetworks() ProviderNetworkInformer - // SecurityGroups returns a SecurityGroupInformer. - SecurityGroups() SecurityGroupInformer - // Subnets returns a SubnetInformer. - Subnets() SubnetInformer - // SwitchLBRules returns a SwitchLBRuleInformer. - SwitchLBRules() SwitchLBRuleInformer - // Vips returns a VipInformer. - Vips() VipInformer - // Vlans returns a VlanInformer. - Vlans() VlanInformer - // Vpcs returns a VpcInformer. - Vpcs() VpcInformer - // VpcDnses returns a VpcDnsInformer. - VpcDnses() VpcDnsInformer - // VpcNatGateways returns a VpcNatGatewayInformer. - VpcNatGateways() VpcNatGatewayInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// HtbQoses returns a HtbQosInformer. -func (v *version) HtbQoses() HtbQosInformer { - return &htbQosInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// IPs returns a IPInformer. -func (v *version) IPs() IPInformer { - return &iPInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// IptablesDnatRules returns a IptablesDnatRuleInformer. -func (v *version) IptablesDnatRules() IptablesDnatRuleInformer { - return &iptablesDnatRuleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// IptablesEIPs returns a IptablesEIPInformer. -func (v *version) IptablesEIPs() IptablesEIPInformer { - return &iptablesEIPInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// IptablesFIPRules returns a IptablesFIPRuleInformer. -func (v *version) IptablesFIPRules() IptablesFIPRuleInformer { - return &iptablesFIPRuleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// IptablesSnatRules returns a IptablesSnatRuleInformer. -func (v *version) IptablesSnatRules() IptablesSnatRuleInformer { - return &iptablesSnatRuleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// OvnEips returns a OvnEipInformer. -func (v *version) OvnEips() OvnEipInformer { - return &ovnEipInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// OvnFips returns a OvnFipInformer. -func (v *version) OvnFips() OvnFipInformer { - return &ovnFipInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// OvnSnatRules returns a OvnSnatRuleInformer. -func (v *version) OvnSnatRules() OvnSnatRuleInformer { - return &ovnSnatRuleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// ProviderNetworks returns a ProviderNetworkInformer. -func (v *version) ProviderNetworks() ProviderNetworkInformer { - return &providerNetworkInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// SecurityGroups returns a SecurityGroupInformer. -func (v *version) SecurityGroups() SecurityGroupInformer { - return &securityGroupInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// Subnets returns a SubnetInformer. -func (v *version) Subnets() SubnetInformer { - return &subnetInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// SwitchLBRules returns a SwitchLBRuleInformer. -func (v *version) SwitchLBRules() SwitchLBRuleInformer { - return &switchLBRuleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// Vips returns a VipInformer. -func (v *version) Vips() VipInformer { - return &vipInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// Vlans returns a VlanInformer. -func (v *version) Vlans() VlanInformer { - return &vlanInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// Vpcs returns a VpcInformer. -func (v *version) Vpcs() VpcInformer { - return &vpcInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// VpcDnses returns a VpcDnsInformer. -func (v *version) VpcDnses() VpcDnsInformer { - return &vpcDnsInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - -// VpcNatGateways returns a VpcNatGatewayInformer. -func (v *version) VpcNatGateways() VpcNatGatewayInformer { - return &vpcNatGatewayInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} diff --git a/pkg/client/listers/informers/externalversions/kubeovn/v1/ip.go b/pkg/client/listers/informers/externalversions/kubeovn/v1/ip.go deleted file mode 100644 index 37743e1390e..00000000000 --- a/pkg/client/listers/informers/externalversions/kubeovn/v1/ip.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - versioned "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned" - internalinterfaces "github.com/kubeovn/kube-ovn/pkg/client/informers/externalversions/internalinterfaces" - v1 "github.com/kubeovn/kube-ovn/pkg/client/listers/kubeovn/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// IPInformer provides access to a shared informer and lister for -// IPs. -type IPInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.IPLister -} - -type iPInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewIPInformer constructs a new informer for IP type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewIPInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredIPInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredIPInformer constructs a new informer for IP type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredIPInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().IPs().List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().IPs().Watch(context.TODO(), options) - }, - }, - &kubeovnv1.IP{}, - resyncPeriod, - indexers, - ) -} - -func (f *iPInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredIPInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *iPInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&kubeovnv1.IP{}, f.defaultInformer) -} - -func (f *iPInformer) Lister() v1.IPLister { - return v1.NewIPLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/listers/informers/externalversions/kubeovn/v1/iptablesdnatrule.go b/pkg/client/listers/informers/externalversions/kubeovn/v1/iptablesdnatrule.go deleted file mode 100644 index 48bdd4e5851..00000000000 --- a/pkg/client/listers/informers/externalversions/kubeovn/v1/iptablesdnatrule.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - versioned "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned" - internalinterfaces "github.com/kubeovn/kube-ovn/pkg/client/informers/externalversions/internalinterfaces" - v1 "github.com/kubeovn/kube-ovn/pkg/client/listers/kubeovn/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// IptablesDnatRuleInformer provides access to a shared informer and lister for -// IptablesDnatRules. -type IptablesDnatRuleInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.IptablesDnatRuleLister -} - -type iptablesDnatRuleInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewIptablesDnatRuleInformer constructs a new informer for IptablesDnatRule type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewIptablesDnatRuleInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredIptablesDnatRuleInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredIptablesDnatRuleInformer constructs a new informer for IptablesDnatRule type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredIptablesDnatRuleInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().IptablesDnatRules().List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().IptablesDnatRules().Watch(context.TODO(), options) - }, - }, - &kubeovnv1.IptablesDnatRule{}, - resyncPeriod, - indexers, - ) -} - -func (f *iptablesDnatRuleInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredIptablesDnatRuleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *iptablesDnatRuleInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&kubeovnv1.IptablesDnatRule{}, f.defaultInformer) -} - -func (f *iptablesDnatRuleInformer) Lister() v1.IptablesDnatRuleLister { - return v1.NewIptablesDnatRuleLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/listers/informers/externalversions/kubeovn/v1/iptableseip.go b/pkg/client/listers/informers/externalversions/kubeovn/v1/iptableseip.go deleted file mode 100644 index a624ddee327..00000000000 --- a/pkg/client/listers/informers/externalversions/kubeovn/v1/iptableseip.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - versioned "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned" - internalinterfaces "github.com/kubeovn/kube-ovn/pkg/client/informers/externalversions/internalinterfaces" - v1 "github.com/kubeovn/kube-ovn/pkg/client/listers/kubeovn/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// IptablesEIPInformer provides access to a shared informer and lister for -// IptablesEIPs. -type IptablesEIPInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.IptablesEIPLister -} - -type iptablesEIPInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewIptablesEIPInformer constructs a new informer for IptablesEIP type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewIptablesEIPInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredIptablesEIPInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredIptablesEIPInformer constructs a new informer for IptablesEIP type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredIptablesEIPInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().IptablesEIPs().List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().IptablesEIPs().Watch(context.TODO(), options) - }, - }, - &kubeovnv1.IptablesEIP{}, - resyncPeriod, - indexers, - ) -} - -func (f *iptablesEIPInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredIptablesEIPInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *iptablesEIPInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&kubeovnv1.IptablesEIP{}, f.defaultInformer) -} - -func (f *iptablesEIPInformer) Lister() v1.IptablesEIPLister { - return v1.NewIptablesEIPLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/listers/informers/externalversions/kubeovn/v1/iptablesfiprule.go b/pkg/client/listers/informers/externalversions/kubeovn/v1/iptablesfiprule.go deleted file mode 100644 index 44a547fb274..00000000000 --- a/pkg/client/listers/informers/externalversions/kubeovn/v1/iptablesfiprule.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - versioned "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned" - internalinterfaces "github.com/kubeovn/kube-ovn/pkg/client/informers/externalversions/internalinterfaces" - v1 "github.com/kubeovn/kube-ovn/pkg/client/listers/kubeovn/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// IptablesFIPRuleInformer provides access to a shared informer and lister for -// IptablesFIPRules. -type IptablesFIPRuleInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.IptablesFIPRuleLister -} - -type iptablesFIPRuleInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewIptablesFIPRuleInformer constructs a new informer for IptablesFIPRule type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewIptablesFIPRuleInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredIptablesFIPRuleInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredIptablesFIPRuleInformer constructs a new informer for IptablesFIPRule type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredIptablesFIPRuleInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().IptablesFIPRules().List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().IptablesFIPRules().Watch(context.TODO(), options) - }, - }, - &kubeovnv1.IptablesFIPRule{}, - resyncPeriod, - indexers, - ) -} - -func (f *iptablesFIPRuleInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredIptablesFIPRuleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *iptablesFIPRuleInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&kubeovnv1.IptablesFIPRule{}, f.defaultInformer) -} - -func (f *iptablesFIPRuleInformer) Lister() v1.IptablesFIPRuleLister { - return v1.NewIptablesFIPRuleLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/listers/informers/externalversions/kubeovn/v1/iptablessnatrule.go b/pkg/client/listers/informers/externalversions/kubeovn/v1/iptablessnatrule.go deleted file mode 100644 index 8ae4adb8b7d..00000000000 --- a/pkg/client/listers/informers/externalversions/kubeovn/v1/iptablessnatrule.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - versioned "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned" - internalinterfaces "github.com/kubeovn/kube-ovn/pkg/client/informers/externalversions/internalinterfaces" - v1 "github.com/kubeovn/kube-ovn/pkg/client/listers/kubeovn/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// IptablesSnatRuleInformer provides access to a shared informer and lister for -// IptablesSnatRules. -type IptablesSnatRuleInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.IptablesSnatRuleLister -} - -type iptablesSnatRuleInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewIptablesSnatRuleInformer constructs a new informer for IptablesSnatRule type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewIptablesSnatRuleInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredIptablesSnatRuleInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredIptablesSnatRuleInformer constructs a new informer for IptablesSnatRule type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredIptablesSnatRuleInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().IptablesSnatRules().List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().IptablesSnatRules().Watch(context.TODO(), options) - }, - }, - &kubeovnv1.IptablesSnatRule{}, - resyncPeriod, - indexers, - ) -} - -func (f *iptablesSnatRuleInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredIptablesSnatRuleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *iptablesSnatRuleInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&kubeovnv1.IptablesSnatRule{}, f.defaultInformer) -} - -func (f *iptablesSnatRuleInformer) Lister() v1.IptablesSnatRuleLister { - return v1.NewIptablesSnatRuleLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/listers/informers/externalversions/kubeovn/v1/ovneip.go b/pkg/client/listers/informers/externalversions/kubeovn/v1/ovneip.go deleted file mode 100644 index 89d5353e2de..00000000000 --- a/pkg/client/listers/informers/externalversions/kubeovn/v1/ovneip.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - versioned "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned" - internalinterfaces "github.com/kubeovn/kube-ovn/pkg/client/informers/externalversions/internalinterfaces" - v1 "github.com/kubeovn/kube-ovn/pkg/client/listers/kubeovn/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// OvnEipInformer provides access to a shared informer and lister for -// OvnEips. -type OvnEipInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.OvnEipLister -} - -type ovnEipInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewOvnEipInformer constructs a new informer for OvnEip type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewOvnEipInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredOvnEipInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredOvnEipInformer constructs a new informer for OvnEip type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredOvnEipInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().OvnEips().List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().OvnEips().Watch(context.TODO(), options) - }, - }, - &kubeovnv1.OvnEip{}, - resyncPeriod, - indexers, - ) -} - -func (f *ovnEipInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredOvnEipInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *ovnEipInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&kubeovnv1.OvnEip{}, f.defaultInformer) -} - -func (f *ovnEipInformer) Lister() v1.OvnEipLister { - return v1.NewOvnEipLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/listers/informers/externalversions/kubeovn/v1/ovnfip.go b/pkg/client/listers/informers/externalversions/kubeovn/v1/ovnfip.go deleted file mode 100644 index 8d582d92862..00000000000 --- a/pkg/client/listers/informers/externalversions/kubeovn/v1/ovnfip.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - versioned "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned" - internalinterfaces "github.com/kubeovn/kube-ovn/pkg/client/informers/externalversions/internalinterfaces" - v1 "github.com/kubeovn/kube-ovn/pkg/client/listers/kubeovn/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// OvnFipInformer provides access to a shared informer and lister for -// OvnFips. -type OvnFipInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.OvnFipLister -} - -type ovnFipInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewOvnFipInformer constructs a new informer for OvnFip type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewOvnFipInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredOvnFipInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredOvnFipInformer constructs a new informer for OvnFip type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredOvnFipInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().OvnFips().List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().OvnFips().Watch(context.TODO(), options) - }, - }, - &kubeovnv1.OvnFip{}, - resyncPeriod, - indexers, - ) -} - -func (f *ovnFipInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredOvnFipInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *ovnFipInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&kubeovnv1.OvnFip{}, f.defaultInformer) -} - -func (f *ovnFipInformer) Lister() v1.OvnFipLister { - return v1.NewOvnFipLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/listers/informers/externalversions/kubeovn/v1/ovnsnatrule.go b/pkg/client/listers/informers/externalversions/kubeovn/v1/ovnsnatrule.go deleted file mode 100644 index 676db376b8c..00000000000 --- a/pkg/client/listers/informers/externalversions/kubeovn/v1/ovnsnatrule.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - versioned "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned" - internalinterfaces "github.com/kubeovn/kube-ovn/pkg/client/informers/externalversions/internalinterfaces" - v1 "github.com/kubeovn/kube-ovn/pkg/client/listers/kubeovn/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// OvnSnatRuleInformer provides access to a shared informer and lister for -// OvnSnatRules. -type OvnSnatRuleInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.OvnSnatRuleLister -} - -type ovnSnatRuleInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewOvnSnatRuleInformer constructs a new informer for OvnSnatRule type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewOvnSnatRuleInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredOvnSnatRuleInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredOvnSnatRuleInformer constructs a new informer for OvnSnatRule type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredOvnSnatRuleInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().OvnSnatRules().List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().OvnSnatRules().Watch(context.TODO(), options) - }, - }, - &kubeovnv1.OvnSnatRule{}, - resyncPeriod, - indexers, - ) -} - -func (f *ovnSnatRuleInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredOvnSnatRuleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *ovnSnatRuleInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&kubeovnv1.OvnSnatRule{}, f.defaultInformer) -} - -func (f *ovnSnatRuleInformer) Lister() v1.OvnSnatRuleLister { - return v1.NewOvnSnatRuleLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/listers/informers/externalversions/kubeovn/v1/providernetwork.go b/pkg/client/listers/informers/externalversions/kubeovn/v1/providernetwork.go deleted file mode 100644 index 2a6d8bfdcd5..00000000000 --- a/pkg/client/listers/informers/externalversions/kubeovn/v1/providernetwork.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - versioned "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned" - internalinterfaces "github.com/kubeovn/kube-ovn/pkg/client/informers/externalversions/internalinterfaces" - v1 "github.com/kubeovn/kube-ovn/pkg/client/listers/kubeovn/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// ProviderNetworkInformer provides access to a shared informer and lister for -// ProviderNetworks. -type ProviderNetworkInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.ProviderNetworkLister -} - -type providerNetworkInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewProviderNetworkInformer constructs a new informer for ProviderNetwork type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewProviderNetworkInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredProviderNetworkInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredProviderNetworkInformer constructs a new informer for ProviderNetwork type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredProviderNetworkInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().ProviderNetworks().List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().ProviderNetworks().Watch(context.TODO(), options) - }, - }, - &kubeovnv1.ProviderNetwork{}, - resyncPeriod, - indexers, - ) -} - -func (f *providerNetworkInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredProviderNetworkInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *providerNetworkInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&kubeovnv1.ProviderNetwork{}, f.defaultInformer) -} - -func (f *providerNetworkInformer) Lister() v1.ProviderNetworkLister { - return v1.NewProviderNetworkLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/listers/informers/externalversions/kubeovn/v1/securitygroup.go b/pkg/client/listers/informers/externalversions/kubeovn/v1/securitygroup.go deleted file mode 100644 index fc108011aa5..00000000000 --- a/pkg/client/listers/informers/externalversions/kubeovn/v1/securitygroup.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - versioned "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned" - internalinterfaces "github.com/kubeovn/kube-ovn/pkg/client/informers/externalversions/internalinterfaces" - v1 "github.com/kubeovn/kube-ovn/pkg/client/listers/kubeovn/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// SecurityGroupInformer provides access to a shared informer and lister for -// SecurityGroups. -type SecurityGroupInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.SecurityGroupLister -} - -type securityGroupInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewSecurityGroupInformer constructs a new informer for SecurityGroup type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewSecurityGroupInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredSecurityGroupInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredSecurityGroupInformer constructs a new informer for SecurityGroup type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredSecurityGroupInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().SecurityGroups().List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().SecurityGroups().Watch(context.TODO(), options) - }, - }, - &kubeovnv1.SecurityGroup{}, - resyncPeriod, - indexers, - ) -} - -func (f *securityGroupInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredSecurityGroupInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *securityGroupInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&kubeovnv1.SecurityGroup{}, f.defaultInformer) -} - -func (f *securityGroupInformer) Lister() v1.SecurityGroupLister { - return v1.NewSecurityGroupLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/listers/informers/externalversions/kubeovn/v1/subnet.go b/pkg/client/listers/informers/externalversions/kubeovn/v1/subnet.go deleted file mode 100644 index 8a185ef0d55..00000000000 --- a/pkg/client/listers/informers/externalversions/kubeovn/v1/subnet.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - versioned "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned" - internalinterfaces "github.com/kubeovn/kube-ovn/pkg/client/informers/externalversions/internalinterfaces" - v1 "github.com/kubeovn/kube-ovn/pkg/client/listers/kubeovn/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// SubnetInformer provides access to a shared informer and lister for -// Subnets. -type SubnetInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.SubnetLister -} - -type subnetInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewSubnetInformer constructs a new informer for Subnet type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewSubnetInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredSubnetInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredSubnetInformer constructs a new informer for Subnet type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredSubnetInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().Subnets().List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().Subnets().Watch(context.TODO(), options) - }, - }, - &kubeovnv1.Subnet{}, - resyncPeriod, - indexers, - ) -} - -func (f *subnetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredSubnetInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *subnetInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&kubeovnv1.Subnet{}, f.defaultInformer) -} - -func (f *subnetInformer) Lister() v1.SubnetLister { - return v1.NewSubnetLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/listers/informers/externalversions/kubeovn/v1/switchlbrule.go b/pkg/client/listers/informers/externalversions/kubeovn/v1/switchlbrule.go deleted file mode 100644 index 5f2794bb246..00000000000 --- a/pkg/client/listers/informers/externalversions/kubeovn/v1/switchlbrule.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - versioned "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned" - internalinterfaces "github.com/kubeovn/kube-ovn/pkg/client/informers/externalversions/internalinterfaces" - v1 "github.com/kubeovn/kube-ovn/pkg/client/listers/kubeovn/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// SwitchLBRuleInformer provides access to a shared informer and lister for -// SwitchLBRules. -type SwitchLBRuleInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.SwitchLBRuleLister -} - -type switchLBRuleInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewSwitchLBRuleInformer constructs a new informer for SwitchLBRule type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewSwitchLBRuleInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredSwitchLBRuleInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredSwitchLBRuleInformer constructs a new informer for SwitchLBRule type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredSwitchLBRuleInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().SwitchLBRules().List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().SwitchLBRules().Watch(context.TODO(), options) - }, - }, - &kubeovnv1.SwitchLBRule{}, - resyncPeriod, - indexers, - ) -} - -func (f *switchLBRuleInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredSwitchLBRuleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *switchLBRuleInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&kubeovnv1.SwitchLBRule{}, f.defaultInformer) -} - -func (f *switchLBRuleInformer) Lister() v1.SwitchLBRuleLister { - return v1.NewSwitchLBRuleLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/listers/informers/externalversions/kubeovn/v1/vip.go b/pkg/client/listers/informers/externalversions/kubeovn/v1/vip.go deleted file mode 100644 index 30932f68f31..00000000000 --- a/pkg/client/listers/informers/externalversions/kubeovn/v1/vip.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - versioned "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned" - internalinterfaces "github.com/kubeovn/kube-ovn/pkg/client/informers/externalversions/internalinterfaces" - v1 "github.com/kubeovn/kube-ovn/pkg/client/listers/kubeovn/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// VipInformer provides access to a shared informer and lister for -// Vips. -type VipInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.VipLister -} - -type vipInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewVipInformer constructs a new informer for Vip type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewVipInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVipInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredVipInformer constructs a new informer for Vip type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredVipInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().Vips().List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().Vips().Watch(context.TODO(), options) - }, - }, - &kubeovnv1.Vip{}, - resyncPeriod, - indexers, - ) -} - -func (f *vipInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVipInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *vipInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&kubeovnv1.Vip{}, f.defaultInformer) -} - -func (f *vipInformer) Lister() v1.VipLister { - return v1.NewVipLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/listers/informers/externalversions/kubeovn/v1/vlan.go b/pkg/client/listers/informers/externalversions/kubeovn/v1/vlan.go deleted file mode 100644 index 498bfa28f88..00000000000 --- a/pkg/client/listers/informers/externalversions/kubeovn/v1/vlan.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - versioned "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned" - internalinterfaces "github.com/kubeovn/kube-ovn/pkg/client/informers/externalversions/internalinterfaces" - v1 "github.com/kubeovn/kube-ovn/pkg/client/listers/kubeovn/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// VlanInformer provides access to a shared informer and lister for -// Vlans. -type VlanInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.VlanLister -} - -type vlanInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewVlanInformer constructs a new informer for Vlan type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewVlanInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVlanInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredVlanInformer constructs a new informer for Vlan type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredVlanInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().Vlans().List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().Vlans().Watch(context.TODO(), options) - }, - }, - &kubeovnv1.Vlan{}, - resyncPeriod, - indexers, - ) -} - -func (f *vlanInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVlanInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *vlanInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&kubeovnv1.Vlan{}, f.defaultInformer) -} - -func (f *vlanInformer) Lister() v1.VlanLister { - return v1.NewVlanLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/listers/informers/externalversions/kubeovn/v1/vpc.go b/pkg/client/listers/informers/externalversions/kubeovn/v1/vpc.go deleted file mode 100644 index 029578d4e7c..00000000000 --- a/pkg/client/listers/informers/externalversions/kubeovn/v1/vpc.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - versioned "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned" - internalinterfaces "github.com/kubeovn/kube-ovn/pkg/client/informers/externalversions/internalinterfaces" - v1 "github.com/kubeovn/kube-ovn/pkg/client/listers/kubeovn/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// VpcInformer provides access to a shared informer and lister for -// Vpcs. -type VpcInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.VpcLister -} - -type vpcInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewVpcInformer constructs a new informer for Vpc type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewVpcInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVpcInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredVpcInformer constructs a new informer for Vpc type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredVpcInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().Vpcs().List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().Vpcs().Watch(context.TODO(), options) - }, - }, - &kubeovnv1.Vpc{}, - resyncPeriod, - indexers, - ) -} - -func (f *vpcInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVpcInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *vpcInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&kubeovnv1.Vpc{}, f.defaultInformer) -} - -func (f *vpcInformer) Lister() v1.VpcLister { - return v1.NewVpcLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/listers/informers/externalversions/kubeovn/v1/vpcdns.go b/pkg/client/listers/informers/externalversions/kubeovn/v1/vpcdns.go deleted file mode 100644 index 57ec5af21e5..00000000000 --- a/pkg/client/listers/informers/externalversions/kubeovn/v1/vpcdns.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - versioned "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned" - internalinterfaces "github.com/kubeovn/kube-ovn/pkg/client/informers/externalversions/internalinterfaces" - v1 "github.com/kubeovn/kube-ovn/pkg/client/listers/kubeovn/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// VpcDnsInformer provides access to a shared informer and lister for -// VpcDnses. -type VpcDnsInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.VpcDnsLister -} - -type vpcDnsInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewVpcDnsInformer constructs a new informer for VpcDns type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewVpcDnsInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVpcDnsInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredVpcDnsInformer constructs a new informer for VpcDns type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredVpcDnsInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().VpcDnses().List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().VpcDnses().Watch(context.TODO(), options) - }, - }, - &kubeovnv1.VpcDns{}, - resyncPeriod, - indexers, - ) -} - -func (f *vpcDnsInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVpcDnsInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *vpcDnsInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&kubeovnv1.VpcDns{}, f.defaultInformer) -} - -func (f *vpcDnsInformer) Lister() v1.VpcDnsLister { - return v1.NewVpcDnsLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/listers/informers/externalversions/kubeovn/v1/vpcnatgateway.go b/pkg/client/listers/informers/externalversions/kubeovn/v1/vpcnatgateway.go deleted file mode 100644 index 2c9a1639c15..00000000000 --- a/pkg/client/listers/informers/externalversions/kubeovn/v1/vpcnatgateway.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - versioned "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned" - internalinterfaces "github.com/kubeovn/kube-ovn/pkg/client/informers/externalversions/internalinterfaces" - v1 "github.com/kubeovn/kube-ovn/pkg/client/listers/kubeovn/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// VpcNatGatewayInformer provides access to a shared informer and lister for -// VpcNatGateways. -type VpcNatGatewayInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.VpcNatGatewayLister -} - -type vpcNatGatewayInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewVpcNatGatewayInformer constructs a new informer for VpcNatGateway type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewVpcNatGatewayInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVpcNatGatewayInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredVpcNatGatewayInformer constructs a new informer for VpcNatGateway type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredVpcNatGatewayInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().VpcNatGateways().List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().VpcNatGateways().Watch(context.TODO(), options) - }, - }, - &kubeovnv1.VpcNatGateway{}, - resyncPeriod, - indexers, - ) -} - -func (f *vpcNatGatewayInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVpcNatGatewayInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *vpcNatGatewayInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&kubeovnv1.VpcNatGateway{}, f.defaultInformer) -} - -func (f *vpcNatGatewayInformer) Lister() v1.VpcNatGatewayLister { - return v1.NewVpcNatGatewayLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/listers/listers/kubeovn/v1/expansion_generated.go b/pkg/client/listers/listers/kubeovn/v1/expansion_generated.go deleted file mode 100644 index 2926ee5143d..00000000000 --- a/pkg/client/listers/listers/kubeovn/v1/expansion_generated.go +++ /dev/null @@ -1,91 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -// HtbQosListerExpansion allows custom methods to be added to -// HtbQosLister. -type HtbQosListerExpansion interface{} - -// IPListerExpansion allows custom methods to be added to -// IPLister. -type IPListerExpansion interface{} - -// IptablesDnatRuleListerExpansion allows custom methods to be added to -// IptablesDnatRuleLister. -type IptablesDnatRuleListerExpansion interface{} - -// IptablesEIPListerExpansion allows custom methods to be added to -// IptablesEIPLister. -type IptablesEIPListerExpansion interface{} - -// IptablesFIPRuleListerExpansion allows custom methods to be added to -// IptablesFIPRuleLister. -type IptablesFIPRuleListerExpansion interface{} - -// IptablesSnatRuleListerExpansion allows custom methods to be added to -// IptablesSnatRuleLister. -type IptablesSnatRuleListerExpansion interface{} - -// OvnEipListerExpansion allows custom methods to be added to -// OvnEipLister. -type OvnEipListerExpansion interface{} - -// OvnFipListerExpansion allows custom methods to be added to -// OvnFipLister. -type OvnFipListerExpansion interface{} - -// OvnSnatRuleListerExpansion allows custom methods to be added to -// OvnSnatRuleLister. -type OvnSnatRuleListerExpansion interface{} - -// ProviderNetworkListerExpansion allows custom methods to be added to -// ProviderNetworkLister. -type ProviderNetworkListerExpansion interface{} - -// SecurityGroupListerExpansion allows custom methods to be added to -// SecurityGroupLister. -type SecurityGroupListerExpansion interface{} - -// SubnetListerExpansion allows custom methods to be added to -// SubnetLister. -type SubnetListerExpansion interface{} - -// SwitchLBRuleListerExpansion allows custom methods to be added to -// SwitchLBRuleLister. -type SwitchLBRuleListerExpansion interface{} - -// VipListerExpansion allows custom methods to be added to -// VipLister. -type VipListerExpansion interface{} - -// VlanListerExpansion allows custom methods to be added to -// VlanLister. -type VlanListerExpansion interface{} - -// VpcListerExpansion allows custom methods to be added to -// VpcLister. -type VpcListerExpansion interface{} - -// VpcDnsListerExpansion allows custom methods to be added to -// VpcDnsLister. -type VpcDnsListerExpansion interface{} - -// VpcNatGatewayListerExpansion allows custom methods to be added to -// VpcNatGatewayLister. -type VpcNatGatewayListerExpansion interface{} diff --git a/pkg/client/listers/listers/kubeovn/v1/htbqos.go b/pkg/client/listers/listers/kubeovn/v1/htbqos.go deleted file mode 100644 index c907b54cefc..00000000000 --- a/pkg/client/listers/listers/kubeovn/v1/htbqos.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// HtbQosLister helps list HtbQoses. -type HtbQosLister interface { - // List lists all HtbQoses in the indexer. - List(selector labels.Selector) (ret []*v1.HtbQos, err error) - // Get retrieves the HtbQos from the index for a given name. - Get(name string) (*v1.HtbQos, error) - HtbQosListerExpansion -} - -// htbQosLister implements the HtbQosLister interface. -type htbQosLister struct { - indexer cache.Indexer -} - -// NewHtbQosLister returns a new HtbQosLister. -func NewHtbQosLister(indexer cache.Indexer) HtbQosLister { - return &htbQosLister{indexer: indexer} -} - -// List lists all HtbQoses in the indexer. -func (s *htbQosLister) List(selector labels.Selector) (ret []*v1.HtbQos, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.HtbQos)) - }) - return ret, err -} - -// Get retrieves the HtbQos from the index for a given name. -func (s *htbQosLister) Get(name string) (*v1.HtbQos, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("htbqos"), name) - } - return obj.(*v1.HtbQos), nil -} diff --git a/pkg/client/listers/listers/kubeovn/v1/ip.go b/pkg/client/listers/listers/kubeovn/v1/ip.go deleted file mode 100644 index 84a45174b67..00000000000 --- a/pkg/client/listers/listers/kubeovn/v1/ip.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// IPLister helps list IPs. -type IPLister interface { - // List lists all IPs in the indexer. - List(selector labels.Selector) (ret []*v1.IP, err error) - // Get retrieves the IP from the index for a given name. - Get(name string) (*v1.IP, error) - IPListerExpansion -} - -// iPLister implements the IPLister interface. -type iPLister struct { - indexer cache.Indexer -} - -// NewIPLister returns a new IPLister. -func NewIPLister(indexer cache.Indexer) IPLister { - return &iPLister{indexer: indexer} -} - -// List lists all IPs in the indexer. -func (s *iPLister) List(selector labels.Selector) (ret []*v1.IP, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.IP)) - }) - return ret, err -} - -// Get retrieves the IP from the index for a given name. -func (s *iPLister) Get(name string) (*v1.IP, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("ip"), name) - } - return obj.(*v1.IP), nil -} diff --git a/pkg/client/listers/listers/kubeovn/v1/iptablesdnatrule.go b/pkg/client/listers/listers/kubeovn/v1/iptablesdnatrule.go deleted file mode 100644 index bb0ebe4a7d6..00000000000 --- a/pkg/client/listers/listers/kubeovn/v1/iptablesdnatrule.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// IptablesDnatRuleLister helps list IptablesDnatRules. -type IptablesDnatRuleLister interface { - // List lists all IptablesDnatRules in the indexer. - List(selector labels.Selector) (ret []*v1.IptablesDnatRule, err error) - // Get retrieves the IptablesDnatRule from the index for a given name. - Get(name string) (*v1.IptablesDnatRule, error) - IptablesDnatRuleListerExpansion -} - -// iptablesDnatRuleLister implements the IptablesDnatRuleLister interface. -type iptablesDnatRuleLister struct { - indexer cache.Indexer -} - -// NewIptablesDnatRuleLister returns a new IptablesDnatRuleLister. -func NewIptablesDnatRuleLister(indexer cache.Indexer) IptablesDnatRuleLister { - return &iptablesDnatRuleLister{indexer: indexer} -} - -// List lists all IptablesDnatRules in the indexer. -func (s *iptablesDnatRuleLister) List(selector labels.Selector) (ret []*v1.IptablesDnatRule, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.IptablesDnatRule)) - }) - return ret, err -} - -// Get retrieves the IptablesDnatRule from the index for a given name. -func (s *iptablesDnatRuleLister) Get(name string) (*v1.IptablesDnatRule, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("iptablesdnatrule"), name) - } - return obj.(*v1.IptablesDnatRule), nil -} diff --git a/pkg/client/listers/listers/kubeovn/v1/iptableseip.go b/pkg/client/listers/listers/kubeovn/v1/iptableseip.go deleted file mode 100644 index 9574d92cebd..00000000000 --- a/pkg/client/listers/listers/kubeovn/v1/iptableseip.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// IptablesEIPLister helps list IptablesEIPs. -type IptablesEIPLister interface { - // List lists all IptablesEIPs in the indexer. - List(selector labels.Selector) (ret []*v1.IptablesEIP, err error) - // Get retrieves the IptablesEIP from the index for a given name. - Get(name string) (*v1.IptablesEIP, error) - IptablesEIPListerExpansion -} - -// iptablesEIPLister implements the IptablesEIPLister interface. -type iptablesEIPLister struct { - indexer cache.Indexer -} - -// NewIptablesEIPLister returns a new IptablesEIPLister. -func NewIptablesEIPLister(indexer cache.Indexer) IptablesEIPLister { - return &iptablesEIPLister{indexer: indexer} -} - -// List lists all IptablesEIPs in the indexer. -func (s *iptablesEIPLister) List(selector labels.Selector) (ret []*v1.IptablesEIP, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.IptablesEIP)) - }) - return ret, err -} - -// Get retrieves the IptablesEIP from the index for a given name. -func (s *iptablesEIPLister) Get(name string) (*v1.IptablesEIP, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("iptableseip"), name) - } - return obj.(*v1.IptablesEIP), nil -} diff --git a/pkg/client/listers/listers/kubeovn/v1/iptablesfiprule.go b/pkg/client/listers/listers/kubeovn/v1/iptablesfiprule.go deleted file mode 100644 index 056b71eca35..00000000000 --- a/pkg/client/listers/listers/kubeovn/v1/iptablesfiprule.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// IptablesFIPRuleLister helps list IptablesFIPRules. -type IptablesFIPRuleLister interface { - // List lists all IptablesFIPRules in the indexer. - List(selector labels.Selector) (ret []*v1.IptablesFIPRule, err error) - // Get retrieves the IptablesFIPRule from the index for a given name. - Get(name string) (*v1.IptablesFIPRule, error) - IptablesFIPRuleListerExpansion -} - -// iptablesFIPRuleLister implements the IptablesFIPRuleLister interface. -type iptablesFIPRuleLister struct { - indexer cache.Indexer -} - -// NewIptablesFIPRuleLister returns a new IptablesFIPRuleLister. -func NewIptablesFIPRuleLister(indexer cache.Indexer) IptablesFIPRuleLister { - return &iptablesFIPRuleLister{indexer: indexer} -} - -// List lists all IptablesFIPRules in the indexer. -func (s *iptablesFIPRuleLister) List(selector labels.Selector) (ret []*v1.IptablesFIPRule, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.IptablesFIPRule)) - }) - return ret, err -} - -// Get retrieves the IptablesFIPRule from the index for a given name. -func (s *iptablesFIPRuleLister) Get(name string) (*v1.IptablesFIPRule, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("iptablesfiprule"), name) - } - return obj.(*v1.IptablesFIPRule), nil -} diff --git a/pkg/client/listers/listers/kubeovn/v1/iptablessnatrule.go b/pkg/client/listers/listers/kubeovn/v1/iptablessnatrule.go deleted file mode 100644 index 7e5524a35fc..00000000000 --- a/pkg/client/listers/listers/kubeovn/v1/iptablessnatrule.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// IptablesSnatRuleLister helps list IptablesSnatRules. -type IptablesSnatRuleLister interface { - // List lists all IptablesSnatRules in the indexer. - List(selector labels.Selector) (ret []*v1.IptablesSnatRule, err error) - // Get retrieves the IptablesSnatRule from the index for a given name. - Get(name string) (*v1.IptablesSnatRule, error) - IptablesSnatRuleListerExpansion -} - -// iptablesSnatRuleLister implements the IptablesSnatRuleLister interface. -type iptablesSnatRuleLister struct { - indexer cache.Indexer -} - -// NewIptablesSnatRuleLister returns a new IptablesSnatRuleLister. -func NewIptablesSnatRuleLister(indexer cache.Indexer) IptablesSnatRuleLister { - return &iptablesSnatRuleLister{indexer: indexer} -} - -// List lists all IptablesSnatRules in the indexer. -func (s *iptablesSnatRuleLister) List(selector labels.Selector) (ret []*v1.IptablesSnatRule, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.IptablesSnatRule)) - }) - return ret, err -} - -// Get retrieves the IptablesSnatRule from the index for a given name. -func (s *iptablesSnatRuleLister) Get(name string) (*v1.IptablesSnatRule, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("iptablessnatrule"), name) - } - return obj.(*v1.IptablesSnatRule), nil -} diff --git a/pkg/client/listers/listers/kubeovn/v1/ovneip.go b/pkg/client/listers/listers/kubeovn/v1/ovneip.go deleted file mode 100644 index 6983c0f010a..00000000000 --- a/pkg/client/listers/listers/kubeovn/v1/ovneip.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// OvnEipLister helps list OvnEips. -type OvnEipLister interface { - // List lists all OvnEips in the indexer. - List(selector labels.Selector) (ret []*v1.OvnEip, err error) - // Get retrieves the OvnEip from the index for a given name. - Get(name string) (*v1.OvnEip, error) - OvnEipListerExpansion -} - -// ovnEipLister implements the OvnEipLister interface. -type ovnEipLister struct { - indexer cache.Indexer -} - -// NewOvnEipLister returns a new OvnEipLister. -func NewOvnEipLister(indexer cache.Indexer) OvnEipLister { - return &ovnEipLister{indexer: indexer} -} - -// List lists all OvnEips in the indexer. -func (s *ovnEipLister) List(selector labels.Selector) (ret []*v1.OvnEip, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.OvnEip)) - }) - return ret, err -} - -// Get retrieves the OvnEip from the index for a given name. -func (s *ovnEipLister) Get(name string) (*v1.OvnEip, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("ovneip"), name) - } - return obj.(*v1.OvnEip), nil -} diff --git a/pkg/client/listers/listers/kubeovn/v1/ovnfip.go b/pkg/client/listers/listers/kubeovn/v1/ovnfip.go deleted file mode 100644 index fdd3fe0aa4f..00000000000 --- a/pkg/client/listers/listers/kubeovn/v1/ovnfip.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// OvnFipLister helps list OvnFips. -type OvnFipLister interface { - // List lists all OvnFips in the indexer. - List(selector labels.Selector) (ret []*v1.OvnFip, err error) - // Get retrieves the OvnFip from the index for a given name. - Get(name string) (*v1.OvnFip, error) - OvnFipListerExpansion -} - -// ovnFipLister implements the OvnFipLister interface. -type ovnFipLister struct { - indexer cache.Indexer -} - -// NewOvnFipLister returns a new OvnFipLister. -func NewOvnFipLister(indexer cache.Indexer) OvnFipLister { - return &ovnFipLister{indexer: indexer} -} - -// List lists all OvnFips in the indexer. -func (s *ovnFipLister) List(selector labels.Selector) (ret []*v1.OvnFip, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.OvnFip)) - }) - return ret, err -} - -// Get retrieves the OvnFip from the index for a given name. -func (s *ovnFipLister) Get(name string) (*v1.OvnFip, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("ovnfip"), name) - } - return obj.(*v1.OvnFip), nil -} diff --git a/pkg/client/listers/listers/kubeovn/v1/ovnsnatrule.go b/pkg/client/listers/listers/kubeovn/v1/ovnsnatrule.go deleted file mode 100644 index ae3ce8488f7..00000000000 --- a/pkg/client/listers/listers/kubeovn/v1/ovnsnatrule.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// OvnSnatRuleLister helps list OvnSnatRules. -type OvnSnatRuleLister interface { - // List lists all OvnSnatRules in the indexer. - List(selector labels.Selector) (ret []*v1.OvnSnatRule, err error) - // Get retrieves the OvnSnatRule from the index for a given name. - Get(name string) (*v1.OvnSnatRule, error) - OvnSnatRuleListerExpansion -} - -// ovnSnatRuleLister implements the OvnSnatRuleLister interface. -type ovnSnatRuleLister struct { - indexer cache.Indexer -} - -// NewOvnSnatRuleLister returns a new OvnSnatRuleLister. -func NewOvnSnatRuleLister(indexer cache.Indexer) OvnSnatRuleLister { - return &ovnSnatRuleLister{indexer: indexer} -} - -// List lists all OvnSnatRules in the indexer. -func (s *ovnSnatRuleLister) List(selector labels.Selector) (ret []*v1.OvnSnatRule, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.OvnSnatRule)) - }) - return ret, err -} - -// Get retrieves the OvnSnatRule from the index for a given name. -func (s *ovnSnatRuleLister) Get(name string) (*v1.OvnSnatRule, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("ovnsnatrule"), name) - } - return obj.(*v1.OvnSnatRule), nil -} diff --git a/pkg/client/listers/listers/kubeovn/v1/providernetwork.go b/pkg/client/listers/listers/kubeovn/v1/providernetwork.go deleted file mode 100644 index 463f960470d..00000000000 --- a/pkg/client/listers/listers/kubeovn/v1/providernetwork.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// ProviderNetworkLister helps list ProviderNetworks. -type ProviderNetworkLister interface { - // List lists all ProviderNetworks in the indexer. - List(selector labels.Selector) (ret []*v1.ProviderNetwork, err error) - // Get retrieves the ProviderNetwork from the index for a given name. - Get(name string) (*v1.ProviderNetwork, error) - ProviderNetworkListerExpansion -} - -// providerNetworkLister implements the ProviderNetworkLister interface. -type providerNetworkLister struct { - indexer cache.Indexer -} - -// NewProviderNetworkLister returns a new ProviderNetworkLister. -func NewProviderNetworkLister(indexer cache.Indexer) ProviderNetworkLister { - return &providerNetworkLister{indexer: indexer} -} - -// List lists all ProviderNetworks in the indexer. -func (s *providerNetworkLister) List(selector labels.Selector) (ret []*v1.ProviderNetwork, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.ProviderNetwork)) - }) - return ret, err -} - -// Get retrieves the ProviderNetwork from the index for a given name. -func (s *providerNetworkLister) Get(name string) (*v1.ProviderNetwork, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("providernetwork"), name) - } - return obj.(*v1.ProviderNetwork), nil -} diff --git a/pkg/client/listers/listers/kubeovn/v1/securitygroup.go b/pkg/client/listers/listers/kubeovn/v1/securitygroup.go deleted file mode 100644 index b4c8ace93a1..00000000000 --- a/pkg/client/listers/listers/kubeovn/v1/securitygroup.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// SecurityGroupLister helps list SecurityGroups. -type SecurityGroupLister interface { - // List lists all SecurityGroups in the indexer. - List(selector labels.Selector) (ret []*v1.SecurityGroup, err error) - // Get retrieves the SecurityGroup from the index for a given name. - Get(name string) (*v1.SecurityGroup, error) - SecurityGroupListerExpansion -} - -// securityGroupLister implements the SecurityGroupLister interface. -type securityGroupLister struct { - indexer cache.Indexer -} - -// NewSecurityGroupLister returns a new SecurityGroupLister. -func NewSecurityGroupLister(indexer cache.Indexer) SecurityGroupLister { - return &securityGroupLister{indexer: indexer} -} - -// List lists all SecurityGroups in the indexer. -func (s *securityGroupLister) List(selector labels.Selector) (ret []*v1.SecurityGroup, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.SecurityGroup)) - }) - return ret, err -} - -// Get retrieves the SecurityGroup from the index for a given name. -func (s *securityGroupLister) Get(name string) (*v1.SecurityGroup, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("securitygroup"), name) - } - return obj.(*v1.SecurityGroup), nil -} diff --git a/pkg/client/listers/listers/kubeovn/v1/subnet.go b/pkg/client/listers/listers/kubeovn/v1/subnet.go deleted file mode 100644 index 01312c23e3a..00000000000 --- a/pkg/client/listers/listers/kubeovn/v1/subnet.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// SubnetLister helps list Subnets. -type SubnetLister interface { - // List lists all Subnets in the indexer. - List(selector labels.Selector) (ret []*v1.Subnet, err error) - // Get retrieves the Subnet from the index for a given name. - Get(name string) (*v1.Subnet, error) - SubnetListerExpansion -} - -// subnetLister implements the SubnetLister interface. -type subnetLister struct { - indexer cache.Indexer -} - -// NewSubnetLister returns a new SubnetLister. -func NewSubnetLister(indexer cache.Indexer) SubnetLister { - return &subnetLister{indexer: indexer} -} - -// List lists all Subnets in the indexer. -func (s *subnetLister) List(selector labels.Selector) (ret []*v1.Subnet, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Subnet)) - }) - return ret, err -} - -// Get retrieves the Subnet from the index for a given name. -func (s *subnetLister) Get(name string) (*v1.Subnet, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("subnet"), name) - } - return obj.(*v1.Subnet), nil -} diff --git a/pkg/client/listers/listers/kubeovn/v1/switchlbrule.go b/pkg/client/listers/listers/kubeovn/v1/switchlbrule.go deleted file mode 100644 index 4061f043666..00000000000 --- a/pkg/client/listers/listers/kubeovn/v1/switchlbrule.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// SwitchLBRuleLister helps list SwitchLBRules. -type SwitchLBRuleLister interface { - // List lists all SwitchLBRules in the indexer. - List(selector labels.Selector) (ret []*v1.SwitchLBRule, err error) - // Get retrieves the SwitchLBRule from the index for a given name. - Get(name string) (*v1.SwitchLBRule, error) - SwitchLBRuleListerExpansion -} - -// switchLBRuleLister implements the SwitchLBRuleLister interface. -type switchLBRuleLister struct { - indexer cache.Indexer -} - -// NewSwitchLBRuleLister returns a new SwitchLBRuleLister. -func NewSwitchLBRuleLister(indexer cache.Indexer) SwitchLBRuleLister { - return &switchLBRuleLister{indexer: indexer} -} - -// List lists all SwitchLBRules in the indexer. -func (s *switchLBRuleLister) List(selector labels.Selector) (ret []*v1.SwitchLBRule, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.SwitchLBRule)) - }) - return ret, err -} - -// Get retrieves the SwitchLBRule from the index for a given name. -func (s *switchLBRuleLister) Get(name string) (*v1.SwitchLBRule, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("switchlbrule"), name) - } - return obj.(*v1.SwitchLBRule), nil -} diff --git a/pkg/client/listers/listers/kubeovn/v1/vip.go b/pkg/client/listers/listers/kubeovn/v1/vip.go deleted file mode 100644 index 3aa7151be03..00000000000 --- a/pkg/client/listers/listers/kubeovn/v1/vip.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// VipLister helps list Vips. -type VipLister interface { - // List lists all Vips in the indexer. - List(selector labels.Selector) (ret []*v1.Vip, err error) - // Get retrieves the Vip from the index for a given name. - Get(name string) (*v1.Vip, error) - VipListerExpansion -} - -// vipLister implements the VipLister interface. -type vipLister struct { - indexer cache.Indexer -} - -// NewVipLister returns a new VipLister. -func NewVipLister(indexer cache.Indexer) VipLister { - return &vipLister{indexer: indexer} -} - -// List lists all Vips in the indexer. -func (s *vipLister) List(selector labels.Selector) (ret []*v1.Vip, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Vip)) - }) - return ret, err -} - -// Get retrieves the Vip from the index for a given name. -func (s *vipLister) Get(name string) (*v1.Vip, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("vip"), name) - } - return obj.(*v1.Vip), nil -} diff --git a/pkg/client/listers/listers/kubeovn/v1/vlan.go b/pkg/client/listers/listers/kubeovn/v1/vlan.go deleted file mode 100644 index 74fffd6a101..00000000000 --- a/pkg/client/listers/listers/kubeovn/v1/vlan.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// VlanLister helps list Vlans. -type VlanLister interface { - // List lists all Vlans in the indexer. - List(selector labels.Selector) (ret []*v1.Vlan, err error) - // Get retrieves the Vlan from the index for a given name. - Get(name string) (*v1.Vlan, error) - VlanListerExpansion -} - -// vlanLister implements the VlanLister interface. -type vlanLister struct { - indexer cache.Indexer -} - -// NewVlanLister returns a new VlanLister. -func NewVlanLister(indexer cache.Indexer) VlanLister { - return &vlanLister{indexer: indexer} -} - -// List lists all Vlans in the indexer. -func (s *vlanLister) List(selector labels.Selector) (ret []*v1.Vlan, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Vlan)) - }) - return ret, err -} - -// Get retrieves the Vlan from the index for a given name. -func (s *vlanLister) Get(name string) (*v1.Vlan, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("vlan"), name) - } - return obj.(*v1.Vlan), nil -} diff --git a/pkg/client/listers/listers/kubeovn/v1/vpc.go b/pkg/client/listers/listers/kubeovn/v1/vpc.go deleted file mode 100644 index 522a99e775e..00000000000 --- a/pkg/client/listers/listers/kubeovn/v1/vpc.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// VpcLister helps list Vpcs. -type VpcLister interface { - // List lists all Vpcs in the indexer. - List(selector labels.Selector) (ret []*v1.Vpc, err error) - // Get retrieves the Vpc from the index for a given name. - Get(name string) (*v1.Vpc, error) - VpcListerExpansion -} - -// vpcLister implements the VpcLister interface. -type vpcLister struct { - indexer cache.Indexer -} - -// NewVpcLister returns a new VpcLister. -func NewVpcLister(indexer cache.Indexer) VpcLister { - return &vpcLister{indexer: indexer} -} - -// List lists all Vpcs in the indexer. -func (s *vpcLister) List(selector labels.Selector) (ret []*v1.Vpc, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Vpc)) - }) - return ret, err -} - -// Get retrieves the Vpc from the index for a given name. -func (s *vpcLister) Get(name string) (*v1.Vpc, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("vpc"), name) - } - return obj.(*v1.Vpc), nil -} diff --git a/pkg/client/listers/listers/kubeovn/v1/vpcdns.go b/pkg/client/listers/listers/kubeovn/v1/vpcdns.go deleted file mode 100644 index 93e5f650bff..00000000000 --- a/pkg/client/listers/listers/kubeovn/v1/vpcdns.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// VpcDnsLister helps list VpcDnses. -type VpcDnsLister interface { - // List lists all VpcDnses in the indexer. - List(selector labels.Selector) (ret []*v1.VpcDns, err error) - // Get retrieves the VpcDns from the index for a given name. - Get(name string) (*v1.VpcDns, error) - VpcDnsListerExpansion -} - -// vpcDnsLister implements the VpcDnsLister interface. -type vpcDnsLister struct { - indexer cache.Indexer -} - -// NewVpcDnsLister returns a new VpcDnsLister. -func NewVpcDnsLister(indexer cache.Indexer) VpcDnsLister { - return &vpcDnsLister{indexer: indexer} -} - -// List lists all VpcDnses in the indexer. -func (s *vpcDnsLister) List(selector labels.Selector) (ret []*v1.VpcDns, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.VpcDns)) - }) - return ret, err -} - -// Get retrieves the VpcDns from the index for a given name. -func (s *vpcDnsLister) Get(name string) (*v1.VpcDns, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("vpcdns"), name) - } - return obj.(*v1.VpcDns), nil -} diff --git a/pkg/client/listers/listers/kubeovn/v1/vpcnatgateway.go b/pkg/client/listers/listers/kubeovn/v1/vpcnatgateway.go deleted file mode 100644 index 2b2bcbc9654..00000000000 --- a/pkg/client/listers/listers/kubeovn/v1/vpcnatgateway.go +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// VpcNatGatewayLister helps list VpcNatGateways. -type VpcNatGatewayLister interface { - // List lists all VpcNatGateways in the indexer. - List(selector labels.Selector) (ret []*v1.VpcNatGateway, err error) - // Get retrieves the VpcNatGateway from the index for a given name. - Get(name string) (*v1.VpcNatGateway, error) - VpcNatGatewayListerExpansion -} - -// vpcNatGatewayLister implements the VpcNatGatewayLister interface. -type vpcNatGatewayLister struct { - indexer cache.Indexer -} - -// NewVpcNatGatewayLister returns a new VpcNatGatewayLister. -func NewVpcNatGatewayLister(indexer cache.Indexer) VpcNatGatewayLister { - return &vpcNatGatewayLister{indexer: indexer} -} - -// List lists all VpcNatGateways in the indexer. -func (s *vpcNatGatewayLister) List(selector labels.Selector) (ret []*v1.VpcNatGateway, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.VpcNatGateway)) - }) - return ret, err -} - -// Get retrieves the VpcNatGateway from the index for a given name. -func (s *vpcNatGatewayLister) Get(name string) (*v1.VpcNatGateway, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("vpcnatgateway"), name) - } - return obj.(*v1.VpcNatGateway), nil -} diff --git a/pkg/daemon/gateway_windows.go b/pkg/daemon/gateway_windows.go index b09aa3daecb..3ab3fded821 100644 --- a/pkg/daemon/gateway_windows.go +++ b/pkg/daemon/gateway_windows.go @@ -80,7 +80,7 @@ func (c *Controller) setExGateway() error { return nil } -//Generally, the MTU of the interface is set to 1400. But in special cases, a special pod (docker indocker) will introduce the docker0 interface to the pod. The MTU of docker0 is 1500. -//The network application in pod will calculate the TCP MSS according to the MTU of docker0, and then initiate communication with others. After the other party sends a response, the kernel protocol stack of Linux host will send ICMP unreachable message to the other party, indicating that IP fragmentation is needed, which is not supported by the other party, resulting in communication failure. +// Generally, the MTU of the interface is set to 1400. But in special cases, a special pod (docker indocker) will introduce the docker0 interface to the pod. The MTU of docker0 is 1500. +// The network application in pod will calculate the TCP MSS according to the MTU of docker0, and then initiate communication with others. After the other party sends a response, the kernel protocol stack of Linux host will send ICMP unreachable message to the other party, indicating that IP fragmentation is needed, which is not supported by the other party, resulting in communication failure. func (c *Controller) appendMssRule() { } diff --git a/pkg/ovn_leader_checker/ovn.go b/pkg/ovn_leader_checker/ovn.go index d204dedf48a..dd93e5bccdb 100755 --- a/pkg/ovn_leader_checker/ovn.go +++ b/pkg/ovn_leader_checker/ovn.go @@ -4,9 +4,9 @@ import ( "context" "flag" "fmt" - "io/ioutil" + "io" "os" - exec "os/exec" + "os/exec" "reflect" "strings" "syscall" @@ -219,7 +219,7 @@ func checkNorthdActive() bool { klog.Errorf("failed to open %s err = %v", OvnNorthdPid, err) return false } - fileByte, err := ioutil.ReadAll(file) + fileByte, err := io.ReadAll(file) if err != nil { klog.Errorf("failed to read %s err = %v", OvnNorthdPid, err) return false diff --git a/test/e2e-ebpf/e2e_ebpf_suite_test.go b/test/e2e-ebpf/e2e_ebpf_suite_test.go deleted file mode 100644 index e8eb4a660d4..00000000000 --- a/test/e2e-ebpf/e2e_ebpf_suite_test.go +++ /dev/null @@ -1,124 +0,0 @@ -package e2e_ebpf - -import ( - "context" - "fmt" - "os" - "os/exec" - "strings" - "testing" - - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - k8sruntime "k8s.io/apimachinery/pkg/runtime" - kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme" - kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3" - kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - kubeovn "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "github.com/kubeovn/kube-ovn/pkg/util" - "github.com/kubeovn/kube-ovn/test/e2e/framework" - - _ "github.com/kubeovn/kube-ovn/test/e2e/ip" - _ "github.com/kubeovn/kube-ovn/test/e2e/service" - _ "github.com/kubeovn/kube-ovn/test/e2e/subnet" -) - -func TestE2eEbpf(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Kube-OVN E2E ebpf Suite") -} - -var _ = SynchronizedAfterSuite(func() {}, func() { - f := framework.NewFramework("init", fmt.Sprintf("%s/.kube/config", os.Getenv("HOME"))) - nss, err := f.KubeClientSet.CoreV1().Namespaces().List(context.Background(), metav1.ListOptions{LabelSelector: "e2e=true"}) - if err != nil { - Fail(err.Error()) - } - if nss != nil { - for _, ns := range nss.Items { - err := f.KubeClientSet.CoreV1().Namespaces().Delete(context.Background(), ns.Name, metav1.DeleteOptions{}) - if err != nil { - Fail(err.Error()) - } - } - } - - err = f.OvnClientSet.KubeovnV1().Subnets().DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{LabelSelector: "e2e=true"}) - if err != nil { - Fail(err.Error()) - } -}) - -func setExternalRoute(af int, dst, gw string) { - if dst == "" || gw == "" { - return - } - - cmd := exec.Command("docker", "exec", "kube-ovn-e2e", "ip", fmt.Sprintf("-%d", af), "route", "replace", dst, "via", gw) - output, err := cmd.CombinedOutput() - if err != nil { - Fail((fmt.Sprintf(`failed to execute command "%s": %v, output: %s`, cmd.String(), err, strings.TrimSpace(string(output))))) - } -} - -var _ = SynchronizedBeforeSuite(func() []byte { - subnetName := "static-ip" - namespace := "static-ip" - f := framework.NewFramework("init", fmt.Sprintf("%s/.kube/config", os.Getenv("HOME"))) - - _, err := f.KubeClientSet.CoreV1().Namespaces().Create(context.Background(), &corev1.Namespace{ - ObjectMeta: metav1.ObjectMeta{ - Name: namespace, - Labels: map[string]string{"e2e": "true"}}}, metav1.CreateOptions{}) - if err != nil { - Fail(err.Error()) - } - - s := kubeovn.Subnet{ - ObjectMeta: metav1.ObjectMeta{ - Name: subnetName, - Labels: map[string]string{"e2e": "true"}, - }, - Spec: kubeovn.SubnetSpec{ - CIDRBlock: "12.10.0.0/16", - Namespaces: []string{namespace}, - Protocol: util.CheckProtocol("12.10.0.0/16"), - }, - } - _, err = f.OvnClientSet.KubeovnV1().Subnets().Create(context.Background(), &s, metav1.CreateOptions{}) - if err != nil { - Fail(err.Error()) - } - err = f.WaitSubnetReady(subnetName) - if err != nil { - Fail(err.Error()) - } - - nodes, err := f.KubeClientSet.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{}) - if err != nil { - Fail(err.Error()) - } - kubeadmConfigMap, err := f.KubeClientSet.CoreV1().ConfigMaps(metav1.NamespaceSystem).Get(context.Background(), kubeadmconstants.KubeadmConfigConfigMap, metav1.GetOptions{}) - if err != nil { - Fail(err.Error()) - } - - clusterConfig := &kubeadmapi.ClusterConfiguration{} - if err = k8sruntime.DecodeInto(kubeadmscheme.Codecs.UniversalDecoder(), []byte(kubeadmConfigMap.Data[kubeadmconstants.ClusterConfigurationConfigMapKey]), clusterConfig); err != nil { - Fail(fmt.Sprintf("failed to decode kubeadm cluster configuration from bytes: %v", err)) - } - - nodeIPv4, nodeIPv6 := util.GetNodeInternalIP(nodes.Items[0]) - podSubnetV4, podSubnetV6 := util.SplitStringIP(clusterConfig.Networking.PodSubnet) - svcSubnetV4, svcSubnetV6 := util.SplitStringIP(clusterConfig.Networking.ServiceSubnet) - setExternalRoute(4, podSubnetV4, nodeIPv4) - setExternalRoute(4, svcSubnetV4, nodeIPv4) - setExternalRoute(6, podSubnetV6, nodeIPv6) - setExternalRoute(6, svcSubnetV6, nodeIPv6) - - return nil -}, func(data []byte) {}) diff --git a/test/e2e-ovnic/e2e_suite_test.go b/test/e2e-ovnic/e2e_suite_test.go deleted file mode 100644 index ab193b7d233..00000000000 --- a/test/e2e-ovnic/e2e_suite_test.go +++ /dev/null @@ -1,98 +0,0 @@ -package e2e_ovnic_test - -import ( - "context" - "fmt" - "os" - "os/exec" - "strings" - "testing" - - v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/kubernetes" - "k8s.io/client-go/rest" - "k8s.io/client-go/tools/clientcmd" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/kubeovn/kube-ovn/test/e2e/framework" -) - -func TestE2eOvnic(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Kube-OVN E2E OVN-IC Suite") -} - -var _ = SynchronizedAfterSuite(func() {}, func() { - - output, err := exec.Command("kubectl", "config", "use-context", "kind-kube-ovn").CombinedOutput() - Expect(err).NotTo(HaveOccurred(), string(output)) - f := framework.NewFramework("init", fmt.Sprintf("%s/.kube/config", os.Getenv("HOME"))) - - pods, err := f.KubeClientSet.CoreV1().Pods("kube-system").List(context.Background(), metav1.ListOptions{LabelSelector: "ovn-nb-leader=true"}) - Expect(err).NotTo(HaveOccurred()) - if len(pods.Items) != 1 { - Fail(fmt.Sprintf("pods %s not right", pods)) - } - - cmdLS := "ovn-nbctl --format=csv --data=bare --columns=name --no-heading find logical_switch name=ts" - sout, _, err := f.ExecToPodThroughAPI(cmdLS, "ovn-central", pods.Items[0].Name, pods.Items[0].Namespace, nil) - if err != nil { - Fail(fmt.Sprintf("switch ts does not exist in pod %s for %s", pods.Items[0].Name, err)) - } - if strings.TrimSpace(sout) != "ts" { - Fail(fmt.Sprintf("switch ts is not right as %s", sout)) - } - - checkLSP("ts-az1", pods.Items[0], f) - checkLSP("ts-az0", pods.Items[0], f) - - // To avoid the situation that the wrong kube-config context is loaded in framework, and then the test cloud always - // pass the test. a replacement kube-client solution is introduced to force the correct context pod-list to be read. - // Then if framework read the wrong context, it will get wrong pod which from another cluster. - output, err = exec.Command("kubectl", "config", "use-context", "kind-kube-ovn1").CombinedOutput() - Expect(err).NotTo(HaveOccurred(), string(output)) - f = framework.NewFramework("init", fmt.Sprintf("%s/.kube/config", os.Getenv("HOME"))) - kubecfg1, err := buildConfigFromFlags("kind-kube-ovn1", fmt.Sprintf("%s/.kube/config", os.Getenv("HOME"))) - Expect(err).NotTo(HaveOccurred()) - kubeClient1, err := kubernetes.NewForConfig(kubecfg1) - Expect(err).NotTo(HaveOccurred()) - - pods1, err := kubeClient1.CoreV1().Pods("kube-system").List(context.Background(), metav1.ListOptions{LabelSelector: "ovn-nb-leader=true"}) - Expect(err).NotTo(HaveOccurred()) - if len(pods1.Items) != 1 { - Fail(fmt.Sprintf("pods %s length not 1", pods1)) - } - - sout, _, err = f.ExecToPodThroughAPI(cmdLS, "ovn-central", pods1.Items[0].Name, pods1.Items[0].Namespace, nil) - if err != nil { - Fail(fmt.Sprintf("switch ts does not exist in pod %s with %s", pods1.Items[0].Name, err)) - } - if strings.TrimSpace(sout) != "ts" { - Fail(fmt.Sprintf("switch ts is not right as %s", sout)) - } - - checkLSP("ts-az1", pods1.Items[0], f) - checkLSP("ts-az0", pods1.Items[0], f) -}) - -func buildConfigFromFlags(context, kubeconfigPath string) (*rest.Config, error) { - return clientcmd.NewNonInteractiveDeferredLoadingClientConfig( - &clientcmd.ClientConfigLoadingRules{ExplicitPath: kubeconfigPath}, - &clientcmd.ConfigOverrides{ - CurrentContext: context, - }).ClientConfig() -} - -func checkLSP(lspName string, pod v1.Pod, f *framework.Framework) { - cmd := fmt.Sprintf("ovn-nbctl --format=csv --data=bare --columns=name --no-heading find logical_switch_port name=%s", lspName) - sout, _, err := f.ExecToPodThroughAPI(cmd, "ovn-central", pod.Name, pod.Namespace, nil) - if err != nil { - Fail(fmt.Sprintf("switch port %s ts does not exist", lspName)) - } - if strings.TrimSpace(sout) != lspName { - Fail(fmt.Sprintf("switch port %s is not right as %s", lspName, sout)) - } -} diff --git a/test/e2e-underlay-single-nic/e2e_suite_test.go b/test/e2e-underlay-single-nic/e2e_suite_test.go deleted file mode 100644 index 1905502ad11..00000000000 --- a/test/e2e-underlay-single-nic/e2e_suite_test.go +++ /dev/null @@ -1,45 +0,0 @@ -package e2e_underlay_single_nic_test - -import ( - "context" - "fmt" - "os" - "testing" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/kubeovn/kube-ovn/test/e2e/framework" - - // tests to run - _ "github.com/kubeovn/kube-ovn/test/e2e-underlay-single-nic/kubectl-ko" - _ "github.com/kubeovn/kube-ovn/test/e2e-underlay-single-nic/node" -) - -func TestE2e(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Kube-OVN Vlan E2E Suite") -} - -var _ = SynchronizedAfterSuite(func() {}, func() { - f := framework.NewFramework("init", fmt.Sprintf("%s/.kube/config", os.Getenv("HOME"))) - nss, err := f.KubeClientSet.CoreV1().Namespaces().List(context.Background(), metav1.ListOptions{LabelSelector: "e2e=true"}) - if err != nil { - Fail(err.Error()) - } - if nss != nil { - for _, ns := range nss.Items { - err := f.KubeClientSet.CoreV1().Namespaces().Delete(context.Background(), ns.Name, metav1.DeleteOptions{}) - if err != nil { - Fail(err.Error()) - } - } - } - - err = f.OvnClientSet.KubeovnV1().Subnets().DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{LabelSelector: "e2e=true"}) - if err != nil { - Fail(err.Error()) - } -}) diff --git a/test/e2e-underlay-single-nic/kubectl-ko/ko.go b/test/e2e-underlay-single-nic/kubectl-ko/ko.go deleted file mode 100644 index a198a8d677f..00000000000 --- a/test/e2e-underlay-single-nic/kubectl-ko/ko.go +++ /dev/null @@ -1,41 +0,0 @@ -package kubectl_ko - -import ( - "context" - "fmt" - "os" - "os/exec" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - kubeovn "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "github.com/kubeovn/kube-ovn/pkg/util" - "github.com/kubeovn/kube-ovn/test/e2e/framework" -) - -var _ = Describe("[kubectl-ko]", func() { - f := framework.NewFramework("kubectl-ko", fmt.Sprintf("%s/.kube/config", os.Getenv("HOME"))) - - It("trace", func() { - pods, err := f.KubeClientSet.CoreV1().Pods("kube-system").List(context.Background(), metav1.ListOptions{LabelSelector: "app=kube-ovn-pinger"}) - Expect(err).NotTo(HaveOccurred()) - - pod := pods.Items[0] - dst := "114.114.114.114" - if util.CheckProtocol(pod.Status.PodIP) == kubeovn.ProtocolIPv6 { - dst = "2400:3200::1" - } - - output, err := exec.Command("kubectl", "ko", "trace", fmt.Sprintf("kube-system/%s", pod.Name), dst, "icmp").CombinedOutput() - Expect(err).NotTo(HaveOccurred(), string(output)) - - output, err = exec.Command("kubectl", "ko", "trace", fmt.Sprintf("kube-system/%s", pod.Name), dst, "tcp", "80").CombinedOutput() - Expect(err).NotTo(HaveOccurred(), string(output)) - - output, err = exec.Command("kubectl", "ko", "trace", fmt.Sprintf("kube-system/%s", pod.Name), dst, "udp", "53").CombinedOutput() - Expect(err).NotTo(HaveOccurred(), string(output)) - }) -}) diff --git a/test/e2e-underlay-single-nic/node/network.json b/test/e2e-underlay-single-nic/node/network.json deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/test/e2e-underlay-single-nic/node/node.go b/test/e2e-underlay-single-nic/node/node.go deleted file mode 100644 index 18362defea9..00000000000 --- a/test/e2e-underlay-single-nic/node/node.go +++ /dev/null @@ -1,228 +0,0 @@ -package node - -import ( - "context" - _ "embed" - "encoding/json" - "fmt" - "net" - "os" - "strings" - - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/kubeovn/kube-ovn/pkg/util" - "github.com/kubeovn/kube-ovn/test/e2e/framework" -) - -const vlanNic = "eth0" - -var vlanBr = util.ExternalBridgeName("provider") - -//go:embed network.json -var networkJSON []byte - -type nodeNetwork struct { - Gateway string - IPAddress string - IPPrefixLen int - IPv6Gateway string - GlobalIPv6Address string - GlobalIPv6PrefixLen int - MacAddress string -} - -var _ = Describe("[Underlay Node]", func() { - f := framework.NewFramework("node", fmt.Sprintf("%s/.kube/config", os.Getenv("HOME"))) - - var network *nodeNetwork - BeforeEach(func() { - if len(networkJSON) != 0 { - network = new(nodeNetwork) - Expect(json.Unmarshal(networkJSON, network)).NotTo(HaveOccurred()) - } - }) - - It("Single NIC", func() { - nodes, err := f.KubeClientSet.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{}) - Expect(err).NotTo(HaveOccurred()) - Expect(nodes).NotTo(BeNil()) - Expect(len(nodes.Items)).NotTo(BeZero()) - - nodeIPs := make([]string, 0, len(nodes.Items)*2) - nodeRoutes := make([]string, 0, len(nodes.Items)*4) - if network != nil { - if network.IPAddress != "" { - addr := fmt.Sprintf("%s/%d", network.IPAddress, network.IPPrefixLen) - nodeIPs = append(nodeIPs, addr) - _, ipnet, err := net.ParseCIDR(addr) - Expect(err).NotTo(HaveOccurred()) - nodeRoutes = append(nodeRoutes, fmt.Sprintf("%s ", ipnet.String())) - } - if network.GlobalIPv6Address != "" { - addr := fmt.Sprintf("%s/%d", network.GlobalIPv6Address, network.GlobalIPv6PrefixLen) - nodeIPs = append(nodeIPs, addr) - _, ipnet, err := net.ParseCIDR(addr) - Expect(err).NotTo(HaveOccurred()) - nodeRoutes = append(nodeRoutes, fmt.Sprintf("%s ", ipnet.String())) - } - if network.Gateway != "" { - nodeRoutes = append(nodeRoutes, fmt.Sprintf("default via %s ", network.Gateway)) - } - if network.IPv6Gateway != "" { - nodeRoutes = append(nodeRoutes, fmt.Sprintf("default via %s ", network.IPv6Gateway)) - } - } else { - for _, node := range nodes.Items { - if node.Name == "kube-ovn-control-plane" { - ipv4, ipv6 := util.GetNodeInternalIP(node) - if ipv4 != "" { - nodeIPs = append(nodeIPs, ipv4+"/") - } - if ipv6 != "" { - nodeIPs = append(nodeIPs, ipv6+"/") - } - break - } - } - } - Expect(nodeIPs).NotTo(BeEmpty()) - - ovsPods, err := f.KubeClientSet.CoreV1().Pods("kube-system").List(context.Background(), metav1.ListOptions{LabelSelector: "app=ovs"}) - Expect(err).NotTo(HaveOccurred()) - Expect(ovsPods).NotTo(BeNil()) - - var ovsPod *corev1.Pod - for _, pod := range ovsPods.Items { - for _, ip := range nodeIPs { - if strings.HasPrefix(ip, pod.Status.HostIP+"/") { - ovsPod = &pod - break - } - } - if ovsPod != nil { - break - } - } - Expect(ovsPod).NotTo(BeNil()) - - stdout, _, err := f.ExecToPodThroughAPI("ovs-vsctl list-ports "+vlanBr, "openvswitch", ovsPod.Name, ovsPod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - - var found bool - for _, port := range strings.Split(stdout, "\n") { - if port == vlanNic { - found = true - break - } - } - Expect(found).To(BeTrue()) - - stdout, _, err = f.ExecToPodThroughAPI("ip addr show "+vlanBr, "openvswitch", ovsPod.Name, ovsPod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - Expect(stdout).NotTo(BeEmpty()) - - ipFound := make([]bool, len(nodeIPs)) - for i, s := range strings.Split(stdout, "\n") { - if i == 0 { - var linkUp bool - idx1, idx2 := strings.IndexRune(s, '<'), strings.IndexRune(s, '>') - if idx1 > 0 && idx2 > idx1+1 { - for _, state := range strings.Split(s[idx1+1:idx2], ",") { - if state == "UP" { - linkUp = true - break - } - } - } - Expect(linkUp).To(BeTrue()) - continue - } - if i == 1 && network != nil && network.MacAddress != "" { - Expect(strings.TrimSpace(s)).To(HavePrefix("link/ether %s ", network.MacAddress)) - continue - } - - s = strings.TrimSpace(s) - for i, ip := range nodeIPs { - if strings.HasPrefix(s, "inet "+ip) || strings.HasPrefix(s, "inet6 "+ip) { - ipFound[i] = true - break - } - } - } - for _, found := range ipFound { - Expect(found).To(BeTrue()) - } - - stdout, _, err = f.ExecToPodThroughAPI("ip addr show "+vlanNic, "openvswitch", ovsPod.Name, ovsPod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - Expect(stdout).NotTo(BeEmpty()) - - var hasAddr bool - for _, s := range strings.Split(stdout, "\n") { - if s = strings.TrimSpace(s); strings.HasPrefix(s, "inet ") || strings.HasPrefix(s, "inet6 ") { - ip, _, err := net.ParseCIDR(strings.Fields(s)[1]) - Expect(err).NotTo(HaveOccurred()) - if ip.IsLinkLocalUnicast() { - continue - } - hasAddr = true - break - } - } - Expect(hasAddr).To(BeFalse()) - - stdout, _, err = f.ExecToPodThroughAPI("ip -4 route show dev "+vlanBr, "openvswitch", ovsPod.Name, ovsPod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - routes := strings.Split(stdout, "\n") - - stdout, _, err = f.ExecToPodThroughAPI("ip -6 route show dev "+vlanBr, "openvswitch", ovsPod.Name, ovsPod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - routes = append(routes, strings.Split(stdout, "\n")...) - - routeFound := make([]bool, len(nodeRoutes)) - for i, prefix := range nodeRoutes { - for _, route := range routes { - if strings.HasPrefix(route, prefix) { - routeFound[i] = true - break - } - } - } - for _, found := range routeFound { - Expect(found).To(BeTrue()) - } - - stdout, _, err = f.ExecToPodThroughAPI("ip -4 route show dev "+vlanNic, "openvswitch", ovsPod.Name, ovsPod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - Expect(strings.TrimSpace(stdout)).To(BeEmpty()) - - stdout, _, err = f.ExecToPodThroughAPI("ip -6 route show dev "+vlanNic, "openvswitch", ovsPod.Name, ovsPod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - - var hasRoute bool - for _, s := range strings.Split(stdout, "\n") { - if s = strings.TrimSpace(s); s == "" { - continue - } - - if !strings.HasPrefix(s, "default ") { - addr := strings.Split(strings.Fields(s)[0], "/")[0] - ip := net.ParseIP(addr) - Expect(ip).NotTo(BeNil()) - if ip.IsLinkLocalUnicast() { - continue - } - } - - hasRoute = true - break - } - Expect(hasRoute).To(BeFalse()) - }) -}) diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go deleted file mode 100644 index 693dbef9caa..00000000000 --- a/test/e2e/e2e_suite_test.go +++ /dev/null @@ -1,350 +0,0 @@ -package e2e - -import ( - "context" - _ "embed" - "encoding/json" - "fmt" - "os" - "os/exec" - "strconv" - "strings" - "testing" - "time" - - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - k8sruntime "k8s.io/apimachinery/pkg/runtime" - kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme" - kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3" - kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - kubeovn "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "github.com/kubeovn/kube-ovn/pkg/util" - "github.com/kubeovn/kube-ovn/test/e2e/framework" - - // tests to run - _ "github.com/kubeovn/kube-ovn/test/e2e/ip" - _ "github.com/kubeovn/kube-ovn/test/e2e/kubectl-ko" - _ "github.com/kubeovn/kube-ovn/test/e2e/node" - _ "github.com/kubeovn/kube-ovn/test/e2e/qos" - _ "github.com/kubeovn/kube-ovn/test/e2e/service" - _ "github.com/kubeovn/kube-ovn/test/e2e/subnet" - "github.com/kubeovn/kube-ovn/test/e2e/underlay" -) - -//go:embed network.json -var networkJSON []byte - -var nodeNetworks map[string]nodeNetwork - -type nodeNetwork struct { - Gateway string - IPAddress string - IPPrefixLen int - IPv6Gateway string - GlobalIPv6Address string - GlobalIPv6PrefixLen int - MacAddress string -} - -func init() { - if err := json.Unmarshal(networkJSON, &nodeNetworks); err != nil { - panic(err) - } -} - -func TestE2e(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Kube-OVN E2E Suite") -} - -var _ = SynchronizedAfterSuite(func() {}, func() { - f := framework.NewFramework("init", fmt.Sprintf("%s/.kube/config", os.Getenv("HOME"))) - for { - pods, err := f.KubeClientSet.CoreV1().Pods(corev1.NamespaceAll).List(context.Background(), metav1.ListOptions{LabelSelector: "e2e=true"}) - if err != nil { - Fail(err.Error()) - } - if len(pods.Items) == 0 { - break - } - time.Sleep(time.Second) - } - - for { - nss, err := f.KubeClientSet.CoreV1().Namespaces().List(context.Background(), metav1.ListOptions{LabelSelector: "e2e=true"}) - if err != nil { - Fail(err.Error()) - } - if len(nss.Items) == 0 { - break - } - for _, ns := range nss.Items { - if ns.DeletionTimestamp != nil { - continue - } - err := f.KubeClientSet.CoreV1().Namespaces().Delete(context.Background(), ns.Name, metav1.DeleteOptions{}) - if err != nil { - Fail(err.Error()) - } - } - time.Sleep(time.Second) - } - - err := f.OvnClientSet.KubeovnV1().Subnets().DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{LabelSelector: "e2e=true"}) - if err != nil { - Fail(err.Error()) - } - for { - subnets, err := f.OvnClientSet.KubeovnV1().Subnets().List(context.Background(), metav1.ListOptions{LabelSelector: "e2e=true"}) - if err != nil { - Fail(err.Error()) - } - if len(subnets.Items) == 0 { - break - } - time.Sleep(time.Second) - } - - err = f.OvnClientSet.KubeovnV1().Vlans().DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{LabelSelector: "e2e=true"}) - if err != nil { - Fail(err.Error()) - } - for { - vlans, err := f.OvnClientSet.KubeovnV1().Vlans().List(context.Background(), metav1.ListOptions{LabelSelector: "e2e=true"}) - if err != nil { - Fail(err.Error()) - } - if len(vlans.Items) == 0 { - break - } - time.Sleep(time.Second) - } - - err = f.OvnClientSet.KubeovnV1().ProviderNetworks().DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{LabelSelector: "e2e=true"}) - if err != nil { - Fail(err.Error()) - } - for { - pns, err := f.OvnClientSet.KubeovnV1().ProviderNetworks().List(context.Background(), metav1.ListOptions{LabelSelector: "e2e=true"}) - if err != nil { - Fail(err.Error()) - } - if len(pns.Items) == 0 { - break - } - time.Sleep(time.Second) - } -}) - -func setExternalRoute(af int, dst, gw string) { - if dst == "" || gw == "" { - return - } - - cmd := exec.Command("docker", "exec", "kube-ovn-e2e", "ip", fmt.Sprintf("-%d", af), "route", "replace", dst, "via", gw) - output, err := cmd.CombinedOutput() - if err != nil { - Fail((fmt.Sprintf(`failed to execute command "%s": %v, output: %s`, cmd.String(), err, strings.TrimSpace(string(output))))) - } -} - -var _ = SynchronizedBeforeSuite(func() []byte { - subnetName := "static-ip" - namespace := "static-ip" - f := framework.NewFramework("init", fmt.Sprintf("%s/.kube/config", os.Getenv("HOME"))) - - _, err := f.KubeClientSet.CoreV1().Namespaces().Create(context.Background(), &corev1.Namespace{ - ObjectMeta: metav1.ObjectMeta{ - Name: namespace, - Labels: map[string]string{"e2e": "true"}}}, metav1.CreateOptions{}) - if err != nil { - Fail(err.Error()) - } - - s := kubeovn.Subnet{ - ObjectMeta: metav1.ObjectMeta{ - Name: subnetName, - Labels: map[string]string{"e2e": "true"}, - }, - Spec: kubeovn.SubnetSpec{ - CIDRBlock: "12.10.0.0/16", - Namespaces: []string{namespace}, - Protocol: util.CheckProtocol("12.10.0.0/16"), - }, - } - _, err = f.OvnClientSet.KubeovnV1().Subnets().Create(context.Background(), &s, metav1.CreateOptions{}) - if err != nil { - Fail(err.Error()) - } - err = f.WaitSubnetReady(subnetName) - if err != nil { - Fail(err.Error()) - } - - nodes, err := f.KubeClientSet.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{}) - if err != nil { - Fail(err.Error()) - } - kubeadmConfigMap, err := f.KubeClientSet.CoreV1().ConfigMaps(metav1.NamespaceSystem).Get(context.Background(), kubeadmconstants.KubeadmConfigConfigMap, metav1.GetOptions{}) - if err != nil { - Fail(err.Error()) - } - - clusterConfig := &kubeadmapi.ClusterConfiguration{} - if err = k8sruntime.DecodeInto(kubeadmscheme.Codecs.UniversalDecoder(), []byte(kubeadmConfigMap.Data[kubeadmconstants.ClusterConfigurationConfigMapKey]), clusterConfig); err != nil { - Fail(fmt.Sprintf("failed to decode kubeadm cluster configuration from bytes: %v", err)) - } - - nodeIPv4, nodeIPv6 := util.GetNodeInternalIP(nodes.Items[0]) - podSubnetV4, podSubnetV6 := util.SplitStringIP(clusterConfig.Networking.PodSubnet) - svcSubnetV4, svcSubnetV6 := util.SplitStringIP(clusterConfig.Networking.ServiceSubnet) - setExternalRoute(4, podSubnetV4, nodeIPv4) - setExternalRoute(4, svcSubnetV4, nodeIPv4) - setExternalRoute(6, podSubnetV6, nodeIPv6) - setExternalRoute(6, svcSubnetV6, nodeIPv6) - - // underlay - var vlanID int - providerInterface := underlay.UnderlayInterface - if underlay.VlanID != "" { - if vlanID, err = strconv.Atoi(underlay.VlanID); err != nil || vlanID <= 0 || vlanID > 4095 { - Fail(underlay.VlanID + " is not a valid VLAN ID") - } - providerInterface = underlay.VlanInterface - } - - var underlayNodeIPs []string - var underlayCIDR, underlayGateway string - for node, network := range nodeNetworks { - underlay.SetNodeMac(node, network.MacAddress) - if network.IPAddress != "" { - underlay.AddNodeIP(network.IPAddress) - underlayNodeIPs = append(underlayNodeIPs, network.IPAddress) - underlay.AddNodeAddrs(node, fmt.Sprintf("%s/%d", network.IPAddress, network.IPPrefixLen)) - if underlayCIDR == "" { - underlayCIDR = fmt.Sprintf("%s/%d", network.IPAddress, network.IPPrefixLen) - } - } - if network.GlobalIPv6Address != "" { - underlay.AddNodeAddrs(node, fmt.Sprintf("%s/%d", network.GlobalIPv6Address, network.GlobalIPv6PrefixLen)) - } - if network.Gateway != "" { - underlay.AddNodeRoutes(node, fmt.Sprintf("default via %s ", network.Gateway)) - if underlayGateway == "" { - underlayGateway = network.Gateway - } - } - if network.IPv6Gateway != "" { - underlay.AddNodeRoutes(node, fmt.Sprintf("default via %s ", network.IPv6Gateway)) - } - } - underlay.SetCIDR(underlayCIDR) - - cniPods, err := f.KubeClientSet.CoreV1().Pods("kube-system").List(context.Background(), metav1.ListOptions{LabelSelector: "app=kube-ovn-cni"}) - if err != nil { - Fail(err.Error()) - } - - for i := range nodes.Items { - var cniPod *corev1.Pod - nodeIPv4, nodeIPv6 := util.GetNodeInternalIP(nodes.Items[i]) - for _, pod := range cniPods.Items { - if pod.Status.HostIP == nodeIPv4 || pod.Status.HostIP == nodeIPv6 { - cniPod = &pod - break - } - } - if cniPod == nil { - Fail("failed to get CNI pod on node " + nodes.Items[i].Name) - return nil - } - - // change MTU - mtu := 1500 - (i+1)*5 - cmd := fmt.Sprintf("ip link set %s mtu %d", providerInterface, mtu) - if _, _, err = f.ExecToPodThroughAPI(cmd, "cni-server", cniPod.Name, cniPod.Namespace, nil); err != nil { - Fail(fmt.Sprintf("failed to set MTU of %s on node %s: %v", providerInterface, nodes.Items[i].Name, err)) - } - underlay.SetNodeMTU(nodes.Items[i].Name, mtu) - } - - ns := corev1.Namespace{ - ObjectMeta: metav1.ObjectMeta{ - Name: underlay.Namespace, - Labels: map[string]string{"e2e": "true"}, - }, - } - if _, err = f.KubeClientSet.CoreV1().Namespaces().Create(context.Background(), &ns, metav1.CreateOptions{}); err != nil { - Fail(err.Error()) - } - - // create provider network - pn := &kubeovn.ProviderNetwork{ - ObjectMeta: metav1.ObjectMeta{ - Name: underlay.ProviderNetwork, - Labels: map[string]string{"e2e": "true"}, - }, - Spec: kubeovn.ProviderNetworkSpec{ - DefaultInterface: providerInterface, - ExchangeLinkName: underlay.ExchangeLinkName, - }, - } - if _, err = f.OvnClientSet.KubeovnV1().ProviderNetworks().Create(context.Background(), pn, metav1.CreateOptions{}); err != nil { - Fail("failed to create provider network: " + err.Error()) - } - if err = f.WaitProviderNetworkReady(pn.Name); err != nil { - Fail("provider network failed: " + err.Error()) - } - if pn, err = f.OvnClientSet.KubeovnV1().ProviderNetworks().Get(context.Background(), pn.Name, metav1.GetOptions{}); err != nil { - Fail("failed to get provider network: " + err.Error()) - } - for _, node := range nodes.Items { - if !pn.Status.NodeIsReady(node.Name) { - Fail(fmt.Sprintf("provider network on node %s is not ready", node.Name)) - } - } - - // create vlan - vlan := kubeovn.Vlan{ - ObjectMeta: metav1.ObjectMeta{ - Name: underlay.Vlan, - Labels: map[string]string{"e2e": "true"}, - }, - Spec: kubeovn.VlanSpec{ - ID: vlanID, - Provider: pn.Name, - }, - } - if _, err = f.OvnClientSet.KubeovnV1().Vlans().Create(context.Background(), &vlan, metav1.CreateOptions{}); err != nil { - Fail("failed to create vlan: " + err.Error()) - } - - // create subnet - subnet := kubeovn.Subnet{ - ObjectMeta: metav1.ObjectMeta{ - Name: underlay.Subnet, - Labels: map[string]string{"e2e": "true"}, - }, - Spec: kubeovn.SubnetSpec{ - CIDRBlock: underlayCIDR, - Gateway: underlayGateway, - ExcludeIps: underlayNodeIPs, - Vlan: vlan.Name, - Namespaces: []string{underlay.Namespace}, - Protocol: util.CheckProtocol(underlayCIDR), - }, - } - if _, err = f.OvnClientSet.KubeovnV1().Subnets().Create(context.Background(), &subnet, metav1.CreateOptions{}); err != nil { - Fail("failed to create subnet: " + err.Error()) - } - if err = f.WaitSubnetReady(subnet.Name); err != nil { - Fail("subnet failed: " + err.Error()) - } - - return nil -}, func(data []byte) {}) diff --git a/test/e2e/framework/framework.go b/test/e2e/framework/framework.go deleted file mode 100644 index 4c982f74c1d..00000000000 --- a/test/e2e/framework/framework.go +++ /dev/null @@ -1,388 +0,0 @@ -package framework - -import ( - "bytes" - "context" - "fmt" - "io" - "os/exec" - "strings" - "time" - - corev1 "k8s.io/api/core/v1" - k8serrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/client-go/kubernetes" - "k8s.io/client-go/rest" - "k8s.io/client-go/tools/clientcmd" - "k8s.io/client-go/tools/remotecommand" - "k8s.io/klog/v2" - - . "github.com/onsi/ginkgo" - - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - clientset "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned" -) - -type Framework struct { - BaseName string - KubeOvnNamespace string - KubeClientSet kubernetes.Interface - OvnClientSet clientset.Interface - KubeConfig *rest.Config -} - -func NewFramework(baseName, kubeConfig string) *Framework { - f := &Framework{BaseName: baseName} - - cfg, err := clientcmd.BuildConfigFromFlags("", kubeConfig) - if err != nil { - panic(err.Error()) - } - f.KubeConfig = cfg - - cfg.QPS = 1000 - cfg.Burst = 2000 - kubeClient, err := kubernetes.NewForConfig(cfg) - if err != nil { - panic(err.Error()) - } - - f.KubeClientSet = kubeClient - - kubeOvnClient, err := clientset.NewForConfig(cfg) - if err != nil { - panic(err.Error()) - } - - f.OvnClientSet = kubeOvnClient - return f -} - -func (f *Framework) GetName() string { - return strings.Replace(CurrentGinkgoTestDescription().TestText, " ", "-", -1) -} - -func (f *Framework) WaitProviderNetworkReady(providerNetwork string) error { - for { - time.Sleep(1 * time.Second) - - pn, err := f.OvnClientSet.KubeovnV1().ProviderNetworks().Get(context.Background(), providerNetwork, metav1.GetOptions{}) - if err != nil { - return err - } - if pn.Status.Ready { - return nil - } - } -} - -func (f *Framework) WaitSubnetReady(subnet string) error { - for { - time.Sleep(1 * time.Second) - s, err := f.OvnClientSet.KubeovnV1().Subnets().Get(context.Background(), subnet, metav1.GetOptions{}) - if err != nil { - return err - } - if s.Status.IsReady() { - return nil - } - if s.Status.IsNotValidated() && s.Status.ConditionReason(v1.Validated) != "" { - return fmt.Errorf(s.Status.ConditionReason(v1.Validated)) - } - } -} - -func (f *Framework) WaitPodReady(pod, namespace string) (*corev1.Pod, error) { - for { - time.Sleep(1 * time.Second) - p, err := f.KubeClientSet.CoreV1().Pods(namespace).Get(context.Background(), pod, metav1.GetOptions{}) - if err != nil { - return nil, err - } - if p.Status.Phase == "Running" && p.Status.Reason != "" { - return p, nil - } - - switch getPodStatus(*p) { - case Completed: - return nil, fmt.Errorf("pod already completed") - case Running: - return p, nil - case Initing, Pending, PodInitializing, ContainerCreating, Terminating: - continue - default: - klog.Info(p.String()) - return nil, fmt.Errorf("pod status failed") - } - } -} - -func (f *Framework) WaitPodDeleted(pod, namespace string) error { - for { - time.Sleep(1 * time.Second) - p, err := f.KubeClientSet.CoreV1().Pods(namespace).Get(context.Background(), pod, metav1.GetOptions{}) - if err != nil { - if k8serrors.IsNotFound(err) { - return nil - } - return err - } - - if status := getPodStatus(*p); status != Terminating { - return fmt.Errorf("unexpected pod status: %s", status) - } - } -} - -func (f *Framework) WaitDeploymentReady(deployment, namespace string) error { - for { - time.Sleep(1 * time.Second) - deploy, err := f.KubeClientSet.AppsV1().Deployments(namespace).Get(context.Background(), deployment, metav1.GetOptions{}) - if err != nil { - return err - } - if deploy.Status.ReadyReplicas != *deploy.Spec.Replicas { - continue - } - - pods, err := f.KubeClientSet.CoreV1().Pods(namespace).List(context.Background(), metav1.ListOptions{LabelSelector: labels.SelectorFromSet(deploy.Spec.Template.Labels).String()}) - if err != nil { - return err - } - - ready := true - for _, pod := range pods.Items { - switch getPodStatus(pod) { - case Completed: - return fmt.Errorf("pod already completed") - case Running: - continue - case Initing, Pending, PodInitializing, ContainerCreating, Terminating: - ready = false - default: - klog.Info(pod.String()) - return fmt.Errorf("pod status failed") - } - } - if ready { - return nil - } - } -} - -func (f *Framework) WaitStatefulsetReady(statefulset, namespace string) error { - for { - time.Sleep(1 * time.Second) - ss, err := f.KubeClientSet.AppsV1().StatefulSets(namespace).Get(context.Background(), statefulset, metav1.GetOptions{}) - if err != nil { - return err - } - if ss.Status.ReadyReplicas != *ss.Spec.Replicas { - continue - } - - pods, err := f.KubeClientSet.CoreV1().Pods(namespace).List(context.Background(), metav1.ListOptions{LabelSelector: labels.SelectorFromSet(ss.Spec.Template.Labels).String()}) - if err != nil { - return err - } - - ready := true - for _, pod := range pods.Items { - switch getPodStatus(pod) { - case Completed: - return fmt.Errorf("pod already completed") - case Running: - continue - case Initing, Pending, PodInitializing, ContainerCreating, Terminating: - ready = false - default: - klog.Info(pod.String()) - return fmt.Errorf("pod status failed") - } - } - if ready { - return nil - } - } -} - -func (f *Framework) ExecToPodThroughAPI(command, containerName, podName, namespace string, stdin io.Reader) (string, string, error) { - req := f.KubeClientSet.CoreV1().RESTClient().Post(). - Resource("pods"). - Name(podName). - Namespace(namespace). - SubResource("exec") - scheme := runtime.NewScheme() - if err := corev1.AddToScheme(scheme); err != nil { - return "", "", fmt.Errorf("error adding to scheme: %v", err) - } - - parameterCodec := runtime.NewParameterCodec(scheme) - req.VersionedParams(&corev1.PodExecOptions{ - Command: strings.Fields(command), - Container: containerName, - Stdin: stdin != nil, - Stdout: true, - Stderr: true, - TTY: false, - }, parameterCodec) - - exec, err := remotecommand.NewSPDYExecutor(f.KubeConfig, "POST", req.URL()) - if err != nil { - return "", "", fmt.Errorf("error while creating Executor: %v", err) - } - - var stdout, stderr bytes.Buffer - err = exec.Stream(remotecommand.StreamOptions{ - Stdin: stdin, - Stdout: &stdout, - Stderr: &stderr, - Tty: false, - }) - if err != nil { - return "", "", fmt.Errorf("error in Stream: %v", err) - } - - return stdout.String(), stderr.String(), nil -} - -const ( - Running = "Running" - Pending = "Pending" - Completed = "Completed" - ContainerCreating = "ContainerCreating" - PodInitializing = "PodInitializing" - Terminating = "Terminating" - Initing = "Initing" -) - -func getPodContainerStatus(pod corev1.Pod, reason string) string { - for i := len(pod.Status.ContainerStatuses) - 1; i >= 0; i-- { - container := pod.Status.ContainerStatuses[i] - - if container.State.Waiting != nil && container.State.Waiting.Reason != "" { - reason = container.State.Waiting.Reason - } else if container.State.Terminated != nil && container.State.Terminated.Reason != "" { - reason = container.State.Terminated.Reason - } else if container.State.Terminated != nil && container.State.Terminated.Reason == "" { - if container.State.Terminated.Signal != 0 { - reason = fmt.Sprintf("Signal:%d", container.State.Terminated.Signal) - } else { - reason = fmt.Sprintf("ExitCode:%d", container.State.Terminated.ExitCode) - } - } - } - return reason -} - -func getPodStatus(pod corev1.Pod) string { - reason := string(pod.Status.Phase) - if pod.Status.Reason != "" { - reason = pod.Status.Reason - } - initializing, reason := getPodInitStatus(pod, reason) - if !initializing { - reason = getPodContainerStatus(pod, reason) - } - - if pod.DeletionTimestamp != nil && pod.Status.Reason == "NodeLost" { - reason = "Unknown" - } else if pod.DeletionTimestamp != nil { - reason = "Terminating" - } - return reason -} - -func getPodInitStatus(pod corev1.Pod, reason string) (bool, string) { - initializing := false - for i := range pod.Status.InitContainerStatuses { - container := pod.Status.InitContainerStatuses[i] - switch { - case container.State.Terminated != nil && container.State.Terminated.ExitCode == 0: - continue - case container.State.Terminated != nil: - // initialization is failed - if len(container.State.Terminated.Reason) == 0 { - if container.State.Terminated.Signal != 0 { - reason = fmt.Sprintf("Init:Signal:%d", container.State.Terminated.Signal) - } else { - reason = fmt.Sprintf("Init:ExitCode:%d", container.State.Terminated.ExitCode) - } - } else { - reason = "Init:" + container.State.Terminated.Reason - } - initializing = true - case container.State.Waiting != nil && len(container.State.Waiting.Reason) > 0 && container.State.Waiting.Reason != "PodInitializing": - reason = "Initing:" + container.State.Waiting.Reason - initializing = true - default: - reason = fmt.Sprintf("Initing:%d/%d", i, len(pod.Spec.InitContainers)) - initializing = true - } - break - } - return initializing, reason -} - -type netemQos struct { - Latency string `json:"latency"` - Limit string `json:"limit"` - Loss string `json:"loss"` -} - -func GetPodNetemQosPara(podName, podNamespace string) (netemQos, error) { - var qosVal netemQos - - output, err := exec.Command("kubectl", "ko", "vsctl", "kube-ovn-control-plane", "--no-heading", "--columns=other_config", "--bare", "find", "qos", fmt.Sprintf(`external_ids:pod="%s/%s"`, podNamespace, podName)).CombinedOutput() - if err != nil { - return qosVal, err - } - - values := strings.Fields(string(output)) - for _, val := range values { - temp := strings.Split(val, "=") - if len(temp) != 2 { - continue - } - - switch temp[0] { - case "latency": - qosVal.Latency = temp[1] - case "limit": - qosVal.Limit = temp[1] - case "loss": - qosVal.Loss = temp[1] - } - } - - return qosVal, nil -} - -func GetPodHtbQosPara(podName, podNamespace string) (string, string, error) { - var priority, rate string - - output, err := exec.Command("kubectl", "ko", "vsctl", "kube-ovn-control-plane", "--no-heading", "--columns=other_config", "--bare", "find", "queue", fmt.Sprintf(`external_ids:pod="%s/%s"`, podNamespace, podName)).CombinedOutput() - if err != nil { - return "", "", err - } - - values := strings.Fields(string(output)) - for _, val := range values { - temp := strings.Split(val, "=") - if len(temp) != 2 { - continue - } - - switch temp[0] { - case "max-rate": - rate = temp[1] - case "priority": - priority = temp[1] - } - } - - return priority, rate, nil -} diff --git a/test/e2e/ip/static_ip.go b/test/e2e/ip/static_ip.go deleted file mode 100644 index c38b1b7c56d..00000000000 --- a/test/e2e/ip/static_ip.go +++ /dev/null @@ -1,350 +0,0 @@ -package ip - -import ( - "context" - "fmt" - "os" - "sort" - "strings" - "time" - - appsv1 "k8s.io/api/apps/v1" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/kubeovn/kube-ovn/pkg/util" - "github.com/kubeovn/kube-ovn/test/e2e/framework" -) - -const testImage = "kubeovn/pause:3.2" - -var _ = Describe("[IP Allocation]", func() { - namespace := "static-ip" - f := framework.NewFramework("ip allocation", fmt.Sprintf("%s/.kube/config", os.Getenv("HOME"))) - - Describe("static pod ip", func() { - It("normal ip", func() { - name := f.GetName() - ip, mac := "12.10.0.10", "00:00:00:53:6B:B6" - autoMount := false - pod := &corev1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: namespace, - Labels: map[string]string{"e2e": "true"}, - Annotations: map[string]string{ - util.IpAddressAnnotation: ip, - util.MacAddressAnnotation: mac, - }, - }, - Spec: corev1.PodSpec{ - Containers: []corev1.Container{ - { - Name: name, - Image: testImage, - ImagePullPolicy: corev1.PullIfNotPresent, - }, - }, - AutomountServiceAccountToken: &autoMount, - }, - } - - By("Create pod") - _, err := f.KubeClientSet.CoreV1().Pods(namespace).Create(context.Background(), pod, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - _, err = f.WaitPodReady(name, namespace) - Expect(err).NotTo(HaveOccurred()) - - pod, err = f.KubeClientSet.CoreV1().Pods(namespace).Get(context.Background(), name, metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - Expect(pod.Annotations[util.AllocatedAnnotation]).To(Equal("true")) - Expect(pod.Annotations[util.RoutedAnnotation]).To(Equal("true")) - - time.Sleep(1 * time.Second) - podIP, err := f.OvnClientSet.KubeovnV1().IPs().Get(context.Background(), fmt.Sprintf("%s.%s", name, namespace), metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - Expect(podIP.Spec.V4IPAddress).To(Equal(ip)) - Expect(podIP.Spec.MacAddress).To(Equal(mac)) - - By("Delete pod") - err = f.KubeClientSet.CoreV1().Pods(namespace).Delete(context.Background(), pod.Name, metav1.DeleteOptions{}) - Expect(err).NotTo(HaveOccurred()) - }) - - It("deployment with ippool", func() { - name := f.GetName() - var replicas int32 = 3 - ips := []string{"12.10.0.20", "12.10.0.21", "12.10.0.22"} - autoMount := false - deployment := appsv1.Deployment{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: namespace, - Labels: map[string]string{"e2e": "true"}, - }, - Spec: appsv1.DeploymentSpec{ - Replicas: &replicas, - Selector: &metav1.LabelSelector{MatchLabels: map[string]string{"apps": name}}, - Template: corev1.PodTemplateSpec{ - ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{ - "apps": name, - "e2e": "true", - }, - Annotations: map[string]string{ - util.IpPoolAnnotation: strings.Join(ips, ","), - }, - }, - Spec: corev1.PodSpec{ - Containers: []corev1.Container{ - { - Name: name, - Image: testImage, - ImagePullPolicy: corev1.PullIfNotPresent, - }, - }, - AutomountServiceAccountToken: &autoMount, - }, - }, - }, - } - - By("Create deployment") - _, err := f.KubeClientSet.AppsV1().Deployments(namespace).Create(context.Background(), &deployment, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - err = f.WaitDeploymentReady(name, namespace) - Expect(err).NotTo(HaveOccurred()) - - pods, err := f.KubeClientSet.CoreV1().Pods(namespace).List(context.Background(), metav1.ListOptions{LabelSelector: labels.SelectorFromSet(deployment.Spec.Template.Labels).String()}) - Expect(err).NotTo(HaveOccurred()) - Expect(pods.Items).To(HaveLen(int(replicas))) - - podIPs := make([]string, replicas) - for i := range pods.Items { - podIPs[i] = pods.Items[i].Status.PodIP - } - sort.Strings(podIPs) - Expect(podIPs).To(Equal(ips)) - - By("Delete pods and recreate") - err = f.KubeClientSet.CoreV1().Pods(namespace).DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{LabelSelector: labels.SelectorFromSet(deployment.Spec.Template.Labels).String()}) - Expect(err).NotTo(HaveOccurred()) - - err = f.WaitDeploymentReady(name, namespace) - Expect(err).NotTo(HaveOccurred()) - - pods, err = f.KubeClientSet.CoreV1().Pods(namespace).List(context.Background(), metav1.ListOptions{LabelSelector: labels.SelectorFromSet(deployment.Spec.Template.Labels).String()}) - Expect(err).NotTo(HaveOccurred()) - Expect(pods.Items).To(HaveLen(int(replicas))) - - for i := range pods.Items { - podIPs[i] = pods.Items[i].Status.PodIP - } - sort.Strings(podIPs) - Expect(podIPs).To(Equal(ips)) - - By("Delete deployment") - err = f.KubeClientSet.AppsV1().Deployments(namespace).Delete(context.Background(), deployment.Name, metav1.DeleteOptions{}) - Expect(err).NotTo(HaveOccurred()) - }) - - It("statefulset with ippool", func() { - name := f.GetName() - var replicas int32 = 3 - ips := []string{"12.10.0.31", "12.10.0.32", "12.10.0.30"} - autoMount := false - sts := appsv1.StatefulSet{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: namespace, - Labels: map[string]string{"e2e": "true"}, - }, - Spec: appsv1.StatefulSetSpec{ - Replicas: &replicas, - Selector: &metav1.LabelSelector{MatchLabels: map[string]string{"apps": name}}, - Template: corev1.PodTemplateSpec{ - ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{ - "apps": name, - "e2e": "true", - }, - Annotations: map[string]string{ - util.IpPoolAnnotation: strings.Join(ips, ","), - }, - }, - Spec: corev1.PodSpec{ - Containers: []corev1.Container{ - { - Name: name, - Image: testImage, - ImagePullPolicy: corev1.PullIfNotPresent, - }, - }, - AutomountServiceAccountToken: &autoMount, - }, - }, - }, - } - - By("Create statefulset") - _, err := f.KubeClientSet.AppsV1().StatefulSets(namespace).Create(context.Background(), &sts, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - err = f.WaitStatefulsetReady(name, namespace) - Expect(err).NotTo(HaveOccurred()) - - for i := range ips { - pod, err := f.KubeClientSet.CoreV1().Pods(namespace).Get(context.Background(), fmt.Sprintf("%s-%d", name, i), metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - Expect(pod.Status.PodIP).To(Equal(ips[i])) - } - - By("Delete statefulset") - err = f.KubeClientSet.AppsV1().StatefulSets(namespace).Delete(context.Background(), sts.Name, metav1.DeleteOptions{}) - Expect(err).NotTo(HaveOccurred()) - }) - - It("statefulset without ippool", func() { - name := f.GetName() - var replicas int32 = 3 - autoMount := false - sts := appsv1.StatefulSet{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: namespace, - Labels: map[string]string{"e2e": "true"}, - }, - Spec: appsv1.StatefulSetSpec{ - Replicas: &replicas, - Selector: &metav1.LabelSelector{MatchLabels: map[string]string{"apps": name}}, - Template: corev1.PodTemplateSpec{ - ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{ - "apps": name, - "e2e": "true", - }, - }, - Spec: corev1.PodSpec{ - Containers: []corev1.Container{ - { - Name: name, - Image: testImage, - ImagePullPolicy: corev1.PullIfNotPresent, - }, - }, - AutomountServiceAccountToken: &autoMount, - }, - }, - }, - } - - By("Create statefulset") - _, err := f.KubeClientSet.AppsV1().StatefulSets(namespace).Create(context.Background(), &sts, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - err = f.WaitStatefulsetReady(name, namespace) - Expect(err).NotTo(HaveOccurred()) - - ips := make([]string, replicas) - for i := range ips { - pod, err := f.KubeClientSet.CoreV1().Pods(namespace).Get(context.Background(), fmt.Sprintf("%s-%d", name, i), metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - ips[i] = pod.Status.PodIP - } - - err = f.KubeClientSet.CoreV1().Pods(namespace).DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{LabelSelector: labels.SelectorFromSet(sts.Spec.Template.Labels).String()}) - Expect(err).NotTo(HaveOccurred()) - - err = f.WaitStatefulsetReady(name, namespace) - Expect(err).NotTo(HaveOccurred()) - for i := range ips { - pod, err := f.KubeClientSet.CoreV1().Pods(namespace).Get(context.Background(), fmt.Sprintf("%s-%d", name, i), metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - Expect(pod.Status.PodIP).To(Equal(ips[i])) - } - - By("Delete statefulset") - err = f.KubeClientSet.AppsV1().StatefulSets(namespace).Delete(context.Background(), sts.Name, metav1.DeleteOptions{}) - Expect(err).NotTo(HaveOccurred()) - }) - - It("force delete statefulset pod", func() { - name := f.GetName() - var replicas int32 = 3 - autoMount := false - sts := appsv1.StatefulSet{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: namespace, - Labels: map[string]string{"e2e": "true"}, - }, - Spec: appsv1.StatefulSetSpec{ - Replicas: &replicas, - Selector: &metav1.LabelSelector{MatchLabels: map[string]string{"apps": name}}, - Template: corev1.PodTemplateSpec{ - ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{ - "apps": name, - "e2e": "true", - }, - }, - Spec: corev1.PodSpec{ - Containers: []corev1.Container{ - { - Name: name, - Image: testImage, - ImagePullPolicy: corev1.PullIfNotPresent, - }, - }, - AutomountServiceAccountToken: &autoMount, - }, - }, - }, - } - - By("Create statefulset") - _, err := f.KubeClientSet.AppsV1().StatefulSets(namespace).Create(context.Background(), &sts, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - err = f.WaitStatefulsetReady(name, namespace) - Expect(err).NotTo(HaveOccurred()) - - ips := make([]string, replicas) - for i := range ips { - pod, err := f.KubeClientSet.CoreV1().Pods(namespace).Get(context.Background(), fmt.Sprintf("%s-%d", name, i), metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - ips[i] = pod.Status.PodIP - } - - err = f.KubeClientSet.CoreV1().Pods(namespace).DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{LabelSelector: labels.SelectorFromSet(sts.Spec.Template.Labels).String()}) - Expect(err).NotTo(HaveOccurred()) - - err = f.WaitStatefulsetReady(name, namespace) - Expect(err).NotTo(HaveOccurred()) - for i := range ips { - pod, err := f.KubeClientSet.CoreV1().Pods(namespace).Get(context.Background(), fmt.Sprintf("%s-%d", name, i), metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - Expect(pod.Status.PodIP).To(Equal(ips[i])) - } - - By("Force delete statefulset Pod") - var gracePeriodSeconds int64 - for i := 0; i < int(replicas); i++ { - err = f.KubeClientSet.CoreV1().Pods(namespace).Delete(context.Background(), fmt.Sprintf("%s-%d", name, i), metav1.DeleteOptions{GracePeriodSeconds: &gracePeriodSeconds}) - Expect(err).NotTo(HaveOccurred()) - } - err = f.WaitStatefulsetReady(name, namespace) - Expect(err).NotTo(HaveOccurred()) - - By("Delete statefulset") - err = f.KubeClientSet.AppsV1().StatefulSets(namespace).Delete(context.Background(), sts.Name, metav1.DeleteOptions{}) - Expect(err).NotTo(HaveOccurred()) - }) - }) -}) diff --git a/test/e2e/kubectl-ko/ko.go b/test/e2e/kubectl-ko/ko.go deleted file mode 100644 index f06962facfe..00000000000 --- a/test/e2e/kubectl-ko/ko.go +++ /dev/null @@ -1,108 +0,0 @@ -package kubectl_ko - -import ( - "context" - "fmt" - "os" - "os/exec" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - kubeovn "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "github.com/kubeovn/kube-ovn/pkg/util" - "github.com/kubeovn/kube-ovn/test/e2e/framework" -) - -var _ = Describe("[kubectl-ko]", func() { - f := framework.NewFramework("kubectl-ko", fmt.Sprintf("%s/.kube/config", os.Getenv("HOME"))) - It("nb show", func() { - output, err := exec.Command("kubectl", "ko", "nbctl", "show").CombinedOutput() - Expect(err).NotTo(HaveOccurred(), string(output)) - }) - - It("sb show", func() { - output, err := exec.Command("kubectl", "ko", "sbctl", "show").CombinedOutput() - Expect(err).NotTo(HaveOccurred(), string(output)) - }) - - It("vsctl show", func() { - nodes, err := f.KubeClientSet.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{}) - Expect(err).NotTo(HaveOccurred()) - for _, node := range nodes.Items { - output, err := exec.Command("kubectl", "ko", "vsctl", node.Name, "show").CombinedOutput() - Expect(err).NotTo(HaveOccurred(), string(output)) - } - }) - - It("ofctl show", func() { - nodes, err := f.KubeClientSet.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{}) - Expect(err).NotTo(HaveOccurred()) - for _, node := range nodes.Items { - output, err := exec.Command("kubectl", "ko", "ofctl", node.Name, "show", "br-int").CombinedOutput() - Expect(err).NotTo(HaveOccurred(), string(output)) - } - }) - - It("dpctl show", func() { - nodes, err := f.KubeClientSet.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{}) - Expect(err).NotTo(HaveOccurred()) - for _, node := range nodes.Items { - output, err := exec.Command("kubectl", "ko", "dpctl", node.Name, "show").CombinedOutput() - Expect(err).NotTo(HaveOccurred(), string(output)) - } - }) - - It("appctl list-commands", func() { - nodes, err := f.KubeClientSet.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{}) - Expect(err).NotTo(HaveOccurred()) - for _, node := range nodes.Items { - output, err := exec.Command("kubectl", "ko", "appctl", node.Name, "list-commands").CombinedOutput() - Expect(err).NotTo(HaveOccurred(), string(output)) - } - }) - - It("tcpdump", func() { - pods, err := f.KubeClientSet.CoreV1().Pods("kube-system").List(context.Background(), metav1.ListOptions{LabelSelector: " app=kube-ovn-pinger"}) - Expect(err).NotTo(HaveOccurred()) - pod := pods.Items[0] - output, err := exec.Command("kubectl", "ko", "tcpdump", fmt.Sprintf("kube-system/%s", pod.Name), "-c", "1").CombinedOutput() - Expect(err).NotTo(HaveOccurred(), string(output)) - }) - - It("trace", func() { - pods, err := f.KubeClientSet.CoreV1().Pods("kube-system").List(context.Background(), metav1.ListOptions{LabelSelector: " app=kube-ovn-pinger"}) - Expect(err).NotTo(HaveOccurred()) - - pod := pods.Items[0] - dst := "114.114.114.114" - if util.CheckProtocol(pod.Status.PodIP) == kubeovn.ProtocolIPv6 { - dst = "2400:3200::1" - } - - output, err := exec.Command("kubectl", "ko", "trace", fmt.Sprintf("kube-system/%s", pod.Name), dst, "icmp").CombinedOutput() - Expect(err).NotTo(HaveOccurred(), string(output)) - - output, err = exec.Command("kubectl", "ko", "trace", fmt.Sprintf("kube-system/%s", pod.Name), dst, "tcp", "80").CombinedOutput() - Expect(err).NotTo(HaveOccurred(), string(output)) - - output, err = exec.Command("kubectl", "ko", "trace", fmt.Sprintf("kube-system/%s", pod.Name), dst, "udp", "53").CombinedOutput() - Expect(err).NotTo(HaveOccurred(), string(output)) - }) - - It("nb/sb operation", func() { - output, err := exec.Command("kubectl", "ko", "nb", "status").CombinedOutput() - Expect(err).NotTo(HaveOccurred(), string(output)) - - output, err = exec.Command("kubectl", "ko", "sb", "status").CombinedOutput() - Expect(err).NotTo(HaveOccurred(), string(output)) - - output, err = exec.Command("kubectl", "ko", "nb", "backup").CombinedOutput() - Expect(err).NotTo(HaveOccurred(), string(output)) - - output, err = exec.Command("kubectl", "ko", "sb", "backup").CombinedOutput() - Expect(err).NotTo(HaveOccurred(), string(output)) - }) -}) diff --git a/test/e2e/network.json b/test/e2e/network.json deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/test/e2e/node/node.go b/test/e2e/node/node.go deleted file mode 100644 index df98829d65e..00000000000 --- a/test/e2e/node/node.go +++ /dev/null @@ -1,35 +0,0 @@ -package node - -import ( - "context" - "fmt" - "os" - - "github.com/kubeovn/kube-ovn/pkg/util" - "github.com/kubeovn/kube-ovn/test/e2e/framework" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -var _ = Describe("[Node Init]", func() { - f := framework.NewFramework("ip allocation", fmt.Sprintf("%s/.kube/config", os.Getenv("HOME"))) - - It("node annotations", func() { - nodes, err := f.KubeClientSet.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{}) - Expect(err).NotTo(HaveOccurred()) - subnet, err := f.OvnClientSet.KubeovnV1().Subnets().Get(context.Background(), "join", metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - for _, no := range nodes.Items { - annotations := no.Annotations - Expect(annotations[util.AllocatedAnnotation]).To(Equal("true")) - Expect(annotations[util.CidrAnnotation]).To(Equal(subnet.Spec.CIDRBlock)) - Expect(annotations[util.GatewayAnnotation]).To(Equal(subnet.Spec.Gateway)) - Expect(annotations[util.IpAddressAnnotation]).NotTo(BeEmpty()) - Expect(util.CIDRContainIP(annotations[util.CidrAnnotation], annotations[util.IpAddressAnnotation])).To(BeTrue()) - Expect(annotations[util.MacAddressAnnotation]).NotTo(BeEmpty()) - Expect(annotations[util.PortNameAnnotation]).NotTo(BeEmpty()) - Expect(annotations[util.LogicalSwitchAnnotation]).To(Equal(subnet.Name)) - } - }) -}) diff --git a/test/e2e/qos/qos.go b/test/e2e/qos/qos.go deleted file mode 100644 index 2f9f1d45177..00000000000 --- a/test/e2e/qos/qos.go +++ /dev/null @@ -1,330 +0,0 @@ -package qos - -import ( - "context" - "fmt" - "os" - "strings" - "time" - - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - kubeovn "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "github.com/kubeovn/kube-ovn/pkg/util" - "github.com/kubeovn/kube-ovn/test/e2e/framework" -) - -const testImage = "kubeovn/pause:3.2" - -var _ = Describe("[Qos]", func() { - namespace := "qos" - f := framework.NewFramework("qos", fmt.Sprintf("%s/.kube/config", os.Getenv("HOME"))) - - ns := corev1.Namespace{ - ObjectMeta: metav1.ObjectMeta{ - Name: namespace, - Labels: map[string]string{"e2e": "true"}, - }, - } - if _, err := f.KubeClientSet.CoreV1().Namespaces().Create(context.Background(), &ns, metav1.CreateOptions{}); err != nil { - Fail(err.Error()) - } - - It("create netem qos", func() { - name := f.GetName() - autoMount := false - pod := &corev1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: namespace, - Labels: map[string]string{ - "e2e": "true", - "kubernetes.io/hostname": "kube-ovn-control-plane", - }, - Annotations: map[string]string{ - util.NetemQosLatencyAnnotation: "600", - util.NetemQosLimitAnnotation: "2000", - util.NetemQosLossAnnotation: "10", - }, - }, - Spec: corev1.PodSpec{ - NodeName: "kube-ovn-control-plane", - Containers: []corev1.Container{ - { - Name: name, - Image: testImage, - ImagePullPolicy: corev1.PullIfNotPresent, - }, - }, - AutomountServiceAccountToken: &autoMount, - }, - } - - By("Create pod") - _, err := f.KubeClientSet.CoreV1().Pods(namespace).Create(context.Background(), pod, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - _, err = f.WaitPodReady(name, namespace) - Expect(err).NotTo(HaveOccurred()) - - By("Check Qos annotation") - pod, err = f.KubeClientSet.CoreV1().Pods(namespace).Get(context.Background(), name, metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - Expect(pod.Annotations[util.AllocatedAnnotation]).To(Equal("true")) - Expect(pod.Annotations[util.RoutedAnnotation]).To(Equal("true")) - Expect(pod.Annotations[util.NetemQosLatencyAnnotation]).To(Equal("600")) - Expect(pod.Annotations[util.NetemQosLimitAnnotation]).To(Equal("2000")) - Expect(pod.Annotations[util.NetemQosLossAnnotation]).To(Equal("10")) - - By("Check Ovs Qos Para") - time.Sleep(3 * time.Second) - qos, err := framework.GetPodNetemQosPara(name, namespace) - Expect(err).NotTo(HaveOccurred()) - Expect(qos.Latency).To(Equal("600000")) - Expect(qos.Limit).To(Equal("2000")) - Expect(qos.Loss).To(Equal("10")) - - By("Delete pod") - err = f.KubeClientSet.CoreV1().Pods(namespace).Delete(context.Background(), pod.Name, metav1.DeleteOptions{}) - Expect(err).NotTo(HaveOccurred()) - }) - - It("update netem qos", func() { - name := f.GetName() - autoMount := false - oriPod := &corev1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: namespace, - Labels: map[string]string{ - "e2e": "true", - "kubernetes.io/hostname": "kube-ovn-control-plane", - }, - }, - Spec: corev1.PodSpec{ - NodeName: "kube-ovn-control-plane", - Containers: []corev1.Container{ - { - Name: name, - Image: testImage, - ImagePullPolicy: corev1.PullIfNotPresent, - }, - }, - AutomountServiceAccountToken: &autoMount, - }, - } - - By("Create pod") - _, err := f.KubeClientSet.CoreV1().Pods(namespace).Create(context.Background(), oriPod, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - oriPod, err = f.WaitPodReady(name, namespace) - Expect(err).NotTo(HaveOccurred()) - pod := oriPod.DeepCopy() - - By("Annotate pod with netem qos") - pod.Annotations[util.NetemQosLatencyAnnotation] = "600" - pod.Annotations[util.NetemQosLimitAnnotation] = "2000" - pod.Annotations[util.NetemQosLossAnnotation] = "10" - patch, err := util.GenerateStrategicMergePatchPayload(oriPod, pod) - Expect(err).NotTo(HaveOccurred()) - - _, err = f.KubeClientSet.CoreV1().Pods(namespace).Patch(context.Background(), name, types.StrategicMergePatchType, patch, metav1.PatchOptions{}, "") - Expect(err).NotTo(HaveOccurred()) - - pod, err = f.KubeClientSet.CoreV1().Pods(namespace).Get(context.Background(), name, metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - Expect(pod.Annotations[util.AllocatedAnnotation]).To(Equal("true")) - Expect(pod.Annotations[util.RoutedAnnotation]).To(Equal("true")) - Expect(pod.Annotations[util.NetemQosLatencyAnnotation]).To(Equal("600")) - Expect(pod.Annotations[util.NetemQosLimitAnnotation]).To(Equal("2000")) - Expect(pod.Annotations[util.NetemQosLossAnnotation]).To(Equal("10")) - - By("Check ovs qos") - time.Sleep(3 * time.Second) - qos, err := framework.GetPodNetemQosPara(name, namespace) - Expect(err).NotTo(HaveOccurred()) - Expect(qos.Latency).To(Equal("600000")) - Expect(qos.Limit).To(Equal("2000")) - Expect(qos.Loss).To(Equal("10")) - - By("Delete pod") - err = f.KubeClientSet.CoreV1().Pods(namespace).Delete(context.Background(), pod.Name, metav1.DeleteOptions{}) - Expect(err).NotTo(HaveOccurred()) - }) - - It("create htb qos", func() { - name := f.GetName() - autoMount := false - pod := &corev1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: namespace, - Labels: map[string]string{ - "e2e": "true", - "kubernetes.io/hostname": "kube-ovn-control-plane", - }, - Annotations: map[string]string{ - util.PriorityAnnotation: "50", - util.IngressRateAnnotation: "300", - }, - }, - Spec: corev1.PodSpec{ - NodeName: "kube-ovn-control-plane", - Containers: []corev1.Container{ - { - Name: name, - Image: testImage, - ImagePullPolicy: corev1.PullIfNotPresent, - }, - }, - AutomountServiceAccountToken: &autoMount, - }, - } - - By("Create pod") - _, err := f.KubeClientSet.CoreV1().Pods(namespace).Create(context.Background(), pod, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - _, err = f.WaitPodReady(name, namespace) - Expect(err).NotTo(HaveOccurred()) - - By("Check Qos annotation") - pod, err = f.KubeClientSet.CoreV1().Pods(namespace).Get(context.Background(), name, metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - Expect(pod.Annotations[util.AllocatedAnnotation]).To(Equal("true")) - Expect(pod.Annotations[util.RoutedAnnotation]).To(Equal("true")) - Expect(pod.Annotations[util.PriorityAnnotation]).To(Equal("50")) - Expect(pod.Annotations[util.IngressRateAnnotation]).To(Equal("300")) - - By("Check Ovs Qos Para") - time.Sleep(3 * time.Second) - priority, rate, err := framework.GetPodHtbQosPara(name, namespace) - Expect(err).NotTo(HaveOccurred()) - Expect(priority).To(Equal("50")) - Expect(rate).To(Equal("300000000")) - - By("Delete pod") - err = f.KubeClientSet.CoreV1().Pods(namespace).Delete(context.Background(), pod.Name, metav1.DeleteOptions{}) - Expect(err).NotTo(HaveOccurred()) - }) - - It("update htb qos", func() { - name := f.GetName() - isIPv6 := strings.EqualFold(os.Getenv("IPV6"), "true") - cidr := "20.6.0.0/16" - if isIPv6 { - cidr = "fc00:20:6::/112" - } - - By("create subnet with htbqos") - s := kubeovn.Subnet{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Labels: map[string]string{"e2e": "true"}, - }, - Spec: kubeovn.SubnetSpec{ - CIDRBlock: cidr, - Protocol: util.CheckProtocol(cidr), - HtbQos: util.HtbQosLow, - Namespaces: []string{namespace}, - }, - } - _, err := f.OvnClientSet.KubeovnV1().Subnets().Create(context.Background(), &s, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - err = f.WaitSubnetReady(name) - Expect(err).NotTo(HaveOccurred()) - - subnet, err := f.OvnClientSet.KubeovnV1().Subnets().Get(context.Background(), name, metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - Expect(subnet.Spec.HtbQos).To(Equal(util.HtbQosLow)) - - autoMount := false - oriPod := &corev1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: namespace, - Labels: map[string]string{ - "e2e": "true", - "kubernetes.io/hostname": "kube-ovn-control-plane", - }, - Annotations: map[string]string{ - util.LogicalSwitchAnnotation: subnet.Name, - }, - }, - Spec: corev1.PodSpec{ - NodeName: "kube-ovn-control-plane", - Containers: []corev1.Container{ - { - Name: name, - Image: testImage, - ImagePullPolicy: corev1.PullIfNotPresent, - }, - }, - AutomountServiceAccountToken: &autoMount, - }, - } - - By("Create pod") - _, err = f.KubeClientSet.CoreV1().Pods(namespace).Create(context.Background(), oriPod, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - oriPod, err = f.WaitPodReady(name, namespace) - Expect(err).NotTo(HaveOccurred()) - - By("Check Ovs Qos Para, same as subnet") - time.Sleep(3 * time.Second) - priority, _, err := framework.GetPodHtbQosPara(name, namespace) - Expect(err).NotTo(HaveOccurred()) - Expect(priority).To(Equal("5")) - - By("Annotate pod with priority") - pod := oriPod.DeepCopy() - pod.Annotations[util.PriorityAnnotation] = "2" - - patch, err := util.GenerateStrategicMergePatchPayload(oriPod, pod) - Expect(err).NotTo(HaveOccurred()) - - _, err = f.KubeClientSet.CoreV1().Pods(namespace).Patch(context.Background(), name, types.StrategicMergePatchType, patch, metav1.PatchOptions{}, "") - Expect(err).NotTo(HaveOccurred()) - - pod, err = f.KubeClientSet.CoreV1().Pods(namespace).Get(context.Background(), name, metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - Expect(pod.Annotations[util.PriorityAnnotation]).To(Equal("2")) - - By("Check Ovs Qos Para") - time.Sleep(3 * time.Second) - priority, _, err = framework.GetPodHtbQosPara(name, namespace) - Expect(err).NotTo(HaveOccurred()) - Expect(priority).To(Equal("2")) - - By("Delete Pod priority annotation") - testPod := pod.DeepCopy() - delete(testPod.Annotations, util.PriorityAnnotation) - - patch, err = util.GenerateStrategicMergePatchPayload(pod, testPod) - Expect(err).NotTo(HaveOccurred()) - - _, err = f.KubeClientSet.CoreV1().Pods(namespace).Patch(context.Background(), name, types.StrategicMergePatchType, patch, metav1.PatchOptions{}, "") - Expect(err).NotTo(HaveOccurred()) - - _, err = f.KubeClientSet.CoreV1().Pods(namespace).Get(context.Background(), name, metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - - By("Check Ovs Qos Para, priority from subnet") - time.Sleep(3 * time.Second) - priority, _, err = framework.GetPodHtbQosPara(name, namespace) - Expect(err).NotTo(HaveOccurred()) - Expect(priority).To(Equal("5")) - - By("Delete pod") - err = f.KubeClientSet.CoreV1().Pods(namespace).Delete(context.Background(), pod.Name, metav1.DeleteOptions{}) - Expect(err).NotTo(HaveOccurred()) - }) -}) diff --git a/test/e2e/service/service.go b/test/e2e/service/service.go deleted file mode 100644 index 30fc2eaecf5..00000000000 --- a/test/e2e/service/service.go +++ /dev/null @@ -1,357 +0,0 @@ -package service - -import ( - "bytes" - "context" - "fmt" - "os" - "os/exec" - "strings" - - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - k8sruntime "k8s.io/apimachinery/pkg/runtime" - "k8s.io/client-go/kubernetes" - kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants" - kubeproxyconfig "k8s.io/kubernetes/pkg/proxy/apis/config" - kubeproxyscheme "k8s.io/kubernetes/pkg/proxy/apis/config/scheme" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/kubeovn/kube-ovn/pkg/util" - "github.com/kubeovn/kube-ovn/test/e2e/framework" -) - -const namespace = "kube-system" - -var dockerArgs = []string{"exec", "kube-ovn-e2e", "curl"} - -func nodeIPs(node corev1.Node) []string { - nodeIPv4, nodeIPv6 := util.GetNodeInternalIP(node) - var nodeIPs []string - if nodeIPv4 != "" { - nodeIPs = append(nodeIPs, nodeIPv4) - } - if nodeIPv6 != "" { - nodeIPs = append(nodeIPs, nodeIPv6) - } - return nodeIPs -} - -func curlArgs(ip string, port int32) string { - return fmt.Sprintf("-s -m 3 -o /dev/null -w %%{http_code} %s/metrics", util.JoinHostPort(ip, port)) -} - -func kubectlArgs(pod, ip string, port int32) string { - return fmt.Sprintf("-n kube-system exec %s -- curl %s", pod, curlArgs(ip, port)) -} - -func setSvcTypeToNodePort(kubeClientSet kubernetes.Interface, name string) (*corev1.Service, error) { - svc, err := kubeClientSet.CoreV1().Services(namespace).Get(context.Background(), name, metav1.GetOptions{}) - if err != nil { - return nil, err - } - if svc.Spec.Type == corev1.ServiceTypeNodePort { - return svc, nil - } - - newSvc := svc.DeepCopy() - newSvc.Spec.Type = corev1.ServiceTypeNodePort - return kubeClientSet.CoreV1().Services(svc.Namespace).Update(context.Background(), newSvc, metav1.UpdateOptions{}) -} - -func setSvcEtpToLocal(kubeClientSet kubernetes.Interface, name string) (*corev1.Service, error) { - svc, err := kubeClientSet.CoreV1().Services(namespace).Get(context.Background(), name, metav1.GetOptions{}) - if err != nil { - return nil, err - } - if svc.Spec.Type == corev1.ServiceTypeNodePort && svc.Spec.ExternalTrafficPolicy == corev1.ServiceExternalTrafficPolicyTypeLocal { - return svc, nil - } - - newSvc := svc.DeepCopy() - newSvc.Spec.Type = corev1.ServiceTypeNodePort - newSvc.Spec.ExternalTrafficPolicy = corev1.ServiceExternalTrafficPolicyTypeLocal - return kubeClientSet.CoreV1().Services(svc.Namespace).Update(context.Background(), newSvc, metav1.UpdateOptions{}) -} - -func hasEndpoint(node string, endpoints *corev1.Endpoints) bool { - for _, subset := range endpoints.Subsets { - for _, addr := range subset.Addresses { - if addr.NodeName != nil && *addr.NodeName == node { - return true - } - } - } - return false -} - -func checkService(checkCount int, shouldSucceed bool, cmd string, args ...string) { - for i := 0; i < checkCount; i++ { - c := exec.Command(cmd, args...) - var stdout, stderr bytes.Buffer - c.Stdout, c.Stderr = &stdout, &stderr - err := c.Run() - output := strings.TrimSpace(stdout.String()) - if shouldSucceed { - Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("stdout: %s, stderr: %s", output, strings.TrimSpace(stderr.String()))) - Expect(output).To(Equal("200")) - } else { - Expect(err).To(HaveOccurred()) - Expect(output).To(Equal("000")) - } - } -} - -var _ = Describe("[Service]", func() { - f := framework.NewFramework("service", fmt.Sprintf("%s/.kube/config", os.Getenv("HOME"))) - hostPods, err := f.KubeClientSet.CoreV1().Pods(namespace).List(context.Background(), metav1.ListOptions{LabelSelector: "app=ovs"}) - Expect(err).NotTo(HaveOccurred()) - - containerPods, err := f.KubeClientSet.CoreV1().Pods(namespace).List(context.Background(), metav1.ListOptions{LabelSelector: "app=kube-ovn-pinger"}) - Expect(err).NotTo(HaveOccurred()) - - hostService, err := setSvcTypeToNodePort(f.KubeClientSet, "kube-ovn-cni") - Expect(err).NotTo(HaveOccurred()) - - containerService, err := setSvcTypeToNodePort(f.KubeClientSet, "kube-ovn-pinger") - Expect(err).NotTo(HaveOccurred()) - - localEtpHostService, err := setSvcEtpToLocal(f.KubeClientSet, "kube-ovn-monitor") - Expect(err).NotTo(HaveOccurred()) - - localEtpHostEndpoints, err := f.KubeClientSet.CoreV1().Endpoints(namespace).Get(context.Background(), localEtpHostService.Name, metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - - nodes, err := f.KubeClientSet.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{}) - Expect(err).NotTo(HaveOccurred()) - checkCount := len(nodes.Items) - - var ciliumChaining, proxyIpvsMode bool - _, err = f.KubeClientSet.AppsV1().DaemonSets(namespace).Get(context.Background(), "cilium", metav1.GetOptions{}) - if err == nil { - ciliumChaining = true - } else { - Expect(errors.IsNotFound(err)).To(BeTrue()) - - kubeProxyConfigMap, err := f.KubeClientSet.CoreV1().ConfigMaps(metav1.NamespaceSystem).Get(context.Background(), kubeadmconstants.KubeProxyConfigMap, metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - - kubeProxyConfig := &kubeproxyconfig.KubeProxyConfiguration{} - err = k8sruntime.DecodeInto(kubeproxyscheme.Codecs.UniversalDecoder(), []byte(kubeProxyConfigMap.Data[kubeadmconstants.KubeProxyConfigMapKey]), kubeProxyConfig) - Expect(err).NotTo(HaveOccurred()) - - proxyIpvsMode = kubeProxyConfig.Mode == kubeproxyconfig.ProxyModeIPVS - } - - Context("service with host network endpoints", func() { - It("container to ClusterIP", func() { - port := hostService.Spec.Ports[0].Port - for _, ip := range hostService.Spec.ClusterIPs { - for _, pod := range containerPods.Items { - checkService(checkCount, true, "kubectl", strings.Fields(kubectlArgs(pod.Name, ip, port))...) - } - } - }) - - It("host to ClusterIP", func() { - port := hostService.Spec.Ports[0].Port - for _, ip := range hostService.Spec.ClusterIPs { - for _, pod := range hostPods.Items { - checkService(checkCount, true, "kubectl", strings.Fields(kubectlArgs(pod.Name, ip, port))...) - } - } - }) - - It("external to ClusterIP", func() { - if ciliumChaining { - return - } - - port := hostService.Spec.Ports[0].Port - for _, ip := range hostService.Spec.ClusterIPs { - checkService(checkCount, true, "docker", append(dockerArgs, strings.Fields(curlArgs(ip, port))...)...) - } - }) - - It("container to NodePort", func() { - port := hostService.Spec.Ports[0].NodePort - for _, pod := range containerPods.Items { - for _, node := range nodes.Items { - for _, nodeIP := range nodeIPs(node) { - checkService(checkCount, true, "kubectl", strings.Fields(kubectlArgs(pod.Name, nodeIP, port))...) - } - } - } - }) - - It("host to NodePort", func() { - port := hostService.Spec.Ports[0].NodePort - for _, pod := range hostPods.Items { - for _, node := range nodes.Items { - for _, nodeIP := range nodeIPs(node) { - checkService(checkCount, true, "kubectl", strings.Fields(kubectlArgs(pod.Name, nodeIP, port))...) - } - } - } - }) - - It("external to NodePort", func() { - if ciliumChaining { - return - } - - port := hostService.Spec.Ports[0].NodePort - for _, node := range nodes.Items { - for _, nodeIP := range nodeIPs(node) { - checkService(checkCount, true, "docker", append(dockerArgs, strings.Fields(curlArgs(nodeIP, port))...)...) - } - } - }) - }) - - Context("service with container network endpoints", func() { - It("container to ClusterIP", func() { - port := containerService.Spec.Ports[0].Port - for _, ip := range containerService.Spec.ClusterIPs { - for _, pod := range containerPods.Items { - checkService(checkCount, true, "kubectl", strings.Fields(kubectlArgs(pod.Name, ip, port))...) - } - } - }) - - It("host to ClusterIP", func() { - port := containerService.Spec.Ports[0].Port - for _, ip := range containerService.Spec.ClusterIPs { - for _, pod := range hostPods.Items { - checkService(checkCount, true, "kubectl", strings.Fields(kubectlArgs(pod.Name, ip, port))...) - } - } - }) - - It("external to ClusterIP", func() { - if ciliumChaining { - return - } - - port := containerService.Spec.Ports[0].Port - for _, ip := range containerService.Spec.ClusterIPs { - checkService(checkCount, true, "docker", append(dockerArgs, strings.Fields(curlArgs(ip, port))...)...) - } - }) - - It("container to NodePort", func() { - port := containerService.Spec.Ports[0].NodePort - for _, pod := range containerPods.Items { - for _, node := range nodes.Items { - for _, nodeIP := range nodeIPs(node) { - checkService(checkCount, true, "kubectl", strings.Fields(kubectlArgs(pod.Name, nodeIP, port))...) - } - } - } - }) - - It("host to NodePort", func() { - port := containerService.Spec.Ports[0].NodePort - for _, pod := range hostPods.Items { - for _, node := range nodes.Items { - for _, nodeIP := range nodeIPs(node) { - checkService(checkCount, true, "kubectl", strings.Fields(kubectlArgs(pod.Name, nodeIP, port))...) - } - } - } - }) - - It("external to NodePort", func() { - if ciliumChaining { - return - } - - port := containerService.Spec.Ports[0].NodePort - for _, node := range nodes.Items { - for _, nodeIP := range nodeIPs(node) { - checkService(checkCount, true, "docker", append(dockerArgs, strings.Fields(curlArgs(nodeIP, port))...)...) - } - } - }) - }) - - Context("host service with local external traffic policy", func() { - It("container to ClusterIP", func() { - port := localEtpHostService.Spec.Ports[0].Port - for _, pod := range containerPods.Items { - for _, ip := range localEtpHostService.Spec.ClusterIPs { - checkService(checkCount, true, "kubectl", strings.Fields(kubectlArgs(pod.Name, ip, port))...) - } - } - }) - - It("host to ClusterIP", func() { - port := localEtpHostService.Spec.Ports[0].Port - for _, pod := range hostPods.Items { - for _, ip := range localEtpHostService.Spec.ClusterIPs { - checkService(checkCount, true, "kubectl", strings.Fields(kubectlArgs(pod.Name, ip, port))...) - } - } - }) - - It("external to ClusterIP", func() { - if ciliumChaining { - return - } - - port := localEtpHostService.Spec.Ports[0].Port - for _, ip := range localEtpHostService.Spec.ClusterIPs { - checkService(checkCount, true, "docker", append(dockerArgs, strings.Fields(curlArgs(ip, port))...)...) - } - }) - - It("container to NodePort", func() { - if ciliumChaining { - return - } - - port := localEtpHostService.Spec.Ports[0].NodePort - for _, node := range nodes.Items { - for _, pod := range containerPods.Items { - for _, nodeIP := range nodeIPs(node) { - checkService(checkCount, true, "kubectl", strings.Fields(kubectlArgs(pod.Name, nodeIP, port))...) - } - } - } - }) - - It("host to NodePort", func() { - if ciliumChaining { - return - } - - port := localEtpHostService.Spec.Ports[0].NodePort - for _, node := range nodes.Items { - hasEndpoint := proxyIpvsMode || hasEndpoint(node.Name, localEtpHostEndpoints) - for _, pod := range hostPods.Items { - shouldSucceed := hasEndpoint || pod.Spec.NodeName == node.Name - for _, nodeIP := range nodeIPs(node) { - checkService(checkCount, shouldSucceed, "kubectl", strings.Fields(kubectlArgs(pod.Name, nodeIP, port))...) - } - } - } - }) - - It("external to NodePort", func() { - if ciliumChaining { - return - } - - port := localEtpHostService.Spec.Ports[0].NodePort - for _, node := range nodes.Items { - shouldSucceed := proxyIpvsMode || hasEndpoint(node.Name, localEtpHostEndpoints) - for _, nodeIP := range nodeIPs(node) { - checkService(checkCount, shouldSucceed, "docker", append(dockerArgs, strings.Fields(curlArgs(nodeIP, port))...)...) - } - } - }) - }) -}) diff --git a/test/e2e/subnet/normal.go b/test/e2e/subnet/normal.go deleted file mode 100644 index 8d5871ade63..00000000000 --- a/test/e2e/subnet/normal.go +++ /dev/null @@ -1,686 +0,0 @@ -package subnet - -import ( - "context" - "fmt" - "math" - "os" - "os/exec" - "strings" - "time" - - corev1 "k8s.io/api/core/v1" - k8serrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/klog/v2" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - kubeovn "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "github.com/kubeovn/kube-ovn/pkg/util" - "github.com/kubeovn/kube-ovn/test/e2e/framework" -) - -var _ = Describe("[Subnet]", func() { - f := framework.NewFramework("subnet", fmt.Sprintf("%s/.kube/config", os.Getenv("HOME"))) - BeforeEach(func() { - if err := f.OvnClientSet.KubeovnV1().Subnets().Delete(context.Background(), f.GetName(), metav1.DeleteOptions{}); err != nil { - if !k8serrors.IsNotFound(err) { - klog.Fatalf("failed to delete subnet %s, %v", f.GetName(), err) - - } - } - if err := f.KubeClientSet.CoreV1().Namespaces().Delete(context.Background(), f.GetName(), metav1.DeleteOptions{}); err != nil { - if !k8serrors.IsNotFound(err) { - klog.Fatalf("failed to delete ns %s, %v", f.GetName(), err) - } - } - }) - AfterEach(func() { - if err := f.OvnClientSet.KubeovnV1().Subnets().Delete(context.Background(), f.GetName(), metav1.DeleteOptions{}); err != nil { - if !k8serrors.IsNotFound(err) { - klog.Fatalf("failed to delete subnet %s, %v", f.GetName(), err) - } - } - if err := f.KubeClientSet.CoreV1().Namespaces().Delete(context.Background(), f.GetName(), metav1.DeleteOptions{}); err != nil { - if !k8serrors.IsNotFound(err) { - klog.Fatalf("failed to delete ns %s, %v", f.GetName(), err) - } - } - }) - - isIPv6 := strings.EqualFold(os.Getenv("IPV6"), "true") - - Describe("Create", func() { - It("only cidr", func() { - name := f.GetName() - af, cidr, protocol := 4, "11.10.0.0/16", kubeovn.ProtocolIPv4 - if isIPv6 { - af, cidr, protocol = 6, "fc00:11:10::/112", kubeovn.ProtocolIPv6 - } - gateway, _ := util.FirstIP(cidr) - - By("create subnet") - s := kubeovn.Subnet{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Labels: map[string]string{"e2e": "true"}, - }, - Spec: kubeovn.SubnetSpec{ - CIDRBlock: cidr, - Protocol: util.CheckProtocol(cidr), - }, - } - _, err := f.OvnClientSet.KubeovnV1().Subnets().Create(context.Background(), &s, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - By("validate subnet") - err = f.WaitSubnetReady(name) - Expect(err).NotTo(HaveOccurred()) - - subnet, err := f.OvnClientSet.KubeovnV1().Subnets().Get(context.Background(), name, metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - Expect(subnet.Spec.Default).To(BeFalse()) - Expect(subnet.Spec.Protocol).To(Equal(protocol)) - Expect(subnet.Spec.Namespaces).To(BeEmpty()) - Expect(subnet.Spec.ExcludeIps).To(ContainElement(gateway)) - Expect(subnet.Spec.Gateway).To(Equal(gateway)) - Expect(subnet.Spec.GatewayType).To(Equal(kubeovn.GWDistributedType)) - Expect(subnet.Spec.GatewayNode).To(BeEmpty()) - Expect(subnet.Spec.NatOutgoing).To(BeFalse()) - Expect(subnet.Spec.Private).To(BeFalse()) - Expect(subnet.Spec.AllowSubnets).To(BeEmpty()) - Expect(subnet.ObjectMeta.Finalizers).To(ContainElement(util.ControllerName)) - - By("validate status") - Expect(subnet.Status.ActivateGateway).To(BeEmpty()) - if isIPv6 { - Expect(subnet.Status.V6AvailableIPs).To(Equal(math.Exp2(128-112) - 3)) - } else { - Expect(subnet.Status.V4AvailableIPs).To(Equal(math.Exp2(32-16) - 3)) - } - Expect(subnet.Status.V4UsingIPs).To(BeZero()) - Expect(subnet.Status.V6UsingIPs).To(BeZero()) - - pods, err := f.KubeClientSet.CoreV1().Pods("kube-system").List(context.Background(), metav1.ListOptions{LabelSelector: "app=ovs"}) - Expect(err).NotTo(HaveOccurred()) - for _, pod := range pods.Items { - stdout, _, err := f.ExecToPodThroughAPI(fmt.Sprintf("ip -%d route list root %s", af, subnet.Spec.CIDRBlock), "openvswitch", pod.Name, pod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - Expect(stdout).To(ContainSubstring("ovn0")) - } - }) - - It("centralized gateway", func() { - name := f.GetName() - cidr := "11.11.0.0/16" - if isIPv6 { - cidr = "fc00:11:11::/112" - } - - By("create subnet") - s := kubeovn.Subnet{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Labels: map[string]string{"e2e": "true"}, - }, - Spec: kubeovn.SubnetSpec{ - CIDRBlock: cidr, - GatewayType: kubeovn.GWCentralizedType, - GatewayNode: "kube-ovn-control-plane,kube-ovn-worker,kube-ovn-worker2", - Protocol: util.CheckProtocol(cidr), - }, - } - _, err := f.OvnClientSet.KubeovnV1().Subnets().Create(context.Background(), &s, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - By("validate subnet") - err = f.WaitSubnetReady(name) - Expect(err).NotTo(HaveOccurred()) - time.Sleep(5 * time.Second) - - subnet, err := f.OvnClientSet.KubeovnV1().Subnets().Get(context.Background(), name, metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - Expect(subnet.Spec.GatewayType).To(Equal(kubeovn.GWCentralizedType)) - }) - }) - - Describe("Update", func() { - It("distributed to centralized", func() { - name := f.GetName() - cidr := "11.12.0.0/16" - if isIPv6 { - cidr = "fc00:11:12::/112" - } - - By("create subnet") - s := &kubeovn.Subnet{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Labels: map[string]string{"e2e": "true"}, - }, - Spec: kubeovn.SubnetSpec{ - CIDRBlock: cidr, - Protocol: util.CheckProtocol(cidr), - }, - } - _, err := f.OvnClientSet.KubeovnV1().Subnets().Create(context.Background(), s, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - err = f.WaitSubnetReady(name) - Expect(err).NotTo(HaveOccurred()) - - for i := 0; i < 3; i++ { - s, err = f.OvnClientSet.KubeovnV1().Subnets().Get(context.Background(), name, metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - s.Spec.GatewayType = kubeovn.GWCentralizedType - s.Spec.GatewayNode = "kube-ovn-control-plane,kube-ovn-worker,kube-ovn-worker2" - _, err = f.OvnClientSet.KubeovnV1().Subnets().Update(context.Background(), s, metav1.UpdateOptions{}) - if err == nil { - break - } - } - Expect(err).NotTo(HaveOccurred()) - - time.Sleep(5 * time.Second) - s, err = f.OvnClientSet.KubeovnV1().Subnets().Get(context.Background(), name, metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - - Expect(s.Spec.GatewayType).To(Equal(kubeovn.GWCentralizedType)) - }) - }) - - Describe("Delete", func() { - It("normal deletion", func() { - name := f.GetName() - cidr := "11.13.0.0/16" - if isIPv6 { - cidr = "fc00:11:13::/112" - } - By("create subnet") - s := kubeovn.Subnet{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Labels: map[string]string{"e2e": "true"}, - }, - Spec: kubeovn.SubnetSpec{ - CIDRBlock: cidr, - Protocol: util.CheckProtocol(cidr), - }, - } - _, err := f.OvnClientSet.KubeovnV1().Subnets().Create(context.Background(), &s, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - time.Sleep(5 * time.Second) - err = f.OvnClientSet.KubeovnV1().Subnets().Delete(context.Background(), name, metav1.DeleteOptions{}) - Expect(err).NotTo(HaveOccurred()) - - time.Sleep(5 * time.Second) - pods, err := f.KubeClientSet.CoreV1().Pods("kube-system").List(context.Background(), metav1.ListOptions{LabelSelector: "app=ovs"}) - Expect(err).NotTo(HaveOccurred()) - for _, pod := range pods.Items { - stdout, _, err := f.ExecToPodThroughAPI("ip route", "openvswitch", pod.Name, pod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - Expect(stdout).NotTo(ContainSubstring(s.Spec.CIDRBlock)) - } - }) - }) - - Describe("cidr with nonstandard style", func() { - It("cidr ends with nonzero", func() { - name := f.GetName() - cidr := "11.14.0.10/16" - if isIPv6 { - cidr = "fc00:11:14::/112" - } - By("create subnet") - s := &kubeovn.Subnet{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Labels: map[string]string{"e2e": "true"}, - }, - Spec: kubeovn.SubnetSpec{ - CIDRBlock: cidr, - Protocol: util.CheckProtocol(cidr), - }, - } - - _, err := f.OvnClientSet.KubeovnV1().Subnets().Create(context.Background(), s, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - err = f.WaitSubnetReady(name) - Expect(err).NotTo(HaveOccurred()) - - s, err = f.OvnClientSet.KubeovnV1().Subnets().Get(context.Background(), name, metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - if !isIPv6 { - Expect(s.Spec.CIDRBlock).To(Equal("11.14.0.0/16")) - } else { - Expect(s.Spec.CIDRBlock).To(Equal("fc00:11:14::/112")) - } - - }) - }) - - Describe("available ip calculation", func() { - It("no available cidr", func() { - name := f.GetName() - s := &kubeovn.Subnet{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Labels: map[string]string{"e2e": "true"}, - }, - Spec: kubeovn.SubnetSpec{ - CIDRBlock: "19.0.0.0/31", - ExcludeIps: []string{"179.17.0.0..179.17.0.10"}, - Protocol: util.CheckProtocol("19.0.0.0/31"), - }, - } - _, err := f.OvnClientSet.KubeovnV1().Subnets().Create(context.Background(), s, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - err = f.WaitSubnetReady(name) - Expect(err).NotTo(HaveOccurred()) - - s, err = f.OvnClientSet.KubeovnV1().Subnets().Get(context.Background(), name, metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - Expect(s.Status.V4AvailableIPs).To(Equal(float64(0))) - }) - - It("small cidr", func() { - name := f.GetName() - s := &kubeovn.Subnet{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Labels: map[string]string{"e2e": "true"}, - }, - Spec: kubeovn.SubnetSpec{ - CIDRBlock: "29.0.0.0/30", - ExcludeIps: []string{"179.17.0.0..179.17.0.10"}, - Protocol: util.CheckProtocol("29.0.0.0/30"), - }, - } - _, err := f.OvnClientSet.KubeovnV1().Subnets().Create(context.Background(), s, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - err = f.WaitSubnetReady(name) - Expect(err).NotTo(HaveOccurred()) - - s, err = f.OvnClientSet.KubeovnV1().Subnets().Get(context.Background(), name, metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - Expect(s.Status.V4AvailableIPs).To(Equal(float64(1))) - }) - - It("with excludeips", func() { - name := f.GetName() - s := &kubeovn.Subnet{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Labels: map[string]string{"e2e": "true"}, - }, - Spec: kubeovn.SubnetSpec{ - CIDRBlock: "179.17.0.0/24", - ExcludeIps: []string{"179.17.0.0..179.17.0.10"}, - Protocol: util.CheckProtocol("179.17.0.0/24"), - }, - } - _, err := f.OvnClientSet.KubeovnV1().Subnets().Create(context.Background(), s, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - err = f.WaitSubnetReady(name) - Expect(err).NotTo(HaveOccurred()) - - s, err = f.OvnClientSet.KubeovnV1().Subnets().Get(context.Background(), name, metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - Expect(s.Status.V4AvailableIPs).To(Equal(float64(244))) - }) - }) - - Describe("External Egress Gateway", func() { - It("centralized gateway with external egress gateway", func() { - nodes, err := f.KubeClientSet.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{}) - Expect(err).NotTo(HaveOccurred()) - Expect(nodes).NotTo(BeNil()) - Expect(nodes.Items).NotTo(BeEmpty()) - - for _, node := range nodes.Items { - Expect(node.Status.Addresses).NotTo(BeEmpty()) - } - - name := f.GetName() - priority, tableID := uint32(1001), uint32(1002) - - af, cidr := 4, "11.15.0.0/16" - if isIPv6 { - af, cidr = 6, "fc00:11:15::/112" - } - - var egw string - nodeIPv4, nodeIPv6 := util.GetNodeInternalIP(nodes.Items[0]) - if isIPv6 { - egw, _ = util.FirstIP(fmt.Sprintf("%s/%d", nodeIPv6, 64)) - } else { - egw, _ = util.FirstIP(fmt.Sprintf("%s/%d", nodeIPv4, 16)) - } - - gatewayNodes := make([]string, 0, 2) - nodeIPs := make(map[string]string) - for i := 0; i < 2 && i < len(nodes.Items); i++ { - gatewayNodes = append(gatewayNodes, nodes.Items[i].Name) - nodeIPv4, nodeIPv6 := util.GetNodeInternalIP(nodes.Items[i]) - if nodeIPv4 != "" { - nodeIPs[nodeIPv4] = gatewayNodes[i] - } - if nodeIPv6 != "" { - nodeIPs[nodeIPv6] = gatewayNodes[i] - } - } - - By("create subnet") - subnet := &kubeovn.Subnet{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Labels: map[string]string{"e2e": "true"}, - }, - Spec: kubeovn.SubnetSpec{ - CIDRBlock: cidr, - GatewayType: kubeovn.GWCentralizedType, - GatewayNode: strings.Join(gatewayNodes, ","), - ExternalEgressGateway: egw, - PolicyRoutingPriority: priority, - PolicyRoutingTableID: tableID, - Protocol: util.CheckProtocol(cidr), - }, - } - _, err = f.OvnClientSet.KubeovnV1().Subnets().Create(context.Background(), subnet, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - By("validate subnet") - err = f.WaitSubnetReady(name) - Expect(err).NotTo(HaveOccurred()) - - subnet, err = f.OvnClientSet.KubeovnV1().Subnets().Get(context.Background(), name, metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - Expect(subnet.Spec.GatewayType).To(Equal(kubeovn.GWCentralizedType)) - Expect(subnet.Spec.ExternalEgressGateway).To(Equal(egw)) - Expect(subnet.Spec.PolicyRoutingPriority).To(Equal(priority)) - Expect(subnet.Spec.PolicyRoutingTableID).To(Equal(tableID)) - time.Sleep(5 * time.Second) - - ovsPods, err := f.KubeClientSet.CoreV1().Pods("kube-system").List(context.Background(), metav1.ListOptions{LabelSelector: "app=ovs"}) - Expect(err).NotTo(HaveOccurred()) - - rulePrefix := fmt.Sprintf("%d:", priority) - ruleSuffix := fmt.Sprintf("from %s lookup %d", subnet.Spec.CIDRBlock, tableID) - routePrefix := fmt.Sprintf("default via %s ", egw) - - for _, pod := range ovsPods.Items { - if nodeIPs[pod.Status.HostIP] == "" { - continue - } - - stdout, _, err := f.ExecToPodThroughAPI(fmt.Sprintf("ip -%d rule show", af), "openvswitch", pod.Name, pod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - - var found bool - rules := strings.Split(stdout, "\n") - for _, rule := range rules { - if strings.HasPrefix(rule, rulePrefix) && strings.HasSuffix(rule, ruleSuffix) { - found = true - break - } - } - Expect(found).To(BeTrue()) - - stdout, _, err = f.ExecToPodThroughAPI(fmt.Sprintf("ip -%d route show table %d", af, tableID), "openvswitch", pod.Name, pod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - Expect(stdout).To(HavePrefix(routePrefix)) - } - - By("dis-ready gateway node") - gwNodesResult, err := f.OvnClientSet.KubeovnV1().Subnets().Get(context.Background(), name, metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - gatewayNodes = strings.Split(gwNodesResult.Spec.GatewayNode, ",") - - cmd := "docker exec -i " + gatewayNodes[0] + " systemctl stop kubelet" - _, err = exec.Command("bash", "-c", cmd).CombinedOutput() - Expect(err).NotTo(HaveOccurred()) - - time.Sleep(time.Second * 10) - for _, pod := range ovsPods.Items { - if nodeIPs[pod.Status.HostIP] == "" || pod.Spec.NodeName == gatewayNodes[0] { - continue - } - - stdout, _, err := f.ExecToPodThroughAPI(fmt.Sprintf("ip -%d rule show", af), "openvswitch", pod.Name, pod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - - var found bool - rules := strings.Split(stdout, "\n") - for _, rule := range rules { - if strings.HasPrefix(rule, rulePrefix) && strings.HasSuffix(rule, ruleSuffix) { - found = true - break - } - } - Expect(found).To(BeTrue()) - - stdout, _, err = f.ExecToPodThroughAPI(fmt.Sprintf("ip -%d route show table %d", af, tableID), "openvswitch", pod.Name, pod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - Expect(stdout).To(HavePrefix(routePrefix)) - } - - cmd = "docker exec -i " + gatewayNodes[0] + " systemctl restart kubelet" - _, err = exec.Command("bash", "-c", cmd).CombinedOutput() - Expect(err).NotTo(HaveOccurred()) - - time.Sleep(time.Second * 30) - - By("delete subnet") - err = f.OvnClientSet.KubeovnV1().Subnets().Delete(context.Background(), name, metav1.DeleteOptions{}) - Expect(err).NotTo(HaveOccurred()) - time.Sleep(5 * time.Second) - - for _, pod := range ovsPods.Items { - if nodeIPs[pod.Status.HostIP] == "" { - continue - } - - stdout, _, err := f.ExecToPodThroughAPI(fmt.Sprintf("ip -%d rule show", af), "openvswitch", pod.Name, pod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - - var found bool - rules := strings.Split(stdout, "\n") - for _, rule := range rules { - if strings.HasPrefix(rule, rulePrefix) && strings.HasSuffix(rule, ruleSuffix) { - found = true - break - } - } - Expect(found).NotTo(BeTrue()) - - stdout, _, err = f.ExecToPodThroughAPI(fmt.Sprintf("ip -%d route show table %d", af, tableID), "openvswitch", pod.Name, pod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - Expect(stdout).NotTo(HavePrefix(routePrefix)) - } - }) - - It("distributed gateway with external egress gateway", func() { - nodes, err := f.KubeClientSet.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{}) - Expect(err).NotTo(HaveOccurred()) - Expect(nodes).NotTo(BeNil()) - Expect(nodes.Items).NotTo(BeEmpty()) - - for _, node := range nodes.Items { - Expect(node.Status.Addresses).NotTo(BeEmpty()) - } - - By("create namespace") - namespace := f.GetName() - _, err = f.KubeClientSet.CoreV1().Namespaces().Create(context.Background(), &corev1.Namespace{ - ObjectMeta: metav1.ObjectMeta{ - Name: namespace, - Labels: map[string]string{"e2e": "true"}, - }, - }, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - name := f.GetName() - priority, tableID := uint32(1003), uint32(1004) - - af, cidr := 4, "11.16.0.0/16" - if isIPv6 { - af, cidr = 6, "fc00:11:16::/112" - } - - var selectedNode *corev1.Node - for i, node := range nodes.Items { - if node.Spec.Unschedulable { - continue - } - - var unschedulable bool - for _, t := range node.Spec.Taints { - if t.Effect == corev1.TaintEffectNoSchedule { - unschedulable = true - break - } - } - if !unschedulable { - selectedNode = &nodes.Items[i] - break - } - } - Expect(selectedNode).NotTo(BeNil()) - - var egw string - nodeIPv4, nodeIPv6 := util.GetNodeInternalIP(*selectedNode) - if isIPv6 { - egw, _ = util.FirstIP(fmt.Sprintf("%s/%d", nodeIPv6, 64)) - } else { - egw, _ = util.FirstIP(fmt.Sprintf("%s/%d", nodeIPv4, 16)) - } - - By("create subnet") - s := kubeovn.Subnet{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Labels: map[string]string{"e2e": "true"}, - }, - Spec: kubeovn.SubnetSpec{ - CIDRBlock: cidr, - GatewayType: kubeovn.GWDistributedType, - ExternalEgressGateway: egw, - PolicyRoutingPriority: priority, - PolicyRoutingTableID: tableID, - Namespaces: []string{namespace}, - Protocol: util.CheckProtocol(cidr), - }, - } - _, err = f.OvnClientSet.KubeovnV1().Subnets().Create(context.Background(), &s, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - By("validate subnet") - err = f.WaitSubnetReady(name) - Expect(err).NotTo(HaveOccurred()) - - subnet, err := f.OvnClientSet.KubeovnV1().Subnets().Get(context.Background(), name, metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - Expect(subnet.Spec.GatewayType).To(Equal(kubeovn.GWDistributedType)) - Expect(subnet.Spec.ExternalEgressGateway).To(Equal(egw)) - Expect(subnet.Spec.PolicyRoutingPriority).To(Equal(priority)) - Expect(subnet.Spec.PolicyRoutingTableID).To(Equal(tableID)) - - pod := &corev1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: namespace, - }, - Spec: corev1.PodSpec{ - Containers: []corev1.Container{ - { - Name: name, - Image: "kubeovn/pause:3.2", - ImagePullPolicy: corev1.PullIfNotPresent, - }, - }, - NodeSelector: map[string]string{"kubernetes.io/hostname": selectedNode.Name}, - }, - } - - By("create pod") - _, err = f.KubeClientSet.CoreV1().Pods(namespace).Create(context.Background(), pod, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - pod, err = f.WaitPodReady(name, namespace) - Expect(err).NotTo(HaveOccurred()) - - ovsPods, err := f.KubeClientSet.CoreV1().Pods("kube-system").List(context.Background(), metav1.ListOptions{LabelSelector: "app=ovs"}) - Expect(err).NotTo(HaveOccurred()) - - rulePrefix := fmt.Sprintf("%d:", priority) - ruleSuffix := fmt.Sprintf("from %s lookup %d", pod.Status.PodIP, tableID) - routePrefix := fmt.Sprintf("default via %s ", egw) - - var ovsPod *corev1.Pod - for i := range ovsPods.Items { - if ovsPods.Items[i].Spec.NodeName == selectedNode.Name { - ovsPod = &ovsPods.Items[i] - break - } - } - Expect(ovsPod).NotTo(BeNil()) - - stdout, _, err := f.ExecToPodThroughAPI(fmt.Sprintf("ip -%d rule show", af), "openvswitch", ovsPod.Name, ovsPod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - - var found bool - rules := strings.Split(stdout, "\n") - for _, rule := range rules { - if strings.HasPrefix(rule, rulePrefix) && strings.HasSuffix(rule, ruleSuffix) { - found = true - break - } - } - Expect(found).To(BeTrue()) - - stdout, _, err = f.ExecToPodThroughAPI(fmt.Sprintf("ip -%d route show table %d", af, tableID), "openvswitch", ovsPod.Name, ovsPod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - Expect(stdout).To(HavePrefix(routePrefix)) - - By("delete pod") - err = f.KubeClientSet.CoreV1().Pods(namespace).Delete(context.Background(), name, metav1.DeleteOptions{}) - Expect(err).NotTo(HaveOccurred()) - - err = f.WaitPodDeleted(name, namespace) - Expect(err).NotTo(HaveOccurred()) - - stdout, _, err = f.ExecToPodThroughAPI(fmt.Sprintf("ip -%d rule show", af), "openvswitch", ovsPod.Name, ovsPod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - - found = false - rules = strings.Split(stdout, "\n") - for _, rule := range rules { - if strings.HasPrefix(rule, rulePrefix) && strings.HasSuffix(rule, ruleSuffix) { - found = true - break - } - } - Expect(found).NotTo(BeTrue()) - - stdout, _, err = f.ExecToPodThroughAPI(fmt.Sprintf("ip -%d route show table %d", af, tableID), "openvswitch", ovsPod.Name, ovsPod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - Expect(stdout).To(HavePrefix(routePrefix)) - - By("delete subnet") - err = f.OvnClientSet.KubeovnV1().Subnets().Delete(context.Background(), name, metav1.DeleteOptions{}) - Expect(err).NotTo(HaveOccurred()) - time.Sleep(5 * time.Second) - - stdout, _, err = f.ExecToPodThroughAPI(fmt.Sprintf("ip -%d route show table %d", af, tableID), "openvswitch", ovsPod.Name, ovsPod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - Expect(stdout).NotTo(HavePrefix(routePrefix)) - }) - }) -}) diff --git a/test/e2e/underlay/underlay.go b/test/e2e/underlay/underlay.go deleted file mode 100644 index 519fb5d341c..00000000000 --- a/test/e2e/underlay/underlay.go +++ /dev/null @@ -1,865 +0,0 @@ -package underlay - -import ( - "context" - "fmt" - "math/rand" - "os" - "os/exec" - "strings" - "time" - - corev1 "k8s.io/api/core/v1" - k8serrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/klog/v2" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - kubeovn "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "github.com/kubeovn/kube-ovn/pkg/util" - "github.com/kubeovn/kube-ovn/test/e2e/framework" -) - -const ( - UnderlayInterface = "eth1" - VlanInterface = "vlan1" - - ProviderNetwork = "net1" - Vlan = "vlan-e2e" - Subnet = "e2e-underlay" - Namespace = "underlay" - - testImage = "kubeovn/pause:3.2" -) - -var ( - ExchangeLinkName bool - - VlanID = os.Getenv("VLAN_ID") - - cidr string - nodeIPs []string - - nodeMac = make(map[string]string) - nodeAddrs = make(map[string][]string) - nodeRoutes = make(map[string][]string) - nodeMTU = make(map[string]int) -) - -func init() { - rand.Seed(time.Now().UnixNano()) - ExchangeLinkName = rand.Intn(2) != 0 -} - -func SetCIDR(s string) { - cidr = s -} -func AddNodeIP(ip string) { - nodeIPs = append(nodeIPs, ip) -} - -func SetNodeMac(node, mac string) { - nodeMac[node] = mac -} -func AddNodeAddrs(node, addr string) { - nodeAddrs[node] = append(nodeAddrs[node], addr) -} -func AddNodeRoutes(node, route string) { - nodeRoutes[node] = append(nodeRoutes[node], route) -} -func SetNodeMTU(node string, mtu int) { - nodeMTU[node] = mtu -} - -var _ = Describe("[Underlay]", func() { - providerInterface := UnderlayInterface - if VlanID != "" { - providerInterface = VlanInterface - } - - f := framework.NewFramework("underlay", fmt.Sprintf("%s/.kube/config", os.Getenv("HOME"))) - - Context("[Provider Network]", func() { - It("normal", func() { - By("validate node labels") - nodes, err := f.KubeClientSet.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{}) - Expect(err).NotTo(HaveOccurred()) - - for _, node := range nodes.Items { - Expect(node.Labels[fmt.Sprintf(util.ProviderNetworkExcludeTemplate, ProviderNetwork)]).To(BeEmpty()) - Expect(node.Labels[fmt.Sprintf(util.ProviderNetworkInterfaceTemplate, ProviderNetwork)]).To(Equal(providerInterface)) - Expect(node.Labels[fmt.Sprintf(util.ProviderNetworkReadyTemplate, ProviderNetwork)]).To(Equal("true")) - Expect(node.Labels[fmt.Sprintf(util.ProviderNetworkMtuTemplate, ProviderNetwork)]).NotTo(BeEmpty()) - } - - By("validate OVS bridge") - ovsPods, err := f.KubeClientSet.CoreV1().Pods("kube-system").List(context.Background(), metav1.ListOptions{LabelSelector: "app=ovs"}) - Expect(err).NotTo(HaveOccurred()) - Expect(ovsPods).NotTo(BeNil()) - for _, node := range nodes.Items { - var ovsPod *corev1.Pod - for _, pod := range ovsPods.Items { - if pod.Spec.NodeName == node.Name { - ovsPod = &pod - break - } - } - Expect(ovsPod).NotTo(BeNil()) - - nic, br := providerInterface, util.ExternalBridgeName(ProviderNetwork) - if ExchangeLinkName { - nic, br = br, nic - } - stdout, _, err := f.ExecToPodThroughAPI("ip addr show "+nic, "openvswitch", ovsPod.Name, ovsPod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - - addrNotFound := make([]bool, len(nodeAddrs[node.Name])) - for _, s := range strings.Split(stdout, "\n") { - s = strings.TrimSpace(s) - for i, addr := range nodeAddrs[node.Name] { - if !strings.HasPrefix(s, fmt.Sprintf("inet %s ", addr)) && !strings.HasPrefix(s, fmt.Sprintf("inet6 %s ", addr)) { - addrNotFound[i] = true - break - } - } - } - for _, found := range addrNotFound { - Expect(found).To(BeTrue()) - } - - stdout, _, err = f.ExecToPodThroughAPI("ovs-vsctl list-ports "+br, "openvswitch", ovsPod.Name, ovsPod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - - var portFound bool - for _, port := range strings.Split(stdout, "\n") { - if port == nic { - portFound = true - break - } - } - Expect(portFound).To(BeTrue()) - - stdout, _, err = f.ExecToPodThroughAPI("ip addr show "+br, "openvswitch", ovsPod.Name, ovsPod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - - var isUp bool - addrFound := make([]bool, len(nodeAddrs[node.Name])) - for i, s := range strings.Split(stdout, "\n") { - if i == 0 { - idx1, idx2 := strings.IndexRune(s, '<'), strings.IndexRune(s, '>') - if idx1 > 0 && idx2 > idx1+1 { - for _, state := range strings.Split(s[idx1+1:idx2], ",") { - if state == "UP" { - isUp = true - break - } - } - } - continue - } - if VlanID == "" { - if i == 1 { - if mac := nodeMac[node.Name]; mac != "" { - Expect(strings.TrimSpace(s)).To(HavePrefix("link/ether %s ", mac)) - continue - } - } - - s = strings.TrimSpace(s) - for i, addr := range nodeAddrs[node.Name] { - if strings.HasPrefix(s, fmt.Sprintf("inet %s ", addr)) || strings.HasPrefix(s, fmt.Sprintf("inet6 %s ", addr)) { - addrFound[i] = true - break - } - } - } - } - Expect(isUp).To(BeTrue()) - if VlanID == "" { - for _, found := range addrFound { - Expect(found).To(BeTrue()) - } - } - } - }) - - It("node annotation", func() { - By("add exclude annotation") - nodes, err := f.KubeClientSet.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{}) - Expect(err).NotTo(HaveOccurred()) - - for _, node := range nodes.Items { - newNode := node.DeepCopy() - newNode.Annotations[fmt.Sprintf(util.ProviderNetworkExcludeTemplate, ProviderNetwork)] = "true" - _, err = f.KubeClientSet.CoreV1().Nodes().Update(context.Background(), newNode, metav1.UpdateOptions{}) - Expect(err).NotTo(HaveOccurred()) - } - - By("wait provider network to be ready") - time.Sleep(3 * time.Second) - err = f.WaitProviderNetworkReady(ProviderNetwork) - Expect(err).NotTo(HaveOccurred()) - - By("validate provider network") - pn, err := f.OvnClientSet.KubeovnV1().ProviderNetworks().Get(context.Background(), ProviderNetwork, metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - for _, node := range nodes.Items { - Expect(util.ContainsString(pn.Spec.ExcludeNodes, node.Name)).To(BeTrue()) - } - - By("validate node annotation") - nodes, err = f.KubeClientSet.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{}) - Expect(err).NotTo(HaveOccurred()) - - for _, node := range nodes.Items { - Expect(node.Annotations).NotTo(HaveKey(fmt.Sprintf(util.ProviderNetworkExcludeTemplate, ProviderNetwork))) - } - - By("restore provider network") - pn, err = f.OvnClientSet.KubeovnV1().ProviderNetworks().Get(context.Background(), ProviderNetwork, metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred()) - - newPn := pn.DeepCopy() - newPn.Spec.ExcludeNodes = nil - _, err = f.OvnClientSet.KubeovnV1().ProviderNetworks().Update(context.Background(), newPn, metav1.UpdateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - By("wait provider network to be ready") - time.Sleep(3 * time.Second) - err = f.WaitProviderNetworkReady(ProviderNetwork) - Expect(err).NotTo(HaveOccurred()) - }) - }) - - Context("[Subnet]", func() { - BeforeEach(func() { - err := f.OvnClientSet.KubeovnV1().Subnets().Delete(context.Background(), f.GetName(), metav1.DeleteOptions{}) - if err != nil && !k8serrors.IsNotFound(err) { - klog.Fatalf("failed to delete subnet %s: %v", f.GetName(), err) - } - }) - AfterEach(func() { - err := f.OvnClientSet.KubeovnV1().Subnets().Delete(context.Background(), f.GetName(), metav1.DeleteOptions{}) - if err != nil && !k8serrors.IsNotFound(err) { - klog.Fatalf("failed to delete subnet %s: %v", f.GetName(), err) - } - }) - - It("logical gateway", func() { - name := f.GetName() - - By("create subnet") - subnet := &kubeovn.Subnet{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Labels: map[string]string{"e2e": "true"}, - }, - Spec: kubeovn.SubnetSpec{ - CIDRBlock: "99.11.0.0/16", - Vlan: Vlan, - LogicalGateway: true, - Protocol: util.CheckProtocol(cidr), - }, - } - _, err := f.OvnClientSet.KubeovnV1().Subnets().Create(context.Background(), subnet, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - By("validate subnet") - err = f.WaitSubnetReady(subnet.Name) - Expect(err).NotTo(HaveOccurred()) - - By("validate OVN logical router port") - ovnPods, err := f.KubeClientSet.CoreV1().Pods("kube-system").List(context.Background(), metav1.ListOptions{LabelSelector: "app=ovn-central,ovn-nb-leader=true"}) - Expect(err).NotTo(HaveOccurred()) - Expect(ovnPods).NotTo(BeNil()) - Expect(ovnPods.Items).To(HaveLen(1)) - - ovnPod := ovnPods.Items[0] - lsp := fmt.Sprintf("%s-%s", name, util.DefaultVpc) - cmd := fmt.Sprintf("ovn-nbctl --no-heading --columns=_uuid find logical_switch_port name=%s", lsp) - uuid, _, err := f.ExecToPodThroughAPI(cmd, "ovn-central", ovnPod.Name, ovnPod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - Expect(uuid).NotTo(BeEmpty()) - - lrp := fmt.Sprintf("%s-%s", util.DefaultVpc, name) - cmd = fmt.Sprintf("ovn-nbctl --no-heading --columns=_uuid find logical_router_port name=%s", lrp) - uuid, _, err = f.ExecToPodThroughAPI(cmd, "ovn-central", ovnPod.Name, ovnPod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - Expect(uuid).NotTo(BeEmpty()) - }) - - It("disable gateway check", func() { - name := f.GetName() - - By("create subnet") - subnet := &kubeovn.Subnet{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Labels: map[string]string{"e2e": "true"}, - }, - Spec: kubeovn.SubnetSpec{ - CIDRBlock: "99.12.0.0/16", - Vlan: Vlan, - DisableGatewayCheck: true, - Protocol: util.CheckProtocol(cidr), - }, - } - _, err := f.OvnClientSet.KubeovnV1().Subnets().Create(context.Background(), subnet, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - By("validate subnet") - err = f.WaitSubnetReady(subnet.Name) - Expect(err).NotTo(HaveOccurred()) - - By("create pod") - pod := &corev1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: Namespace, - Annotations: map[string]string{util.LogicalSwitchAnnotation: subnet.Name}, - }, - Spec: corev1.PodSpec{ - Containers: []corev1.Container{ - { - Name: name, - Image: "kubeovn/pause:3.2", - ImagePullPolicy: corev1.PullIfNotPresent, - }, - }, - }, - } - _, err = f.KubeClientSet.CoreV1().Pods(pod.Namespace).Create(context.Background(), pod, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - - _, err = f.WaitPodReady(pod.Name, pod.Namespace) - Expect(err).NotTo(HaveOccurred()) - - By("delete pod") - err = f.KubeClientSet.CoreV1().Pods(pod.Namespace).Delete(context.Background(), pod.Name, metav1.DeleteOptions{}) - Expect(err).NotTo(HaveOccurred()) - }) - }) - - Context("[Pod]", func() { - var cniPods map[string]corev1.Pod - BeforeEach(func() { - nodeList, err := f.KubeClientSet.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{}) - Expect(err).NotTo(HaveOccurred()) - Expect(nodeList).NotTo(BeNil()) - - podList, err := f.KubeClientSet.CoreV1().Pods("kube-system").List(context.Background(), metav1.ListOptions{LabelSelector: "app=kube-ovn-cni"}) - Expect(err).NotTo(HaveOccurred()) - Expect(podList).NotTo(BeNil()) - Expect(len(podList.Items)).To(Equal(len(nodeList.Items))) - - cniPods = make(map[string]corev1.Pod) - for _, node := range nodeList.Items { - var cniPod *corev1.Pod - for _, pod := range podList.Items { - if pod.Spec.NodeName == node.Name { - cniPod = &pod - break - } - } - Expect(cniPod).NotTo(BeNil()) - cniPods[node.Name] = *cniPod - } - }) - - Context("[MTU]", func() { - BeforeEach(func() { - err := f.KubeClientSet.CoreV1().Pods(Namespace).Delete(context.Background(), f.GetName(), metav1.DeleteOptions{}) - if err != nil && !k8serrors.IsNotFound(err) { - klog.Fatalf("failed to delete pod %s: %v", f.GetName(), err) - } - }) - AfterEach(func() { - err := f.KubeClientSet.CoreV1().Pods(Namespace).Delete(context.Background(), f.GetName(), metav1.DeleteOptions{}) - if err != nil && !k8serrors.IsNotFound(err) { - klog.Fatalf("failed to delete pod %s: %v", f.GetName(), err) - } - }) - - It("normal", func() { - By("create pod") - var autoMount bool - pod := &corev1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: f.GetName(), - Namespace: Namespace, - Labels: map[string]string{"e2e": "true"}, - Annotations: map[string]string{util.LogicalSwitchAnnotation: Subnet}, - }, - Spec: corev1.PodSpec{ - Containers: []corev1.Container{ - { - Name: f.GetName(), - Image: testImage, - ImagePullPolicy: corev1.PullIfNotPresent, - }, - }, - AutomountServiceAccountToken: &autoMount, - }, - } - _, err := f.KubeClientSet.CoreV1().Pods(Namespace).Create(context.Background(), pod, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - pod, err = f.WaitPodReady(pod.Name, Namespace) - Expect(err).NotTo(HaveOccurred()) - Expect(pod.Spec.NodeName).NotTo(BeEmpty()) - - By("get cni pod") - cniPod, ok := cniPods[pod.Spec.NodeName] - Expect(ok).To(BeTrue()) - - By("get pod's netns") - cmd := fmt.Sprintf("ovs-vsctl --no-heading --columns=external_ids find interface external-ids:pod_name=%s external-ids:pod_namespace=%s", pod.Name, Namespace) - stdout, _, err := f.ExecToPodThroughAPI(cmd, "cni-server", cniPod.Name, cniPod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - var netns string - for _, field := range strings.Fields(stdout) { - if strings.HasPrefix(field, "pod_netns=") { - netns = strings.TrimPrefix(field, "pod_netns=") - netns = strings.Trim(netns[:len(netns)-1], `"`) - break - } - } - Expect(netns).NotTo(BeEmpty()) - - By("validate pod's MTU") - cmd = fmt.Sprintf("nsenter --net=%s ip link show eth0", netns) - stdout, _, err = f.ExecToPodThroughAPI(cmd, "cni-server", cniPod.Name, cniPod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - Expect(stdout).To(ContainSubstring(" mtu %d ", nodeMTU[pod.Spec.NodeName])) - }) - }) - - Context("[Connectivity]", func() { - Context("[Host-Pod]", func() { - if VlanID != "" { - return - } - - BeforeEach(func() { - err := f.KubeClientSet.CoreV1().Pods(Namespace).Delete(context.Background(), f.GetName(), metav1.DeleteOptions{}) - if err != nil && !k8serrors.IsNotFound(err) { - klog.Fatalf("failed to delete pod %s: %v", f.GetName(), err) - } - }) - AfterEach(func() { - err := f.KubeClientSet.CoreV1().Pods(Namespace).Delete(context.Background(), f.GetName(), metav1.DeleteOptions{}) - if err != nil && !k8serrors.IsNotFound(err) { - klog.Fatalf("failed to delete pod %s: %v", f.GetName(), err) - } - }) - - It("hp", func() { - By("create pod") - var autoMount bool - pod := &corev1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: f.GetName(), - Namespace: Namespace, - Labels: map[string]string{"e2e": "true"}, - Annotations: map[string]string{util.LogicalSwitchAnnotation: Subnet}, - }, - Spec: corev1.PodSpec{ - Containers: []corev1.Container{ - { - Name: f.GetName(), - Image: testImage, - ImagePullPolicy: corev1.PullIfNotPresent, - }, - }, - AutomountServiceAccountToken: &autoMount, - }, - } - _, err := f.KubeClientSet.CoreV1().Pods(Namespace).Create(context.Background(), pod, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - pod, err = f.WaitPodReady(pod.Name, Namespace) - Expect(err).NotTo(HaveOccurred()) - Expect(pod.Spec.NodeName).NotTo(BeEmpty()) - - By("get pod's netns") - cniPod := cniPods[pod.Spec.NodeName] - cmd := fmt.Sprintf("ovs-vsctl --no-heading --columns=external_ids find interface external-ids:pod_name=%s external-ids:pod_namespace=%s", pod.Name, Namespace) - stdout, _, err := f.ExecToPodThroughAPI(cmd, "cni-server", cniPod.Name, cniPod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - var netns string - for _, field := range strings.Fields(stdout) { - if strings.HasPrefix(field, "pod_netns=") { - netns = strings.TrimPrefix(field, "pod_netns=") - netns = strings.Trim(netns[:len(netns)-1], `"`) - break - } - } - Expect(netns).NotTo(BeEmpty()) - - By("get host IP") - var hostIP string - for _, addr := range nodeAddrs[pod.Spec.NodeName] { - if util.CIDRContainIP(cidr, strings.Split(addr, "/")[0]) { - hostIP = strings.Split(addr, "/")[0] - break - } - } - Expect(hostIP).ToNot(BeEmpty()) - - By("ping host") - cmd = fmt.Sprintf("nsenter --net=%s ping -c1 -W1 %s", netns, hostIP) - stdout, _, err = f.ExecToPodThroughAPI(cmd, "cni-server", cniPod.Name, cniPod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - Expect(stdout).To(ContainSubstring(" 0% packet loss")) - }) - }) - - Context("[Host-Host-Pod]", func() { - if VlanID != "" { - return - } - - BeforeEach(func() { - err := f.KubeClientSet.CoreV1().Pods(Namespace).Delete(context.Background(), f.GetName(), metav1.DeleteOptions{}) - if err != nil && !k8serrors.IsNotFound(err) { - klog.Fatalf("failed to delete pod %s: %v", f.GetName(), err) - } - }) - AfterEach(func() { - err := f.KubeClientSet.CoreV1().Pods(Namespace).Delete(context.Background(), f.GetName(), metav1.DeleteOptions{}) - if err != nil && !k8serrors.IsNotFound(err) { - klog.Fatalf("failed to delete pod %s: %v", f.GetName(), err) - } - }) - - It("hhp", func() { - if len(cniPods) < 2 { - return - } - - By("select nodes") - nodes := make([]string, 0, 2) - for node := range cniPods { - nodes = append(nodes, node) - if len(nodes) == 2 { - break - } - } - Expect(len(nodes)).To(Equal(2)) - - By("create pod") - var autoMount bool - pod := &corev1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: f.GetName(), - Namespace: Namespace, - Labels: map[string]string{"e2e": "true"}, - Annotations: map[string]string{util.LogicalSwitchAnnotation: Subnet}, - }, - Spec: corev1.PodSpec{ - NodeName: nodes[0], - Containers: []corev1.Container{ - { - Name: f.GetName(), - Image: testImage, - ImagePullPolicy: corev1.PullIfNotPresent, - }, - }, - AutomountServiceAccountToken: &autoMount, - }, - } - _, err := f.KubeClientSet.CoreV1().Pods(Namespace).Create(context.Background(), pod, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - pod, err = f.WaitPodReady(pod.Name, Namespace) - Expect(err).NotTo(HaveOccurred()) - Expect(pod.Spec.NodeName).NotTo(BeEmpty()) - - By("get pod's netns") - cniPod := cniPods[pod.Spec.NodeName] - cmd := fmt.Sprintf("ovs-vsctl --no-heading --columns=external_ids find interface external-ids:pod_name=%s external-ids:pod_namespace=%s", pod.Name, Namespace) - stdout, _, err := f.ExecToPodThroughAPI(cmd, "cni-server", cniPod.Name, cniPod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - var netns string - for _, field := range strings.Fields(stdout) { - if strings.HasPrefix(field, "pod_netns=") { - netns = strings.TrimPrefix(field, "pod_netns=") - netns = strings.Trim(netns[:len(netns)-1], `"`) - break - } - } - Expect(netns).NotTo(BeEmpty()) - - By("get host IP") - var hostIP string - for _, addr := range nodeAddrs[nodes[1]] { - if util.CIDRContainIP(cidr, strings.Split(addr, "/")[0]) { - hostIP = strings.Split(addr, "/")[0] - break - } - } - Expect(hostIP).ToNot(BeEmpty()) - - By("ping host") - cmd = fmt.Sprintf("nsenter --net=%s ping -c1 -W1 %s", netns, hostIP) - stdout, _, err = f.ExecToPodThroughAPI(cmd, "cni-server", cniPod.Name, cniPod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - Expect(stdout).To(ContainSubstring(" 0% packet loss")) - }) - }) - - Context("Pod-Host-Host-Pod", func() { - BeforeEach(func() { - for i := 0; i < len(cniPods); i++ { - name := fmt.Sprintf("%s-%d", f.GetName(), i+1) - err := f.KubeClientSet.CoreV1().Pods(Namespace).Delete(context.Background(), name, metav1.DeleteOptions{}) - if err != nil && !k8serrors.IsNotFound(err) { - klog.Fatalf("failed to delete pod %s: %v", name, err) - } - } - }) - AfterEach(func() { - for i := 0; i < len(cniPods); i++ { - name := fmt.Sprintf("%s-%d", f.GetName(), i+1) - err := f.KubeClientSet.CoreV1().Pods(Namespace).Delete(context.Background(), name, metav1.DeleteOptions{}) - if err != nil && !k8serrors.IsNotFound(err) { - klog.Fatalf("failed to delete pod %s: %v", name, err) - } - } - }) - - It("phhp", func() { - if len(cniPods) < 2 { - return - } - - By("select nodes") - nodes := make([]string, 0, len(cniPods)) - for node := range cniPods { - nodes = append(nodes, node) - } - - By("create pods") - name := f.GetName() - pods := make([]*corev1.Pod, len(nodes)) - var autoMount bool - for i := range nodes { - pods[i] = &corev1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: fmt.Sprintf("%s-%d", name, i+1), - Namespace: Namespace, - Labels: map[string]string{"e2e": "true"}, - Annotations: map[string]string{util.LogicalSwitchAnnotation: Subnet}, - }, - Spec: corev1.PodSpec{ - NodeName: nodes[i], - Containers: []corev1.Container{ - { - Name: name, - Image: testImage, - ImagePullPolicy: corev1.PullIfNotPresent, - }, - }, - AutomountServiceAccountToken: &autoMount, - }, - } - _, err := f.KubeClientSet.CoreV1().Pods(Namespace).Create(context.Background(), pods[i], metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - pods[i], err = f.WaitPodReady(pods[i].Name, Namespace) - Expect(err).NotTo(HaveOccurred()) - } - - for i := range pods { - By("get pod's netns") - cmd := fmt.Sprintf("ovs-vsctl --no-heading --columns=external_ids find interface external-ids:pod_name=%s external-ids:pod_namespace=%s", pods[i].Name, Namespace) - stdout, _, err := f.ExecToPodThroughAPI(cmd, "cni-server", cniPods[nodes[i]].Name, cniPods[nodes[i]].Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - var netns string - for _, field := range strings.Fields(stdout) { - if strings.HasPrefix(field, "pod_netns=") { - netns = strings.TrimPrefix(field, "pod_netns=") - netns = strings.Trim(netns[:len(netns)-1], `"`) - break - } - } - Expect(netns).NotTo(BeEmpty()) - - By("ping another pod") - cmd = fmt.Sprintf("nsenter --net=%s ping -c1 -W1 %s", netns, pods[(i+len(pods)+1)%len(pods)].Status.PodIP) - stdout, _, err = f.ExecToPodThroughAPI(cmd, "cni-server", cniPods[nodes[i]].Name, cniPods[nodes[i]].Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - Expect(stdout).To(ContainSubstring(" 0% packet loss")) - } - }) - }) - - Context("[Overlay-Underlay]", func() { - if VlanID != "" { - return - } - - defaultSubnet, err := f.OvnClientSet.KubeovnV1().Subnets().Get(context.Background(), util.DefaultSubnet, metav1.GetOptions{}) - if err != nil && !k8serrors.IsNotFound(err) { - klog.Fatalf("failed to get subnet %s: %v", util.DefaultSubnet, err) - } - if defaultSubnet.Spec.LogicalGateway { - return - } - - overlayNamespace := "default" - - BeforeEach(func() { - err := f.KubeClientSet.CoreV1().Pods(Namespace).Delete(context.Background(), f.GetName(), metav1.DeleteOptions{}) - if err != nil && !k8serrors.IsNotFound(err) { - klog.Fatalf("failed to delete pod %s/%s: %v", Namespace, f.GetName(), err) - } - err = f.KubeClientSet.CoreV1().Pods(overlayNamespace).Delete(context.Background(), f.GetName(), metav1.DeleteOptions{}) - if err != nil && !k8serrors.IsNotFound(err) { - klog.Fatalf("failed to delete pod %s/%s: %v", overlayNamespace, f.GetName(), err) - } - }) - AfterEach(func() { - err := f.KubeClientSet.CoreV1().Pods(Namespace).Delete(context.Background(), f.GetName(), metav1.DeleteOptions{}) - if err != nil && !k8serrors.IsNotFound(err) { - klog.Fatalf("failed to delete pod %s/%s: %v", Namespace, f.GetName(), err) - } - err = f.KubeClientSet.CoreV1().Pods(overlayNamespace).Delete(context.Background(), f.GetName(), metav1.DeleteOptions{}) - if err != nil && !k8serrors.IsNotFound(err) { - klog.Fatalf("failed to delete pod %s/%s: %v", overlayNamespace, f.GetName(), err) - } - }) - - It("o2u", func() { - if strings.EqualFold(os.Getenv("IPV6"), "true") { - return - } - - By("create underlay pod") - var autoMount bool - upod := &corev1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: f.GetName(), - Namespace: Namespace, - Labels: map[string]string{"e2e": "true"}, - Annotations: map[string]string{util.LogicalSwitchAnnotation: Subnet}, - }, - Spec: corev1.PodSpec{ - Containers: []corev1.Container{ - { - Name: f.GetName(), - Image: testImage, - ImagePullPolicy: corev1.PullIfNotPresent, - }, - }, - AutomountServiceAccountToken: &autoMount, - }, - } - _, err := f.KubeClientSet.CoreV1().Pods(upod.Namespace).Create(context.Background(), upod, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - upod, err = f.WaitPodReady(upod.Name, upod.Namespace) - Expect(err).NotTo(HaveOccurred()) - Expect(upod.Spec.NodeName).NotTo(BeEmpty()) - - By("create overlay pod") - opod := &corev1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: f.GetName(), - Namespace: overlayNamespace, - Labels: map[string]string{"e2e": "true"}, - }, - Spec: corev1.PodSpec{ - Containers: []corev1.Container{ - { - Name: f.GetName(), - Image: testImage, - ImagePullPolicy: corev1.PullIfNotPresent, - }, - }, - AutomountServiceAccountToken: &autoMount, - }, - } - _, err = f.KubeClientSet.CoreV1().Pods(opod.Namespace).Create(context.Background(), opod, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - opod, err = f.WaitPodReady(opod.Name, opod.Namespace) - Expect(err).NotTo(HaveOccurred()) - - By("get overlay pod's netns") - cniPod := cniPods[opod.Spec.NodeName] - cmd := fmt.Sprintf("ovs-vsctl --no-heading --columns=external_ids find interface external-ids:pod_name=%s external-ids:pod_namespace=%s", opod.Name, opod.Namespace) - stdout, _, err := f.ExecToPodThroughAPI(cmd, "cni-server", cniPod.Name, cniPod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - var netns string - for _, field := range strings.Fields(stdout) { - if strings.HasPrefix(field, "pod_netns=") { - netns = strings.TrimPrefix(field, "pod_netns=") - netns = strings.Trim(netns[:len(netns)-1], `"`) - break - } - } - Expect(netns).NotTo(BeEmpty()) - - By("ping underlay pod") - cmd = fmt.Sprintf("nsenter --net=%s ping -c1 -W1 %s", netns, upod.Status.PodIP) - stdout, _, err = f.ExecToPodThroughAPI(cmd, "cni-server", cniPod.Name, cniPod.Namespace, nil) - Expect(err).NotTo(HaveOccurred()) - Expect(stdout).To(ContainSubstring(" 0% packet loss")) - }) - }) - }) - }) - - Context("[kubectl-ko]", func() { - BeforeEach(func() { - err := f.KubeClientSet.CoreV1().Pods(Namespace).Delete(context.Background(), f.GetName(), metav1.DeleteOptions{}) - if err != nil && !k8serrors.IsNotFound(err) { - klog.Fatalf("failed to delete pod %s: %v", f.GetName(), err) - } - }) - AfterEach(func() { - err := f.KubeClientSet.CoreV1().Pods(Namespace).Delete(context.Background(), f.GetName(), metav1.DeleteOptions{}) - if err != nil && !k8serrors.IsNotFound(err) { - klog.Fatalf("failed to delete pod %s: %v", f.GetName(), err) - } - }) - - It("trace", func() { - By("create pod") - var autoMount bool - pod := &corev1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Name: f.GetName(), - Namespace: Namespace, - Labels: map[string]string{"e2e": "true"}, - Annotations: map[string]string{util.LogicalSwitchAnnotation: Subnet}, - }, - Spec: corev1.PodSpec{ - Containers: []corev1.Container{ - { - Name: f.GetName(), - Image: testImage, - ImagePullPolicy: corev1.PullIfNotPresent, - }, - }, - AutomountServiceAccountToken: &autoMount, - }, - } - _, err := f.KubeClientSet.CoreV1().Pods(Namespace).Create(context.Background(), pod, metav1.CreateOptions{}) - Expect(err).NotTo(HaveOccurred()) - pod, err = f.WaitPodReady(pod.Name, Namespace) - Expect(err).NotTo(HaveOccurred()) - - dst := "114.114.114.114" - if util.CheckProtocol(pod.Status.PodIP) == kubeovn.ProtocolIPv6 { - dst = "2400:3200::1" - } - - output, err := exec.Command("kubectl", "ko", "trace", fmt.Sprintf("%s/%s", Namespace, pod.Name), dst, "icmp").CombinedOutput() - Expect(err).NotTo(HaveOccurred(), string(output)) - - output, err = exec.Command("kubectl", "ko", "trace", fmt.Sprintf("%s/%s", Namespace, pod.Name), dst, "tcp", "80").CombinedOutput() - Expect(err).NotTo(HaveOccurred(), string(output)) - - output, err = exec.Command("kubectl", "ko", "trace", fmt.Sprintf("%s/%s", Namespace, pod.Name), dst, "udp", "53").CombinedOutput() - Expect(err).NotTo(HaveOccurred(), string(output)) - }) - }) -}) diff --git a/yamls/kind.yaml.j2 b/yamls/kind.yaml.j2 index e506229deaf..f90679571f3 100644 --- a/yamls/kind.yaml.j2 +++ b/yamls/kind.yaml.j2 @@ -1,5 +1,17 @@ {%- if k8s_version is not defined -%} - {%- set k8s_version = "v1.24.7" -%} + {%- set k8s_version = "v1.26.0" -%} +{%- endif -%} +{%- if kube_proxy_mode is not defined -%} + {%- set kube_proxy_mode = "ipvs" -%} +{%- endif -%} +{%- if ip_family is not defined -%} + {%- set ip_family = "ipv4" -%} +{%- endif -%} +{%- if ha is not defined -%} + {%- set ha = "false" -%} +{%- endif -%} +{%- if single is not defined -%} + {%- set single = "false" -%} {%- endif -%} {%- if api_server_address is not defined -%} {%- set api_server_address = "127.0.0.1" -%} @@ -37,14 +49,15 @@ kubeadmConfigPatches: nodes: - role: control-plane image: kindest/node:{{ k8s_version }} - {%- if ha is equalto "true" %} - - role: control-plane - image: kindest/node:{{ k8s_version }} - - role: control-plane +{%- if single is equalto "false" %} + - role: worker image: kindest/node:{{ k8s_version }} - {%- elif single is equalto "true" %} - - {%- else %} + {%- if ha is equalto "true" %} + labels: + kube-ovn/role: master - role: worker image: kindest/node:{{ k8s_version }} + labels: + kube-ovn/role: master {%- endif %} +{%- endif %} diff --git a/yamls/ovn-dpdk.yaml b/yamls/ovn-dpdk.yaml index 406fab6cc3f..923219b4c99 100644 --- a/yamls/ovn-dpdk.yaml +++ b/yamls/ovn-dpdk.yaml @@ -1,32 +1,3 @@ -apiVersion: policy/v1beta1 -kind: PodSecurityPolicy -metadata: - name: kube-ovn - annotations: - seccomp.security.alpha.kubernetes.io/allowedProfileNames: '*' -spec: - privileged: true - allowPrivilegeEscalation: true - allowedCapabilities: - - '*' - volumes: - - '*' - hostNetwork: true - hostPorts: - - min: 0 - max: 65535 - hostIPC: true - hostPID: true - runAsUser: - rule: 'RunAsAny' - seLinux: - rule: 'RunAsAny' - supplementalGroups: - rule: 'RunAsAny' - fsGroup: - rule: 'RunAsAny' - ---- apiVersion: v1 kind: ServiceAccount metadata: diff --git a/yamls/ovn-ha.yaml b/yamls/ovn-ha.yaml index 0438cc0174d..9cd98384219 100644 --- a/yamls/ovn-ha.yaml +++ b/yamls/ovn-ha.yaml @@ -1,32 +1,3 @@ -apiVersion: policy/v1beta1 -kind: PodSecurityPolicy -metadata: - name: kube-ovn - annotations: - seccomp.security.alpha.kubernetes.io/allowedProfileNames: '*' -spec: - privileged: true - allowPrivilegeEscalation: true - allowedCapabilities: - - '*' - volumes: - - '*' - hostNetwork: true - hostPorts: - - min: 0 - max: 65535 - hostIPC: true - hostPID: true - runAsUser: - rule: 'RunAsAny' - seLinux: - rule: 'RunAsAny' - supplementalGroups: - rule: 'RunAsAny' - fsGroup: - rule: 'RunAsAny' - ---- apiVersion: v1 kind: ServiceAccount metadata: