Skip to content

Commit

Permalink
rdma tools chart
Browse files Browse the repository at this point in the history
  • Loading branch information
weizhoublue committed Jul 17, 2024
1 parent fd1835b commit 553c3aa
Show file tree
Hide file tree
Showing 9 changed files with 307 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/ChartRdma.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Chart Rdma Tools

env:
CHART_PATH: rdma-tools/chart

on:
workflow_dispatch:
inputs:
ref:
description: 'tag, sha, branch'
required: true
default: main
push:
tags:
- rdma-tools-v[0-9]+.[0-9]+.[0-9]+

permissions: write-all

jobs:
get_info:
runs-on: ubuntu-latest
outputs:
chart_path: ${{ env.chart_path }}
code_sha: ${{ env.code_sha }}
steps:
- name: Get information
id: get_original_ref
run: |
echo '${{ toJSON(github) }}'
if ${{ github.event_name == 'workflow_dispatch' }}; then
echo "call by workflow_dispatch"
echo "code_sha=${{ github.event.inputs.ref }}" >> $GITHUB_ENV
echo "chart_path=${{ env.CHART_PATH }}" >> $GITHUB_ENV
elif ${{ github.event_name == 'push' }} ; then
echo "call by push tag"
echo "code_sha=${GITHUB_REF##*/}" >> $GITHUB_ENV
echo "chart_path=${{ env.CHART_PATH }}" >> $GITHUB_ENV
else
exit 1
fi
call-workflow:
needs: [get_info]
uses: ./.github/workflows/callBuildChart.yaml
with:
code_sha: ${{ needs.get_info.outputs.code_sha }}
chart_path: ${{ needs.get_info.outputs.chart_path }}
secrets: inherit
2 changes: 2 additions & 0 deletions ofed-driver/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ for example:
```shell
helm repo add spiderchart https://spidernet-io.github.io/charts
helm repo update
helm search repo ofed-driver

helm install spiderchart/ofed-driver ofed-driver -n kube-system \
--set image.OSName="ubuntu" \
--set image.OSVer="22.04" \
Expand Down
40 changes: 40 additions & 0 deletions rdma-tools/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,43 @@ images including kinds of RDMA tools for debugging
git tag rdma-tools-vXX.YY.ZZ
git push --tags
```

```shell
helm repo add spiderchart https://spidernet-io.github.io/charts
helm repo update
helm search repo rdma-tools

# run daemonset on worker1 and worker2
cat <<EOF > values.yaml
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- worker1
- worker2
# sriov interfaces
extraAnnotations:
v1.multus-cni.io/default-network: spiderpool/calico
k8s.v1.cni.cncf.io/networks: |
'[{"name":"gpu1-sriov","namespace":"spiderpool"},
{"name":"gpu2-sriov","namespace":"spiderpool"}]'
# sriov resource
resources:
limits:
spidernet.io/gpu1sriov: 1
spidernet.io/gpu2sriov: 1
#securityContext:
# capabilities:
# add: [ "IPC_LOCK" ]
EOF

helm install spiderchart/rdma-tools rdma-tools -f ./values.yaml

```
23 changes: 23 additions & 0 deletions rdma-tools/chart/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
19 changes: 19 additions & 0 deletions rdma-tools/chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v2
name: rdma-tools
home: "https://spidernet-io.github.io/charts"
#icon:
# application or library
type: application
# no need to modify this version , CI will auto update it with /VERSION
version: 0.1.0
# This field is informational, and has no impact on chart version calculations .
# Leaving it unquoted can lead to parsing issues in some cases
# no need to modify this version , CI will auto update it with /VERSION
appVersion: "0.1.0"
kubeVersion: ">= 1.16.0-0"
description: rdma test
sources:
- "https://spidernet-io.github.io/charts"
keywords:
- rdma
- networking
3 changes: 3 additions & 0 deletions rdma-tools/chart/README.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# rdma tools

test rdma networks
33 changes: 33 additions & 0 deletions rdma-tools/chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Renders a value that contains template.
Usage:
{{ include "tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
*/}}
{{- define "tplvalues.render" -}}
{{- if typeIs "string" .value }}
{{- tpl .value .context }}
{{- else }}
{{- tpl (.value | toYaml) .context }}
{{- end }}
{{- end -}}


{{/*
return the image
*/}}
{{- define "project.image" -}}
{{- $registryName := .Values.image.registry -}}
{{- $repositoryName := .Values.image.repository -}}
{{ if $registryName }}
{{- printf "%s/%s" $registryName $repositoryName -}}
{{- else -}}
{{- printf "%s" $repositoryName -}}
{{- end -}}
{{- if .Values.image.tag -}}
{{- printf ":%s" .Values.image.tag -}}
{{- else -}}
{{- printf ":v%s" .Chart.AppVersion -}}
{{- end -}}
{{- end -}}

94 changes: 94 additions & 0 deletions rdma-tools/chart/templates/daemonset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ .Values.name | trunc 63 | trimSuffix "-" }}
namespace: {{ .Release.Namespace }}
labels:
app: {{ .Values.name | trunc 63 | trimSuffix "-" }}
spec:
selector:
matchLabels:
app: {{ .Values.name | trunc 63 | trimSuffix "-" }}
updateStrategy:
type: OnDelete
template:
metadata:
labels:
app: {{ .Values.name | trunc 63 | trimSuffix "-" }}
{{- if .Values.extraAnnotations }}
annotations:
{{- include "tplvalues.render" ( dict "value" .Values.extraAnnotations "context" $ ) | nindent 8 }}
{{- end }}
spec:
{{- if .Values.image.imagePullSecrets }}
imagePullSecrets:
{{- with .Values.image.imagePullSecrets }}
{{- toYaml . | trim | nindent 6 }}
{{- end }}
{{- end }}
{{- if .Values.hostnetwork }}
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
{{- else }}
hostNetwork: false
dnsPolicy: ClusterFirst
{{- end }}
restartPolicy: Always
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.affinity }}
affinity:
{{- include "tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 6 }}
{{- end }}
containers:
- name: {{ .Values.name | trunc 63 | trimSuffix "-" }}
image: {{ include "project.image" . | quote }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.resources }}
resources:
{{- toYaml . | trim | nindent 12 }}
{{- end }}
{{- if .Values.securityContext }}
securityContext:
{{- with .Values.securityContext }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- end }}
env:
- name: ENV_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: ENV_LOCAL_NODE_IP
valueFrom:
fieldRef:
fieldPath: status.hostIP
- name: ENV_LOCAL_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: ENV_POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- with .Values.extraEnv }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.extraVolumes }}
volumeMounts:
{{- if .Values.extraVolumes }}
{{- include "tplvalues.render" ( dict "value" .Values.extraVolumeMounts "context" $ ) | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.extraVolumes }}
volumes:
{{- if .Values.extraVolumeMounts }}
{{- include "tplvalues.render" ( dict "value" .Values.extraVolumeMounts "context" $ ) | nindent 6 }}
{{- end }}
{{- end }}
45 changes: 45 additions & 0 deletions rdma-tools/chart/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: rdma-test

image:
registry: ghcr.io
repository: spidernet-io/rdma-tools
tag: ""

pullPolicy: IfNotPresent
imagePullSecrets: []

hostnetwork: false
tolerations: []

nodeSelector:
kubernetes.io/os: linux

affinity: {}

resources:
#limits:
# spidernet.io/gpu1sriov: 1
requests:
cpu: 200m
memory: 150Mi

extraAnnotations:
#v1.multus-cni.io/default-network: spiderpool/calico
#k8s.v1.cni.cncf.io/networks: |
# '[{"name":"gpu1-sriov","namespace":"spiderpool"},
# {"name":"gpu2-sriov","namespace":"spiderpool"},
# {"name":"gpu8-sriov","namespace":"spiderpool"}]'

securityContext:
#capabilities:
# add: [ "IPC_LOCK" ]

extraEnv: []

extraVolumes: []
# - name: test-val
# mountPath: /host/tmp

extraVolumeMounts: []
# - name: test-val
# mountPath: /tmp

0 comments on commit 553c3aa

Please sign in to comment.