Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move github.com/cilium/ipam packages to main repo #25289

Merged
merged 3 commits into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ issues:
- path: \\.(generated\\.deepcopy|pb)\\.go$
linters:
- goimports
# Skip goheader check on files imported and modified from upstream k8s
- path: "pkg/ipam/(cidrset|service)/.+\\.go"
linters:
- goheader

linters:
disable-all: true
enable:
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ require (
github.com/cilium/customvet v0.0.0-20221207181232-aa8731fa2d27
github.com/cilium/deepequal-gen v0.0.0-20230330134849-754271daeec2
github.com/cilium/ebpf v0.10.0
github.com/cilium/ipam v0.0.0-20230509084518-fd66eae7909b
github.com/cilium/kafka v0.0.0-20180809090225-01ce283b732b
github.com/cilium/lumberjack/v2 v2.3.0
github.com/cilium/proxy v0.0.0-20230420184820-797bea843de1
Expand Down
2 changes: 0 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion operator/cmd/allocator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import (
"testing"
"time"

"github.com/cilium/ipam/cidrset"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"

"github.com/cilium/cilium/pkg/ipam/allocator/clusterpool/cidralloc"
"github.com/cilium/cilium/pkg/ipam/allocator/podcidr"
"github.com/cilium/cilium/pkg/ipam/cidrset"
"github.com/cilium/cilium/pkg/ipam/types"
cilium_api_v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2"
k8sClient "github.com/cilium/cilium/pkg/k8s/client"
Expand Down
2 changes: 1 addition & 1 deletion operator/pkg/lbipam/lbipam.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"strings"
"time"

"github.com/cilium/ipam/service/ipallocator"
"github.com/sirupsen/logrus"
"go.uber.org/multierr"
"golang.org/x/exp/slices"
Expand All @@ -24,6 +23,7 @@ import (

"github.com/cilium/cilium/pkg/hive"
"github.com/cilium/cilium/pkg/hive/job"
"github.com/cilium/cilium/pkg/ipam/service/ipallocator"
"github.com/cilium/cilium/pkg/k8s"
cilium_api_v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1"
cilium_client_v2alpha1 "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned/typed/cilium.io/v2alpha1"
Expand Down
2 changes: 1 addition & 1 deletion operator/pkg/lbipam/range_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"fmt"
"net"

"github.com/cilium/ipam/service/ipallocator"
"golang.org/x/exp/slices"

"github.com/cilium/cilium/pkg/ipam/service/ipallocator"
cilium_api_v2alpha1 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2alpha1"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/alibabacloud/api/mock/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
"fmt"
"net"

"github.com/cilium/ipam/service/ipallocator"
"github.com/google/uuid"

eniTypes "github.com/cilium/cilium/pkg/alibabacloud/eni/types"
"github.com/cilium/cilium/pkg/alibabacloud/types"
"github.com/cilium/cilium/pkg/ipam/service/ipallocator"
ipamTypes "github.com/cilium/cilium/pkg/ipam/types"
"github.com/cilium/cilium/pkg/lock"
)
Expand Down
5 changes: 2 additions & 3 deletions pkg/aws/ec2/mock/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ import (
"net"
"time"

"github.com/cilium/ipam/cidrset"
"github.com/cilium/ipam/service/ipallocator"

"github.com/cilium/cilium/pkg/api/helpers"
eniTypes "github.com/cilium/cilium/pkg/aws/eni/types"
"github.com/cilium/cilium/pkg/aws/types"
"github.com/cilium/cilium/pkg/ip"
"github.com/cilium/cilium/pkg/ipam/cidrset"
"github.com/cilium/cilium/pkg/ipam/option"
"github.com/cilium/cilium/pkg/ipam/service/ipallocator"
ipamTypes "github.com/cilium/cilium/pkg/ipam/types"
"github.com/cilium/cilium/pkg/lock"

Expand Down
2 changes: 1 addition & 1 deletion pkg/aws/ec2/mock/mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import (
"net"
"testing"

"github.com/cilium/ipam/cidrset"
"gopkg.in/check.v1"

"github.com/cilium/cilium/pkg/aws/types"
"github.com/cilium/cilium/pkg/checker"
"github.com/cilium/cilium/pkg/ip"
"github.com/cilium/cilium/pkg/ipam/cidrset"
ipamTypes "github.com/cilium/cilium/pkg/ipam/types"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/azure/api/mock/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (
"net"
"time"

"github.com/cilium/ipam/service/ipallocator"
"golang.org/x/time/rate"

"github.com/cilium/cilium/pkg/api/helpers"
"github.com/cilium/cilium/pkg/azure/types"
"github.com/cilium/cilium/pkg/ipam/service/ipallocator"
ipamTypes "github.com/cilium/cilium/pkg/ipam/types"
"github.com/cilium/cilium/pkg/lock"
)
Expand Down
3 changes: 1 addition & 2 deletions pkg/ipam/allocator/clusterpool/cidralloc/cidralloc.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import (
"fmt"
"net"

"github.com/cilium/ipam/cidrset"

"github.com/cilium/cilium/pkg/ip"
"github.com/cilium/cilium/pkg/ipam/cidrset"
)

type CIDRAllocator interface {
Expand Down
3 changes: 1 addition & 2 deletions pkg/ipam/allocator/pool_allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import (
"fmt"
"net"

"github.com/cilium/ipam/service/ipallocator"

"github.com/cilium/cilium/pkg/cidr"
"github.com/cilium/cilium/pkg/ipam/service/ipallocator"
"github.com/cilium/cilium/pkg/ipam/types"
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
/*
Copyright 2020 Authors of Cilium.
Copyright 2016 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.
*/
// SPDX-License-Identifier: Apache-2.0
// Copyright Authors of Cilium
// Copyright The Kubernetes Authors.

package cidrset

Expand All @@ -24,13 +11,14 @@ import (
"math/big"
"math/bits"
"net"
"sync"

"github.com/cilium/cilium/pkg/lock"
)

// CidrSet manages a set of CIDR ranges from which blocks of IPs can
// be allocated from.
type CidrSet struct {
sync.Mutex
lock.Mutex
// clusterCIDR is the CIDR assigned to the cluster
clusterCIDR *net.IPNet
// clusterMaskSize is the mask size, in bits, assigned to the cluster
Expand Down