Skip to content

Commit 08fee7e

Browse files
committed
Use go modules, update controller-{runtime, tools} to v2
Signed-off-by: Vince Prignano <[email protected]>
1 parent 1cb3deb commit 08fee7e

File tree

1,770 files changed

+118991
-156852
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,770 files changed

+118991
-156852
lines changed

Gopkg.lock

Lines changed: 0 additions & 1316 deletions
This file was deleted.

Gopkg.toml

Lines changed: 0 additions & 41 deletions
This file was deleted.

Makefile

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,16 @@ help: ## Display this help
4343
gazelle: ## Run Bazel Gazelle
4444
(which bazel && ./hack/update-bazel.sh) || true
4545

46-
.PHONY: dep-ensure
47-
dep-ensure: ## Runs dep-ensure and rebuilds Bazel gazelle files.
48-
find vendor -name 'BUILD.bazel' -delete
49-
(which dep && dep ensure -v) || true
50-
$(MAKE) gazelle
46+
.PHONY: vendor-ensure
47+
vendor-ensure: ## Runs go mod to ensure proper vendoring.
48+
./hack/update-vendor.sh
49+
50+
.PHONY: test
51+
test: verify generate fmt vet ## Run tests
52+
$(MAKE) test-go
5153

5254
.PHONY: test
53-
test: gazelle verify generate fmt vet manifests ## Run tests
55+
test-go: ## Run tests
5456
go test -v -tags=integration ./pkg/... ./cmd/...
5557

5658
.PHONY: manager
@@ -84,14 +86,14 @@ vet: ## Run go vet against code
8486
go vet ./pkg/... ./cmd/...
8587

8688
.PHONY: lint
87-
lint: dep-ensure ## Lint codebase
89+
lint: vendor-ensure ## Lint codebase
8890
bazel run //:lint $(BAZEL_ARGS)
8991

90-
lint-full: dep-ensure ## Run slower linters to detect possible issues
92+
lint-full: vendor-ensure ## Run slower linters to detect possible issues
9193
bazel run //:lint-full $(BAZEL_ARGS)
9294

9395
.PHONY: generate
94-
generate: clientset dep-ensure ## Generate code
96+
generate: clientset vendor-ensure ## Generate code
9597
go generate ./pkg/... ./cmd/...
9698
$(MAKE) gazelle
9799

@@ -162,6 +164,7 @@ docker-push-ci: docker-build-ci ## Build the docker image for ci
162164

163165
.PHONY: verify
164166
verify:
167+
./hack/verify-go.sh
165168
./hack/verify-boilerplate.sh
166-
./hack/verify_clientset.sh
169+
./hack/verify-clientset.sh
167170
./hack/verify-bazel.sh

build/run_in_workspace_with_goroot.bzl

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,6 @@ _workspace_binary_script = rule(
6767
)
6868

6969
# Wraps a binary to be run in the workspace root via bazel run.
70-
#
71-
# For example, one might do something like
72-
#
73-
# workspace_binary(
74-
# name = "dep",
75-
# cmd = "//vendor/github.com/golang/dep/cmd/dep",
76-
# )
77-
#
78-
# which would allow running dep with bazel run.
7970
def workspace_binary(
8071
name,
8172
cmd,

cmd/clusterctl/testdata/create-cluster-no-args-invalid-flag.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Global Flags:
2525
--log-file-max-size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
2626
--log-flush-frequency duration Maximum number of seconds between log flushes (default 5s)
2727
--logtostderr log to standard error instead of files (default true)
28-
--master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
28+
--master --kubeconfig (Deprecated: switch to --kubeconfig) The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
2929
--skip-headers If true, avoid header prefixes in the log messages
3030
--skip-log-headers If true, avoid headers when opening log files
3131
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)

cmd/clusterctl/testdata/create-cluster-no-args.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Global Flags:
2525
--log-file-max-size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
2626
--log-flush-frequency duration Maximum number of seconds between log flushes (default 5s)
2727
--logtostderr log to standard error instead of files (default true)
28-
--master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
28+
--master --kubeconfig (Deprecated: switch to --kubeconfig) The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
2929
--skip-headers If true, avoid header prefixes in the log messages
3030
--skip-log-headers If true, avoid headers when opening log files
3131
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)

cmd/clusterctl/testdata/create-no-args-invalid-flag.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Global Flags:
1717
--log-file-max-size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
1818
--log-flush-frequency duration Maximum number of seconds between log flushes (default 5s)
1919
--logtostderr log to standard error instead of files (default true)
20-
--master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
20+
--master --kubeconfig (Deprecated: switch to --kubeconfig) The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
2121
--skip-headers If true, avoid header prefixes in the log messages
2222
--skip-log-headers If true, avoid headers when opening log files
2323
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)

cmd/clusterctl/testdata/create-no-args.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Global Flags:
1818
--log-file-max-size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
1919
--log-flush-frequency duration Maximum number of seconds between log flushes (default 5s)
2020
--logtostderr log to standard error instead of files (default true)
21-
--master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
21+
--master --kubeconfig (Deprecated: switch to --kubeconfig) The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
2222
--skip-headers If true, avoid header prefixes in the log messages
2323
--skip-log-headers If true, avoid headers when opening log files
2424
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)

cmd/clusterctl/testdata/delete-cluster-no-args-invalid-flag.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Global Flags:
2222
--log-file-max-size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
2323
--log-flush-frequency duration Maximum number of seconds between log flushes (default 5s)
2424
--logtostderr log to standard error instead of files (default true)
25-
--master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
25+
--master --kubeconfig (Deprecated: switch to --kubeconfig) The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
2626
--skip-headers If true, avoid header prefixes in the log messages
2727
--skip-log-headers If true, avoid headers when opening log files
2828
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)

cmd/clusterctl/testdata/delete-cluster-no-args.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Global Flags:
2424
--log-file-max-size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
2525
--log-flush-frequency duration Maximum number of seconds between log flushes (default 5s)
2626
--logtostderr log to standard error instead of files (default true)
27-
--master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
27+
--master --kubeconfig (Deprecated: switch to --kubeconfig) The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
2828
--skip-headers If true, avoid header prefixes in the log messages
2929
--skip-log-headers If true, avoid headers when opening log files
3030
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)

cmd/clusterctl/testdata/delete-no-args-invalid-flag.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Global Flags:
1717
--log-file-max-size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
1818
--log-flush-frequency duration Maximum number of seconds between log flushes (default 5s)
1919
--logtostderr log to standard error instead of files (default true)
20-
--master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
20+
--master --kubeconfig (Deprecated: switch to --kubeconfig) The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
2121
--skip-headers If true, avoid header prefixes in the log messages
2222
--skip-log-headers If true, avoid headers when opening log files
2323
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)

cmd/clusterctl/testdata/delete-no-args.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Global Flags:
1818
--log-file-max-size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
1919
--log-flush-frequency duration Maximum number of seconds between log flushes (default 5s)
2020
--logtostderr log to standard error instead of files (default true)
21-
--master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
21+
--master --kubeconfig (Deprecated: switch to --kubeconfig) The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
2222
--skip-headers If true, avoid header prefixes in the log messages
2323
--skip-log-headers If true, avoid headers when opening log files
2424
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)

cmd/clusterctl/testdata/no-args-invalid-flag.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Flags:
2020
--log-file-max-size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
2121
--log-flush-frequency duration Maximum number of seconds between log flushes (default 5s)
2222
--logtostderr log to standard error instead of files (default true)
23-
--master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
23+
--master --kubeconfig (Deprecated: switch to --kubeconfig) The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
2424
--skip-headers If true, avoid header prefixes in the log messages
2525
--skip-log-headers If true, avoid headers when opening log files
2626
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)

cmd/clusterctl/testdata/no-args.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Flags:
2121
--log-file-max-size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
2222
--log-flush-frequency duration Maximum number of seconds between log flushes (default 5s)
2323
--logtostderr log to standard error instead of files (default true)
24-
--master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
24+
--master --kubeconfig (Deprecated: switch to --kubeconfig) The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
2525
--skip-headers If true, avoid header prefixes in the log messages
2626
--skip-log-headers If true, avoid headers when opening log files
2727
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)

cmd/clusterctl/testdata/validate-cluster-no-args-invalid-flag.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Global Flags:
1717
--log-file-max-size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
1818
--log-flush-frequency duration Maximum number of seconds between log flushes (default 5s)
1919
--logtostderr log to standard error instead of files (default true)
20-
--master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
20+
--master --kubeconfig (Deprecated: switch to --kubeconfig) The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
2121
--skip-headers If true, avoid header prefixes in the log messages
2222
--skip-log-headers If true, avoid headers when opening log files
2323
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)

cmd/clusterctl/testdata/validate-no-args-invalid-flag.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Global Flags:
1717
--log-file-max-size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
1818
--log-flush-frequency duration Maximum number of seconds between log flushes (default 5s)
1919
--logtostderr log to standard error instead of files (default true)
20-
--master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
20+
--master --kubeconfig (Deprecated: switch to --kubeconfig) The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
2121
--skip-headers If true, avoid header prefixes in the log messages
2222
--skip-log-headers If true, avoid headers when opening log files
2323
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)

cmd/clusterctl/testdata/validate-no-args.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Global Flags:
1818
--log-file-max-size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
1919
--log-flush-frequency duration Maximum number of seconds between log flushes (default 5s)
2020
--logtostderr log to standard error instead of files (default true)
21-
--master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
21+
--master --kubeconfig (Deprecated: switch to --kubeconfig) The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
2222
--skip-headers If true, avoid header prefixes in the log messages
2323
--skip-log-headers If true, avoid headers when opening log files
2424
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)

cmd/clusterctl/validation/validate_cluster_api_objects.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func ValidateClusterAPIObjects(ctx context.Context, w io.Writer, c client.Client
4343
}
4444

4545
machines := &clusterv1alpha1.MachineList{}
46-
if err := c.List(ctx, client.InNamespace(namespace), machines); err != nil {
46+
if err := c.List(ctx, machines, client.InNamespace(namespace)); err != nil {
4747
return errors.Wrapf(err, "failed to get the machines from the apiserver in namespace %q", namespace)
4848
}
4949

@@ -58,7 +58,7 @@ func getClusterObject(ctx context.Context, c client.Reader, clusterName string,
5858
}
5959

6060
clusters := &clusterv1alpha1.ClusterList{}
61-
if err := c.List(ctx, &client.ListOptions{Namespace: namespace}, clusters); err != nil {
61+
if err := c.List(ctx, clusters, client.InNamespace(namespace)); err != nil {
6262
return nil, errors.Wrapf(err, "failed to get the clusters from the apiserver in namespace %q", namespace)
6363
}
6464

@@ -67,6 +67,7 @@ func getClusterObject(ctx context.Context, c client.Reader, clusterName string,
6767
} else if numOfClusters > 1 {
6868
return nil, errors.Errorf("fail: There is more than one cluster in namespace %q. Please specify --cluster-name", namespace)
6969
}
70+
7071
return &clusters.Items[0], nil
7172
}
7273

cmd/clusterctl/validation/validate_pods.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func ValidatePods(ctx context.Context, w io.Writer, c client.Client, namespace s
5151

5252
func getPods(ctx context.Context, c client.Client, namespace string) (*corev1.PodList, error) {
5353
pods := &corev1.PodList{}
54-
if err := c.List(ctx, client.InNamespace(namespace), pods); err != nil {
54+
if err := c.List(ctx, pods, client.InNamespace(namespace)); err != nil {
5555
return nil, fmt.Errorf("failed to get pods in namespace %q: %v", namespace, err)
5656
}
5757
return pods, nil
@@ -108,7 +108,7 @@ func validatePods(w io.Writer, pods *corev1.PodList, namespace string) error {
108108

109109
func getComponents(ctx context.Context, c client.Client) (*corev1.ComponentStatusList, error) {
110110
components := &corev1.ComponentStatusList{}
111-
if err := c.List(ctx, &client.ListOptions{}, components); err != nil {
111+
if err := c.List(ctx, components); err != nil {
112112
return nil, err
113113
}
114114
return components, nil

cmd/example-provider/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func main() {
5050
klog.Fatalf("Failed to create client from configuration: %v", err)
5151
}
5252

53-
recorder := mgr.GetRecorder("clusterapi-controller")
53+
recorder := mgr.GetEventRecorderFor("clusterapi-controller")
5454

5555
// Initialize cluster actuator.
5656
clusterActuator, _ := cluster.NewClusterActuator(cs.ClusterV1alpha1(), recorder)

0 commit comments

Comments
 (0)