Skip to content

Commit

Permalink
SRIOV support for helm charts
Browse files Browse the repository at this point in the history
Change-Id: I5a1cba46f3d161824d618e8d0bf01e9e8315b541
Depends-On: Id6dc555ba91531f49ba69f7019093a8ce515158e
Depends-On: Idcabbbcf4b9eecb21ab24d93f3ca84137c5a12b6
Closes-bug: #1767470
(cherry picked from commit 5909056)
  • Loading branch information
madhukar32 authored and mnayakbomman@juniper.net committed Jul 31, 2018
1 parent 3e273d0 commit e98d4a6
Show file tree
Hide file tree
Showing 7 changed files with 415 additions and 59 deletions.
22 changes: 22 additions & 0 deletions contrail-vrouter/templates/configmap-env.yaml
Expand Up @@ -39,6 +39,28 @@ data:
{{- end }}
{{- end }}

{{- if .Values.manifests.configmap_vrouter_sriov }}
{{- $_ := required ".Values.global.contrail_env_vrouter_sriov.per_compute_info must be specified" .Values.global.contrail_env_vrouter_sriov.per_compute_info }}
{{- $common_sriov_vars := .Values.global.contrail_env_vrouter_sriov }}
{{- $per_compute_info := .Values.global.contrail_env_vrouter_sriov.per_compute_info }}
{{- range $_, $compute_vars := $per_compute_info }}
{{- $compute_name := index $compute_vars "node_name" }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: contrail-vrouter-sriov-{{ $compute_name }}
data:
{{- range $key, $value := $compute_vars }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- range $key, $value := $common_sriov_vars }}
{{ if ne $key "per_compute_info" }}{{ $key }}: {{ $value | quote }}{{ end }}
{{- end }}
{{- end }}
{{- end }}


{{- if .Values.manifests.configmap_vrouter_keystone }}
---
apiVersion: v1
Expand Down
Expand Up @@ -71,7 +71,7 @@ spec:
name: lib-modules
- mountPath: /host/bin
name: host-bin
{{- else if $host_os "centos" }}
{{- else if eq $host_os "centos" }}
- name: contrail-vrouter-init-kernel
image: {{ .Values.global.images.tags.vrouter_init_kernel | quote }}
imagePullPolicy: {{ default "" .Values.global.images.imagePullPolicy | quote }}
Expand Down
277 changes: 277 additions & 0 deletions contrail-vrouter/templates/daemonset-vrouter-agent-sriov.yaml
@@ -0,0 +1,277 @@
{{- define "contrail.sriov.daemonset" }}
{{- $daemonset_name := index . 0 }}
{{- $config_map_name := index . 1 }}
{{- $compute_name := index . 2 }}
{{- $sriov_env := index . 3 }}
{{- $context := index . 4 }}
{{- $agent_mode := $sriov_env.AGENT_MODE | default "kernel" }}

{{- $_ := set $context.Values "images" $context.Values.global.images }}
# host_os is a mandatory field
{{- $_ := required ".Values.global.node.host_os must be specified, valid values are ubuntu, centos" $context.Values.global.node.host_os }}
{{- $host_os := $context.Values.global.node.host_os }}
---
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: {{ $daemonset_name }}
spec:
{{ tuple $context "vrouter_agent_sriov" | include "helm-toolkit.snippets.kubernetes_upgrades_daemonset" | indent 2 }}
template:
metadata:
labels:
{{ tuple $context "opencontrail" "contrail-vrouter-agent-sriov" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
annotations:
configmap-hash: {{ tuple "configmap-env.yaml" $context | include "helm-toolkit.utils.hash" }}
spec:
#Disable affinity for single node setup
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: {{ $context.Values.labels.vrouter_agent_sriov.node_selector_key }}
operator: In
values:
- {{ $context.Values.labels.vrouter_agent_sriov.node_selector_value }}
- key: "kubernetes.io/hostname"
operator: In
values:
- {{ $compute_name }}
#Enable tolerations for single node setup
tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
imagePullSecrets:
- name: contrail-vrouter-docker-secret
initContainers:
{{ tuple $context $context.Values.dependencies.vrouter_agent_sriov nil | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
- name: contrail-node-init
image: {{ $context.Values.global.images.tags.node_init | quote }}
imagePullPolicy: {{ default "" $context.Values.global.images.imagePullPolicy | quote }}
securityContext:
privileged: true
env:
- name: CONTRAIL_STATUS_IMAGE
value: {{ $context.Values.global.images.tags.contrail_status | quote }}
envFrom:
- configMapRef:
name: {{ $config_map_name }}
volumeMounts:
- mountPath: /host/usr/bin
name: host-usr-bin
{{- if and $agent_mode ( eq $agent_mode "kernel" ) }}
{{- if eq $host_os "ubuntu"}}
- name: contrail-vrouter-init-kernel
image: {{ $context.Values.global.images.tags.build_driver_init | quote }}
imagePullPolicy: {{ default "" $context.Values.global.images.imagePullPolicy | quote }}
securityContext:
privileged: true
envFrom:
- configMapRef:
name: contrail-vrouter-kernel
- configMapRef:
name: contrail-vrouter-keystone
volumeMounts:
- mountPath: /usr/src
name: usr-src
- mountPath: /lib/modules
name: lib-modules
- mountPath: /host/bin
name: host-bin
{{- else if $host_os "centos" }}
- name: contrail-vrouter-init-kernel
image: {{ $context.Values.global.images.tags.vrouter_init_kernel | quote }}
imagePullPolicy: {{ default "" $context.Values.global.images.imagePullPolicy | quote }}
securityContext:
privileged: true
envFrom:
- configMapRef:
name: configmap-vrouter
- configMapRef:
name: contrail-vrouter-keystone
volumeMounts:
- mountPath: /lib/modules
name: lib-modules
- mountPath: /etc/sysconfig/network-scripts
name: network-scripts
- mountPath: /host/bin
name: host-bin
{{- end }}
{{- else if and $agent_mode ( eq $agent_mode "dpdk" ) }}
- name: contrail-vrouter-init-dpdk
image: {{ $context.Values.global.images.tags.vrouter_init_dpdk | quote }}
imagePullPolicy: {{ default "" $context.Values.global.images.imagePullPolicy | quote }}
securityContext:
privileged: true
envFrom:
- configMapRef:
name: contrail-vrouter-dpdk
- configMapRef:
name: contrail-vrouter-keystone
volumeMounts:
- mountPath: /lib/modules
name: lib-modules
- mountPath: /var/run
name: var-run
- mountPath: /etc/os-release
name: os-release
- mountPath: /etc/lsb-release
name: lsb-release
- mountPath: /dev/hugepages
name: hugepages
{{- end }}
containers:
{{- if and $agent_mode ( eq $agent_mode "dpdk" ) }}
- name: contrail-vrouter-dpdk
image: {{ $context.Values.global.images.tags.vrouter_dpdk | quote }}
imagePullPolicy: {{ default "" $context.Values.global.images.imagePullPolicy | quote }}
securityContext:
privileged: true
envFrom:
- configMapRef:
name: contrail-vrouter-dpdk
- configMapRef:
name: contrail-vrouter-keystone
volumeMounts:
- mountPath: /etc/
name: mount-etc
- mountPath: /lib/modules
name: lib-modules
- mountPath: /var/run
name: var-run
- mountPath: /var/lib/contrail
name: var-lib-contrail
- mountPath: /var/log/contrail
name: contrail-log
- mountPath: /etc/os-release
name: os-release
- mountPath: /etc/lsb-release
name: lsb-release
- mountPath: /dev
name: host-dev
- mountPath: /var/crashes
name: var-crashes-vrouter
{{- end }}
- name: contrail-vrouter-agent
image: {{ $context.Values.global.images.tags.vrouter_agent | quote }}
imagePullPolicy: {{ default "" $context.Values.global.images.imagePullPolicy | quote }}
securityContext:
privileged: true
envFrom:
- configMapRef:
name: {{ $config_map_name }}
- configMapRef:
name: contrail-vrouter-keystone
volumeMounts:
{{- if eq $host_os "centos"}}
- mountPath: /etc/sysconfig/network-scripts
name: network-scripts
{{- end }}
- mountPath: /lib/modules
name: lib-modules
- mountPath: /var/lib/contrail/
name: var-lib-contrail
- mountPath: /var/log/contrail/
name: contrail-log
- mountPath: /var/crashes
name: var-crashes-vrouter
- mountPath: /host/bin
name: host-bin
- mountPath: /dev/log
name: host-dev-log
- mountPath: /var/run/libvirt
name: var-run-libvirt
- mountPath: /etc/contrail/ssl
name: ssl-dir
- name: contrail-vrouter-nodemgr
image: {{ $context.Values.global.images.tags.nodemgr | quote }}
imagePullPolicy: {{ default "" $context.Values.global.images.imagePullPolicy | quote }}
envFrom:
- configMapRef:
name: {{ $config_map_name }}
- configMapRef:
name: contrail-vrouter-keystone
env:
- name: NODE_TYPE
value: vrouter
- name: DOCKER_HOST
value: "unix://mnt/docker.sock"
volumeMounts:
- mountPath: /mnt/docker.sock
name: docker-unix-socket
- mountPath: /var/log/contrail/
name: contrail-log
- mountPath: /var/crashes
name: var-crashes-vrouter
- mountPath: /etc/contrail/ssl
name: ssl-dir
volumes:
{{- if eq $host_os "ubuntu"}}
- name: usr-src
hostPath:
path: /usr/src
{{- else if $host_os "centos" }}
- name: network-scripts
hostPath:
path: /etc/sysconfig/network-scripts
{{- end }}
- name: lib-modules
hostPath:
path: /lib/modules
- name: docker-unix-socket
hostPath:
path: /var/run/docker.sock
type: Socket
- name: os-release
hostPath:
path: /usr/lib/os-release
- name: lsb-release
hostPath:
path: /etc/lsb-release
- name: hugepages
hostPath:
path: /dev/hugepages
- name: var-run
hostPath:
path: /var/run/
- name: var-lib-contrail
hostPath:
path: /var/lib/contrail/
- name: contrail-log
hostPath:
path: /var/log/contrail
- name: var-crashes-vrouter
hostPath:
path: /var/crashes
- name: host-bin
hostPath:
path: /bin
- name: var-run-libvirt
hostPath:
path: /var/run/libvirt
- name: host-usr-bin
hostPath:
path: /usr/bin
- name: host-dev-log
hostPath:
path: /dev/log
- name: ssl-dir
hostPath:
path: /etc/contrail/ssl
{{- end }}

{{- if .Values.manifests.daemonset_vrouter_sriov }}
{{- $_ := required ".Values.global.contrail_env_vrouter_sriov.per_compute_info must be specified" .Values.global.contrail_env_vrouter_sriov.per_compute_info }}
{{- $context := . }}
{{- range $_, $compute_vars := .Values.global.contrail_env_vrouter_sriov.per_compute_info }}
{{- $compute_name := index $compute_vars "node_name" }}
{{- $sriov_env := omit $compute_vars "node_name" }}
{{- $daemonset_name := printf "contrail-vrouter-agent-sriov-%s" $compute_name }}
{{- $config_map_name := printf "contrail-vrouter-sriov-%s" $compute_name }}
{{- list $daemonset_name $config_map_name $compute_name $sriov_env $context | include "contrail.sriov.daemonset" }}
{{- end }}
{{- end }}
21 changes: 21 additions & 0 deletions contrail-vrouter/values.yaml
Expand Up @@ -37,6 +37,14 @@ global:
contrail_env_vrouter_dpdk:
AGENT_MODE: dpdk

contrail_env_vrouter_sriov:
SRIOV: true
#per_compute_info:
# - node_name: k8snode1
# SRIOV_VF: 10
# SRIOV_PHYSICAL_INTERFACE: enp129s0f1
# SRIOV_PHYS_NET: physnet1

node:
host_os: ubuntu

Expand All @@ -47,6 +55,9 @@ labels:
vrouter_agent_dpdk:
node_selector_key: "opencontrail.org/vrouter-dpdk"
node_selector_value: "enabled"
vrouter_agent_sriov:
node_selector_key: "vrouter-sriov"
node_selector_value: "enabled"

dependencies:
vrouter_agent_kernel:
Expand All @@ -57,6 +68,10 @@ dependencies:
daemonset:
- contrail-config
- contrail-control
vrouter_agent_sriov:
daemonset:
- contrail-config
- contrail-control

# typically overriden by environmental
# values, but should include all endpoints
Expand Down Expand Up @@ -99,10 +114,16 @@ pod:
enabled: true
min_ready_seconds: 0
max_unavailable: 1
vrouter_agent_sriov:
enabled: true
min_ready_seconds: 0
max_unavailable: 1

manifests:
configmap_vrouter_kernel: true
configmap_vrouter_keystone: true
configmap_vrouter_dpdk: false
configmap_vrouter_sriov: false
daemonset_kernel: true
daemonset_dpdk: false
daemonset_vrouter_sriov: false

0 comments on commit e98d4a6

Please sign in to comment.