Skip to content

Commit

Permalink
Backports (#986)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
detiber authored and k8s-ci-robot committed Jun 7, 2019
1 parent 0f911c1 commit 7c38de4
Show file tree
Hide file tree
Showing 108 changed files with 3,814 additions and 1,674 deletions.
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

0 comments on commit 7c38de4

Please sign in to comment.