improbable-eng / etcd-cluster-operator

A controller to deploy and manage etcd clusters inside of Kubernetes
MIT License
128 stars 35 forks source link

Upgrade to Kubebuilder 2.3.0 #182

Closed wallrj closed 4 years ago

wallrj commented 4 years ago

Upgrade to Kubebuilder 2.3.0: https://github.com/kubernetes-sigs/kubebuilder/releases/tag/v2.3.0

The main difference is that the kubebuilder tests will now run against kube-apiserver v1.16.4 rather than v1.15.5

I've also looked at what changes were introduced to the skaffolding, but there isn't much that affects us. See comment below.

Here's a diff showing differences between projects created by 2.2.0 and 2.3.0, some of these might need applying to our project:


diff --git a/example-2-2-0/Makefile b/example-2-3-0/Makefile
index cf99ca1..5da22b5 100644
--- a/example-2-2-0/Makefile
+++ b/example-2-3-0/Makefile
@@ -52,7 +52,7 @@ vet:

 # Generate code
 generate: controller-gen
-   $(CONTROLLER_GEN) object:headerFile=./hack/boilerplate.go.txt paths="./..."
+   $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

 # Build the docker image
 docker-build: test
@@ -71,7 +71,7 @@ ifeq (, $(shell which controller-gen))
    CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
    cd $$CONTROLLER_GEN_TMP_DIR ;\
    go mod init tmp ;\
-   go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.2.4 ;\
+   go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.2.5 ;\
    rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
    }
 CONTROLLER_GEN=$(GOBIN)/controller-gen
diff --git a/example-2-2-0/api/v1beta1/frigate_types.go b/example-2-3-0/api/v1beta1/frigate_types.go
index 39c2641..2651491 100644
--- a/example-2-2-0/api/v1beta1/frigate_types.go
+++ b/example-2-3-0/api/v1beta1/frigate_types.go
@@ -1,5 +1,6 @@
 /*

+
 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
diff --git a/example-2-2-0/api/v1beta1/groupversion_info.go b/example-2-3-0/api/v1beta1/groupversion_info.go
index 1604631..a5e08e5 100644
--- a/example-2-2-0/api/v1beta1/groupversion_info.go
+++ b/example-2-3-0/api/v1beta1/groupversion_info.go
@@ -1,5 +1,6 @@
 /*

+
 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
diff --git a/example-2-2-0/api/v1beta1/zz_generated.deepcopy.go b/example-2-3-0/api/v1beta1/zz_generated.deepcopy.go
index bd859c1..64cc5ba 100644
--- a/example-2-2-0/api/v1beta1/zz_generated.deepcopy.go
+++ b/example-2-3-0/api/v1beta1/zz_generated.deepcopy.go
@@ -2,6 +2,7 @@

 /*

+
 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
diff --git a/example-2-3-0/bin/manager b/example-2-3-0/bin/manager
new file mode 100755
index 0000000..65b9a64
Binary files /dev/null and b/example-2-3-0/bin/manager differ
diff --git a/example-2-2-0/config/certmanager/certificate.yaml b/example-2-3-0/config/certmanager/certificate.yaml
index 237c937..58db114 100644
--- a/example-2-2-0/config/certmanager/certificate.yaml
+++ b/example-2-3-0/config/certmanager/certificate.yaml
@@ -1,6 +1,7 @@
 # The following manifests contain a self-signed issuer CR and a certificate CR.
 # More document can be found at https://docs.cert-manager.io
-# WARNING: Targets CertManager 0.11 check https://docs.cert-manager.io/en/latest/tasks/upgrading/index.html for breaking changes
+# WARNING: Targets CertManager 0.11 check https://docs.cert-manager.io/en/latest/tasks/upgrading/index.html for 
+# breaking changes
 apiVersion: cert-manager.io/v1alpha2
 kind: Issuer
 metadata:
diff --git a/example-2-2-0/config/default/kustomization.yaml b/example-2-3-0/config/default/kustomization.yaml
index add3c5f..06c5ad4 100644
--- a/example-2-2-0/config/default/kustomization.yaml
+++ b/example-2-3-0/config/default/kustomization.yaml
@@ -1,12 +1,12 @@
 # Adds namespace to all resources.
-namespace: example-2-2-0-system
+namespace: example-2-3-0-system

 # Value of this field is prepended to the
 # names of all resources, e.g. a deployment named
 # "wordpress" becomes "alices-wordpress".
 # Note that it should also match with the prefix (text before '-') of the namespace
 # field above.
-namePrefix: example-2-2-0-
+namePrefix: example-2-3-0-

 # Labels to add to all resources and selectors.
 #commonLabels:
@@ -16,7 +16,8 @@ bases:
 - ../crd
 - ../rbac
 - ../manager
-# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in crd/kustomization.yaml
+# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in 
+# crd/kustomization.yaml
 #- ../webhook
 # [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required.
 #- ../certmanager
@@ -25,17 +26,12 @@ bases:

 patchesStrategicMerge:
   # Protect the /metrics endpoint by putting it behind auth.
-  # Only one of manager_auth_proxy_patch.yaml and
-  # manager_prometheus_metrics_patch.yaml should be enabled.
-- manager_auth_proxy_patch.yaml
   # If you want your controller-manager to expose the /metrics
-  # endpoint w/o any authn/z, uncomment the following line and
-  # comment manager_auth_proxy_patch.yaml.
-  # Only one of manager_auth_proxy_patch.yaml and
-  # manager_prometheus_metrics_patch.yaml should be enabled.
-#- manager_prometheus_metrics_patch.yaml
+  # endpoint w/o any authn/z, please comment the following line.
+- manager_auth_proxy_patch.yaml

-# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in crd/kustomization.yaml
+# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in 
+# crd/kustomization.yaml
 #- manager_webhook_patch.yaml

 # [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'.
diff --git a/example-2-2-0/config/default/manager_auth_proxy_patch.yaml b/example-2-3-0/config/default/manager_auth_proxy_patch.yaml
index 61cb5e7..c23836e 100644
--- a/example-2-2-0/config/default/manager_auth_proxy_patch.yaml
+++ b/example-2-3-0/config/default/manager_auth_proxy_patch.yaml
@@ -1,5 +1,5 @@
-# This patch inject a sidecar container which is a HTTP proxy for the controller manager,
-# it performs RBAC authorization against the Kubernetes API using SubjectAccessReviews.
+# This patch inject a sidecar container which is a HTTP proxy for the 
+# controller manager, it performs RBAC authorization against the Kubernetes API using SubjectAccessReviews.
 apiVersion: apps/v1
 kind: Deployment
 metadata:
diff --git a/example-2-2-0/config/prometheus/monitor.yaml b/example-2-3-0/config/prometheus/monitor.yaml
index e2d9b08..9b8047b 100644
--- a/example-2-2-0/config/prometheus/monitor.yaml
+++ b/example-2-3-0/config/prometheus/monitor.yaml
@@ -12,4 +12,5 @@ spec:
     - path: /metrics
       port: https
   selector:
-    control-plane: controller-manager
+    matchLabels:
+      control-plane: controller-manager
diff --git a/example-2-3-0/config/rbac/auth_proxy_client_clusterrole.yaml b/example-2-3-0/config/rbac/auth_proxy_client_clusterrole.yaml
new file mode 100644
index 0000000..7d62534
--- /dev/null
+++ b/example-2-3-0/config/rbac/auth_proxy_client_clusterrole.yaml
@@ -0,0 +1,7 @@
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: ClusterRole
+metadata:
+  name: metrics-reader
+rules:
+- nonResourceURLs: ["/metrics"]
+  verbs: ["get"]
diff --git a/example-2-2-0/config/rbac/frigate_editor_role.yaml b/example-2-3-0/config/rbac/frigate_editor_role.yaml
index 933e0c4..ae83fbf 100644
--- a/example-2-2-0/config/rbac/frigate_editor_role.yaml
+++ b/example-2-3-0/config/rbac/frigate_editor_role.yaml
@@ -1,4 +1,4 @@
-# permissions to do edit frigates.
+# permissions for end users to edit frigates.
 apiVersion: rbac.authorization.k8s.io/v1
 kind: ClusterRole
 metadata:
@@ -22,5 +22,3 @@ rules:
   - frigates/status
   verbs:
   - get
-  - patch
-  - update
diff --git a/example-2-2-0/config/rbac/frigate_viewer_role.yaml b/example-2-3-0/config/rbac/frigate_viewer_role.yaml
index 6875957..e5e0720 100644
--- a/example-2-2-0/config/rbac/frigate_viewer_role.yaml
+++ b/example-2-3-0/config/rbac/frigate_viewer_role.yaml
@@ -1,4 +1,4 @@
-# permissions to do viewer frigates.
+# permissions for end users to view frigates.
 apiVersion: rbac.authorization.k8s.io/v1
 kind: ClusterRole
 metadata:
diff --git a/example-2-2-0/config/rbac/kustomization.yaml b/example-2-3-0/config/rbac/kustomization.yaml
index 817f1fe..66c2833 100644
--- a/example-2-2-0/config/rbac/kustomization.yaml
+++ b/example-2-3-0/config/rbac/kustomization.yaml
@@ -3,9 +3,10 @@ resources:
 - role_binding.yaml
 - leader_election_role.yaml
 - leader_election_role_binding.yaml
-# Comment the following 3 lines if you want to disable
+# Comment the following 4 lines if you want to disable
 # the auth proxy (https://github.com/brancz/kube-rbac-proxy)
 # which protects your /metrics endpoint.
 - auth_proxy_service.yaml
 - auth_proxy_role.yaml
 - auth_proxy_role_binding.yaml
+- auth_proxy_client_clusterrole.yaml
diff --git a/example-2-2-0/controllers/frigate_controller.go b/example-2-3-0/controllers/frigate_controller.go
index f84c261..9f9a3e3 100644
--- a/example-2-2-0/controllers/frigate_controller.go
+++ b/example-2-3-0/controllers/frigate_controller.go
@@ -1,5 +1,6 @@
 /*

+
 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
diff --git a/example-2-2-0/controllers/suite_test.go b/example-2-3-0/controllers/suite_test.go
index 78ede99..7480f66 100644
--- a/example-2-2-0/controllers/suite_test.go
+++ b/example-2-3-0/controllers/suite_test.go
@@ -1,5 +1,6 @@
 /*

+
 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
@@ -21,14 +22,15 @@ import (

    . "github.com/onsi/ginkgo"
    . "github.com/onsi/gomega"
-
-   shipv1beta1 "github.com/jetstack/example/api/v1beta1"
    "k8s.io/client-go/kubernetes/scheme"
    "k8s.io/client-go/rest"
    "sigs.k8s.io/controller-runtime/pkg/client"
    "sigs.k8s.io/controller-runtime/pkg/envtest"
+   "sigs.k8s.io/controller-runtime/pkg/envtest/printer"
    logf "sigs.k8s.io/controller-runtime/pkg/log"
    "sigs.k8s.io/controller-runtime/pkg/log/zap"
+
+   shipv1beta1 "github.com/jetstack/example/api/v1beta1"
    // +kubebuilder:scaffold:imports
 )

@@ -44,7 +46,7 @@ func TestAPIs(t *testing.T) {

    RunSpecsWithDefaultAndCustomReporters(t,
        "Controller Suite",
-       []Reporter{envtest.NewlineReporter{}})
+       []Reporter{printer.NewlineReporter{}})
 }

 var _ = BeforeSuite(func(done Done) {
diff --git a/example-2-2-0/go.mod b/example-2-3-0/go.mod
index b843758..364a4aa 100644
--- a/example-2-2-0/go.mod
+++ b/example-2-3-0/go.mod
@@ -1,12 +1,12 @@
 module github.com/jetstack/example

-go 1.14
+go 1.13

 require (
    github.com/go-logr/logr v0.1.0
    github.com/onsi/ginkgo v1.11.0
    github.com/onsi/gomega v1.8.1
-   k8s.io/apimachinery v0.17.3
-   k8s.io/client-go v11.0.0+incompatible
+   k8s.io/apimachinery v0.17.2
+   k8s.io/client-go v0.17.2
    sigs.k8s.io/controller-runtime v0.5.0
 )
diff --git a/example-2-2-0/go.sum b/example-2-3-0/go.sum
index bfee090..23fff21 100644
--- a/example-2-2-0/go.sum
+++ b/example-2-3-0/go.sum
@@ -62,6 +62,7 @@ github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLi
 github.com/evanphx/json-patch v4.5.0+incompatible h1:ouOWdg56aJriqS0huScTkVXPC5IcNrDCXZ6OoTAWu7M=
 github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
 github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
+github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
 github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
 github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
 github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
@@ -179,9 +180,11 @@ github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQL
 github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
 github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
 github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
+github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
 github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
 github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
 github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
+github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
 github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
 github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
 github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
@@ -225,6 +228,7 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
 github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
 github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
 github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA=
 github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
@@ -263,6 +267,7 @@ github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoH
 github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
 github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
 github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
 github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
 github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
 github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
@@ -378,6 +383,7 @@ gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e/go.mod h1:kS+toOQn6AQKjmK
 google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
 google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
 google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+google.golang.org/appengine v1.5.0 h1:KxkO13IPW4Lslp2bz+KHP2E3gtFlrIGNThxkZQ3g+4c=
 google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
 google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
@@ -387,6 +393,7 @@ google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZi
 google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
 gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
 gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
@@ -401,9 +408,8 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD
 gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
 gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
 gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
-gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
-gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
 honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
@@ -412,14 +418,11 @@ k8s.io/api v0.17.2 h1:NF1UFXcKN7/OOv1uxdRz3qfra8AHsPav5M93hlV9+Dc=
 k8s.io/api v0.17.2/go.mod h1:BS9fjjLc4CMuqfSO8vgbHPKMt5+SF0ET6u/RVDihTo4=
 k8s.io/apiextensions-apiserver v0.17.2 h1:cP579D2hSZNuO/rZj9XFRzwJNYb41DbNANJb6Kolpss=
 k8s.io/apiextensions-apiserver v0.17.2/go.mod h1:4KdMpjkEjjDI2pPfBA15OscyNldHWdBCfsWMDWAmSTs=
+k8s.io/apimachinery v0.17.2 h1:hwDQQFbdRlpnnsR64Asdi55GyCaIP/3WQpMmbNBeWr4=
 k8s.io/apimachinery v0.17.2/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg=
-k8s.io/apimachinery v0.17.3 h1:f+uZV6rm4/tHE7xXgLyToprg6xWairaClGVkm2t8omg=
-k8s.io/apimachinery v0.17.3/go.mod h1:gxLnyZcGNdZTCLnq3fgzyg2A5BVCHTNDFrw8AmuJ+0g=
 k8s.io/apiserver v0.17.2/go.mod h1:lBmw/TtQdtxvrTk0e2cgtOxHizXI+d0mmGQURIHQZlo=
+k8s.io/client-go v0.17.2 h1:ndIfkfXEGrNhLIgkr0+qhRguSD3u6DCmonepn1O6NYc=
 k8s.io/client-go v0.17.2/go.mod h1:QAzRgsa0C2xl4/eVpeVAZMvikCn8Nm81yqVx3Kk9XYI=
-k8s.io/client-go v1.5.1 h1:XaX/lo2/u3/pmFau8HN+sB5C/b4dc4Dmm2eXjBH4p1E=
-k8s.io/client-go v11.0.0+incompatible h1:LBbX2+lOwY9flffWlJM7f1Ct8V2SRNiMRDFeiwnJo9o=
-k8s.io/client-go v11.0.0+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s=
 k8s.io/code-generator v0.17.2/go.mod h1:DVmfPQgxQENqDIzVR2ddLXMH34qeszkKSdH/N+s+38s=
 k8s.io/component-base v0.17.2/go.mod h1:zMPW3g5aH7cHJpKYQ/ZsGMcgbsA/VyhEugF3QT1awLs=
 k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
diff --git a/example-2-2-0/hack/boilerplate.go.txt b/example-2-3-0/hack/boilerplate.go.txt
index b92001f..767efde 100644
--- a/example-2-2-0/hack/boilerplate.go.txt
+++ b/example-2-3-0/hack/boilerplate.go.txt
@@ -1,5 +1,6 @@
 /*

+
 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
diff --git a/example-2-2-0/main.go b/example-2-3-0/main.go
index 9356394..228bd39 100644
--- a/example-2-2-0/main.go
+++ b/example-2-3-0/main.go
@@ -1,5 +1,6 @@
 /*

+
 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
@@ -19,13 +20,14 @@ import (
    "flag"
    "os"

-   shipv1beta1 "github.com/jetstack/example/api/v1beta1"
-   "github.com/jetstack/example/controllers"
    "k8s.io/apimachinery/pkg/runtime"
    clientgoscheme "k8s.io/client-go/kubernetes/scheme"
    _ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
    ctrl "sigs.k8s.io/controller-runtime"
    "sigs.k8s.io/controller-runtime/pkg/log/zap"
+
+   shipv1beta1 "github.com/jetstack/example/api/v1beta1"
+   "github.com/jetstack/example/controllers"
    // +kubebuilder:scaffold:imports
 )

@@ -46,18 +48,18 @@ func main() {
    var enableLeaderElection bool
    flag.StringVar(&metricsAddr, "metrics-addr", ":8080", "The address the metric endpoint binds to.")
    flag.BoolVar(&enableLeaderElection, "enable-leader-election", false,
-       "Enable leader election for controller manager. Enabling this will ensure there is only one active controller manager.")
+       "Enable leader election for controller manager. "+
+           "Enabling this will ensure there is only one active controller manager.")
    flag.Parse()

-   ctrl.SetLogger(zap.New(func(o *zap.Options) {
-       o.Development = true
-   }))
+   ctrl.SetLogger(zap.New(zap.UseDevMode(true)))

    mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
        Scheme:             scheme,
        MetricsBindAddress: metricsAddr,
-       LeaderElection:     enableLeaderElection,
        Port:               9443,
+       LeaderElection:     enableLeaderElection,
+       LeaderElectionID:   "a60ff4da.example.com",
    })
    if err != nil {
        setupLog.Error(err, "unable to start manager")
wallrj commented 4 years ago

I've gone through the diff (above) and found that we've already got most of them:

We do not have: