Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backports #986

Merged
merged 37 commits into from
Jun 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
f664a09
Adding steps for how to use existing cluster as bootstrap cluster. (#…
gyliu513 Apr 5, 2019
f22495b
Add proposals template (#879)
vincepri Apr 8, 2019
305d98e
Clarify how to use kuebconfig. (#869)
gyliu513 Apr 9, 2019
0b73754
Add discuss link to README (#885)
vincepri Apr 10, 2019
8bed60b
Fix a broken link to Cluster API KEP (#900)
kkohtaka Apr 16, 2019
9f8478f
Add Cluster API project scope and objectives (#882)
vincepri Apr 18, 2019
979211f
Fix API group name written in kubebuilder's annotation comments (#883)
kkohtaka Apr 18, 2019
3bd1d17
Update github org for the baremetal provider. (#911)
russellb Apr 23, 2019
4b9c162
Add Talos to list of providers (#915)
andrewrynhard Apr 24, 2019
c818f7d
Add reference use cases for Cluster API (#903)
vincepri Apr 26, 2019
35fd817
Add missing bullet point to staging-use-cases.md (#920)
astrieanna Apr 30, 2019
a513883
Added IBM Cloud to Cluster API README. (#928)
gyliu513 May 3, 2019
7b68e3d
Update documentation links to published content (#927)
poidag-zz May 3, 2019
2ca16f1
Add Cluster API logos from CNCF (#916)
detiber May 3, 2019
cb8e003
Adding Reference Use Cases to README. (#931)
gyliu513 May 6, 2019
d007c5c
Updating release docs for branching approach now that we are 0.x (#862)
justinsb May 8, 2019
541f382
Used doctoc generated toc. (#932)
gyliu513 May 8, 2019
db990eb
Update to go 1.12.5 (#937)
detiber May 8, 2019
8a161b3
Attempt to fix integration tests (#942)
detiber May 13, 2019
9132bae
Update README.md (#941)
pierre-emmanuelJ May 13, 2019
0259dec
Add shortnames for crds. (#943)
jennydickinson May 14, 2019
742c9ff
Fix machine object pivoting to the target cluster (#944)
vikaschoudhary16 May 14, 2019
aa8cb19
[docs] Update RBAC annotations for example provider (#947)
detiber May 15, 2019
90d55da
Remove workstreams from scope and objectives (#948)
vincepri May 16, 2019
0034890
Added ibm cloud to architecture diagram. (#946)
gyliu513 May 16, 2019
efb4442
Added comment about cluster API vs cloud providers to readme (#954)
liztio May 24, 2019
c473f17
Quit MachineSet reconcile early if DeletionTimestamp is set (#956)
vincepri May 24, 2019
7d9449c
Cleanup controllers (#958)
vincepri May 28, 2019
f0d92d9
updates Google Cloud branding to mach other usages (#973)
dimitropoulos Jun 3, 2019
0dde0c7
Cannot retrieve machine name (#960)
clyang82 Jun 3, 2019
13ac474
Allow to use foregroundDeletion for MachineDeployments and MachineSet…
alvaroaleman Jun 3, 2019
8bae858
Rename controllers test files (#968)
vincepri Jun 3, 2019
0730db8
make cluster-api-manager container run with a non-root user (#955)
tariq1890 Jun 4, 2019
297c783
Update Gitbook release process (#659)
davidewatson Jun 4, 2019
4f3fd38
Add versioning and releases to README (#967)
vincepri Jun 5, 2019
1548ffd
Add more log for cluster deletion failure (#978)
jichenjc Jun 5, 2019
f0bfc72
Update dependencies (#982)
vincepri Jun 6, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
# limitations under the License.

# Build the manager binary
FROM golang:1.12.3 as builder
FROM golang:1.12.5 as builder

# Copy in the go src
WORKDIR $GOPATH/src/sigs.k8s.io/cluster-api
WORKDIR ${GOPATH}/src/sigs.k8s.io/cluster-api
COPY pkg/ pkg/
COPY cmd/ cmd/
COPY vendor/ vendor/
Expand All @@ -28,4 +28,5 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags '-extldflags "-st
FROM gcr.io/distroless/static:latest
WORKDIR /
COPY --from=builder /go/src/sigs.k8s.io/cluster-api/manager .
USER nobody
ENTRYPOINT ["/manager"]
32 changes: 17 additions & 15 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ required = [

[[constraint]]
name="sigs.k8s.io/controller-runtime"
version="v0.1.10"
version="v0.1.11"

[[constraint]]
name="sigs.k8s.io/controller-tools"
Expand Down
28 changes: 24 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,20 @@ API design. Because of this, all of the prototype code is rapidly changing.

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

To learn more, see the [Cluster API KEP][cluster-api-kep].
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).

### How does Cluster API compare to [Kubernetes Cloud Providers](https://kubernetes.io/docs/concepts/cluster-administration/cloud-providers/)?

Cloud Providers and the Cluster API work in concert to provide a rich Kubernetes experience in cloud environments.
The Cluster API initializes new nodes and clusters using available [providers](#Provider-Implementations).
Running clusters can then use Cloud Providers to provision support infrastructure like
[load balancers](https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/)
and [persistent volumes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/).

## Get involved!

* Join the [Cluster API discuss forum](https://discuss.kubernetes.io/c/contributors/cluster-api).

* Join the [sig-cluster-lifecycle](https://groups.google.com/forum/#!forum/kubernetes-sig-cluster-lifecycle)
Google Group for access to documents and calendars.

Expand All @@ -38,10 +48,13 @@ are also sponsored by SIG-cluster-lifecycle:
* AWS, https://github.com/kubernetes-sigs/cluster-api-provider-aws
* Azure, https://github.com/kubernetes-sigs/cluster-api-provider-azure
* Baidu Cloud, https://github.com/baidu/cluster-api-provider-baiducloud
* Bare Metal, https://github.com/metalkube/cluster-api-provider-baremetal
* Bare Metal, https://github.com/metal3-io/cluster-api-provider-baremetal
* DigitalOcean, https://github.com/kubernetes-sigs/cluster-api-provider-digitalocean
* GCE, https://github.com/kubernetes-sigs/cluster-api-provider-gcp
* Exoscale, https://github.com/exoscale/cluster-api-provider-exoscale
* GCP, https://github.com/kubernetes-sigs/cluster-api-provider-gcp
* IBM Cloud, https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud
* OpenStack, https://github.com/kubernetes-sigs/cluster-api-provider-openstack
* Talos, https://github.com/talos-systems/cluster-api-provider-talos
* Tencent Cloud, https://github.com/TencentCloud/cluster-api-provider-tencent
* vSphere, https://github.com/kubernetes-sigs/cluster-api-provider-vsphere

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

## Versioning, Maintenance, and Compatibility

- We follow [Semantic Versioning (semver)](https://semver.org/).
- Cluster API release cadence is Kubernetes Release + 6 weeks.
- 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.
- The _master_ branch is where development happens, this might include breaking changes.
- The _release-X_ branches contain stable, backward compatible code. A new _release-X_ branch is created at every major (X) release.

## Getting Started

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

[cluster-api-kep]: https://github.com/kubernetes/enhancements/blob/master/keps/sig-cluster-lifecycle/0003-cluster-api.md
[notes]: https://docs.google.com/document/d/1Ys-DOR5UsgbMEeciuG0HOgDQc8kZsaWIWJeKJ1-UfbY/edit
[recordings]: https://www.youtube.com/playlist?list=PL69nYSiGNLP29D0nYgAGWt1ZFqS9Z7lw4
[zoomMeeting]: https://zoom.us/j/861487554
Expand Down
6 changes: 3 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

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

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

go_register_toolchains(
go_version = "1.12.3",
go_version = "1.12.5",
)

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
Expand Down
23 changes: 18 additions & 5 deletions cmd/clusterctl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ this repository.**

### Prerequisites

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.
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.
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.
- If you want to use container, install [kind](https://github.com/kubernetes-sigs/kind#installation-and-usage). This is preferred.
- If you want to use VM, install [minikube](https://kubernetes.io/docs/tasks/tools/install-minikube/), version 0.30.0 or greater.
- If you want to use existing Kubernetes cluster, prepare your kubeconfig.
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.
2. Build the `clusterctl` tool

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

1. Create a cluster:

- __Bootstrap Cluster__: Use `bootstrap-type`, currently only `kind` and `minikube` are supported.

```shell
./clusterctl create cluster --provider <provider> --bootstrap-type <bootstrap-type> -c cluster.yaml -m machines.yaml -p provider-components.yaml -a addons.yaml
./clusterctl create cluster --provider <provider> --bootstrap-type <bootstrap-type> -c cluster.yaml \
-m machines.yaml -p provider-components.yaml -a addons.yaml
```

Currently two `bootstrap-type` options are supported - `kind` and `minikube`.
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`.

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`.
- __Existing Cluster__: Use `bootstrap-cluster-kubeconfig`. This flag is used when you have an existing Kubernetes cluster.

```shell
./clusterctl create cluster --provider <provider> --bootstrap-cluster-kubeconfig <kubeconfig> \
-c cluster.yaml -m machines.yaml -p provider-components.yaml -a addons.yaml
```

Additional advanced flags can be found via help.

Expand Down Expand Up @@ -74,6 +85,8 @@ $ kubectl --kubeconfig kubeconfig get machines
$ kubectl --kubeconfig kubeconfig get machines -o yaml
```

**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`.

#### Scaling your cluster

You can scale your cluster by adding additional individual Machines, or by adding a MachineSet or MachineDeployment
Expand Down
10 changes: 10 additions & 0 deletions cmd/clusterctl/clusterdeployer/clusterclient/clusterclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -754,43 +754,53 @@ func (c *client) WaitForResourceStatuses() error {
klog.V(2).Info("Waiting for Cluster API resources to have statuses...")
clusters, err := c.clientSet.ClusterV1alpha1().Clusters("").List(metav1.ListOptions{})
if err != nil {
klog.V(10).Infof("retrying: failed to list clusters: %v", err)
return false, nil
}
for _, cluster := range clusters.Items {
if reflect.DeepEqual(clusterv1.ClusterStatus{}, cluster.Status) {
klog.V(10).Info("retrying: cluster status is empty")
return false, nil
}
if cluster.Status.ProviderStatus == nil {
klog.V(10).Info("retrying: cluster.Status.ProviderStatus is not set")
return false, nil
}
}
machineDeployments, err := c.clientSet.ClusterV1alpha1().MachineDeployments("").List(metav1.ListOptions{})
if err != nil {
klog.V(10).Infof("retrying: failed to list machine deployment: %v", err)
return false, nil
}
for _, md := range machineDeployments.Items {
if reflect.DeepEqual(clusterv1.MachineDeploymentStatus{}, md.Status) {
klog.V(10).Info("retrying: machine deployment status is empty")
return false, nil
}
}
machineSets, err := c.clientSet.ClusterV1alpha1().MachineSets("").List(metav1.ListOptions{})
if err != nil {
klog.V(10).Infof("retrying: failed to list machinesets: %v", err)
return false, nil
}
for _, ms := range machineSets.Items {
if reflect.DeepEqual(clusterv1.MachineSetStatus{}, ms.Status) {
klog.V(10).Info("retrying: machineset status is empty")
return false, nil
}
}
machines, err := c.clientSet.ClusterV1alpha1().Machines("").List(metav1.ListOptions{})
if err != nil {
klog.V(10).Infof("retrying: failed to list machines: %v", err)
return false, nil
}
for _, m := range machines.Items {
if reflect.DeepEqual(clusterv1.MachineStatus{}, m.Status) {
klog.V(10).Info("retrying: machine status is empty")
return false, nil
}
if m.Status.ProviderStatus == nil {
klog.V(10).Info("retrying: machine.Status.ProviderStatus is not set")
return false, nil
}
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/clusterctl/clusterdeployer/clusterdeployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ func (d *ClusterDeployer) Create(cluster *clusterv1.Cluster, machines []*cluster
cluster.Namespace = bootstrapClient.GetContextNamespace()
}

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

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)
klog.Infof("Updating bootstrap cluster object for cluster %v in namespace %q with control plane endpoint running on machine", cluster.Name, cluster.Namespace)
if err := d.updateClusterEndpoint(bootstrapClient, provider, cluster.Name, cluster.Namespace); err != nil {
return errors.Wrap(err, "unable to update bootstrap cluster endpoint")
}
Expand Down Expand Up @@ -130,7 +130,7 @@ func (d *ClusterDeployer) Create(cluster *clusterv1.Cluster, machines []*cluster

// For some reason, endpoint doesn't get updated in bootstrap cluster sometimes. So we
// update the target cluster endpoint as well to be sure.
klog.Infof("Updating target cluster object with control plane endpoint running on %s", controlPlaneMachines[0].Name)
klog.Info("Updating target cluster object with control plane endpoint running on machine")
if err := d.updateClusterEndpoint(targetClient, provider, cluster.Name, cluster.Namespace); err != nil {
return errors.Wrap(err, "unable to update target cluster endpoint")
}
Expand Down
7 changes: 7 additions & 0 deletions cmd/clusterctl/phases/pivot.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,18 @@ func moveMachineSet(from sourceClient, to targetClient, ms *clusterv1.MachineSet
func moveMachines(from sourceClient, to targetClient, machines []*clusterv1.Machine) error {
machineNames := make([]string, 0, len(machines))
for _, m := range machines {
if m.DeletionTimestamp != nil {
klog.V(4).Infof("Skipping to move deleted machine: %q", m.Name)
continue
}
machineNames = append(machineNames, m.Name)
}
klog.V(4).Infof("Preparing to move Machines: %v", machineNames)

for _, m := range machines {
if m.DeletionTimestamp != nil {
continue
}
if err := moveMachine(from, to, m); err != nil {
return errors.Wrapf(err, "failed to move Machine %s:%s", m.Namespace, m.Name)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Global Flags:
--logtostderr log to standard error instead of files (default true)
--master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
--skip-headers If true, avoid header prefixes in the log messages
--skip-log-headers If true, avoid headers when openning log files
--skip-log-headers If true, avoid headers when opening log files
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
-v, --v Level number for the log level verbosity
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
Expand Down
2 changes: 1 addition & 1 deletion cmd/clusterctl/testdata/create-cluster-no-args.golden
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Global Flags:
--logtostderr log to standard error instead of files (default true)
--master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
--skip-headers If true, avoid header prefixes in the log messages
--skip-log-headers If true, avoid headers when openning log files
--skip-log-headers If true, avoid headers when opening log files
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
-v, --v Level number for the log level verbosity
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
Expand Down
2 changes: 1 addition & 1 deletion cmd/clusterctl/testdata/create-no-args-invalid-flag.golden
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Global Flags:
--logtostderr log to standard error instead of files (default true)
--master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
--skip-headers If true, avoid header prefixes in the log messages
--skip-log-headers If true, avoid headers when openning log files
--skip-log-headers If true, avoid headers when opening log files
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
-v, --v Level number for the log level verbosity
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
Expand Down
2 changes: 1 addition & 1 deletion cmd/clusterctl/testdata/create-no-args.golden
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Global Flags:
--logtostderr log to standard error instead of files (default true)
--master string The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
--skip-headers If true, avoid header prefixes in the log messages
--skip-log-headers If true, avoid headers when openning log files
--skip-log-headers If true, avoid headers when opening log files
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
-v, --v Level number for the log level verbosity
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
Expand Down
Loading