Skip to content

Commit 5524f52

Browse files
authored
Merge branch 'master' into setup-doctoc
2 parents b560600 + cc9ce92 commit 5524f52

File tree

805 files changed

+9203
-63503
lines changed

Some content is hidden

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

805 files changed

+9203
-63503
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ minikube.kubeconfig
3232

3333
# GitBook - do not check in node_modules for a specific arch and os.
3434
docs/book/node_modules/
35+
docs/book/_book/
3536

3637
# Common editor / temporary files
3738
*~
@@ -42,3 +43,6 @@ config/ci/rbac/role_binding.yaml
4243
config/ci/rbac/role.yaml
4344
config/ci/manager/manager.yaml
4445
config/crds-v1alpha1
46+
47+
# Sample config files auto-generated by kubebuilder
48+
config/samples

.golangci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ linters:
2121
issue:
2222
max-same-issues: 0
2323
max-per-linter: 0
24+
run:
25+
skip-files:
26+
- ".*\\.deepcopy\\.go$"

Makefile

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ TAG ?= dev
3232

3333
ARCH?=amd64
3434
ALL_ARCH = amd64 arm arm64 ppc64le s390x
35+
GOOS?=linux
3536

3637
all: test manager clusterctl
3738

@@ -58,13 +59,20 @@ test-go: ## Run tests
5859
manager: lint-full ## Build manager binary
5960
go build -o bin/manager sigs.k8s.io/cluster-api/cmd/manager
6061

62+
.PHONY: docker-build-manager
63+
docker-build-manager: lint-full ## Build manager binary in docker
64+
docker run --rm \
65+
-v "${PWD}:/go/src/sigs.k8s.io/cluster-api" \
66+
-v "${PWD}/bin:/go/bin" \
67+
-w "/go/src/sigs.k8s.io/cluster-api" \
68+
-e CGO_ENABLED=0 -e GOOS=${GOOS} -e GOARCH=${ARCH} -e GO111MODULE=on -e GOFLAGS="-mod=vendor" \
69+
golang:1.12.6 \
70+
go build -a -ldflags '-extldflags "-static"' -o /go/bin/manager sigs.k8s.io/cluster-api/cmd/manager
71+
6172
.PHONY: clusterctl
6273
clusterctl: lint-full ## Build clusterctl binary
6374
go build -o bin/clusterctl sigs.k8s.io/cluster-api/cmd/clusterctl
6475

65-
bin/%-gen: ./vendor/k8s.io/code-generator/cmd/%-gen ## Build code-generator binaries
66-
go build -o $@ ./$<
67-
6876
.PHONY: run
6977
run: lint ## Run against the configured Kubernetes cluster in ~/.kube/config
7078
go run ./cmd/manager/main.go
@@ -87,36 +95,14 @@ lint-full: ## Run slower linters to detect possible issues
8795
.PHONY: generate
8896
generate: ## Generate code
8997
$(MAKE) generate-manifests
90-
$(MAKE) generate-go
98+
$(MAKE) generate-deepcopy
9199
$(MAKE) gazelle
92100

93-
.PHONY: generate-full
94-
generate-full: vendor ## Generate code
95-
$(MAKE) generate-clientset
96-
$(MAKE) generate
97-
98-
.PHONY: generate-go
99-
generate-go: ## Runs go generate
100-
go generate ./pkg/... ./cmd/...
101-
102-
.PHONY: generate-clientset
103-
generate-clientset: clean-clientset bin/client-gen bin/lister-gen bin/informer-gen ## Generate a typed clientset
104-
bin/client-gen \
105-
--clientset-name clientset \
106-
--input-base sigs.k8s.io/cluster-api/pkg/apis \
107-
--input deprecated/v1alpha1,cluster/v1alpha2 \
108-
--output-package sigs.k8s.io/cluster-api/pkg/client/clientset_generated \
109-
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt
110-
bin/lister-gen \
111-
--input-dirs sigs.k8s.io/cluster-api/pkg/apis/deprecated/v1alpha1,sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha2 \
112-
--output-package sigs.k8s.io/cluster-api/pkg/client/listers_generated \
113-
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt
114-
bin/informer-gen \
115-
--input-dirs sigs.k8s.io/cluster-api/pkg/apis/deprecated/v1alpha1,sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha2 \
116-
--versioned-clientset-package sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset \
117-
--listers-package sigs.k8s.io/cluster-api/pkg/client/listers_generated \
118-
--output-package sigs.k8s.io/cluster-api/pkg/client/informers_generated \
119-
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt
101+
.PHONY: generate-deepcopy
102+
generate-deepcopy: ## Runs controller-gen to generate deepcopy files
103+
go run vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go \
104+
object:headerFile=./hack/boilerplate/boilerplate.generatego.txt \
105+
paths=./pkg/...
120106

121107
.PHONY: generate-manifests
122108
generate-manifests: ## Generate manifests e.g. CRD, RBAC etc.
@@ -194,6 +180,7 @@ docker-push-manifest: ## Push the fat manifest docker image. TODO: Update bazel
194180
clean: ## Remove all generated files
195181
$(MAKE) clean-bazel
196182
$(MAKE) clean-bin
183+
$(MAKE) clean-book
197184

198185
.PHONY: clean-bazel
199186
clean-bazel: ## Remove all generated bazel symlinks

PROJECT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version: "1"
2-
domain: sigs.k8s.io
2+
domain: x-k8s.io
33
repo: sigs.k8s.io/cluster-api

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ are also sponsored by SIG-cluster-lifecycle:
8282
* GCP, https://github.com/kubernetes-sigs/cluster-api-provider-gcp
8383
* IBM Cloud, https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud
8484
* OpenStack, https://github.com/kubernetes-sigs/cluster-api-provider-openstack
85+
* Packet, https://github.com/packethost/cluster-api-provider-packet
8586
* Talos, https://github.com/talos-systems/cluster-api-provider-talos
8687
* Tencent Cloud, https://github.com/TencentCloud/cluster-api-provider-tencent
8788
* vSphere, https://github.com/kubernetes-sigs/cluster-api-provider-vsphere

cmd/clusterctl/BUILD.bazel

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ go_library(
55
srcs = ["main.go"],
66
importpath = "sigs.k8s.io/cluster-api/cmd/clusterctl",
77
visibility = ["//visibility:private"],
8-
deps = ["//cmd/clusterctl/cmd:go_default_library"],
8+
deps = [
9+
"//cmd/clusterctl/cmd:go_default_library",
10+
"//pkg/apis:go_default_library",
11+
"//vendor/k8s.io/client-go/kubernetes/scheme:go_default_library",
12+
],
913
)
1014

1115
go_binary(

cmd/clusterctl/clientcmd/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ go_library(
66
importpath = "sigs.k8s.io/cluster-api/cmd/clusterctl/clientcmd",
77
visibility = ["//visibility:public"],
88
deps = [
9-
"//pkg/client/clientset_generated/clientset:go_default_library",
109
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
1110
"//vendor/k8s.io/client-go/rest:go_default_library",
1211
"//vendor/k8s.io/client-go/tools/clientcmd:go_default_library",
1312
"//vendor/k8s.io/client-go/tools/clientcmd/api:go_default_library",
13+
"//vendor/sigs.k8s.io/controller-runtime/pkg/client:go_default_library",
1414
],
1515
)

cmd/clusterctl/clientcmd/configutil.go

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,19 @@ import (
2323
"k8s.io/client-go/rest"
2424
"k8s.io/client-go/tools/clientcmd"
2525
"k8s.io/client-go/tools/clientcmd/api"
26-
"sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset"
26+
"sigs.k8s.io/controller-runtime/pkg/client"
2727
)
2828

2929
// This is a convenience method to prevent the need of importing both this version of clientcmd and the client-go version
3030
func NewConfigOverrides() clientcmd.ConfigOverrides {
3131
return clientcmd.ConfigOverrides{}
3232
}
3333

34-
// NewCoreClientSetForDefaultSearchPath creates a core kubernetes clientset. If the kubeconfigPath is specified then the configuration is loaded from that path.
35-
// Otherwise the default kubeconfig search path is used.
36-
// The overrides parameter is used to select a specific context of the config, for example, select the context with a given cluster name or namespace.
34+
// NewCoreClientSetForDefaultSearchPath creates a core kubernetes clientset.
35+
// If the kubeconfigPath is specified then the configuration is loaded from that path,
36+
// otherwise the default kubeconfig search path is used.
37+
// The overrides parameter is used to select a specific context of the config, for example,
38+
// select the context with a given cluster name or namespace.
3739
func NewCoreClientSetForDefaultSearchPath(kubeconfigPath string, overrides clientcmd.ConfigOverrides) (*kubernetes.Clientset, error) {
3840
config, err := newRestConfigForDefaultSearchPath(kubeconfigPath, overrides)
3941
if err != nil {
@@ -42,19 +44,23 @@ func NewCoreClientSetForDefaultSearchPath(kubeconfigPath string, overrides clien
4244
return kubernetes.NewForConfig(config)
4345
}
4446

45-
// NewClusterAPIClientForDefaultSearchPath creates a Cluster API clientset. If the kubeconfigPath is specified then the configuration is loaded from that path.
46-
// Otherwise the default kubeconfig search path is used.
47-
// The overrides parameter is used to select a specific context of the config, for example, select the context with a given cluster name or namespace.
48-
func NewClusterAPIClientForDefaultSearchPath(kubeconfigPath string, overrides clientcmd.ConfigOverrides) (*clientset.Clientset, error) {
47+
// NewControllerRuntimeClient creates a controller-runtime Client.
48+
// If the kubeconfigPath is specified then the configuration is loaded from that path,
49+
// otherwise the default kubeconfig search path is used.
50+
// The overrides parameter is used to select a specific context of the config, for example,
51+
// select the context with a given cluster name or namespace.
52+
func NewControllerRuntimeClient(kubeconfigPath string, overrides clientcmd.ConfigOverrides) (client.Client, error) {
4953
config, err := newRestConfigForDefaultSearchPath(kubeconfigPath, overrides)
5054
if err != nil {
5155
return nil, err
5256
}
53-
return clientset.NewForConfig(config)
57+
58+
return client.New(config, client.Options{})
5459
}
5560

5661
// newRestConfig creates a rest.Config for the given apiConfig
57-
// The overrides parameter is used to select a specific context of the config, for example, select the context with a given cluster name or namespace.
62+
// The overrides parameter is used to select a specific context of the config, for example,
63+
// select the context with a given cluster name or namespace.
5864
func newRestConfig(apiConfig *api.Config, overrides clientcmd.ConfigOverrides) (*rest.Config, error) {
5965
return clientcmd.NewDefaultClientConfig(*apiConfig, &overrides).ClientConfig()
6066
}

cmd/clusterctl/clusterdeployer/clusterclient/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ go_library(
1111
deps = [
1212
"//cmd/clusterctl/clientcmd:go_default_library",
1313
"//pkg/apis/cluster/v1alpha2:go_default_library",
14-
"//pkg/client/clientset_generated/clientset:go_default_library",
1514
"//pkg/util:go_default_library",
1615
"//vendor/github.com/pkg/errors:go_default_library",
1716
"//vendor/k8s.io/api/autoscaling/v1:go_default_library",
@@ -22,6 +21,7 @@ go_library(
2221
"//vendor/k8s.io/client-go/plugin/pkg/client/auth:go_default_library",
2322
"//vendor/k8s.io/client-go/tools/clientcmd:go_default_library",
2423
"//vendor/k8s.io/klog:go_default_library",
24+
"//vendor/sigs.k8s.io/controller-runtime/pkg/client:go_default_library",
2525
],
2626
)
2727

0 commit comments

Comments
 (0)