Skip to content

Commit d0c3ec3

Browse files
committed
Fix name to mapping for intel and simplify apply helper
Signed-off-by: Balazs Nemeth <[email protected]>
1 parent e02fe45 commit d0c3ec3

File tree

6 files changed

+19
-17
lines changed

6 files changed

+19
-17
lines changed

config/manager/manager.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,15 @@ spec:
8080
value: quay.io/openshift/origin-dpu-daemon:4.20
8181
- name: NRIWebhookImage
8282
value: quay.io/openshift/sriov-dp-admission-controller:latest
83-
#TODO: We will need pointers to all supported VSP images so we can dynamically detect the correct vendor to support at runtime
84-
# - name: IntelVspImage
85-
# value: quay.io/openshift/origin-intel-vsp-image:4.16
83+
# VSP images for different vendors
84+
- name: IntelVspImage
85+
value: quay.io/openshift/origin-intel-vsp-image:4.16
86+
- name: IntelVspP4Image
87+
value: quay.io/openshift/origin-intel-vsp-p4-image:4.16
88+
- name: MarvellVspImage
89+
value: quay.io/openshift/origin-marvell-vsp-image:4.16
90+
- name: IntelNetSecVspImage
91+
value: quay.io/openshift/origin-intel-netsec-vsp-image:4.16
8692
image: quay.io/openshift/origin-dpu-operator:4.20
8793
name: manager
8894
securityContext:

internal/controller/dataprocessingunit_controller.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,8 @@ func (r *DataProcessingUnitReconciler) ensureVSPResources(ctx context.Context, d
119119
"Args": "[]",
120120
}
121121

122-
// Apply all VSP resources using the existing bindata
123-
// Pass nil for owner reference since render function expects DpuOperatorConfig
124-
// TODO: Consider creating a generic version that accepts any owner type
125-
err = render.ApplyAllFromBinData(logger, "vsp", templateVars, dpuBinData, r.Client, nil, r.Scheme)
122+
// Apply all VSP resources using the existing bindata with DPU CR as owner
123+
err = render.ApplyAllFromBinData(logger, "vsp", templateVars, dpuBinData, r.Client, dpu)
126124
if err != nil {
127125
return fmt.Errorf("failed to apply VSP resources: %v", err)
128126
}

internal/controller/dpuoperatorconfig_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ func (r *DpuOperatorConfigReconciler) yamlVars() map[string]string {
168168

169169
func (r *DpuOperatorConfigReconciler) createAndApplyAllFromBinData(logger logr.Logger, binDataPath string, cfg *configv1.DpuOperatorConfig) error {
170170
mergedData := images.MergeVarsWithImages(r.imageManager, r.yamlVars())
171-
return render.ApplyAllFromBinData(logger, binDataPath, mergedData, binData, r.Client, cfg, r.Scheme)
171+
return render.ApplyAllFromBinData(logger, binDataPath, mergedData, binData, r.Client, cfg)
172172
}
173173

174174
func (r *DpuOperatorConfigReconciler) ensureDpuDeamonSet(ctx context.Context, cfg *configv1.DpuOperatorConfig) error {

internal/daemon/daemon_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ var _ = g.Describe("Full Daemon", func() {
129129

130130
Expect(err).NotTo(HaveOccurred())
131131
Expect(dpuCR.Spec.IsDpuSide).To(BeTrue())
132-
Expect(dpuCR.Spec.DpuProductName).To(Equal("Intel IPU"))
132+
Expect(dpuCR.Spec.DpuProductName).To(Equal("Intel IPU E2100"))
133133
return nil
134134
}, 30*time.Second, 2*time.Second).Should(Succeed())
135135
})

internal/platform/ipu.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type IntelDetector struct {
2424
}
2525

2626
func NewIntelDetector() *IntelDetector {
27-
return &IntelDetector{name: "Intel IPU"}
27+
return &IntelDetector{name: "Intel IPU E2100"}
2828
}
2929

3030
func (d *IntelDetector) Name() string {

pkgs/render/render.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ import (
1313

1414
"github.com/go-logr/logr"
1515
"github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/apply"
16-
configv1 "github.com/openshift/dpu-operator/api/v1"
1716
apierrors "k8s.io/apimachinery/pkg/api/errors"
1817
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
19-
"k8s.io/apimachinery/pkg/runtime"
2018
"k8s.io/apimachinery/pkg/util/yaml"
2119
ctrl "sigs.k8s.io/controller-runtime"
2220
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -57,7 +55,7 @@ func BinDataYamlFiles(dirPath string, binData embed.FS) ([]string, error) {
5755
return yamlFileDescriptors, nil
5856
}
5957

60-
func applyFromBinData(logger logr.Logger, filePath string, data map[string]string, binData embed.FS, client client.Client, cfg *configv1.DpuOperatorConfig, scheme *runtime.Scheme) error {
58+
func applyObjectFromBinData(logger logr.Logger, filePath string, data map[string]string, binData embed.FS, client client.Client, owner client.Object) error {
6159
file, err := binData.Open(filepath.Join("bindata", filePath))
6260
if err != nil {
6361
return fmt.Errorf("Failed to read file '%s': %v", filePath, err)
@@ -71,8 +69,8 @@ func applyFromBinData(logger logr.Logger, filePath string, data map[string]strin
7169
if err != nil {
7270
return err
7371
}
74-
if cfg != nil {
75-
if err := ctrl.SetControllerReference(cfg, obj, scheme); err != nil {
72+
if owner != nil {
73+
if err := ctrl.SetControllerReference(owner, obj, client.Scheme()); err != nil {
7674
return err
7775
}
7876
}
@@ -95,13 +93,13 @@ func applyFromBinData(logger logr.Logger, filePath string, data map[string]strin
9593
return nil
9694
}
9795

98-
func ApplyAllFromBinData(logger logr.Logger, binDataPath string, data map[string]string, binData embed.FS, client client.Client, cfg *configv1.DpuOperatorConfig, scheme *runtime.Scheme) error {
96+
func ApplyAllFromBinData(logger logr.Logger, binDataPath string, data map[string]string, binData embed.FS, client client.Client, owner client.Object) error {
9997
filePaths, err := BinDataYamlFiles(binDataPath, binData)
10098
if err != nil {
10199
return err
102100
}
103101
for _, f := range filePaths {
104-
err = applyFromBinData(logger, f, data, binData, client, cfg, scheme)
102+
err = applyObjectFromBinData(logger, f, data, binData, client, owner)
105103
if err != nil {
106104
return err
107105
}

0 commit comments

Comments
 (0)