Skip to content

Commit

Permalink
remove k8s.io/kubernetes dependency
Browse files Browse the repository at this point in the history
k8s.io/kubernetes can be replaced with a fork of the single package that
cilium depends on. Dropping this dependency from our go modules will make
the go.mod file a lot simpler.

Signed-off-by: André Martins <andre@cilium.io>
  • Loading branch information
aanm committed Feb 17, 2020
1 parent 45cebce commit 0f6d008
Show file tree
Hide file tree
Showing 39 changed files with 32 additions and 12,821 deletions.
11 changes: 10 additions & 1 deletion go.mod
Expand Up @@ -8,6 +8,7 @@ go 1.13

// direct dependencies
require (
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878 // indirect
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a
github.com/aws/aws-sdk-go-v2 v0.18.0
Expand All @@ -16,11 +17,14 @@ require (
github.com/census-instrumentation/opencensus-proto v0.2.1 // indirect
github.com/cilium/arping v1.0.1-0.20190728065459-c5eaf8d7a710
github.com/cilium/ebpf v0.0.0-20191113100448-d9fb101ca1fb
github.com/cilium/ipam v0.0.0-20200217195329-a46f8d55f9db
github.com/cilium/proxy v0.0.0-20191113190709-4c7b379792e6
github.com/containernetworking/cni v0.7.1
github.com/containernetworking/plugins v0.8.2
github.com/davecgh/go-spew v1.1.1
github.com/docker/distribution v2.7.1+incompatible // indirect
github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0
github.com/docker/go-connections v0.3.0 // indirect
github.com/docker/libnetwork v0.8.0-dev.2.0.20190624125649-f0e46a78ea34
github.com/envoyproxy/protoc-gen-validate v0.1.0 // indirect
github.com/fatih/color v1.7.0
Expand Down Expand Up @@ -50,11 +54,15 @@ require (
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect
github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd
github.com/kr/pretty v0.1.0
github.com/mattn/go-isatty v0.0.9 // indirect
github.com/mattn/go-shellwords v1.0.5
github.com/miekg/dns v1.1.4
github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c // indirect
github.com/onsi/ginkgo v1.10.1
github.com/onsi/gomega v1.7.0
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
github.com/opencontainers/go-digest v1.0.0-rc1 // indirect
github.com/opencontainers/image-spec v1.0.1 // indirect
github.com/optiopay/kafka v0.0.0-20180809090225-01ce283b732b
github.com/pborman/uuid v1.2.0
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
Expand All @@ -68,6 +76,7 @@ require (
github.com/shirou/gopsutil v0.0.0-20181107111621-48177ef5f880
github.com/sirupsen/logrus v1.4.2
github.com/spf13/cobra v0.0.5
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.6.1
github.com/vishvananda/netlink v1.0.1-0.20191113183427-d71301a47b60
Expand All @@ -89,7 +98,6 @@ require (
k8s.io/client-go v8.0.0+incompatible
k8s.io/code-generator v0.0.0
k8s.io/klog v1.0.0
k8s.io/kubernetes v1.17.3
sigs.k8s.io/yaml v1.1.0
)

Expand Down Expand Up @@ -166,6 +174,7 @@ replace (
github.com/cheekybits/genny => github.com/cheekybits/genny v0.0.0-20170328200008-9127e812e1e9
github.com/cilium/arping => github.com/cilium/arping v1.0.1-0.20190728065459-c5eaf8d7a710
github.com/cilium/ebpf => github.com/cilium/ebpf v0.0.0-20191113100448-d9fb101ca1fb
github.com/cilium/ipam => github.com/cilium/ipam v0.0.0-20200217195329-a46f8d55f9db
github.com/cilium/proxy => github.com/cilium/proxy v0.0.0-20191113190709-4c7b379792e6
github.com/circonus-labs/circonus-gometrics => github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible
github.com/circonus-labs/circonusllhist => github.com/circonus-labs/circonusllhist v0.1.3
Expand Down
179 changes: 2 additions & 177 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pkg/aws/ec2/mock/mock.go
@@ -1,4 +1,4 @@
// Copyright 2019 Authors of Cilium
// Copyright 2019-2020 Authors of Cilium
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -25,8 +25,8 @@ import (
"github.com/cilium/cilium/pkg/lock"
"github.com/cilium/cilium/pkg/uuid"

"github.com/cilium/ipam/service/ipallocator"
"golang.org/x/time/rate"
"k8s.io/kubernetes/pkg/registry/core/service/ipallocator"
)

type eniMap map[string]*v2.ENI
Expand Down
13 changes: 7 additions & 6 deletions pkg/ipam/hostscope.go
@@ -1,4 +1,4 @@
// Copyright 2017-2019 Authors of Cilium
// Copyright 2017-2020 Authors of Cilium
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -21,8 +21,7 @@ import (

"github.com/cilium/cilium/pkg/ip"

k8sAPI "k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/registry/core/service/ipallocator"
"github.com/cilium/ipam/service/ipallocator"
)

type hostScopeAllocator struct {
Expand Down Expand Up @@ -67,14 +66,16 @@ func (h *hostScopeAllocator) AllocateNext(owner string) (*AllocationResult, erro
func (h *hostScopeAllocator) Dump() (map[string]string, string) {
var origIP *big.Int
alloc := map[string]string{}
ral := k8sAPI.RangeAllocation{}
h.allocator.Snapshot(&ral)
_, data, err := h.allocator.Snapshot()
if err != nil {
return nil, fmt.Sprintf("Unable to get a snapshot of the allocator")
}
if h.allocCIDR.IP.To4() != nil {
origIP = big.NewInt(0).SetBytes(h.allocCIDR.IP.To4())
} else {
origIP = big.NewInt(0).SetBytes(h.allocCIDR.IP.To16())
}
bits := big.NewInt(0).SetBytes(ral.Data)
bits := big.NewInt(0).SetBytes(data)
for i := 0; i < bits.BitLen(); i++ {
if bits.Bit(i) != 0 {
ip := net.IP(big.NewInt(0).Add(origIP, big.NewInt(int64(uint(i+1)))).Bytes()).String()
Expand Down
15 changes: 1 addition & 14 deletions pkg/k8s/utils/utils.go
@@ -1,4 +1,4 @@
// Copyright 2018 Authors of Cilium
// Copyright 2018-2020 Authors of Cilium
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -17,7 +17,6 @@ package utils
import (
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/kubelet/types"
)

// ExtractNamespace extracts the namespace of ObjectMeta.
Expand Down Expand Up @@ -51,15 +50,3 @@ func GetObjNamespaceName(obj metav1.Object) string {

return ns + "/" + obj.GetName()
}

// GetObjUID returns the object's namespace and name.
func GetObjUID(obj metav1.Object) string {
return GetObjNamespaceName(obj) + "/" + string(obj.GetUID())
}

// IsInfraContainer returns true if the given set of labels represent a infra
// container.
func IsInfraContainer(labels map[string]string) bool {
return labels[types.KubernetesContainerNameLabel] == "POD"

}
103 changes: 0 additions & 103 deletions pkg/k8s/utils/utils_test.go

This file was deleted.

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

0 comments on commit 0f6d008

Please sign in to comment.