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

Add weave-net as an alternative CNI plugin #432

Merged
merged 6 commits into from
May 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions Gopkg.lock

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

11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
export GOPATH?=$(shell go env GOPATH)
export CGO_ENABLED=0
export TFJSON?=
export KUBEONE_CONFIG_FILE?=config.yaml.dist
export KUBERNETES_VERSION=1.13.3
export KUBERNETES_VERSION=1.14.1
BUILD_DATE=$(shell if hash gdate 2>/dev/null; then gdate --rfc-3339=seconds | sed 's/ /T/'; else date --rfc-3339=seconds | sed 's/ /T/'; fi)
BUILD_IMAGE?=golang:1.11.5
BUILD_IMAGE?=golang:1.12.5
GITCOMMIT=$(shell git log -1 --pretty=format:"%H")
GITTAG=$(shell git describe --tags --always)
GOLDFLAGS?=-s -w -X github.com/kubermatic/kubeone/pkg/cmd.version=$(GITTAG) -X github.com/kubermatic/kubeone/pkg/cmd.commit=$(GITCOMMIT) -X github.com/kubermatic/kubeone/pkg/cmd.date=$(BUILD_DATE)
Expand Down Expand Up @@ -82,9 +81,11 @@ $(CREATE_TARGETS): kubeone
for host in $$(cat tf.json |jq -r '.kubeone_hosts.value.control_plane[0].public_address|.[]'); do \
until ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $(USER)@$$host exit; do sleep 1; done; \
done
./dist/kubeone install config.yaml.dist --tfjson tf.json
./dist/kubeone config print --full --provider $(PROVIDERNAME) > ./dist/fresh_config.yaml
./dist/kubeone install ./dist/fresh_config.yaml --tfjson tf.json

$(DESTROY_TARGETS): kubeone
$(eval PROVIDERNAME := $(@:-env-cleanup=))
./dist/kubeone reset config.yaml.dist --tfjson tf.json
./dist/kubeone config print --full --provider $(PROVIDERNAME) > ./dist/fresh_config.yaml
./dist/kubeone reset ./dist/fresh_config.yaml --tfjson tf.json
cd terraform/$(PROVIDERNAME) && terraform destroy --auto-approve
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ about the infrastructure.
kubeone install config.yaml --tfjson tf.json
```

To learn more about KubeOne configuration, check out
[the example configuration file][12].
To learn more about KubeOne configuration, please run `kubeone config print --full`.

For advanced use cases and other features, check the [KubeOne features][13]
document.
Expand Down Expand Up @@ -154,7 +153,6 @@ See [the list of releases][3] to find out about feature changes.
[9]: https://github.com/kubermatic/kubeone/releases
[10]: ./docs
[11]: ./docs/quickstart-aws.md
[12]: ./config.yaml.dist
[13]: https://github.com/kubermatic/kubeone#features
[14]: https://groups.google.com/forum/#!forum/loodse-dev
[15]: http://slack.kubermatic.io/
Expand Down
200 changes: 0 additions & 200 deletions config.yaml.dist

This file was deleted.

7 changes: 5 additions & 2 deletions docs/quickstart-aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,12 @@ terraform output -json > tf.json

## Installing Kubernetes

Now that you have infrastructure you can proceed with installing Kubernetes using KubeOne.
Now that you have infrastructure you can proceed with installing Kubernetes
using KubeOne.

Before you start you'll need a configuration file that defines how Kubernetes will be installed, e.g. what version will be used and what features will be enabled. For the configuration file reference see [`config.yaml.dist`](https://github.com/kubermatic/kubeone/blob/master/config.yaml.dist).
Before you start you'll need a configuration file that defines how Kubernetes
will be installed, e.g. what version will be used and what features will be
enabled. For the configuration file reference run `kubeone config print --full`.

To get started you can use the following configuration. It'll install Kubernetes 1.14.1 and create 3 worker nodes. KubeOne automatically populates all needed information about worker nodes from the [Terraform output](https://github.com/kubermatic/kubeone/blob/ec8bf305446ac22529e9683fd4ce3c9abf753d1e/examples/terraform/aws/output.tf#L38-L87). Alternatively, you can set those information manually. As KubeOne is using [Kubermatic `machine-controller`](https://github.com/kubermatic/machine-controller) for creating worker nodes, see [AWS example manifest](https://github.com/kubermatic/machine-controller/blob/master/examples/aws-machinedeployment.yaml) for available options.

Expand Down
4 changes: 3 additions & 1 deletion docs/quickstart-digitalocean.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ terraform output -json > tf.json

Now that you have infrastructure you can proceed with installing Kubernetes using KubeOne.

Before you start you'll need a configuration file that defines how Kubernetes will be installed, e.g. what version will be used and what features will be enabled. For the configuration file reference see [`config.yaml.dist`](https://github.com/kubermatic/kubeone/blob/master/config.yaml.dist).
Before you start you'll need a configuration file that defines how Kubernetes
will be installed, e.g. what version will be used and what features will be
enabled. For the configuration file reference run `kubeone config print --full`.

To get started you can use the following configuration. It'll install Kubernetes 1.14.1, create 3 worker nodes and deploy the [external cloud controller manager](https://github.com/digitalocean/digitalocean-cloud-controller-manager). The external cloud controller manager takes care of providing correct information about nodes from the DigitalOcean API and allows you to use the `type: LoadBalancer` services. KubeOne automatically populates information about the worker nodes from the [Terraform output](https://github.com/kubermatic/kubeone/blob/ec8bf305446ac22529e9683fd4ce3c9abf753d1e/examples/terraform/digitalocean/output.tf#L38-L59). Alternatively, you can set those information manually. As KubeOne is using [Kubermatic `machine-controller`](https://github.com/kubermatic/machine-controller) for creating worker nodes, see [DigitalOcean example manifest](https://github.com/kubermatic/machine-controller/blob/master/examples/digitalocean-machinedeployment.yaml) for available options.

Expand Down
3 changes: 1 addition & 2 deletions docs/quickstart-gce.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ using KubeOne.

Before you start you'll need a configuration file that defines how Kubernetes
will be installed, e.g. what version will be used and what features will be
enabled. For the configuration file reference see
[`config.yaml.dist`](https://github.com/kubermatic/kubeone/blob/master/config.yaml.dist).
enabled. For the configuration file reference run `kubeone config print --full`.

To get started you can use the following configuration. It'll install Kubernetes
1.14.1 and create 3 worker nodes. KubeOne automatically populates information
Expand Down
7 changes: 5 additions & 2 deletions docs/quickstart-hetzner.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,12 @@ terraform output -json > tf.json

## Installing Kubernetes

Now that you have infrastructure you can proceed with installing Kubernetes using KubeOne.
Now that you have infrastructure you can proceed with installing Kubernetes
using KubeOne.

Before you start you'll need a configuration file that defines how Kubernetes will be installed, e.g. what version will be used and what features will be enabled. For the configuration file reference see [`config.yaml.dist`](https://github.com/kubermatic/kubeone/blob/master/config.yaml.dist).
Before you start you'll need a configuration file that defines how Kubernetes
will be installed, e.g. what version will be used and what features will be
enabled. For the configuration file reference run `kubeone config print --full`.

To get started you can use the following configuration. It'll install Kubernetes 1.14.1, create 3 worker nodes and deploy the [external cloud controller manager](https://github.com/hetznercloud/hcloud-cloud-controller-manager). The external cloud controller manager takes care of providing correct information about the nodes. KubeOne automatically populates all needed information about worker nodes from the [Terraform output](https://github.com/kubermatic/kubeone/blob/a874fd5913ca2a86c3b8136982c2a00e835c2f62/examples/terraform/hetzner/output.tf#L26-L36). Alternatively, you can set those information manually. As KubeOne is using [Kubermatic `machine-controller`](https://github.com/kubermatic/machine-controller) for creating worker nodes see [Hetzner example manifest](https://github.com/kubermatic/machine-controller/blob/master/examples/hetzner-machinedeployment.yaml) for available options.

Expand Down
7 changes: 5 additions & 2 deletions docs/quickstart-openstack.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,12 @@ terraform output -json > tf.json

## Installing Kubernetes

Now that you have infrastructure you can proceed with installing Kubernetes using KubeOne.
Now that you have infrastructure you can proceed with installing Kubernetes
using KubeOne.

Before you start you'll need a configuration file that defines how Kubernetes will be installed, e.g. what version will be used and what features will be enabled. For the configuration file reference see [`config.yaml.dist`](https://github.com/kubermatic/kubeone/blob/master/config.yaml.dist).
Before you start you'll need a configuration file that defines how Kubernetes
will be installed, e.g. what version will be used and what features will be
enabled. For the configuration file reference run `kubeone config print --full`.

To get started you can use the following configuration. It'll install Kubernetes 1.14.1 and create 2 worker nodes. KubeOne automatically populates information about image, instance size and networking settings for worker nodes from the Terraform output. Alternatively, you can set those information manually. As KubeOne is using [Kubermatic `machine-controller`](https://github.com/kubermatic/machine-controller) for creating worker nodes, see [OpenStack example manifest](https://github.com/kubermatic/machine-controller/blob/master/examples/openstack-machinedeployment.yaml) for available options.

Expand Down
4 changes: 1 addition & 3 deletions docs/quickstart-packet.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ using KubeOne.

Before you start you'll need a configuration file that defines how Kubernetes
will be installed, e.g. what version will be used and what features will be
enabled. For the configuration file reference see
[`config.yaml.dist`][config_yaml_dist].
enabled. For the configuration file reference run `kubeone config print --full`.

To get started you can use the following configuration. It'll install Kubernetes
1.14.1, create 1 worker node and deploy the
Expand Down Expand Up @@ -272,7 +271,6 @@ our [documentation][kubeone_docs].
[packet_support_docs]: https://support.packet.com/kb/articles/api-integrations
[packet_terraform]: https://github.com/kubermatic/kubeone/tree/master/examples/terraform/packet
[packet_variables]: https://github.com/kubermatic/kubeone/blob/master/examples/terraform/packet/variables.tf
[config_yaml_dist]: https://github.com/kubermatic/kubeone/blob/master/config.yaml.dist
[packet_ccm]: https://github.com/packethost/packet-ccm
[packet_tf_output]: https://github.com/kubermatic/kubeone/blob/789509f54b3a4aed7b15cd8b27b2e5bb2a4fa6c1/examples/terraform/packet/output.tf
[machine_controller]: https://github.com/kubermatic/machine-controller
Expand Down
30 changes: 30 additions & 0 deletions pkg/apis/kubeone/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,36 @@ type ClusterNetworkConfig struct {
ServiceSubnet string `json:"serviceSubnet"`
ServiceDomainName string `json:"serviceDomainName"`
NodePortRange string `json:"nodePortRange"`
CNI *CNI `json:"cni,omitempty"`
}

// CNIProvider type
type CNIProvider string

// List of CNI Providers
const (
// CNIProviderCanal is a Canal CNI plugin (Flannel + Calico).
// Highlights:
// * Support Network Policies
// * Does not support traffic encryption
kron4eg marked this conversation as resolved.
Show resolved Hide resolved
// More info: https://docs.projectcalico.org/v3.7/getting-started/kubernetes/installation/flannel
CNIProviderCanal CNIProvider = "canal"

// CNIProviderWeaveNet is a WeaveNet CNI plugin.
// Highlights:
// * Support Network Policies
// * Support optional traffic encryption
// * In case when encryption is enabled, strong secret will be autogenerated
// More info: https://www.weave.works/docs/net/latest/kubernetes/kube-addon/
xmudrii marked this conversation as resolved.
Show resolved Hide resolved
CNIProviderWeaveNet CNIProvider = "weave-net"
)

// CNI config
type CNI struct {
// Provider choice
Provider CNIProvider `json:"provider"`
// Encrypted enables encryption for supported CNI plugins
Encrypted bool `json:"encrypted"`
}

// ProxyConfig configures proxy for the Docker daemon and is used by KubeOne scripts
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/kubeone/v1alpha1/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ func SetDefaults_ClusterNetwork(obj *KubeOneCluster) {
if len(obj.ClusterNetwork.NodePortRange) == 0 {
obj.ClusterNetwork.NodePortRange = DefaultNodePortRange
}
if obj.ClusterNetwork.CNI == nil {
obj.ClusterNetwork.CNI = &CNI{
Provider: CNIProviderCanal,
}
}
}

func SetDefaults_MachineController(obj *KubeOneCluster) {
Expand Down
Loading