Skip to content

Commit 7c38de4

Browse files
detiberk8s-ci-robot
authored andcommitted
Backports (#986)
* Adding steps for how to use existing cluster as bootstrap cluster. (#877) * Add proposals template (#879) Signed-off-by: Vince Prignano <[email protected]> * Clarify how to use kuebconfig. (#869) * Add discuss link to README (#885) Signed-off-by: Vince Prignano <[email protected]> * Fix a broken link to Cluster API KEP (#900) * Add Cluster API project scope and objectives (#882) Signed-off-by: Vince Prignano <[email protected]> * Fix API group name written in kubebuilder's annotation comments (#883) * Update github org for the baremetal provider. (#911) The github org was renamed, so use the new URL for the location of the bare metal cluster-api provider. * Add Talos to list of providers (#915) * Add reference use cases for Cluster API (#903) Signed-off-by: Vince Prignano <[email protected]> * Add missing bullet point to staging-use-cases.md (#920) * Added IBM Cloud to Cluster API README. (#928) * Update documentation links to published content (#927) * Add Cluster API logos from CNCF (#916) * Adding Reference Use Cases to README. (#931) * Updating release docs for branching approach now that we are 0.x (#862) I think the previous approach was for pre-versioned branches, but now we probably want to start maintaining release branches - even if in practice we would cut 0.2.0 instead of 0.1.1 * Used doctoc generated toc. (#932) * Update to go 1.12.5 (#937) * Attempt to fix integration tests (#942) - Use specific versions of kind and kustomize instead of installing with `go get` - Update golang version for example provider * Update README.md (#941) * Add shortnames for crds. (#943) * Fix machine object pivoting to the target cluster (#944) * [docs] Update RBAC annotations for example provider (#947) * Remove workstreams from scope and objectives (#948) Signed-off-by: Vince Prignano <[email protected]> * Added ibm cloud to architecture diagram. (#946) * Added comment about cluster API vs cloud providers to readme (#954) * Quit MachineSet reconcile early if DeletionTimestamp is set (#956) Signed-off-by: Vince Prignano <[email protected]> * Cleanup controllers (#958) Signed-off-by: Vince Prignano <[email protected]> * updates Google Cloud branding to mach other usages (#973) * Cannot retrieve machine name (#960) Signed-off-by: clyang82 <[email protected]> * Allow to use foregroundDeletion for MachineDeployments and MachineSets (#953) * Rename controllers test files (#968) Signed-off-by: Vince Prignano <[email protected]> * make cluster-api-manager container run with a non-root user (#955) * Update Gitbook release process (#659) * Remove mermaid module because it is currently unused and does not always install cleanly. * Introduce npm-shrinkwrap so that npm installations are reproducable. * Update gitbook release documentation. * Clarify verification instructions. * Update GitBook. * Remove rendered Gitbook from repo in preparation for using firebase instead. * Install gitbook cli. * Update documentation for netlify. * Add Netlify configuration toml. * Update link to homepage so that it points to the book and not the GitHub repository. * Remove base from netlify.toml. The build script already accounts for the correct location... * Remove reference to no longer existent KEP. :( * Disable redirects until the cluster-api.sigs.k8s.io domain has been created. * Reenable netlify redirects now that the cluster-api.sigs.k8s.io domain exists. * Add versioning and releases to README (#967) Signed-off-by: Vince Prignano <[email protected]> * Add more log for cluster deletion failure (#978) * Update dependencies (#982) Signed-off-by: Vince Prignano <[email protected]>
1 parent 0f911c1 commit 7c38de4

File tree

108 files changed

+3814
-1674
lines changed

Some content is hidden

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

108 files changed

+3814
-1674
lines changed

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
# limitations under the License.
1414

1515
# Build the manager binary
16-
FROM golang:1.12.3 as builder
16+
FROM golang:1.12.5 as builder
1717

1818
# Copy in the go src
19-
WORKDIR $GOPATH/src/sigs.k8s.io/cluster-api
19+
WORKDIR ${GOPATH}/src/sigs.k8s.io/cluster-api
2020
COPY pkg/ pkg/
2121
COPY cmd/ cmd/
2222
COPY vendor/ vendor/
@@ -28,4 +28,5 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags '-extldflags "-st
2828
FROM gcr.io/distroless/static:latest
2929
WORKDIR /
3030
COPY --from=builder /go/src/sigs.k8s.io/cluster-api/manager .
31+
USER nobody
3132
ENTRYPOINT ["/manager"]

Gopkg.lock

Lines changed: 17 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ required = [
2424

2525
[[constraint]]
2626
name="sigs.k8s.io/controller-runtime"
27-
version="v0.1.10"
27+
version="v0.1.11"
2828

2929
[[constraint]]
3030
name="sigs.k8s.io/controller-tools"

README.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,20 @@ API design. Because of this, all of the prototype code is rapidly changing.
1212

1313
![Cluster API Architecture](./docs/book/common_code/architecture.svg "Cluster API Architecture")
1414

15-
To learn more, see the [Cluster API KEP][cluster-api-kep].
15+
Learn more about the project's [scope, objectives, goals and requirements](./docs/scope-and-objectives.md), [feature proposals](./docs/proposals/) and [reference use cases](./docs/staging-use-cases.md).
16+
17+
### How does Cluster API compare to [Kubernetes Cloud Providers](https://kubernetes.io/docs/concepts/cluster-administration/cloud-providers/)?
18+
19+
Cloud Providers and the Cluster API work in concert to provide a rich Kubernetes experience in cloud environments.
20+
The Cluster API initializes new nodes and clusters using available [providers](#Provider-Implementations).
21+
Running clusters can then use Cloud Providers to provision support infrastructure like
22+
[load balancers](https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/)
23+
and [persistent volumes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/).
1624

1725
## Get involved!
1826

27+
* Join the [Cluster API discuss forum](https://discuss.kubernetes.io/c/contributors/cluster-api).
28+
1929
* Join the [sig-cluster-lifecycle](https://groups.google.com/forum/#!forum/kubernetes-sig-cluster-lifecycle)
2030
Google Group for access to documents and calendars.
2131

@@ -38,10 +48,13 @@ are also sponsored by SIG-cluster-lifecycle:
3848
* AWS, https://github.com/kubernetes-sigs/cluster-api-provider-aws
3949
* Azure, https://github.com/kubernetes-sigs/cluster-api-provider-azure
4050
* Baidu Cloud, https://github.com/baidu/cluster-api-provider-baiducloud
41-
* Bare Metal, https://github.com/metalkube/cluster-api-provider-baremetal
51+
* Bare Metal, https://github.com/metal3-io/cluster-api-provider-baremetal
4252
* DigitalOcean, https://github.com/kubernetes-sigs/cluster-api-provider-digitalocean
43-
* GCE, https://github.com/kubernetes-sigs/cluster-api-provider-gcp
53+
* Exoscale, https://github.com/exoscale/cluster-api-provider-exoscale
54+
* GCP, https://github.com/kubernetes-sigs/cluster-api-provider-gcp
55+
* IBM Cloud, https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud
4456
* OpenStack, https://github.com/kubernetes-sigs/cluster-api-provider-openstack
57+
* Talos, https://github.com/talos-systems/cluster-api-provider-talos
4558
* Tencent Cloud, https://github.com/TencentCloud/cluster-api-provider-tencent
4659
* vSphere, https://github.com/kubernetes-sigs/cluster-api-provider-vsphere
4760

@@ -53,6 +66,14 @@ Following are the implementations managed by third-parties adopting the standard
5366
* Machine API Operator, https://github.com/openshift/machine-api-operator/tree/master
5467
* Machine-controller-manager, https://github.com/gardener/machine-controller-manager/tree/cluster-api
5568

69+
## Versioning, Maintenance, and Compatibility
70+
71+
- We follow [Semantic Versioning (semver)](https://semver.org/).
72+
- Cluster API release cadence is Kubernetes Release + 6 weeks.
73+
- The cadence is subject to change if necessary, refer to the [Milestones](https://github.com/kubernetes-sigs/cluster-api/milestones) page for up-to-date information.
74+
- The _master_ branch is where development happens, this might include breaking changes.
75+
- The _release-X_ branches contain stable, backward compatible code. A new _release-X_ branch is created at every major (X) release.
76+
5677
## Getting Started
5778

5879
### Resources
@@ -63,7 +84,6 @@ Following are the implementations managed by third-parties adopting the standard
6384
* `kubectl` is required, see [here](http://kubernetes.io/docs/user-guide/prereqs/).
6485
* `clusterctl` is a SIG-cluster-lifecycle sponsored tool to manage Cluster API clusters. See [here](cmd/clusterctl)
6586

66-
[cluster-api-kep]: https://github.com/kubernetes/enhancements/blob/master/keps/sig-cluster-lifecycle/0003-cluster-api.md
6787
[notes]: https://docs.google.com/document/d/1Ys-DOR5UsgbMEeciuG0HOgDQc8kZsaWIWJeKJ1-UfbY/edit
6888
[recordings]: https://www.youtube.com/playlist?list=PL69nYSiGNLP29D0nYgAGWt1ZFqS9Z7lw4
6989
[zoomMeeting]: https://zoom.us/j/861487554

WORKSPACE

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
33

44
http_archive(
55
name = "io_bazel_rules_go",
6-
sha256 = "86ae934bd4c43b99893fc64be9d9fc684b81461581df7ea8fc291c816f5ee8c5",
7-
url = "https://github.com/bazelbuild/rules_go/releases/download/0.18.3/rules_go-0.18.3.tar.gz",
6+
sha256 = "3743a20704efc319070957c45e24ae4626a05ba4b1d6a8961e87520296f1b676",
7+
url = "https://github.com/bazelbuild/rules_go/releases/download/0.18.4/rules_go-0.18.4.tar.gz",
88
)
99

1010
http_archive(
@@ -18,7 +18,7 @@ load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_depe
1818
go_rules_dependencies()
1919

2020
go_register_toolchains(
21-
go_version = "1.12.3",
21+
go_version = "1.12.5",
2222
)
2323

2424
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")

cmd/clusterctl/README.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ this repository.**
1313

1414
### Prerequisites
1515

16-
1. Install [kind](https://github.com/kubernetes-sigs/kind#installation-and-usage) or [minikube](https://kubernetes.io/docs/tasks/tools/install-minikube/). [kind](https://github.com/kubernetes-sigs/kind#installation-and-usage) is preferred.
17-
2. If you are using kind, go to step 3; If you are using minikube, install a [driver](https://github.com/kubernetes/minikube/blob/master/docs/drivers.md) for minikube. For Linux, we recommend kvm2. For MacOS, we recommend VirtualBox.
16+
1. Cluster API runs its operations in Kubernetes. A pre-existing or temporary bootstrap cluster is required. Currently, we support multiple methods to bootstrap Cluster API: `kind` (preferred), `minikube` or any pre-existing cluster.
17+
- If you want to use container, install [kind](https://github.com/kubernetes-sigs/kind#installation-and-usage). This is preferred.
18+
- If you want to use VM, install [minikube](https://kubernetes.io/docs/tasks/tools/install-minikube/), version 0.30.0 or greater.
19+
- If you want to use existing Kubernetes cluster, prepare your kubeconfig.
20+
2. If you are using `kind` or existing Kubernetes cluster, go to step 3. If you are using `minikube`, install a [driver](https://github.com/kubernetes/minikube/blob/master/docs/drivers.md). For Linux, we recommend `kvm2`. For MacOS, we recommend VirtualBox.
1821
2. Build the `clusterctl` tool
1922

2023
```bash
@@ -40,13 +43,21 @@ https://github.com/kubernetes-sigs/cluster-api/issues/158 and https://github.com
4043

4144
1. Create a cluster:
4245

46+
- __Bootstrap Cluster__: Use `bootstrap-type`, currently only `kind` and `minikube` are supported.
47+
4348
```shell
44-
./clusterctl create cluster --provider <provider> --bootstrap-type <bootstrap-type> -c cluster.yaml -m machines.yaml -p provider-components.yaml -a addons.yaml
49+
./clusterctl create cluster --provider <provider> --bootstrap-type <bootstrap-type> -c cluster.yaml \
50+
-m machines.yaml -p provider-components.yaml -a addons.yaml
4551
```
4652

47-
Currently two `bootstrap-type` options are supported - `kind` and `minikube`.
53+
If you are using minikube, to choose a specific minikube driver, please use the `--bootstrap-flags vm-driver=xxx` command line parameter. For example to use the kvm2 driver with clusterctl you woud add `--bootstrap-flags vm-driver=kvm2`.
4854

49-
If you are using minikube, to choose a specific minikube driver, please use the `--bootstrap-flags vm-driver=xxx` command line parameter. For example to use the kvm2 driver with clusterctl you woud add `--bootstrap-flags vm-driver=kvm2`.
55+
- __Existing Cluster__: Use `bootstrap-cluster-kubeconfig`. This flag is used when you have an existing Kubernetes cluster.
56+
57+
```shell
58+
./clusterctl create cluster --provider <provider> --bootstrap-cluster-kubeconfig <kubeconfig> \
59+
-c cluster.yaml -m machines.yaml -p provider-components.yaml -a addons.yaml
60+
```
5061

5162
Additional advanced flags can be found via help.
5263

@@ -74,6 +85,8 @@ $ kubectl --kubeconfig kubeconfig get machines
7485
$ kubectl --kubeconfig kubeconfig get machines -o yaml
7586
```
7687

88+
**NOTE:** There is no need to specify `--kubeconfig` if your `kubeconfig` was located in the default directory under `$HOME/.kube/config` or if you have already exposed env variable `KUBECONFIG`.
89+
7790
#### Scaling your cluster
7891

7992
You can scale your cluster by adding additional individual Machines, or by adding a MachineSet or MachineDeployment

cmd/clusterctl/clusterdeployer/clusterclient/clusterclient.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,43 +754,53 @@ func (c *client) WaitForResourceStatuses() error {
754754
klog.V(2).Info("Waiting for Cluster API resources to have statuses...")
755755
clusters, err := c.clientSet.ClusterV1alpha1().Clusters("").List(metav1.ListOptions{})
756756
if err != nil {
757+
klog.V(10).Infof("retrying: failed to list clusters: %v", err)
757758
return false, nil
758759
}
759760
for _, cluster := range clusters.Items {
760761
if reflect.DeepEqual(clusterv1.ClusterStatus{}, cluster.Status) {
762+
klog.V(10).Info("retrying: cluster status is empty")
761763
return false, nil
762764
}
763765
if cluster.Status.ProviderStatus == nil {
766+
klog.V(10).Info("retrying: cluster.Status.ProviderStatus is not set")
764767
return false, nil
765768
}
766769
}
767770
machineDeployments, err := c.clientSet.ClusterV1alpha1().MachineDeployments("").List(metav1.ListOptions{})
768771
if err != nil {
772+
klog.V(10).Infof("retrying: failed to list machine deployment: %v", err)
769773
return false, nil
770774
}
771775
for _, md := range machineDeployments.Items {
772776
if reflect.DeepEqual(clusterv1.MachineDeploymentStatus{}, md.Status) {
777+
klog.V(10).Info("retrying: machine deployment status is empty")
773778
return false, nil
774779
}
775780
}
776781
machineSets, err := c.clientSet.ClusterV1alpha1().MachineSets("").List(metav1.ListOptions{})
777782
if err != nil {
783+
klog.V(10).Infof("retrying: failed to list machinesets: %v", err)
778784
return false, nil
779785
}
780786
for _, ms := range machineSets.Items {
781787
if reflect.DeepEqual(clusterv1.MachineSetStatus{}, ms.Status) {
788+
klog.V(10).Info("retrying: machineset status is empty")
782789
return false, nil
783790
}
784791
}
785792
machines, err := c.clientSet.ClusterV1alpha1().Machines("").List(metav1.ListOptions{})
786793
if err != nil {
794+
klog.V(10).Infof("retrying: failed to list machines: %v", err)
787795
return false, nil
788796
}
789797
for _, m := range machines.Items {
790798
if reflect.DeepEqual(clusterv1.MachineStatus{}, m.Status) {
799+
klog.V(10).Info("retrying: machine status is empty")
791800
return false, nil
792801
}
793802
if m.Status.ProviderStatus == nil {
803+
klog.V(10).Info("retrying: machine.Status.ProviderStatus is not set")
794804
return false, nil
795805
}
796806
}

cmd/clusterctl/clusterdeployer/clusterdeployer.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ func (d *ClusterDeployer) Create(cluster *clusterv1.Cluster, machines []*cluster
8989
cluster.Namespace = bootstrapClient.GetContextNamespace()
9090
}
9191

92-
klog.Infof("Creating control plane %v in namespace %q", controlPlaneMachines[0].Name, cluster.Namespace)
92+
klog.Infof("Creating control plane machine in namespace %q", cluster.Namespace)
9393
if err := phases.ApplyMachines(bootstrapClient, cluster.Namespace, []*clusterv1.Machine{controlPlaneMachines[0]}); err != nil {
9494
return errors.Wrap(err, "unable to create control plane machine")
9595
}
9696

97-
klog.Infof("Updating bootstrap cluster object for cluster %v in namespace %q with control plane endpoint running on %s", cluster.Name, cluster.Namespace, controlPlaneMachines[0].Name)
97+
klog.Infof("Updating bootstrap cluster object for cluster %v in namespace %q with control plane endpoint running on machine", cluster.Name, cluster.Namespace)
9898
if err := d.updateClusterEndpoint(bootstrapClient, provider, cluster.Name, cluster.Namespace); err != nil {
9999
return errors.Wrap(err, "unable to update bootstrap cluster endpoint")
100100
}
@@ -130,7 +130,7 @@ func (d *ClusterDeployer) Create(cluster *clusterv1.Cluster, machines []*cluster
130130

131131
// For some reason, endpoint doesn't get updated in bootstrap cluster sometimes. So we
132132
// update the target cluster endpoint as well to be sure.
133-
klog.Infof("Updating target cluster object with control plane endpoint running on %s", controlPlaneMachines[0].Name)
133+
klog.Info("Updating target cluster object with control plane endpoint running on machine")
134134
if err := d.updateClusterEndpoint(targetClient, provider, cluster.Name, cluster.Namespace); err != nil {
135135
return errors.Wrap(err, "unable to update target cluster endpoint")
136136
}

cmd/clusterctl/phases/pivot.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,11 +369,18 @@ func moveMachineSet(from sourceClient, to targetClient, ms *clusterv1.MachineSet
369369
func moveMachines(from sourceClient, to targetClient, machines []*clusterv1.Machine) error {
370370
machineNames := make([]string, 0, len(machines))
371371
for _, m := range machines {
372+
if m.DeletionTimestamp != nil {
373+
klog.V(4).Infof("Skipping to move deleted machine: %q", m.Name)
374+
continue
375+
}
372376
machineNames = append(machineNames, m.Name)
373377
}
374378
klog.V(4).Infof("Preparing to move Machines: %v", machineNames)
375379

376380
for _, m := range machines {
381+
if m.DeletionTimestamp != nil {
382+
continue
383+
}
377384
if err := moveMachine(from, to, m); err != nil {
378385
return errors.Wrapf(err, "failed to move Machine %s:%s", m.Namespace, m.Name)
379386
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Global Flags:
2727
--logtostderr log to standard error instead of files (default true)
2828
--master string 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
30-
--skip-log-headers If true, avoid headers when openning log files
30+
--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)
3232
-v, --v Level number for the log level verbosity
3333
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging

0 commit comments

Comments
 (0)