Skip to content

Commit

Permalink
Use the standard context library
Browse files Browse the repository at this point in the history
Signed-off-by: manuelbuil <mbuil@suse.com>
  • Loading branch information
manuelbuil committed Nov 20, 2024
1 parent 0e99f63 commit c0d5ae7
Show file tree
Hide file tree
Showing 32 changed files with 41 additions and 42 deletions.
5 changes: 2 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package main

import (
"context"
"errors"
"flag"
"fmt"
Expand All @@ -40,10 +41,8 @@ import (
"github.com/flannel-io/flannel/pkg/trafficmngr/iptables"
"github.com/flannel-io/flannel/pkg/trafficmngr/nftables"
"github.com/flannel-io/flannel/pkg/version"
"golang.org/x/net/context"
log "k8s.io/klog/v2"

"github.com/joho/godotenv"
log "k8s.io/klog/v2"

// Backends need to be imported for their init() to get executed and them to register
"github.com/coreos/go-systemd/v22/daemon"
Expand Down
3 changes: 2 additions & 1 deletion pkg/backend/alloc/alloc.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ import (
"fmt"
"sync"

"context"

"github.com/flannel-io/flannel/pkg/backend"
"github.com/flannel-io/flannel/pkg/ip"
"github.com/flannel-io/flannel/pkg/lease"
"github.com/flannel-io/flannel/pkg/subnet"
"golang.org/x/net/context"
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
package backend

import (
"context"
"net"
"sync"

"github.com/flannel-io/flannel/pkg/lease"
"github.com/flannel-io/flannel/pkg/subnet"
"golang.org/x/net/context"
)

type ExternalInterface struct {
Expand Down
7 changes: 3 additions & 4 deletions pkg/backend/extension/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,19 @@
package extension

import (
"context"
"encoding/json"
"fmt"
"io"
"os"
"strings"

"encoding/json"
"os/exec"
"strings"
"sync"

"github.com/flannel-io/flannel/pkg/backend"
"github.com/flannel-io/flannel/pkg/ip"
"github.com/flannel-io/flannel/pkg/lease"
"github.com/flannel-io/flannel/pkg/subnet"
"golang.org/x/net/context"
log "k8s.io/klog/v2"
)

Expand Down
6 changes: 2 additions & 4 deletions pkg/backend/extension/extension_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@
package extension

import (
"context"
"encoding/json"
"sync"

"golang.org/x/net/context"

"fmt"
"sync"

"github.com/flannel-io/flannel/pkg/backend"
"github.com/flannel-io/flannel/pkg/lease"
Expand Down
3 changes: 2 additions & 1 deletion pkg/backend/hostgw/hostgw.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@
package hostgw

import (
"context"
"fmt"
"sync"


"github.com/flannel-io/flannel/pkg/backend"
"github.com/flannel-io/flannel/pkg/ip"
"github.com/flannel-io/flannel/pkg/lease"
"github.com/flannel-io/flannel/pkg/subnet"
"github.com/vishvananda/netlink"
"golang.org/x/net/context"
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/hostgw/hostgw_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package hostgw

import (
"context"
"fmt"
"strings"
"sync"
Expand All @@ -27,7 +28,6 @@ import (
"github.com/flannel-io/flannel/pkg/routing"
"github.com/flannel-io/flannel/pkg/subnet"
"github.com/pkg/errors"
"golang.org/x/net/context"
"k8s.io/apimachinery/pkg/util/json"
"k8s.io/apimachinery/pkg/util/wait"
log "k8s.io/klog/v2"
Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/ipip/ipip.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package ipip

import (
"context"
"encoding/json"
"fmt"
"sync"
Expand All @@ -28,7 +29,6 @@ import (
"github.com/flannel-io/flannel/pkg/lease"
"github.com/flannel-io/flannel/pkg/subnet"
"github.com/vishvananda/netlink"
"golang.org/x/net/context"
log "k8s.io/klog/v2"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/ipsec/handle_charon.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package ipsec

import (
"context"
"fmt"
"net"
"os"
Expand All @@ -28,7 +29,6 @@ import (

"github.com/bronze1man/goStrongswanVici"
"github.com/flannel-io/flannel/pkg/lease"
"golang.org/x/net/context"
log "k8s.io/klog/v2"
)

Expand Down
3 changes: 1 addition & 2 deletions pkg/backend/ipsec/ipsec.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@
package ipsec

import (
"context"
"encoding/json"
"fmt"
"sync"

"golang.org/x/net/context"

"github.com/flannel-io/flannel/pkg/backend"
"github.com/flannel-io/flannel/pkg/ip"
"github.com/flannel-io/flannel/pkg/lease"
Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/ipsec/ipsec_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package ipsec

import (
"context"
"fmt"
"net"
"strconv"
Expand All @@ -26,7 +27,6 @@ import (
"github.com/flannel-io/flannel/pkg/lease"
"github.com/flannel-io/flannel/pkg/subnet"
"github.com/vishvananda/netlink"
"golang.org/x/net/context"
log "k8s.io/klog/v2"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
package backend

import (
"context"
"fmt"
"strings"
"sync"

"github.com/flannel-io/flannel/pkg/subnet"
"golang.org/x/net/context"
)

var constructors = make(map[string]BackendCtor)
Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/route_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ package backend

import (
"bytes"
"context"
"net"
"sync"
"time"

"github.com/flannel-io/flannel/pkg/lease"
"github.com/flannel-io/flannel/pkg/subnet"
"github.com/vishvananda/netlink"
"golang.org/x/net/context"
log "k8s.io/klog/v2"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/route_network_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
package backend

import (
"context"
"strings"
"sync"
"time"

"github.com/flannel-io/flannel/pkg/lease"
"github.com/flannel-io/flannel/pkg/routing"
"github.com/flannel-io/flannel/pkg/subnet"
"golang.org/x/net/context"
log "k8s.io/klog/v2"
)

Expand Down
3 changes: 2 additions & 1 deletion pkg/backend/simple_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
package backend

import (
"context"

"github.com/flannel-io/flannel/pkg/lease"
"golang.org/x/net/context"
)

type SimpleNetwork struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/tencentvpc/tencentvpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package tencentvpc

import (
"context"
"encoding/json"
"fmt"
"io"
Expand All @@ -31,7 +32,6 @@ import (
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors"
vpc "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312"
"golang.org/x/net/context"
log "k8s.io/klog/v2"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/udp/udp_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package udp

import (
"context"
"encoding/json"
"fmt"
"sync"
Expand All @@ -25,7 +26,6 @@ import (
"github.com/flannel-io/flannel/pkg/ip"
"github.com/flannel-io/flannel/pkg/lease"
"github.com/flannel-io/flannel/pkg/subnet"
"golang.org/x/net/context"
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/udp/udp_network_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package udp

import (
"context"
"fmt"
"net"
"os"
Expand All @@ -29,7 +30,6 @@ import (
"github.com/flannel-io/flannel/pkg/lease"
"github.com/flannel-io/flannel/pkg/subnet"
"github.com/vishvananda/netlink"
"golang.org/x/net/context"
log "k8s.io/klog/v2"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/vxlan/vxlan.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ package vxlan
// this is called "directRouting"

import (
"context"
"encoding/json"
"fmt"
"net"
Expand All @@ -63,7 +64,6 @@ import (
"github.com/flannel-io/flannel/pkg/ip"
"github.com/flannel-io/flannel/pkg/lease"
"github.com/flannel-io/flannel/pkg/subnet"
"golang.org/x/net/context"
log "k8s.io/klog/v2"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/vxlan/vxlan_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package vxlan

import (
"context"
"encoding/json"
"net"
"sync"
Expand All @@ -28,7 +29,6 @@ import (
"github.com/flannel-io/flannel/pkg/retry"
"github.com/flannel-io/flannel/pkg/subnet"
"github.com/vishvananda/netlink"
"golang.org/x/net/context"
log "k8s.io/klog/v2"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/vxlan/vxlan_network_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package vxlan

import (
"context"
"encoding/json"
"net"
"strings"
Expand All @@ -25,7 +26,6 @@ import (
"github.com/flannel-io/flannel/pkg/ip"
"github.com/flannel-io/flannel/pkg/lease"
"github.com/flannel-io/flannel/pkg/subnet"
"golang.org/x/net/context"
log "k8s.io/klog/v2"
)

Expand Down
5 changes: 3 additions & 2 deletions pkg/backend/vxlan/vxlan_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ package vxlan
// In this scheme the scaling of table entries (per host) is:
// - 1 network entry for the overlay network
// - 1 endpoint per local container
// - N remote endpoints remote node (total endpoints =
// - N remote endpoints remote node (total endpoints = N * number of remote nodes)

import (
"context"
"encoding/json"
"errors"
"fmt"
Expand All @@ -35,7 +37,6 @@ import (
"github.com/flannel-io/flannel/pkg/ip"
"github.com/flannel-io/flannel/pkg/lease"
"github.com/flannel-io/flannel/pkg/subnet"
"golang.org/x/net/context"
log "k8s.io/klog/v2"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/wireguard/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package wireguard

import (
"context"
"errors"
"fmt"
"net"
Expand All @@ -28,7 +29,6 @@ import (

"github.com/flannel-io/flannel/pkg/ip"
"github.com/vishvananda/netlink"
"golang.org/x/net/context"
"golang.zx2c4.com/wireguard/wgctrl"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
log "k8s.io/klog/v2"
Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/wireguard/wireguard.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package wireguard

import (
"context"
"encoding/json"
"fmt"
"net"
Expand All @@ -27,7 +28,6 @@ import (
"github.com/flannel-io/flannel/pkg/ip"
"github.com/flannel-io/flannel/pkg/lease"
"github.com/flannel-io/flannel/pkg/subnet"
"golang.org/x/net/context"
)

type Mode string
Expand Down
Loading

0 comments on commit c0d5ae7

Please sign in to comment.