From 4a2a45ab36ee2c9e052fda1b6dbf36dbedc46e62 Mon Sep 17 00:00:00 2001 From: rushmorem Date: Thu, 22 Sep 2016 00:44:32 +0200 Subject: [PATCH] coredns: init at 001 (cherry picked from commit b93b37cf0a9c9e4fb8f3bf87013085df832a22bc) --- pkgs/servers/dns/coredns/default.nix | 27 ++ pkgs/servers/dns/coredns/deps.nix | 453 ++++++++++++++++++++++++ pkgs/servers/dns/coredns/pull-278.patch | 153 ++++++++ pkgs/top-level/all-packages.nix | 2 + 4 files changed, 635 insertions(+) create mode 100644 pkgs/servers/dns/coredns/default.nix create mode 100644 pkgs/servers/dns/coredns/deps.nix create mode 100644 pkgs/servers/dns/coredns/pull-278.patch diff --git a/pkgs/servers/dns/coredns/default.nix b/pkgs/servers/dns/coredns/default.nix new file mode 100644 index 00000000000000..1955cce2a9f8d0 --- /dev/null +++ b/pkgs/servers/dns/coredns/default.nix @@ -0,0 +1,27 @@ +{ stdenv, buildGoPackage, fetchFromGitHub }: + +buildGoPackage rec { + name = "coredns-${version}"; + version = "001"; + + goPackagePath = "github.com/miekg/coredns"; + subPackages = [ "." ]; + + src = fetchFromGitHub { + owner = "miekg"; + repo = "coredns"; + rev = "v${version}"; + sha256 = "1ybi0v40bsndiffm41hak3b3w22l1in392zcy75bpf2mklxywnak"; + }; + + patches = [ ./pull-278.patch ]; + + goDeps = ./deps.nix; + + meta = with stdenv.lib; { + homepage = https://coredns.io; + description = "A DNS server that runs middleware"; + license = licenses.asl20; + maintainers = [ maintainers.rushmorem ]; + }; +} diff --git a/pkgs/servers/dns/coredns/deps.nix b/pkgs/servers/dns/coredns/deps.nix new file mode 100644 index 00000000000000..2aa442a8fef495 --- /dev/null +++ b/pkgs/servers/dns/coredns/deps.nix @@ -0,0 +1,453 @@ +# This file was generated by go2nix. +[ + { + goPackagePath = "cloud.google.com/go"; + fetch = { + type = "git"; + url = "https://code.googlesource.com/gocloud"; + rev = "0a9baebe991e5ff35dd9f35578eb002cf07d229c"; + sha256 = "18palgdg1ldfmjqm4almlcymx9f0kf6vy9lfspl0iwkv3wsnvfb6"; + }; + } + { + goPackagePath = "github.com/PuerkitoBio/purell"; + fetch = { + type = "git"; + url = "https://github.com/PuerkitoBio/purell"; + rev = "8a290539e2e8629dbc4e6bad948158f790ec31f4"; + sha256 = "1qhsy1nm96b9kb63svkvkqmmw15xg6irwcysisxdgzk64adfwqv1"; + }; + } + { + goPackagePath = "github.com/PuerkitoBio/urlesc"; + fetch = { + type = "git"; + url = "https://github.com/PuerkitoBio/urlesc"; + rev = "5bd2802263f21d8788851d5305584c82a5c75d7e"; + sha256 = "15y5r3asvm7196m3nza5xvdvlc2k11p6lfs6hi917hl7r9vgi6mp"; + }; + } + { + goPackagePath = "github.com/beorn7/perks"; + fetch = { + type = "git"; + url = "https://github.com/beorn7/perks"; + rev = "4c0e84591b9aa9e6dcfdf3e020114cd81f89d5f9"; + sha256 = "1hrybsql68xw57brzj805xx2mghydpdiysv3gbhr7f5wlxj2514y"; + }; + } + { + goPackagePath = "github.com/blang/semver"; + fetch = { + type = "git"; + url = "https://github.com/blang/semver"; + rev = "60ec3488bfea7cca02b021d106d9911120d25fe9"; + sha256 = "19pli07y5592g4dyjyj0jq5rn548vc3fz0qg3624vm1j5828p1c2"; + }; + } + { + goPackagePath = "github.com/cloudfoundry-incubator/candiedyaml"; + fetch = { + type = "git"; + url = "https://github.com/cloudfoundry-incubator/candiedyaml"; + rev = "99c3df83b51532e3615f851d8c2dbb638f5313bf"; + sha256 = "106nibg7423642gbkg88c5x2jxfz6nmxbribhwb8cr1rn9vpjaxs"; + }; + } + { + goPackagePath = "github.com/coreos/etcd"; + fetch = { + type = "git"; + url = "https://github.com/coreos/etcd"; + rev = "c016325647ff1837d8e9695bc79837ff7549d31f"; + sha256 = "0jm0kas8c2zhkaqibvzbx7bqfg67b9yb9cs0q8g9r0b9rxjr5prk"; + }; + } + { + goPackagePath = "github.com/coreos/go-oidc"; + fetch = { + type = "git"; + url = "https://github.com/coreos/go-oidc"; + rev = "fe7346e2e6855bda769d5b3db7d917f159c5613c"; + sha256 = "141h47s2z56pff8fi926m7wzswkr34kj7hzwib8w5s8zxgdp0wld"; + }; + } + { + goPackagePath = "github.com/coreos/pkg"; + fetch = { + type = "git"; + url = "https://github.com/coreos/pkg"; + rev = "3ac0863d7acf3bc44daf49afef8919af12f704ef"; + sha256 = "0l5ans1ls2gknkrnhymgc0zbgg5nqjbjbqc51r611adcr0m6gg8l"; + }; + } + { + goPackagePath = "github.com/davecgh/go-spew"; + fetch = { + type = "git"; + url = "https://github.com/davecgh/go-spew"; + rev = "6d212800a42e8ab5c146b8ace3490ee17e5225f9"; + sha256 = "01i0n1s4j7khb7n6mz2wymniz37q0vbzkgfv7rbi6p9hpg227q93"; + }; + } + { + goPackagePath = "github.com/docker/distribution"; + fetch = { + type = "git"; + url = "https://github.com/docker/distribution"; + rev = "431cfa3179d9b3766e39f6a74283db8bb5a13209"; + sha256 = "0hwqlqns0igaa3hg1dvz2grgy46q0v8wixyzfsmxsr5xb4ggpf32"; + }; + } + { + goPackagePath = "github.com/emicklei/go-restful"; + fetch = { + type = "git"; + url = "https://github.com/emicklei/go-restful"; + rev = "c795848f1d7f574bbf767a8f17c7357e4003fed6"; + sha256 = "0abnk4055kcz57v3f5d15pd5dvvlkg7bwfy1f22rmsqwzs44ixmz"; + }; + } + { + goPackagePath = "github.com/flynn/go-shlex"; + fetch = { + type = "git"; + url = "https://github.com/flynn/go-shlex"; + rev = "3f9db97f856818214da2e1057f8ad84803971cff"; + sha256 = "1j743lysygkpa2s2gii2xr32j7bxgc15zv4113b0q9jhn676ysia"; + }; + } + { + goPackagePath = "github.com/fsnotify/fsnotify"; + fetch = { + type = "git"; + url = "https://github.com/fsnotify/fsnotify"; + rev = "f12c6236fe7b5cf6bcf30e5935d08cb079d78334"; + sha256 = "1h5s03y6b17qj12p8fpm5pdijnsbfvaq38z7b2hfjn5qp45h02xb"; + }; + } + { + goPackagePath = "github.com/ghodss/yaml"; + fetch = { + type = "git"; + url = "https://github.com/ghodss/yaml"; + rev = "aa0c862057666179de291b67d9f093d12b5a8473"; + sha256 = "0cbc78n8l7h1gdzhrvahplcvr4v7n8v23vkgskfp843rcx5h6isr"; + }; + } + { + goPackagePath = "github.com/go-openapi/jsonpointer"; + fetch = { + type = "git"; + url = "https://github.com/go-openapi/jsonpointer"; + rev = "46af16f9f7b149af66e5d1bd010e3574dc06de98"; + sha256 = "0w0fphmdycjzbsm1vppdcjc9aqinkcdzcq3pxikdvdqh5p791gsc"; + }; + } + { + goPackagePath = "github.com/go-openapi/jsonreference"; + fetch = { + type = "git"; + url = "https://github.com/go-openapi/jsonreference"; + rev = "13c6e3589ad90f49bd3e3bbe2c2cb3d7a4142272"; + sha256 = "1fh4xcl9ijww4bdq656sx981d57w2c9zx5148jsxlsg4bsvxmwis"; + }; + } + { + goPackagePath = "github.com/go-openapi/spec"; + fetch = { + type = "git"; + url = "https://github.com/go-openapi/spec"; + rev = "2433d2f0fc794728337e0c5d65716e79e163f04d"; + sha256 = "14kdzfzjs06c2050fsg9vc0mn12b6i72gj45964mzxa5a6i09ph6"; + }; + } + { + goPackagePath = "github.com/go-openapi/swag"; + fetch = { + type = "git"; + url = "https://github.com/go-openapi/swag"; + rev = "0e04f5e499b19bf51031c01a00f098f25067d8dc"; + sha256 = "0kbqrfargkx3yb6gj0k5rpi728pcgjyvy1as9x79sh3sgvnrq15f"; + }; + } + { + goPackagePath = "github.com/gogo/protobuf"; + fetch = { + type = "git"; + url = "https://github.com/gogo/protobuf"; + rev = "a31fa025390fe54d2af14a04199ed08dea5dc2fd"; + sha256 = "141059khzlkfjx5qsgzryqhl1mgilb13ha7syjm1297m54ch749c"; + }; + } + { + goPackagePath = "github.com/golang/glog"; + fetch = { + type = "git"; + url = "https://github.com/golang/glog"; + rev = "23def4e6c14b4da8ac2ed8007337bc5eb5007998"; + sha256 = "0jb2834rw5sykfr937fxi8hxi2zy80sj2bdn9b3jb4b26ksqng30"; + }; + } + { + goPackagePath = "github.com/golang/protobuf"; + fetch = { + type = "git"; + url = "https://github.com/golang/protobuf"; + rev = "1f49d83d9aa00e6ce4fc8258c71cc7786aec968a"; + sha256 = "0ny3nvjrsczihzmng2s0awvhq8k389l4lzl3vwgifi6ng34fszbj"; + }; + } + { + goPackagePath = "github.com/google/cadvisor"; + fetch = { + type = "git"; + url = "https://github.com/google/cadvisor"; + rev = "418c181ebad0d592828bd53c5704ed9af9a7c5a6"; + sha256 = "1k3r7a333a6x53fs0anvraf8n93dyanjfwp396sng1zxchb07dk3"; + }; + } + { + goPackagePath = "github.com/google/gofuzz"; + fetch = { + type = "git"; + url = "https://github.com/google/gofuzz"; + rev = "fd52762d25a41827db7ef64c43756fd4b9f7e382"; + sha256 = "1yxmmr73h0lq7ryf3q9a7pcm2x5xrg4d5bxkq8n5pxwxwyq26kw8"; + }; + } + { + goPackagePath = "github.com/hashicorp/go-syslog"; + fetch = { + type = "git"; + url = "https://github.com/hashicorp/go-syslog"; + rev = "315de0c1920b18b942603ffdc2229e2af4803c17"; + sha256 = "1z0kinqp8hbl7hw856jhx41ys97rc6hflcgwrkfyxj5fdx60xis6"; + }; + } + { + goPackagePath = "github.com/howeyc/gopass"; + fetch = { + type = "git"; + url = "https://github.com/howeyc/gopass"; + rev = "26c6e1184fd5255fa5f5289d0b789a4819c203a4"; + sha256 = "00fd4pa2dq8fala5sc6ics2721hnkh69p7d35w5lb2zf1i41l6dq"; + }; + } + { + goPackagePath = "github.com/imdario/mergo"; + fetch = { + type = "git"; + url = "https://github.com/imdario/mergo"; + rev = "50d4dbd4eb0e84778abe37cefef140271d96fade"; + sha256 = "06z52vri1ymb0s8nk2qr4xmw068s4abh6b66qj4w92whjxmxsvnh"; + }; + } + { + goPackagePath = "github.com/jonboulle/clockwork"; + fetch = { + type = "git"; + url = "https://github.com/jonboulle/clockwork"; + rev = "bcac9884e7502bb2b474c0339d889cb981a2f27f"; + sha256 = "1a732411y26arr0pq9j5rfkyql7rqxbkanjs4m59hil8cx8mb068"; + }; + } + { + goPackagePath = "github.com/juju/ratelimit"; + fetch = { + type = "git"; + url = "https://github.com/juju/ratelimit"; + rev = "77ed1c8a01217656d2080ad51981f6e99adaa177"; + sha256 = "1r7xdl3bpdzny4d05fpm229864ipghqwv5lplv5im5b4vhv9ryp7"; + }; + } + { + goPackagePath = "github.com/mailru/easyjson"; + fetch = { + type = "git"; + url = "https://github.com/mailru/easyjson"; + rev = "e978125a7e335d8f4db746a9ac5b44643f27416b"; + sha256 = "1if7bzxs9ibq1a1d8z96djixqrxnwc2wplcbc67ddk071anrbs8w"; + }; + } + { + goPackagePath = "github.com/matttproud/golang_protobuf_extensions"; + fetch = { + type = "git"; + url = "https://github.com/matttproud/golang_protobuf_extensions"; + rev = "c12348ce28de40eed0136aa2b644d0ee0650e56c"; + sha256 = "1d0c1isd2lk9pnfq2nk0aih356j30k3h1gi2w0ixsivi5csl7jya"; + }; + } + { + goPackagePath = "github.com/mholt/caddy"; + fetch = { + type = "git"; + url = "https://github.com/mholt/caddy"; + rev = "bbf954cbf2801bc32f4378fe5059eb16de3ae4d3"; + sha256 = "1i5p9xz3lhir5k070a580mi77n4vbjlbglzi92qbn0mxrdvd13lr"; + }; + } + { + goPackagePath = "github.com/miekg/coredns"; + fetch = { + type = "git"; + url = "https://github.com/miekg/coredns.git"; + rev = "a8fb01bfd28e8b57f6d7b7d33f8282d807b2457d"; + sha256 = "1ybi0v40bsndiffm41hak3b3w22l1in392zcy75bpf2mklxywnak"; + }; + } + { + goPackagePath = "github.com/miekg/dns"; + fetch = { + type = "git"; + url = "https://github.com/miekg/dns"; + rev = "db96a2b759cdef4f11a34506a42eb8d1290c598e"; + sha256 = "0h5n4psd0p7q55jadgsgz2a1aj791yanrfj76avalh6aawvdpcm6"; + }; + } + { + goPackagePath = "github.com/patrickmn/go-cache"; + fetch = { + type = "git"; + url = "https://github.com/patrickmn/go-cache"; + rev = "1881a9bccb818787f68c52bfba648c6cf34c34fa"; + sha256 = "1nd0kqijx6mrxb8wlh20bx73mwj0fqzla2sr68y6j6lz3fsy1fw2"; + }; + } + { + goPackagePath = "github.com/pborman/uuid"; + fetch = { + type = "git"; + url = "https://github.com/pborman/uuid"; + rev = "b984ec7fa9ff9e428bd0cf0abf429384dfbe3e37"; + sha256 = "0y4nxc0kzlmqfqi3w3m7r9h508bx80vxbzj4qn0mksp40mfhjxyv"; + }; + } + { + goPackagePath = "github.com/prometheus/client_golang"; + fetch = { + type = "git"; + url = "https://github.com/prometheus/client_golang"; + rev = "5636dc67ae776adf5590da7349e70fbb9559972d"; + sha256 = "0fb4w52zp0jk8218gwk4wgbhpj7d4hp6n00dvm8s0ajbysbx524d"; + }; + } + { + goPackagePath = "github.com/prometheus/client_model"; + fetch = { + type = "git"; + url = "https://github.com/prometheus/client_model"; + rev = "fa8ad6fec33561be4280a8f0514318c79d7f6cb6"; + sha256 = "11a7v1fjzhhwsl128znjcf5v7v6129xjgkdpym2lial4lac1dhm9"; + }; + } + { + goPackagePath = "github.com/prometheus/common"; + fetch = { + type = "git"; + url = "https://github.com/prometheus/common"; + rev = "9a94032291f2192936512bab367bc45e77990d6a"; + sha256 = "10ligvvdh6v5l7i1khirnhhfdhnlasxrqq39b3hxpnz9fq0fibg5"; + }; + } + { + goPackagePath = "github.com/prometheus/procfs"; + fetch = { + type = "git"; + url = "https://github.com/prometheus/procfs"; + rev = "abf152e5f3e97f2fafac028d2cc06c1feb87ffa5"; + sha256 = "0cp8lznv1b4zhi3wnbjkfxwzhkqd3wbmiy6mwgjanip8l9l3ykws"; + }; + } + { + goPackagePath = "github.com/spf13/pflag"; + fetch = { + type = "git"; + url = "https://github.com/spf13/pflag"; + rev = "c7e63cf4530bcd3ba943729cee0efeff2ebea63f"; + sha256 = "197mlkgb01zk86fxfl8r8maymcxsspqblg7hmngjxf7ivdid1i1l"; + }; + } + { + goPackagePath = "github.com/ugorji/go"; + fetch = { + type = "git"; + url = "https://github.com/ugorji/go"; + rev = "b7eff9abce531d6aeda923e759ae668e56601d21"; + sha256 = "0w84jwpiq0knspc9pp8dfvr5z6h7yl3qdq59ihvlfixl3kczw5k4"; + }; + } + { + goPackagePath = "golang.org/x/crypto"; + fetch = { + type = "git"; + url = "https://go.googlesource.com/crypto"; + rev = "6ab629be5e31660579425a738ba8870beb5b7404"; + sha256 = "1pk98j3wcxkns9whgazhid3if0dnaf57hmq0h6byq75aj9xbncxj"; + }; + } + { + goPackagePath = "golang.org/x/net"; + fetch = { + type = "git"; + url = "https://go.googlesource.com/net"; + rev = "f4fe4abe3c785295ddf81c7f1823bcd3bad391b6"; + sha256 = "0l50x533pj0sj3gnr30zxgm51y4x5a5fwc515zj93iy1z0pyf9cn"; + }; + } + { + goPackagePath = "golang.org/x/oauth2"; + fetch = { + type = "git"; + url = "https://go.googlesource.com/oauth2"; + rev = "3c3a985cb79f52a3190fbc056984415ca6763d01"; + sha256 = "0c7x8wkya56z03j2qfm61932npsddgqyggi75hkla9755d1inqlv"; + }; + } + { + goPackagePath = "golang.org/x/sys"; + fetch = { + type = "git"; + url = "https://go.googlesource.com/sys"; + rev = "8f0908ab3b2457e2e15403d3697c9ef5cb4b57a9"; + sha256 = "04va4pqygfzr89fx873k44bmivk7nybqalybi6q96lnn45h2scbr"; + }; + } + { + goPackagePath = "golang.org/x/text"; + fetch = { + type = "git"; + url = "https://go.googlesource.com/text"; + rev = "2df9074612f50810d82416d2229398a1e7188c5c"; + sha256 = "0ibg4pr9hxlvc5m4zn5hl4nsb6v5i0yfr9japsnjm010318df885"; + }; + } + { + goPackagePath = "gopkg.in/inf.v0"; + fetch = { + type = "git"; + url = "https://gopkg.in/inf.v0"; + rev = "3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4"; + sha256 = "0rf3vwyb8aqnac9x9d6ax7z5526c45a16yjm2pvkijr6qgqz8b82"; + }; + } + { + goPackagePath = "k8s.io/client-go"; + fetch = { + type = "git"; + url = "https://github.com/kubernetes/client-go"; + rev = "93fcd402979cfad8a7151f96e016416947c6a3cb"; + sha256 = "1v0kyav7i40wrahg9ng1vfq87xcp8r8hi4y7bspyfg35np6j8wdj"; + }; + } + { + goPackagePath = "k8s.io/kubernetes"; + fetch = { + type = "git"; + url = "https://github.com/kubernetes/kubernetes"; + rev = "313ef63993017597bd28f5efd23677820274cb58"; + sha256 = "1rl2mwhg20h5ay3crg5jqiwabfwgn8amp4dps6qmzyy3pcrjvsa8"; + }; + } +] diff --git a/pkgs/servers/dns/coredns/pull-278.patch b/pkgs/servers/dns/coredns/pull-278.patch new file mode 100644 index 00000000000000..1323f898c785da --- /dev/null +++ b/pkgs/servers/dns/coredns/pull-278.patch @@ -0,0 +1,153 @@ +From 1158d4cb3a3cd43f1d0a72bd35c6dea9b1de345e Mon Sep 17 00:00:00 2001 +From: Manuel de Brito Fontes +Date: Wed, 21 Sep 2016 14:16:52 -0300 +Subject: [PATCH] Fix k8s build + +--- + contrib/kubernetes/testscripts/00_run_k8s.sh | 2 +- + contrib/kubernetes/testscripts/10_setup_kubectl.sh | 2 +- + middleware/kubernetes/controller.go | 38 ++++++++-------------- + middleware/kubernetes/kubernetes.go | 9 +++-- + 4 files changed, 20 insertions(+), 31 deletions(-) + +diff --git a/contrib/kubernetes/testscripts/00_run_k8s.sh b/contrib/kubernetes/testscripts/00_run_k8s.sh +index ef98a8e..7ff6811 100755 +--- a/contrib/kubernetes/testscripts/00_run_k8s.sh ++++ b/contrib/kubernetes/testscripts/00_run_k8s.sh +@@ -5,7 +5,7 @@ set -e + # Based on instructions at: http://kubernetes.io/docs/getting-started-guides/docker/ + + #K8S_VERSION=$(curl -sS https://storage.googleapis.com/kubernetes-release/release/latest.txt) +-K8S_VERSION="v1.2.4" ++K8S_VERSION="v1.3.7" + + ARCH="amd64" + +diff --git a/contrib/kubernetes/testscripts/10_setup_kubectl.sh b/contrib/kubernetes/testscripts/10_setup_kubectl.sh +index 1778671..a7cfc1e 100755 +--- a/contrib/kubernetes/testscripts/10_setup_kubectl.sh ++++ b/contrib/kubernetes/testscripts/10_setup_kubectl.sh +@@ -10,7 +10,7 @@ cd ${BASEDIR} + echo "Setting up kubectl..." + + if [ ! -e kubectl ]; then +- curl -O http://storage.googleapis.com/kubernetes-release/release/v1.2.4/bin/linux/amd64/kubectl ++ curl -O http://storage.googleapis.com/kubernetes-release/release/v1.3.7/bin/linux/amd64/kubectl + chmod u+x kubectl + fi + +diff --git a/middleware/kubernetes/controller.go b/middleware/kubernetes/controller.go +index 126d415..c7f9e9e 100644 +--- a/middleware/kubernetes/controller.go ++++ b/middleware/kubernetes/controller.go +@@ -55,12 +55,15 @@ func newdnsController(kubeClient *client.Client, resyncPeriod time.Duration, lse + }, + &api.Endpoints{}, resyncPeriod, cache.ResourceEventHandlerFuncs{}) + +- dns.svcLister.Store, dns.svcController = cache.NewInformer( ++ dns.svcLister.Indexer, dns.svcController = cache.NewIndexerInformer( + &cache.ListWatch{ + ListFunc: serviceListFunc(dns.client, namespace, dns.selector), + WatchFunc: serviceWatchFunc(dns.client, namespace, dns.selector), + }, +- &api.Service{}, resyncPeriod, cache.ResourceEventHandlerFuncs{}) ++ &api.Service{}, ++ resyncPeriod, ++ cache.ResourceEventHandlerFuncs{}, ++ cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) + + dns.nsLister.Store, dns.nsController = cache.NewInformer( + &cache.ListWatch{ +@@ -163,47 +166,34 @@ func (dns *dnsController) GetNamespaceList() *api.NamespaceList { + return &nsList + } + +-func (dns *dnsController) GetServiceList() *api.ServiceList { +- svcList, err := dns.svcLister.List() ++func (dns *dnsController) GetServiceList() []*api.Service { ++ svcs, err := dns.svcLister.List(labels.Everything()) + if err != nil { +- return &api.ServiceList{} ++ return []*api.Service{} + } +- +- return &svcList ++ return svcs + } + + // GetServicesByNamespace returns a map of + // namespacename :: [ kubernetesService ] + func (dns *dnsController) GetServicesByNamespace() map[string][]api.Service { + k8sServiceList := dns.GetServiceList() +- if k8sServiceList == nil { +- return nil +- } +- +- items := make(map[string][]api.Service, len(k8sServiceList.Items)) +- for _, i := range k8sServiceList.Items { ++ items := make(map[string][]api.Service, len(k8sServiceList)) ++ for _, i := range k8sServiceList { + namespace := i.Namespace +- items[namespace] = append(items[namespace], i) ++ items[namespace] = append(items[namespace], *i) + } +- + return items + } + + // GetServiceInNamespace returns the Service that matches + // servicename in the namespace + func (dns *dnsController) GetServiceInNamespace(namespace string, servicename string) *api.Service { +- svcKey := fmt.Sprintf("%v/%v", namespace, servicename) +- svcObj, svcExists, err := dns.svcLister.Store.GetByKey(svcKey) +- ++ svcObj, err := dns.svcLister.Services(namespace).Get(servicename) + if err != nil { + // TODO(...): should return err here + return nil + } + +- if !svcExists { +- // TODO(...): should return err here +- return nil +- } +- +- return svcObj.(*api.Service) ++ return svcObj + } +diff --git a/middleware/kubernetes/kubernetes.go b/middleware/kubernetes/kubernetes.go +index 0bd1dc7..eddc58b 100644 +--- a/middleware/kubernetes/kubernetes.go ++++ b/middleware/kubernetes/kubernetes.go +@@ -183,14 +183,14 @@ func (k *Kubernetes) Get(namespace string, nsWildcard bool, servicename string, + + var resultItems []api.Service + +- for _, item := range serviceList.Items { ++ for _, item := range serviceList { + if symbolMatches(namespace, item.Namespace, nsWildcard) && symbolMatches(servicename, item.Name, serviceWildcard) { + // If namespace has a wildcard, filter results against Corefile namespace list. + // (Namespaces without a wildcard were filtered before the call to this function.) + if nsWildcard && (len(k.Namespaces) > 0) && (!util.StringInSlice(item.Namespace, k.Namespaces)) { + continue + } +- resultItems = append(resultItems, item) ++ resultItems = append(resultItems, *item) + } + } + +@@ -216,12 +216,11 @@ func isKubernetesNameError(err error) bool { + } + + func (k *Kubernetes) getServiceRecordForIP(ip, name string) []msg.Service { +- svcList, err := k.APIConn.svcLister.List() ++ svcList, err := k.APIConn.svcLister.List(labels.Everything()) + if err != nil { + return nil + } +- +- for _, service := range svcList.Items { ++ for _, service := range svcList { + if service.Spec.ClusterIP == ip { + return []msg.Service{msg.Service{Host: ip}} + } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 420071e2ef5807..bf83c23f225e80 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10863,6 +10863,8 @@ in conntrack_tools = callPackage ../os-specific/linux/conntrack-tools { }; + coredns = callPackage ../servers/dns/coredns { }; + cpufrequtils = callPackage ../os-specific/linux/cpufrequtils { }; cryopid = callPackage ../os-specific/linux/cryopid { };