Skip to content

Commit

Permalink
Merge branch 'master' into dev/update-readme
Browse files Browse the repository at this point in the history
  • Loading branch information
s1061123 committed Oct 1, 2018
2 parents d9e98f8 + a4f5fd4 commit f027b8e
Show file tree
Hide file tree
Showing 21 changed files with 333 additions and 150 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ env:

before_install:
- sudo apt-get update -qq
- go get github.com/mattn/goveralls

install:
# workaround golint install error in https://github.com/golang/lint/issues/288
- mkdir -p $GOPATH/src/golang.org/x
- pushd $GOPATH/src/golang.org/x
- git clone https://github.com/golang/tools.git
- git clone https://github.com/golang/lint.git
- go get github.com/golang/lint/golint
- popd
Expand All @@ -29,9 +29,10 @@ before_script:
script:
- ./build
- sudo ./test.sh
- $GOPATH/bin/goveralls -coverprofile=coverage.out -service=travis-ci
- mkdir -p ${TRAVIS_BUILD_DIR}/dist
- tar cvfz ${TRAVIS_BUILD_DIR}/dist/multus-cni_amd64.tar.gz --warning=no-file-changed --exclude="dist" --exclude="vendor" .
- docker build -t nfvpe/multus -f ./images/Dockerfile .
- docker build -t nfvpe/multus .

before_deploy:
- go get -u github.com/laher/goxc
Expand Down
File renamed without changes.
37 changes: 20 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
![multus-cni Logo](https://github.com/intel/multus-cni/blob/master/doc/images/Multus.png)

[![Travis CI](https://travis-ci.org/intel/multus-cni.svg?branch=master)](https://travis-ci.org/intel/multus-cni/builds)[![Go Report Card](https://goreportcard.com/badge/github.com/intel/multus-cni)](https://goreportcard.com/report/github.com/intel/multus-cni)

* [MULTUS CNI plugin](#multus-cni-plugin)
* [Quickstart Guide](#quickstart-guide)
* [Multi-Homed pod](#multi-homed-pod)
Expand Down Expand Up @@ -54,7 +56,7 @@ apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: macvlan-conf
spec:
spec:
config: '{
"cniVersion": "0.3.0",
"type": "macvlan",
Expand Down Expand Up @@ -135,6 +137,7 @@ $ kubectl exec -it samplepod -- ip a
- type (string, required): "multus"
- kubeconfig (string, optional): kubeconfig file for the out of cluster communication with kube-apiserver. See the example [kubeconfig](https://github.com/intel/multus-cni/blob/master/doc/node-kubeconfig.yaml)
- delegates (([]map,required): number of delegate details in the Multus
- capabilities ({}list, optional): [capabilities](https://github.com/containernetworking/cni/blob/master/CONVENTIONS.md#dynamic-plugin-specific-fields-capabilities--runtime-configuration) supported by at least one of the delegates. (NOTE: Multus only supports portMappings capability for now). See the [example](https://github.com/intel/multus-cni/blob/master/examples/multus-ptp-portmap.conf).

## Usage with Kubernetes CRD based network objects

Expand Down Expand Up @@ -174,7 +177,7 @@ apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: flannel-networkobj
spec:
spec:
config: '{
"cniVersion": "0.3.0",
"type": "flannel",
Expand Down Expand Up @@ -303,7 +306,7 @@ Configurations referenced in annotations are created in addition to the default

1. Save the following YAML to pod-multi-network.yaml. In this case flannel-conf network object acts as the primary network.
```
# cat pod-multi-network.yaml
# cat pod-multi-network.yaml
apiVersion: v1
kind: Pod
metadata:
Expand Down Expand Up @@ -344,7 +347,7 @@ multus-multi-net-poc 1/1 Running 0 30s
1. Run `ifconfig` command in Pod:

```
# kubectl exec -it multus-multi-net-poc -- ifconfig
# kubectl exec -it multus-multi-net-poc -- ifconfig
eth0 Link encap:Ethernet HWaddr C6:43:7C:09:B4:9C
inet addr:10.128.0.4 Bcast:0.0.0.0 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1450 Metric:1
Expand All @@ -353,39 +356,39 @@ eth0 Link encap:Ethernet HWaddr C6:43:7C:09:B4:9C
collisions:0 txqueuelen:0
RX bytes:648 (648.0 B) TX bytes:42 (42.0 B)
lo Link encap:Local Loopback
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
collisions:0 txqueuelen:1
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
net0 Link encap:Ethernet HWaddr 06:21:91:2D:74:B9
net0 Link encap:Ethernet HWaddr 06:21:91:2D:74:B9
inet addr:192.168.42.3 Bcast:0.0.0.0 Mask:255.255.255.0
inet6 addr: fe80::421:91ff:fe2d:74b9/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1450 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:648 (648.0 B)
net1 Link encap:Ethernet HWaddr D2:94:98:82:00:00
net1 Link encap:Ethernet HWaddr D2:94:98:82:00:00
inet addr:10.56.217.171 Bcast:0.0.0.0 Mask:255.255.255.0
inet6 addr: fe80::d094:98ff:fe82:0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
collisions:0 txqueuelen:1000
RX bytes:120 (120.0 B) TX bytes:648 (648.0 B)
north Link encap:Ethernet HWaddr BE:F2:48:42:83:12
north Link encap:Ethernet HWaddr BE:F2:48:42:83:12
inet6 addr: fe80::bcf2:48ff:fe42:8312/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1420 errors:0 dropped:0 overruns:0 frame:0
TX packets:1276 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
collisions:0 txqueuelen:1000
RX bytes:95956 (93.7 KiB) TX bytes:82200 (80.2 KiB)
```

Expand Down Expand Up @@ -422,7 +425,7 @@ Given the following network configuration:
{
"type": "sriov",
#part of sriov plugin conf
"if0": "enp12s0f0",
"if0": "enp12s0f0",
"ipam": {
"type": "host-local",
"subnet": "10.56.217.0/24",
Expand Down Expand Up @@ -460,7 +463,7 @@ EOF

## Logging Options

You may wish to enable some enhanced logging for Multus, especially during the process where you're configuring Multus and need to understand what is or isn't working with your particular configuration.
You may wish to enable some enhanced logging for Multus, especially during the process where you're configuring Multus and need to understand what is or isn't working with your particular configuration.

Multus will always log via `STDERR`, which is the standard method by which CNI plugins communicate errors, and these errors are logged by the Kubelet. This method is always enabled.

Expand All @@ -478,7 +481,7 @@ For example in your CNI configuration, you may set:

The default logging level is set as `panic` -- this will log only the most critical errors, and is the least verbose logging level.

The available logging level values, in descreasing order of verbosity are:
The available logging level values, in decreasing order of verbosity are:

* `debug`
* `error`
Expand Down Expand Up @@ -555,7 +558,7 @@ pod "multus-test" created
20: net0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq qlen 1000
link/ether f6:fb:21:4f:1d:63 brd ff:ff:ff:ff:ff:ff
21: net1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq qlen 1000
link/ether 76:13:b1:60:00:00 brd ff:ff:ff:ff:ff:ff
link/ether 76:13:b1:60:00:00 brd ff:ff:ff:ff:ff:ff
```

| Interface name | Description |
Expand Down
6 changes: 3 additions & 3 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ In the `./examples` folder some example configurations are provided for using Mu

## Examples overview

Generally, the examples here show a setup using Multus with CRD support. The examples here demonstrate a setup with Multus as the meta-plugin used by Kubernetes, and delgating to either Flannel (which will be the default pod network), or to macvlan. The CRDs are intended to be alignment with the defacto standard.
Generally, the examples here show a setup using Multus with CRD support. The examples here demonstrate a setup with Multus as the meta-plugin used by Kubernetes, and delegating to either Flannel (which will be the default pod network), or to macvlan. The CRDs are intended to be alignment with the defacto standard.

It is expected that aspects of your own setup will vary, at least in part, from some of what's demonstrated here. Namely, the IP address spaces, and likely the host ethernet interface names used in the macvlan part of the configuration.

More specifically, these examples show:

* Multus configured, using CNI a `.conf` file, with CRD support, specifying that we will use a "default network".
* A resource definition with a daemonset that places the `.conf` on each node in the cluster.
* A CRD definining the "networks" @ `network-attachment-definitions.k8s.cni.cncf.io`
* A CRD defining the "networks" @ `network-attachment-definitions.k8s.cni.cncf.io`
* CRD objects containing the configuration for both Flannel & macvlan.

## Quick-start instructions
Expand All @@ -37,7 +37,7 @@ More specifically, these examples show:

## RBAC configuration

You'll need to abnel the `system:node` users access to the API endpoints that will deliver the CRD objects to Multus.
You'll need to enable the `system:node` users access to the API endpoints that will deliver the CRD objects to Multus.

Using these examples, you'll first create a cluster role with the provided sample:

Expand Down
36 changes: 36 additions & 0 deletions examples/multus-ptp-portmap.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "multus-cni-network",
"type": "multus"
"capabilities": {
"portMappings": true
},
"delegates": [
{
"cniVersion": "0.3.1",
"name": "ptp-tuning-conflist",
"plugins": [
{
"dns": {
"nameservers": [
"172.16.1.1"
]
},
"ipMasq": true,
"ipam": {
"subnet": "172.16.0.0/24",
"type": "host-local"
},
"mtu": 512,
"type": "ptp"
},
{
"capabilities": {
"portMappings": true
},
"externalSetMarkChain": "KUBE-MARK-MASQ",
"type": "portmap"
}
]
}
],
}
20 changes: 14 additions & 6 deletions examples/npwg-demo-1/01_crd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,29 @@ apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
# name must match the spec fields below, and be in the form: <plural>.<group>
name: networks.kubernetes.cni.cncf.io
name: network-attachment-definitions.k8s.cni.cncf.io
spec:
# group name to use for REST API: /apis/<group>/<version>
group: kubernetes.cni.cncf.io
group: k8s.cni.cncf.io
# version name to use for REST API: /apis/<group>/<version>
version: v1
# either Namespaced or Cluster
scope: Namespaced
names:
# plural name to be used in the URL: /apis/<group>/<version>/<plural>
plural: networks
plural: network-attachment-definitions
# singular name to be used as an alias on the CLI and for display
singular: network
singular: network-attachment-definition
# kind is normally the CamelCased singular type. Your resource manifests use this.
kind: Network
kind: NetworkAttachmentDefinition
# shortNames allow shorter string to match your resource on the CLI
shortNames:
- net
- net-attach-def
validation:
openAPIV3Schema:
properties:
spec:
properties:
config:
type: string

2 changes: 1 addition & 1 deletion examples/npwg-demo-1/02_clusterrole.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: multus-crd-overpowered
name: multus
rules:
- apiGroups:
- '*'
Expand Down
16 changes: 8 additions & 8 deletions examples/npwg-demo-1/04_macvlan1.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
apiVersion: "kubernetes.cni.cncf.io/v1"
kind: Network
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: macvlan-conf-1
spec:
Expand All @@ -17,8 +17,8 @@ spec:
}
}'
---
apiVersion: "kubernetes.cni.cncf.io/v1"
kind: Network
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: macvlan-conf-2
spec:
Expand All @@ -35,8 +35,8 @@ spec:
}
}'
---
apiVersion: "kubernetes.cni.cncf.io/v1"
kind: Network
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: macvlan-conf-3
spec:
Expand All @@ -53,8 +53,8 @@ spec:
}
}'
---
apiVersion: "kubernetes.cni.cncf.io/v1"
kind: Network
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: macvlan-conf-4
spec:
Expand Down
4 changes: 2 additions & 2 deletions examples/npwg-demo-1/05_vlan1.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
apiVersion: "kubernetes.cni.cncf.io/v1"
kind: Network
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: vlan-conf-1-1
namespace: testns1
Expand Down
6 changes: 4 additions & 2 deletions glide.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
package: github.com/intel/multus-cni
ignore:
- bytes
import:
- package: github.com/containernetworking/cni
version: 07c1a6da47b7fbf8b357f4949ecce2113e598491
subpackages:
- pkg/ip
- pkg/ipam
- pkg/skel
- pkg/types
- pkg/version
- package: github.com/containernetworking/plugins
version: 2b8b1ac0af4568e928d96ccc5f47b075416eeabd
subpackages:
- pkg/ip
- pkg/ipam
- pkg/ns
- package: github.com/onsi/ginkgo
version: 7f8ab55aaf3b86885aa55b762e803744d1674700
Expand Down
3 changes: 2 additions & 1 deletion images/70-multus.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"type": "flannel",
"name": "flannel.1",
"delegate": {
"isDefaultGateway": true
"isDefaultGateway": true,
"hairpinMode": true
}
}
],
Expand Down
4 changes: 2 additions & 2 deletions images/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

This is used for distribution of Multus in a Docker image.

Typically you'd build this from the root of your Multus clone, and you'd set the `-f` flag to specify the Dockerfile during build time. This allows the addition of the entirety of the Multus git clone as part of the Docker context. Use the `-f` flag with the root of the clone as the context (e.g. your current work directory would be root of git clone), such as:
Typically you'd build this from the root of your Multus clone, as such:

```
$ docker build -t dougbtv/multus -f ./images/Dockerfile .
$ docker build -t dougbtv/multus .
```

---
Expand Down
Loading

0 comments on commit f027b8e

Please sign in to comment.