Skip to content

Commit

Permalink
multus: add multus manifests
Browse files Browse the repository at this point in the history
  • Loading branch information
zshi-redhat committed Jan 8, 2019
1 parent e3da273 commit ae8945e
Show file tree
Hide file tree
Showing 12 changed files with 420 additions and 10 deletions.
11 changes: 9 additions & 2 deletions bindata/network/additional-networks/cr/cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: {{.AdditionalNetworkName}}
namespace: default
{{if .ConfigAnnotation}}
annotations:
{{range $k, $v := .AdditionalNetworkAnnotations}}
{{$k | indent 4}}: {{$v}}
{{end}}
{{end}}
namespace: {{.AdditionalNetworkNamespace}}
spec:
config: {{.AdditionalNetworkConfig}}
config: |-
{{.AdditionalNetworkConfig | indent 4}}
10 changes: 10 additions & 0 deletions bindata/network/additional-networks/multus/000-ns.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Namespace
metadata:
name: multus
labels:
name: multus
openshift.io/run-level: "0"
annotations:
openshift.io/node-selector: "" #override default node selector
openshift.io/description: "Multus components"
51 changes: 51 additions & 0 deletions bindata/network/additional-networks/multus/002-rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: multus
rules:
- apiGroups:
- '*'
resources:
- '*'
verbs:
- '*'
- nonResourceURLs:
- '*'
verbs:
- '*'

---
apiVersion: v1
kind: ServiceAccount
metadata:
name: multus
namespace: multus

---
apiVersion: v1
kind: ServiceAccount
metadata:
name: sriov-device-plugin
namespace: multus

---
apiVersion: v1
kind: ServiceAccount
metadata:
name: sriov-cni
namespace: multus

---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: multus
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: multus
subjects:
- kind: ServiceAccount
name: multus
namespace: multus
73 changes: 73 additions & 0 deletions bindata/network/additional-networks/multus/multus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
kind: ConfigMap
apiVersion: v1
metadata:
name: multus-cni-config
namespace: multus
data:
cni-conf.json: |-
{{.NodeConfig | indent 4}}

---
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: multus
namespace: multus
annotations:
kubernetes.io/description: |
This daemon set launches the Multus networking components.
spec:
selector:
matchLabels:
app: multus
updateStrategy:
type: RollingUpdate
template:
metadata:
labels:
app: multus
component: network
type: infra
openshift.io/component: network
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
spec:
hostNetwork: true
nodeSelector:
beta.kubernetes.io/os: linux
tolerations:
- operator: Exists
serviceAccountName: multus
containers:
- name: multus
image: nfvpe/multus:latest
resources:
requests:
cpu: "100m"
memory: "50Mi"
limits:
cpu: "100m"
memory: "50Mi"
securityContext:
privileged: true
volumeMounts:
- name: cni
mountPath: /host/etc/cni/net.d
- name: cnibin
mountPath: /host/opt/cni/bin
- name: multus-cfg
mountPath: /usr/src/multus-cni/images
volumes:
- name: cni
hostPath:
path: /etc/cni/net.d
- name: cnibin
hostPath:
path: /opt/cni/bin
- name: multus-cfg
configMap:
name: multus-cni-config
items:
- key: cni-conf.json
path: 70-multus.conf
48 changes: 48 additions & 0 deletions bindata/network/additional-networks/multus/sriov-cni.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: sriov-cni
namespace: multus
annotations:
kubernetes.io/description: |
This daemon set launches the SR-IOV CNI Plugin.
spec:
selector:
matchLabels:
app: sriov-cni
updateStrategy:
type: RollingUpdate
template:
metadata:
labels:
app: sriov-cni
component: network
type: infra
openshift.io/component: network
spec:
hostNetwork: true
nodeSelector:
beta.kubernetes.io/os: linux
tolerations:
- operator: Exists
serviceAccountName: sriov-cni
containers:
- name: sriov-cni
image: nfvpe/sriov-cni:latest
securityContext:
privileged: true
resources:
requests:
cpu: "100m"
memory: "50Mi"
limits:
cpu: "100m"
memory: "50Mi"
volumeMounts:
- name: cnibin
mountPath: /host/opt/cni/bin
volumes:
- name: cnibin
hostPath:
path: /opt/cni/bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: sriov-device-plugin
namespace: multus
annotations:
kubernetes.io/description: |
This daemon set launches the SR-IOV Network Device Plugin.
spec:
selector:
matchLabels:
app: sriovdp
updateStrategy:
type: RollingUpdate
template:
metadata:
labels:
app: sriovdp
component: network
type: infra
openshift.io/component: network
spec:
hostNetwork: true
nodeSelector:
beta.kubernetes.io/os: linux
tolerations:
- operator: Exists
serviceAccountName: sriov-device-plugin
containers:
- name: sriovdp
image: nfvpe/sriov-device-plugin:release-v1
args:
- --log-dir=sriovdp
resources:
requests:
cpu: "100m"
memory: "50Mi"
limits:
cpu: "100m"
memory: "50Mi"
securityContext:
privileged: false
volumeMounts:
- name: devicesock
mountPath: /var/lib/kubelet/device-plugins/
readOnly: false
- name: net
mountPath: /sys/class/net
readOnly: true
volumes:
- name: devicesock
hostPath:
path: /var/lib/kubelet/device-plugins/
- name: net
hostPath:
path: /sys/class/net
2 changes: 2 additions & 0 deletions manifests/0000_07_cluster-network-operator_03_daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ spec:
value: "docker.io/openshift/origin-node:v4.0.0"
- name: HYPERSHIFT_IMAGE
value: "docker.io/openshift/origin-hypershift:v4.0.0"
- name: HOST_KUBECONFIG
value: "/etc/kubernetes/kubeconfig"
- name: POD_NAME
valueFrom:
fieldRef:
Expand Down
32 changes: 32 additions & 0 deletions pkg/apis/networkoperator/v1/networkconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ type AdditionalNetworkDefinition struct {
// The name of the network. This will be populated in the resulting CRD
Name string `json:"name"`

// The namespace of the network. This will be populated in the resulting CRD
Namespace string `json:"namespace"`

// The annotations of the network. This will be populated in the resulting CRD
Annotations map[string]string `json:"annotations,omitEmpty"`

// RawCNIConfig is the raw CNI configuration json to create in the
// NetworkAttachmentDefinition CRD
RawCNIConfig string `json:"rawCNIConfig"`
Expand Down Expand Up @@ -152,6 +158,32 @@ type OVNKubernetesConfig struct {
MTU *uint32 `json:"mtu,omitempty"`
}

// MultusCNIConfig is the CNI configuration parameters for networks using the
// multus network project
type MultusCNIConfig struct {
// The Name set to use multus network name
Name string `json:"name"`

// The Type set to use multus network type
Type string `json:"type"`

// The Kubeconfig set to host kube config path
Kubeconfig string `json:"kubeconfig"`

// The Delegates set to multus delegate networks
Delegates []*MultusDelegate `json:"delegates"`
}

// MultusCNIConfig is the CNI delegate configuration for networks using the
// multus network project
type MultusDelegate struct {
// The Name set to use default network name
Name string `json:"name"`

// The Type set to use default network type
Type string `json:"type"`
}

// NetworkType describes the network plugin type to configure
type NetworkType string

Expand Down
54 changes: 53 additions & 1 deletion pkg/apis/networkoperator/v1/zz_generated.deepcopy.go

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

Loading

0 comments on commit ae8945e

Please sign in to comment.