Add DBUF helm chart
- Support the SR-IOV (Static IP first)
https://jira.opennetworking.org/browse/AETHER-803
- Fix docker image and dbuf args
Change-Id: I2942c6a7816c8a747203113d58576d677fc1da03
diff --git a/apps/dbuf/.helmignore b/apps/dbuf/.helmignore
new file mode 100644
index 0000000..c687fff
--- /dev/null
+++ b/apps/dbuf/.helmignore
@@ -0,0 +1,26 @@
+# Copyright 2021-present Open Networking Foundation
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+# 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/
diff --git a/apps/dbuf/Chart.yaml b/apps/dbuf/Chart.yaml
new file mode 100644
index 0000000..9514e8e
--- /dev/null
+++ b/apps/dbuf/Chart.yaml
@@ -0,0 +1,26 @@
+# Copyright 2021-present Open Networking Foundation
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+apiVersion: v1
+name: dbuf
+description: A Helm chart deploying DBUF
+
+# A chart can be either an 'application' or a 'library' chart.
+#
+# Application charts are a collection of templates that can be packaged into versioned archives
+# to be deployed.
+#
+# Library charts provide useful utilities or functions for the chart developer. They're included as
+# a dependency of application charts to inject those utilities and functions into the rendering
+# pipeline. Library charts do not define any templates and therefore cannot be deployed.
+type: application
+
+# This is the chart version. This version number should be incremented each time you make changes
+# to the chart and its templates, including the app version.
+# Versions are expected to follow Semantic Versioning (https://semver.org/)
+version: 0.1.0
+
+# This is the version number of the application being deployed. This version number should be
+# incremented each time you make changes to the application. Versions are not expected to
+# follow Semantic Versioning. They should reflect the version the application is using.
+appVersion: 0.1.0
diff --git a/apps/dbuf/templates/NOTES.txt b/apps/dbuf/templates/NOTES.txt
new file mode 100644
index 0000000..55b688c
--- /dev/null
+++ b/apps/dbuf/templates/NOTES.txt
@@ -0,0 +1,10 @@
+{{/*
+Copyright 2020-present Open Networking Foundation
+SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+*/}}
+
+Thank you for installing {{ .Chart.Name }}.
+
+Your release is named {{ .Release.Name }}.
+
+This chart deploys DBUF.
\ No newline at end of file
diff --git a/apps/dbuf/templates/_helpers.tpl b/apps/dbuf/templates/_helpers.tpl
new file mode 100644
index 0000000..b8b672a
--- /dev/null
+++ b/apps/dbuf/templates/_helpers.tpl
@@ -0,0 +1,71 @@
+{{/*
+Copyright 2020-present Open Networking Foundation
+SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+*/}}
+
+{{- define "extraParams" -}}
+{{- join "," . -}}
+{{- end -}}
+
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "dbuf.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
+{{- end }}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "dbuf.fullname" -}}
+{{- if .Values.fullnameOverride }}
+{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
+{{- else }}
+{{- $name := default .Chart.Name .Values.nameOverride }}
+{{- if contains $name .Release.Name }}
+{{- .Release.Name | trunc 63 | trimSuffix "-" }}
+{{- else }}
+{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
+{{- end }}
+{{- end }}
+{{- end }}
+
+{{/*
+Create chart name and version as used by the chart label.
+*/}}
+{{- define "dbuf.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
+{{- end }}
+
+{{/*
+Common labels
+*/}}
+{{- define "dbuf.labels" -}}
+helm.sh/chart: {{ include "dbuf.chart" . }}
+{{ include "dbuf.selectorLabels" . }}
+{{- if .Chart.AppVersion }}
+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
+{{- end }}
+app.kubernetes.io/managed-by: {{ .Release.Service }}
+{{- end }}
+
+{{/*
+Selector labels
+*/}}
+{{- define "dbuf.selectorLabels" -}}
+app.kubernetes.io/name: {{ include "dbuf.name" . }}
+app.kubernetes.io/instance: {{ .Release.Name }}
+{{- end }}
+
+{{/*
+Create the name of the service account to use
+*/}}
+{{- define "dbuf.serviceAccountName" -}}
+{{- if .Values.serviceAccount.create }}
+{{- default (include "dbuf.fullname" .) .Values.serviceAccount.name }}
+{{- else }}
+{{- default "default" .Values.serviceAccount.name }}
+{{- end }}
+{{- end }}
diff --git a/apps/dbuf/templates/deployment.yaml b/apps/dbuf/templates/deployment.yaml
new file mode 100644
index 0000000..3c8ef5e
--- /dev/null
+++ b/apps/dbuf/templates/deployment.yaml
@@ -0,0 +1,61 @@
+
+# Copyright 2020-present Open Networking Foundation
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: {{ include "dbuf.fullname" . }}
+ labels:
+ {{- include "dbuf.labels" . | nindent 4 }}
+spec:
+ replicas: {{ .Values.replicaCount }}
+ selector:
+ matchLabels:
+ {{- include "dbuf.selectorLabels" . | nindent 6 }}
+ template:
+ metadata:
+ {{- with .Values.podAnnotations }}
+ annotations:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ labels:
+ {{- include "dbuf.selectorLabels" . | nindent 8 }}
+ spec:
+ {{- if .Values.image.credentials }}
+ imagePullSecrets:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ securityContext:
+ {{- toYaml .Values.podSecurityContext | nindent 8 }}
+ containers:
+ - name: {{ .Chart.Name }}
+ securityContext:
+ {{- toYaml .Values.securityContext | nindent 12 }}
+ image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
+ imagePullPolicy: {{ .Values.image.pullPolicy }}
+ command: [ "dbuf", {{ template "extraParams" .Values.extraParams }} ]
+ resources:
+ requests:
+ intel.com/{{ .Values.sriovResourceName }}: '{{ .Values.sriovNICSize }}'
+ limits:
+ intel.com/{{ .Values.sriovResourceName }}: '{{ .Values.sriovNICSize }}'
+ ports:
+ - name: grpc
+ containerPort: 10000
+ protocol: TCP
+ - name: stats
+ containerPort: 8080
+ protocol: TCP
+ {{- with .Values.nodeSelector }}
+ nodeSelector:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ {{- with .Values.affinity }}
+ affinity:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ {{- with .Values.tolerations }}
+ tolerations:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
diff --git a/apps/dbuf/templates/networks.yaml b/apps/dbuf/templates/networks.yaml
new file mode 100644
index 0000000..0ab4521
--- /dev/null
+++ b/apps/dbuf/templates/networks.yaml
@@ -0,0 +1,25 @@
+{{/*
+# Copyright 2020-present Open Networking Foundation
+
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+*/}}
+
+apiVersion: "k8s.cni.cncf.io/v1"
+kind: NetworkAttachmentDefinition
+metadata:
+ name: {{ .Values.multusNetworkName }}
+ annotations:
+ k8s.v1.cni.cncf.io/resourceName: intel.com/{{ .Values.sriovResourceName }}
+spec:
+ config: '{
+ "type": "sriov",
+ "name": "sriov-network",
+ "ipam": {
+ "type": "host-local",
+ "subnet": "10.56.217.0/24",
+ "routes": [{
+ "dst": "0.0.0.0/0"
+ }],
+ "gateway": "10.56.217.1"
+ }
+}'
diff --git a/apps/dbuf/templates/secret-registry.yaml b/apps/dbuf/templates/secret-registry.yaml
new file mode 100644
index 0000000..eafb8e2
--- /dev/null
+++ b/apps/dbuf/templates/secret-registry.yaml
@@ -0,0 +1,18 @@
+{{/*
+# Copyright 2020-present Open Networking Foundation
+
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+*/}}
+
+{{- if .Values.image.credentials }}
+---
+kind: Secret
+apiVersion: v1
+metadata:
+ name: {{ .Release.Name }}.registry
+ labels:
+ release: {{ .Release.Name }}
+type: kubernetes.io/dockerconfigjson
+data:
+ .dockerconfigjson: {{ printf `{"auths":{%s:{"auth":"%s"}}}` (.Values.images.credentials.registry | quote) (printf "%s:%s" .Values.images.credentials.username .Values.images.credentials.password | b64enc) | b64enc | quote }}
+{{- end }}
diff --git a/apps/dbuf/templates/service.yml b/apps/dbuf/templates/service.yml
new file mode 100644
index 0000000..8139fb9
--- /dev/null
+++ b/apps/dbuf/templates/service.yml
@@ -0,0 +1,38 @@
+{{/*
+# Copyright 2021-present Open Networking Foundation
+
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+*/}}
+
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ include "dbuf.fullname" . }}
+ labels:
+ {{- include "dbuf.labels" . | nindent 4 }}
+spec:
+ selector:
+ {{- include "dbuf.selectorLabels" . | nindent 4 }}
+ ports:
+ - name: grpc
+ protocol: TCP
+ # TODO: define in values
+ port: 10000
+ targetPort: grpc
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ include "dbuf.fullname" . }}-stats
+ labels:
+ {{- include "dbuf.labels" . | nindent 4 }}
+spec:
+ selector:
+ {{- include "dbuf.selectorLabels" . | nindent 4 }}
+ ports:
+ - name: stats
+ protocol: TCP
+ # TODO: define in values
+ port: 8080
+ targetPort: stats
diff --git a/apps/dbuf/values.yaml b/apps/dbuf/values.yaml
new file mode 100644
index 0000000..946d3f4
--- /dev/null
+++ b/apps/dbuf/values.yaml
@@ -0,0 +1,39 @@
+# Copyright 2021-present Open Networking Foundation
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+image:
+ repository: registry.aetherproject.org/tost/dbuf
+ pullPolicy: IfNotPresent
+ tag: "latest"
+ credentials: {}
+ # If specified, use this credential to access the image
+ # registry:
+ # username:
+ # password:
+
+extraParams:
+ - '"-max_queues=1024"'
+
+
+replicaCount: 1
+sriovNICSize: 1
+sriovResourceName: intel_sriov_netdevice
+
+# Change both in the same time
+multusNetworkName: dbuf-sriov
+podAnnotations:
+ k8s.v1.cni.cncf.io/networks: dbuf-sriov
+
+imagePullSecrets: []
+podSecurityContext: {}
+resources:
+ requests:
+ intel.com/intel_sriov_netdevice: '1'
+ limits:
+ intel.com/intel_sriov_netdevice: '1'
+
+nodeSelector: {}
+
+tolerations: []
+
+affinity: {}