-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathconfigmap.go
More file actions
100 lines (72 loc) · 3.04 KB
/
configmap.go
File metadata and controls
100 lines (72 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package define
import (
"html/template"
"strings"
"github.com/rh-ecosystem-edge/eco-gotests/tests/hw-accel/kmm/internal/kmmparams"
)
// MultiStageConfigMapContent returns the configmap multi-stage contents for a specified module name.
func MultiStageConfigMapContent(module string) map[string]string {
data := map[string]interface{}{
"Module": module,
}
templateInstance := template.Must(template.New("contents").Parse(kmmparams.MultistageContents))
builder := &strings.Builder{}
if err := templateInstance.Execute(builder, data); err != nil {
panic(err)
}
content := builder.String()
configmapContents := map[string]string{"dockerfile": content}
return configmapContents
}
// UserDtkMultiStateConfigMapContents returns the configmap contents for speficied DTK image and module name.
func UserDtkMultiStateConfigMapContents(module, dtkImage string) map[string]string {
data := map[string]interface{}{
"Module": module,
"DTKImage": dtkImage,
}
templateInstance := template.Must(template.New("contents").Parse(kmmparams.UserDTKContents))
builder := &strings.Builder{}
if err := templateInstance.Execute(builder, data); err != nil {
panic(err)
}
content := builder.String()
configmapContents := map[string]string{"dockerfile": content}
return configmapContents
}
// SimpleKmodConfigMapContents returns the configmap for simple-kmod example.
func SimpleKmodConfigMapContents() map[string]string {
configmapContents := map[string]string{"dockerfile": kmmparams.SimpleKmodContents}
return configmapContents
}
// SimpleKmodFirmwareConfigMapContents returns the configmap for simple-kmod-firmware example.
func SimpleKmodFirmwareConfigMapContents() map[string]string {
configmapContents := map[string]string{"dockerfile": kmmparams.SimpleKmodFirmwareContents}
return configmapContents
}
// LocalMultiStageConfigMapContent returns the configmap multi-stage contents for a specified module name.
func LocalMultiStageConfigMapContent(module string) map[string]string {
data := map[string]interface{}{
"Module": module,
}
templateInstance := template.Must(template.New("contents").Parse(kmmparams.LocalMultiStageContents))
builder := &strings.Builder{}
if err := templateInstance.Execute(builder, data); err != nil {
panic(err)
}
content := builder.String()
configmapContents := map[string]string{"dockerfile": content}
return configmapContents
}
// KmmScannerConfigMapContents returns the configmap for KMM image scanner.
func KmmScannerConfigMapContents() map[string]string {
configMapContent := map[string]string{"dockerfile": kmmparams.KmmScannerDockerfile}
return configMapContent
}
// MultiKoConfigMapContent returns the configmap contents for building 3 kernel modules.
func MultiKoConfigMapContent() map[string]string {
return map[string]string{"dockerfile": kmmparams.MultiKoContents}
}
// MultiKoCustomDirConfigMapContent returns the configmap contents for building 3 kernel modules under /custom.
func MultiKoCustomDirConfigMapContent() map[string]string {
return map[string]string{"dockerfile": kmmparams.MultiKoCustomDirContents}
}