treewide: switch to gomod and bump everything

This switches version resolution from fietsje to gomod and updates
all Go dependencies. It also bumps rules_go (required by gVisor) and
switches the Gazelle naming convention from go_default_xxx to the
standard Bazel convention of the default target having the package
name.

Since Kubernetes dropped upstream Bazel support and doesn't check in
all generated files I manually pregenerated the OpenAPI spec. This
should be fixed, but because of the already-huge scope of this CL
and the rebase complexity this is not in here.

Change-Id: Iec8ea613d06946882426c2f9fad5bda7e8aaf833
Reviewed-on: https://review.monogon.dev/c/monogon/+/639
Reviewed-by: Sergiusz Bazanski <serge@monogon.tech>
Reviewed-by: Leopold Schabel <leo@nexantic.com>
diff --git a/third_party/go/patches/coredns-remove-unused-plugins.patch b/third_party/go/patches/coredns-remove-unused-plugins.patch
index 9180d48..e952585 100644
--- a/third_party/go/patches/coredns-remove-unused-plugins.patch
+++ b/third_party/go/patches/coredns-remove-unused-plugins.patch
@@ -1,202 +1,156 @@
-Copyright 2020 The Monogon Project 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.
-
-
-From b8a216a10775163dac6267127c35c9230ccbc5f7 Mon Sep 17 00:00:00 2001
-From: Lorenz Brun <lorenz@nexantic.com>
-Date: Mon, 27 Jul 2020 14:25:03 +0200
-Subject: [PATCH] Removed unused plugins
+From 355d38f38cf241b91a862795892bcb87c5729d2e Mon Sep 17 00:00:00 2001
+From: Lorenz Brun <lorenz@monogon.tech>
+Date: Wed, 16 Mar 2022 13:39:39 +0100
+Subject: [PATCH] Remove unused plugins
 
 ---
- core/dnsserver/zdirectives.go | 26 --------------------------
- core/plugin/zplugin.go        | 26 --------------------------
- plugin.cfg                    | 26 --------------------------
- plugin/kubernetes/setup.go    |  3 ---
- 4 files changed, 81 deletions(-)
+ core/dnsserver/zdirectives.go | 7 -------
+ core/plugin/zplugin.go        | 7 -------
+ plugin.cfg                    | 7 -------
+ plugin/kubernetes/setup.go    | 3 ---
+ 4 files changed, 24 deletions(-)
 
 diff --git a/core/dnsserver/zdirectives.go b/core/dnsserver/zdirectives.go
-index 1bf449cb..c3619160 100644
+index bca21718..678c02c6 100644
 --- a/core/dnsserver/zdirectives.go
 +++ b/core/dnsserver/zdirectives.go
-@@ -11,48 +11,22 @@ package dnsserver
+@@ -11,7 +11,6 @@ package dnsserver
  // care what plugin above them are doing.
  var Directives = []string{
  	"metadata",
--	"cancel",
--	"tls",
+-	"geoip",
+ 	"cancel",
+ 	"tls",
  	"reload",
- 	"nsid",
- 	"bufsize",
--	"root",
+@@ -20,14 +19,12 @@ var Directives = []string{
+ 	"root",
  	"bind",
  	"debug",
 -	"trace",
--	"ready",
+ 	"ready",
  	"health",
--	"pprof",
--	"prometheus",
+ 	"pprof",
+ 	"prometheus",
  	"errors",
  	"log",
 -	"dnstap",
+ 	"local",
  	"dns64",
  	"acl",
- 	"any",
--	"chaos",
- 	"loadbalance",
- 	"cache",
--	"rewrite",
--	"dnssec",
--	"autopath",
+@@ -43,15 +40,11 @@ var Directives = []string{
  	"template",
--	"transfer",
+ 	"transfer",
  	"hosts",
 -	"route53",
 -	"azure",
 -	"clouddns",
--	"k8s_external",
+ 	"k8s_external",
  	"kubernetes",
--	"file",
--	"auto",
--	"secondary",
+ 	"file",
+ 	"auto",
+ 	"secondary",
 -	"etcd",
--	"loop",
+ 	"loop",
  	"forward",
--	"grpc",
--	"erratic",
- 	"whoami",
--	"on",
--	"sign",
- }
+ 	"grpc",
 diff --git a/core/plugin/zplugin.go b/core/plugin/zplugin.go
-index cf83be70..de026516 100644
+index a9167eea..2a5d0b13 100644
 --- a/core/plugin/zplugin.go
 +++ b/core/plugin/zplugin.go
-@@ -4,49 +4,23 @@ package plugin
-
- import (
- 	// Include all plugins.
--	_ "github.com/caddyserver/caddy/onevent"
- 	_ "github.com/coredns/coredns/plugin/acl"
+@@ -9,23 +9,18 @@ import (
  	_ "github.com/coredns/coredns/plugin/any"
--	_ "github.com/coredns/coredns/plugin/auto"
--	_ "github.com/coredns/coredns/plugin/autopath"
+ 	_ "github.com/coredns/coredns/plugin/auto"
+ 	_ "github.com/coredns/coredns/plugin/autopath"
 -	_ "github.com/coredns/coredns/plugin/azure"
  	_ "github.com/coredns/coredns/plugin/bind"
  	_ "github.com/coredns/coredns/plugin/bufsize"
  	_ "github.com/coredns/coredns/plugin/cache"
--	_ "github.com/coredns/coredns/plugin/cancel"
--	_ "github.com/coredns/coredns/plugin/chaos"
+ 	_ "github.com/coredns/coredns/plugin/cancel"
+ 	_ "github.com/coredns/coredns/plugin/chaos"
 -	_ "github.com/coredns/coredns/plugin/clouddns"
  	_ "github.com/coredns/coredns/plugin/debug"
  	_ "github.com/coredns/coredns/plugin/dns64"
--	_ "github.com/coredns/coredns/plugin/dnssec"
+ 	_ "github.com/coredns/coredns/plugin/dnssec"
 -	_ "github.com/coredns/coredns/plugin/dnstap"
--	_ "github.com/coredns/coredns/plugin/erratic"
+ 	_ "github.com/coredns/coredns/plugin/erratic"
  	_ "github.com/coredns/coredns/plugin/errors"
 -	_ "github.com/coredns/coredns/plugin/etcd"
--	_ "github.com/coredns/coredns/plugin/file"
+ 	_ "github.com/coredns/coredns/plugin/file"
  	_ "github.com/coredns/coredns/plugin/forward"
--	_ "github.com/coredns/coredns/plugin/grpc"
+-	_ "github.com/coredns/coredns/plugin/geoip"
+ 	_ "github.com/coredns/coredns/plugin/grpc"
+ 	_ "github.com/coredns/coredns/plugin/header"
  	_ "github.com/coredns/coredns/plugin/health"
- 	_ "github.com/coredns/coredns/plugin/hosts"
--	_ "github.com/coredns/coredns/plugin/k8s_external"
- 	_ "github.com/coredns/coredns/plugin/kubernetes"
- 	_ "github.com/coredns/coredns/plugin/loadbalance"
- 	_ "github.com/coredns/coredns/plugin/log"
--	_ "github.com/coredns/coredns/plugin/loop"
- 	_ "github.com/coredns/coredns/plugin/metadata"
--	_ "github.com/coredns/coredns/plugin/metrics"
- 	_ "github.com/coredns/coredns/plugin/nsid"
--	_ "github.com/coredns/coredns/plugin/pprof"
--	_ "github.com/coredns/coredns/plugin/ready"
+@@ -45,12 +40,10 @@ import (
  	_ "github.com/coredns/coredns/plugin/reload"
--	_ "github.com/coredns/coredns/plugin/rewrite"
--	_ "github.com/coredns/coredns/plugin/root"
+ 	_ "github.com/coredns/coredns/plugin/rewrite"
+ 	_ "github.com/coredns/coredns/plugin/root"
 -	_ "github.com/coredns/coredns/plugin/route53"
--	_ "github.com/coredns/coredns/plugin/secondary"
--	_ "github.com/coredns/coredns/plugin/sign"
+ 	_ "github.com/coredns/coredns/plugin/secondary"
+ 	_ "github.com/coredns/coredns/plugin/sign"
  	_ "github.com/coredns/coredns/plugin/template"
--	_ "github.com/coredns/coredns/plugin/tls"
+ 	_ "github.com/coredns/coredns/plugin/tls"
 -	_ "github.com/coredns/coredns/plugin/trace"
--	_ "github.com/coredns/coredns/plugin/transfer"
+ 	_ "github.com/coredns/coredns/plugin/transfer"
  	_ "github.com/coredns/coredns/plugin/whoami"
  )
 diff --git a/plugin.cfg b/plugin.cfg
-index c389d74e..80a8bc51 100644
+index 628e7141..d4ce1c89 100644
 --- a/plugin.cfg
 +++ b/plugin.cfg
-@@ -20,47 +20,21 @@
+@@ -20,7 +20,6 @@
  # log:log
-
+ 
  metadata:metadata
--cancel:cancel
--tls:tls
+-geoip:geoip
+ cancel:cancel
+ tls:tls
  reload:reload
- nsid:nsid
- bufsize:bufsize
--root:root
+@@ -29,14 +28,12 @@ bufsize:bufsize
+ root:root
  bind:bind
  debug:debug
 -trace:trace
--ready:ready
+ ready:ready
  health:health
--pprof:pprof
--prometheus:metrics
+ pprof:pprof
+ prometheus:metrics
  errors:errors
  log:log
 -dnstap:dnstap
+ local:local
  dns64:dns64
  acl:acl
- any:any
--chaos:chaos
- loadbalance:loadbalance
- cache:cache
--rewrite:rewrite
--dnssec:dnssec
--autopath:autopath
+@@ -52,15 +49,11 @@ minimal:minimal
  template:template
--transfer:transfer
+ transfer:transfer
  hosts:hosts
 -route53:route53
 -azure:azure
 -clouddns:clouddns
--k8s_external:k8s_external
+ k8s_external:k8s_external
  kubernetes:kubernetes
--file:file
--auto:auto
--secondary:secondary
+ file:file
+ auto:auto
+ secondary:secondary
 -etcd:etcd
--loop:loop
+ loop:loop
  forward:forward
--grpc:grpc
--erratic:erratic
- whoami:whoami
--on:github.com/caddyserver/caddy/onevent
--sign:sign
+ grpc:grpc
 diff --git a/plugin/kubernetes/setup.go b/plugin/kubernetes/setup.go
-index 0c46a3ab..827fc141 100644
+index 5f5ab058..ae1a7cf8 100644
 --- a/plugin/kubernetes/setup.go
 +++ b/plugin/kubernetes/setup.go
-@@ -20,9 +20,6 @@ import (
- 	"github.com/caddyserver/caddy"
+@@ -17,9 +17,6 @@ import (
+ 
  	"github.com/miekg/dns"
  	meta "k8s.io/apimachinery/pkg/apis/meta/v1"
 -	_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"       // pull this in here, because we want it excluded if plugin.cfg doesn't have k8s
 -	_ "k8s.io/client-go/plugin/pkg/client/auth/oidc"      // pull this in here, because we want it excluded if plugin.cfg doesn't have k8s
 -	_ "k8s.io/client-go/plugin/pkg/client/auth/openstack" // pull this in here, because we want it excluded if plugin.cfg doesn't have k8s
  	"k8s.io/client-go/tools/clientcmd"
- 	"k8s.io/klog"
+ 	"k8s.io/klog/v2"
  )
---
+-- 
 2.25.1
+