Skip to content

Commit

Permalink
initial commit for updated device plugin chart
Browse files Browse the repository at this point in the history
  • Loading branch information
jdambly-ns committed Oct 2, 2024
1 parent 14342a1 commit 6f18644
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 241 deletions.
31 changes: 0 additions & 31 deletions sriov/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,37 +1,6 @@
======
{{- if or ( gt .Capabilities.KubeVersion.Major "1" ) ( ge .Capabilities.KubeVersion.Minor "16" ) }}
1. The following components have been deployed as part of this helm chart:
{{- if .Values.manifests.serviceAccount }}
Service Account: {{ .Values.serviceAccount.name }}
{{- end }}
{{- if .Values.manifests.configMap_sriov_device_plugin }}
Config Map: {{ .Release.Name }}-{{ .Chart.Name }}-{{ .Chart.Version }}-config
{{- end }}
{{- if .Values.manifests.daemonSet_sriov_device_plugin }}
Daemon Set: {{ .Release.Name }}-{{ .Chart.Name }}-device-plugin-ds
{{- end }}
{{- if .Values.manifests.daemonSet_sriov_cni }}
Daemon Set: {{ .Release.Name }}-{{ .Chart.Name }}-cni-ds
{{- end }}
{{- if .Values.manifests.net_attach_def_netdev }}
Network Attachment Definition for NetDevice: {{ .Values.config.netAttachDef.netdeviceName }}
{{- end }}
{{- if .Values.manifests.net_attach_def_dpdk }}
Network Attachment Definition for DPDK: {{ .Values.config.netAttachDef.dpdkName }}
{{- end }}
{{- if .Values.manifests.test_netdevice }}
Example pod with nedevice interface: {{ .Release.Name }}-test-netdevice
{{- end }}
{{- if .Values.manifests.test_dpdk }}
Example pod with dpdk interface: {{ .Release.Name }}-test-dpdk
{{- end }}

You can now create more Network Attachment Definitions or test SRIOV pods using Network Attachment Defintions as mentioned above.
---------

2. To uninstall helm chart use the command:
helm delete {{ .Release.Name }}
---------
{{- else }}
To run these charts, please use K8s ver >= v1.16
{{- end }}
11 changes: 0 additions & 11 deletions sriov/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,3 @@ app: {{ .Chart.Name }}-dp
name: {{ .Values.serviceAccount.name }}
{{- end }}

{{/* Generate SRIOV tolerations */}}
{{- define "sriov.tolerations" }}
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
{{- if index .Values "tolerations" }}
{{- if gt (len .Values.tolerations) 0 }}
{{ toYaml .Values.tolerations }}
{{- end }}
{{- end }}
{{- end }}
4 changes: 1 addition & 3 deletions sriov/templates/configMap_sriov_device_plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
{{- if or ( gt .Capabilities.KubeVersion.Major "1" ) ( ge .Capabilities.KubeVersion.Minor "16" ) }}
{{- if .Values.manifests.configMap_sriov_device_plugin }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}-{{ .Chart.Version }}-config
namespace: kube-system
data:
dp-conf.json: |-
{{ toJson .Values.config.sriov_device_plugin | indent 4 }}
{{- end }}
{{ toJson .Values.config.sriov_device_plugin | indent 4 }}
{{- end }}
30 changes: 20 additions & 10 deletions sriov/templates/daemonSet_sriov_cni.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,52 @@
# See the License for the specific language governing permissions and
# limitations under the License.
{{- if or ( gt .Capabilities.KubeVersion.Major "1" ) ( ge .Capabilities.KubeVersion.Minor "16" ) }}
{{- if .Values.manifests.daemonSet_sriov_cni }}
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}-cni-ds
namespace: kube-system
labels:
{{- include "sriov-cni.labels" . | indent 4 }}
{{- include "sriov-cni.labels" . | nindent 4 }}
spec:
selector:
matchLabels:
{{- include "sriov-cni.labels" . | indent 6 }}
{{- include "sriov-cni.labels" . | nindent 6 }}
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
template:
metadata:
labels:
{{- include "sriov-cni.labels" . | indent 8 }}
{{- include "sriov-cni.labels" . | nindent 8 }}
spec:
hostNetwork: true
nodeSelector: {{- toYaml .Values.labels.nodeSelector | nindent 8 }}
priorityClassName: system-node-critical
{{- with .Values.nodeSelector}}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- include "sriov.tolerations" . | indent 6 }}
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ .Values.serviceAccount.name }}
containers:
- name: kube-{{ .Chart.Name }}-cni
image: {{ .Values.images.sriovCni.repository }}:{{ .Values.images.sriovCni.tag }}
imagePullPolicy: {{ .Values.images.pullPolicy }}
{{- with .Values.securityContext}}
securityContext:
privileged: {{ .Values.securityContext.privileged }}
{{- if .Values.pod.resources.enabled }}
resources: {{- toYaml .Values.pod.resources.sriov_cni | nindent 10 }}
{{- toYaml . | nindent 10 }}
{{- end }}
resources:
requests:
memory: "50Mi"
cpu: "100m"
limits:
memory: "50Mi"
cpu: "100m"
volumeMounts:
- name: cnibin
mountPath: {{ .Values.config.scMountPaths.cnibin }}
Expand All @@ -55,4 +66,3 @@ spec:
hostPath:
path: /opt/cni/bin
{{- end }}
{{- end }}
28 changes: 17 additions & 11 deletions sriov/templates/daemonSet_sriov_device_plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
{{- if or ( gt .Capabilities.KubeVersion.Major "1" ) ( ge .Capabilities.KubeVersion.Minor "16" ) }}
{{- if .Values.manifests.daemonSet_sriov_device_plugin }}
apiVersion: apps/v1
kind: DaemonSet
metadata:
Expand All @@ -23,35 +22,43 @@ metadata:
spec:
selector:
matchLabels:
{{- include "sriov-dp.serviceAccount.Name" . | indent 6 }}
{{- include "sriov-dp.labels" . | indent 6 }}
{{- include "sriov-dp.serviceAccount.Name" . | indent 6 }}
{{- include "sriov-dp.labels" . | indent 6 }}
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
template:
metadata:
labels:
{{- include "sriov-dp.serviceAccount.Name" . | indent 8 }}
{{- include "sriov-dp.labels" . | indent 8 }}
{{- include "sriov-dp.serviceAccount.Name" . | indent 8 }}
{{- include "sriov-dp.labels" . | indent 8 }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configMap_sriov_device_plugin.yaml") . | sha256sum }}
spec:
priorityClassName: system-node-critical
hostNetwork: true
nodeSelector: {{- toYaml .Values.labels.nodeSelector | nindent 8 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- include "sriov.tolerations" . | indent 6 }}
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ .Values.serviceAccount.name }}
containers:
- name: kube-{{ .Chart.Name }}-dp
image: {{ .Values.images.sriovDevicePlugin.repository }}:{{ .Values.images.sriovDevicePlugin.tag }}
imagePullPolicy: {{ .Values.images.pullPolicy }}
{{- with .Values.args}}
args:
- --log-dir=sriovdp
- --log-level=10
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.securityContext }}
securityContext:
privileged: {{ .Values.securityContext.privileged }}
{{- toYaml . | nindent 10 }}
{{- end }}
volumeMounts:
- name: devicesock
mountPath: {{ .Values.config.sdpMountPaths.deviceSock }}
Expand All @@ -72,4 +79,3 @@ spec:
configMap:
name: {{ .Release.Name }}-{{ .Chart.Name }}-{{ .Chart.Version }}-config
{{- end }}
{{- end }}
26 changes: 0 additions & 26 deletions sriov/templates/net_attach_def_dpdk.yaml

This file was deleted.

26 changes: 0 additions & 26 deletions sriov/templates/net_attach_def_netdev.yaml

This file was deleted.

Loading

0 comments on commit 6f18644

Please sign in to comment.