update
This commit is contained in:
10
kubespray/roles/network_plugin/multus/defaults/main.yml
Normal file
10
kubespray/roles/network_plugin/multus/defaults/main.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
multus_conf_file: "auto"
|
||||
multus_cni_conf_dir_host: "/etc/cni/net.d"
|
||||
multus_cni_bin_dir_host: "/opt/cni/bin"
|
||||
multus_cni_run_dir_host: "/run"
|
||||
multus_cni_conf_dir: "{{ ('/host', multus_cni_conf_dir_host) | join }}"
|
||||
multus_cni_bin_dir: "{{ ('/host', multus_cni_bin_dir_host) | join }}"
|
||||
multus_cni_run_dir: "{{ ('/host', multus_cni_run_dir_host) | join }}"
|
||||
multus_cni_version: "0.4.0"
|
||||
multus_kubeconfig_file_host: "{{ (multus_cni_conf_dir_host, '/multus.d/multus.kubeconfig') | join }}"
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
kind: ClusterRole
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: multus
|
||||
rules:
|
||||
- apiGroups: ["k8s.cni.cncf.io"]
|
||||
resources:
|
||||
- '*'
|
||||
verbs:
|
||||
- '*'
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods
|
||||
- pods/status
|
||||
verbs:
|
||||
- get
|
||||
- update
|
||||
- apiGroups:
|
||||
- ""
|
||||
- events.k8s.io
|
||||
resources:
|
||||
- events
|
||||
verbs:
|
||||
- create
|
||||
- patch
|
||||
- update
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: multus
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: multus
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: multus
|
||||
namespace: kube-system
|
||||
45
kubespray/roles/network_plugin/multus/files/multus-crd.yml
Normal file
45
kubespray/roles/network_plugin/multus/files/multus-crd.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: network-attachment-definitions.k8s.cni.cncf.io
|
||||
spec:
|
||||
group: k8s.cni.cncf.io
|
||||
scope: Namespaced
|
||||
names:
|
||||
plural: network-attachment-definitions
|
||||
singular: network-attachment-definition
|
||||
kind: NetworkAttachmentDefinition
|
||||
shortNames:
|
||||
- net-attach-def
|
||||
versions:
|
||||
- name: v1
|
||||
served: true
|
||||
storage: true
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
description: 'NetworkAttachmentDefinition is a CRD schema specified by the Network Plumbing
|
||||
Working Group to express the intent for attaching pods to one or more logical or physical
|
||||
networks. More information available at: https://github.com/k8snetworkplumbingwg/multi-net-spec'
|
||||
type: object
|
||||
properties:
|
||||
apiVersion:
|
||||
description: 'APIVersion defines the versioned schema of this represen
|
||||
tation of an object. Servers should convert recognized schemas to the
|
||||
latest internal value, and may reject unrecognized values. More info:
|
||||
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
|
||||
type: string
|
||||
kind:
|
||||
description: 'Kind is a string value representing the REST resource this
|
||||
object represents. Servers may infer this from the endpoint the client
|
||||
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
|
||||
type: string
|
||||
metadata:
|
||||
type: object
|
||||
spec:
|
||||
description: 'NetworkAttachmentDefinition spec defines the desired state of a network attachment'
|
||||
type: object
|
||||
properties:
|
||||
config:
|
||||
description: 'NetworkAttachmentDefinition config is a JSON-formatted CNI configuration'
|
||||
type: string
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: multus
|
||||
namespace: kube-system
|
||||
3
kubespray/roles/network_plugin/multus/meta/main.yml
Normal file
3
kubespray/roles/network_plugin/multus/meta/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
dependencies:
|
||||
- role: network_plugin/cni
|
||||
21
kubespray/roles/network_plugin/multus/tasks/main.yml
Normal file
21
kubespray/roles/network_plugin/multus/tasks/main.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
- name: Multus | Copy manifest files
|
||||
copy:
|
||||
src: "{{ item.file }}"
|
||||
dest: "{{ kube_config_dir }}"
|
||||
mode: 0644
|
||||
with_items:
|
||||
- {name: multus-crd, file: multus-crd.yml, type: customresourcedefinition}
|
||||
- {name: multus-serviceaccount, file: multus-serviceaccount.yml, type: serviceaccount}
|
||||
- {name: multus-clusterrole, file: multus-clusterrole.yml, type: clusterrole}
|
||||
- {name: multus-clusterrolebinding, file: multus-clusterrolebinding.yml, type: clusterrolebinding}
|
||||
register: multus_manifest_1
|
||||
|
||||
- name: Multus | Copy manifest templates
|
||||
template:
|
||||
src: "{{ item.file }}.j2"
|
||||
dest: "{{ kube_config_dir }}/{{ item.file }}"
|
||||
mode: 0644
|
||||
with_items:
|
||||
- {name: multus-daemonset, file: multus-daemonset.yml, type: daemonset}
|
||||
register: multus_manifest_2
|
||||
@@ -0,0 +1,71 @@
|
||||
---
|
||||
kind: DaemonSet
|
||||
apiVersion: apps/v1
|
||||
metadata:
|
||||
name: kube-multus-ds-{{ image_arch }}
|
||||
namespace: kube-system
|
||||
labels:
|
||||
tier: node
|
||||
app: multus
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
tier: node
|
||||
app: multus
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
tier: node
|
||||
app: multus
|
||||
spec:
|
||||
hostNetwork: true
|
||||
dnsPolicy: ClusterFirstWithHostNet
|
||||
nodeSelector:
|
||||
kubernetes.io/arch: {{ image_arch }}
|
||||
tolerations:
|
||||
- operator: Exists
|
||||
serviceAccountName: multus
|
||||
containers:
|
||||
- name: kube-multus
|
||||
image: {{ multus_image_repo }}:{{ multus_image_tag }}
|
||||
command: ["/entrypoint.sh"]
|
||||
args:
|
||||
- "--cni-conf-dir={{ multus_cni_conf_dir }}"
|
||||
- "--cni-bin-dir={{ multus_cni_bin_dir }}"
|
||||
- "--multus-conf-file={{ multus_conf_file }}"
|
||||
- "--multus-kubeconfig-file-host={{ multus_kubeconfig_file_host }}"
|
||||
- "--cni-version={{ multus_cni_version }}"
|
||||
resources:
|
||||
requests:
|
||||
cpu: "100m"
|
||||
memory: "90Mi"
|
||||
limits:
|
||||
cpu: "100m"
|
||||
memory: "90Mi"
|
||||
securityContext:
|
||||
privileged: true
|
||||
{% if container_manager == 'crio' %}
|
||||
capabilities:
|
||||
add: ["SYS_ADMIN"]
|
||||
{% endif %}
|
||||
volumeMounts:
|
||||
{% if container_manager == 'crio' %}
|
||||
- name: run
|
||||
mountPath: {{ multus_cni_run_dir }}
|
||||
{% endif %}
|
||||
- name: cni
|
||||
mountPath: {{ multus_cni_conf_dir }}
|
||||
- name: cnibin
|
||||
mountPath: {{ multus_cni_bin_dir }}
|
||||
volumes:
|
||||
{% if container_manager == 'crio' %}
|
||||
- name: run
|
||||
hostPath:
|
||||
path: {{ multus_cni_run_dir_host }}
|
||||
{% endif %}
|
||||
- name: cni
|
||||
hostPath:
|
||||
path: {{ multus_cni_conf_dir_host }}
|
||||
- name: cnibin
|
||||
hostPath:
|
||||
path: {{ multus_cni_bin_dir_host }}
|
||||
Reference in New Issue
Block a user