Skip to content

Commit f037c8b

Browse files
authored
Merge pull request #1372 from hj-johannes-lee/qat-initcontainer-improvement
qat init: make qat.conf optional
2 parents e56e0e6 + cdfc3bb commit f037c8b

File tree

6 files changed

+22
-19
lines changed

6 files changed

+22
-19
lines changed

cmd/qat_plugin/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ The QAT plugin can take a number of command line arguments, summarised in the fo
4444
|:---- |:-------- |:------- |
4545
| -dpdk-driver | string | DPDK Device driver for configuring the QAT device (default: `vfio-pci`) |
4646
| -kernel-vf-drivers | string | Comma separated VF Device Driver of the QuickAssist Devices in the system. Devices supported: DH895xCC, C62x, C3xxx, 4xxx/401xx/402xx, C4xxx and D15xx (default: `c6xxvf,4xxxvf`) |
47-
| -max-num-devices | int | maximum number of QAT devices to be provided to the QuickAssist device plugin (default: `32`) |
47+
| -max-num-devices | int | maximum number of QAT devices to be provided to the QuickAssist device plugin (default: `64`) |
4848
| -mode | string | plugin mode which can be either `dpdk` or `kernel` (default: `dpdk`) |
4949
| -allocation-policy | string | 2 possible values: balanced and packed. Balanced mode spreads allocated QAT VF resources balanced among QAT PF devices, and packed mode packs one QAT PF device full of QAT VF resources before allocating resources from the next QAT PF. (There is no default.) |
5050

@@ -136,12 +136,11 @@ In addition to the default configuration, you can add device-specific configurat
136136
|:-------|:-----------------------|:-----------------|:--------|:------|
137137
| 4xxx, 401xx,402xx | [cfg_services](https://github.com/torvalds/linux/blob/42e66b1cc3a070671001f8a1e933a80818a192bf/Documentation/ABI/testing/sysfs-driver-qat) reports the configured services (crypto services or compression services) of the QAT device. | `ServicesEnabled=<value>` | compress:`dc`, crypto:`sym;asym` | Linux 6.0+ kernel is required. |
138138

139-
To create a provisioning config after customizing, run as follows:
139+
To create a provisioning `configMap`, run the following command before deploying initcontainer:
140140

141141
```bash
142142
$ kubectl create configmap --namespace=inteldeviceplugins-system qat-config --from-file=deployments/qat_plugin/overlays/qat_initcontainer/qat.conf
143143
```
144-
> **Note**: When deploying the overlay qat_initcontainer, such a manual creation is not necessary since ConfigMap is generated automatically. Just set the values in the config file and deploy the overlay.
145144

146145
When using the operator for deploying the plugin with provisioning config, use `provisioningConfig` field for the name of the ConfigMap, then the config is passed to initcontainer through the volume mount.
147146

cmd/qat_plugin/qat_plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func main() {
4242
dpdkDriver := flag.String("dpdk-driver", "vfio-pci", "DPDK Device driver for configuring the QAT device")
4343
kernelVfDrivers := flag.String("kernel-vf-drivers", "c6xxvf,4xxxvf", "Comma separated VF Device Driver of the QuickAssist Devices in the system. Devices supported: DH895xCC, C62x, C3xxx, C4xxx, 4xxx, and D15xx")
4444
preferredAllocationPolicy := flag.String("allocation-policy", "", "Modes of allocating QAT devices: balanced and packed")
45-
maxNumDevices := flag.Int("max-num-devices", 32, "maximum number of QAT devices to be provided to the QuickAssist device plugin")
45+
maxNumDevices := flag.Int("max-num-devices", 64, "maximum number of QAT devices to be provided to the QuickAssist device plugin")
4646
flag.Parse()
4747

4848
switch *mode {

deployments/qat_plugin/overlays/qat_initcontainer/kustomization.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,3 @@ bases:
22
- ../../base
33
patchesStrategicMerge:
44
- qat_initcontainer.yaml
5-
configMapGenerator:
6-
- name: qat-config
7-
files:
8-
- qat.conf

deployments/qat_plugin/overlays/qat_initcontainer/qat.conf

Lines changed: 0 additions & 1 deletion
This file was deleted.

deployments/qat_plugin/overlays/qat_initcontainer/qat_initcontainer.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ spec:
2828
- name: qat-config
2929
configMap:
3030
name: qat-config
31+
optional: true
3132
defaultMode: 0440

test/e2e/qat/qatplugin_dpdk.go

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020

2121
"github.com/intel/intel-device-plugins-for-kubernetes/test/e2e/utils"
2222
"github.com/onsi/ginkgo/v2"
23+
v1 "k8s.io/api/core/v1"
2324
"k8s.io/apimachinery/pkg/labels"
2425
"k8s.io/kubernetes/test/e2e/framework"
2526
e2edebug "k8s.io/kubernetes/test/e2e/framework/debug"
@@ -65,7 +66,9 @@ func describeQatDpdkPlugin() {
6566

6667
var dpPodName string
6768

68-
ginkgo.BeforeEach(func() {
69+
var resourceName v1.ResourceName
70+
71+
ginkgo.JustBeforeEach(func() {
6972
ginkgo.By("deploying QAT plugin in DPDK mode")
7073
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(kustomizationPath))
7174

@@ -83,6 +86,11 @@ func describeQatDpdkPlugin() {
8386
if err := utils.TestPodsFileSystemInfo(podList.Items); err != nil {
8487
framework.Failf("container filesystem info checks failed: %v", err)
8588
}
89+
90+
ginkgo.By("checking if the resource is allocatable")
91+
if err := utils.WaitForNodesWithResource(f.ClientSet, resourceName, 30*time.Second); err != nil {
92+
framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
93+
}
8694
})
8795

8896
ginkgo.AfterEach(func() {
@@ -93,12 +101,14 @@ func describeQatDpdkPlugin() {
93101
}
94102
})
95103

96-
ginkgo.Context("When QAT Gen4 resources are available", func() {
104+
ginkgo.Context("When QAT Gen4 resources are available with crypto (cy) services enabled", func() {
105+
// This BeforeEach runs even before the JustBeforeEach above.
97106
ginkgo.BeforeEach(func() {
98-
ginkgo.By("checking if the resource is allocatable")
99-
if err := utils.WaitForNodesWithResource(f.ClientSet, "qat.intel.com/cy", 30*time.Second); err != nil {
100-
framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
101-
}
107+
ginkgo.By("creating a configMap before plugin gets deployed")
108+
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "create", "configmap", "--from-literal", "qat.conf=ServicesEnabled=sym;asym", "qat-config")
109+
110+
ginkgo.By("setting resourceName for cy services")
111+
resourceName = "qat.intel.com/cy"
102112
})
103113

104114
ginkgo.It("deploys a crypto pod requesting QAT resources", func() {
@@ -116,10 +126,8 @@ func describeQatDpdkPlugin() {
116126

117127
ginkgo.Context("When QAT Gen2 resources are available", func() {
118128
ginkgo.BeforeEach(func() {
119-
ginkgo.By("checking if the resource is allocatable")
120-
if err := utils.WaitForNodesWithResource(f.ClientSet, "qat.intel.com/generic", 30*time.Second); err != nil {
121-
framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
122-
}
129+
ginkgo.By("setting resourceName for Gen2 resources")
130+
resourceName = "qat.intel.com/generic"
123131
})
124132

125133
ginkgo.It("deploys a crypto pod requesting QAT resources", func() {

0 commit comments

Comments
 (0)