Skip to content

Commit e214f4d

Browse files
committed
fixup! refactor: Apply review suggestions
1 parent f7d429a commit e214f4d

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

pkg/handlers/generic/lifecycle/cni/cilium/strategy_crs.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package cilium
66
import (
77
"context"
88
"fmt"
9-
"maps"
109

1110
"github.com/go-logr/logr"
1211
"github.com/spf13/pflag"
@@ -85,8 +84,9 @@ func (s crsStrategy) apply(
8584
Namespace: cluster.Namespace,
8685
Name: "cilium-cni-installation-" + cluster.Name,
8786
},
87+
Data: defaultCiliumConfigMap.Data,
88+
BinaryData: defaultCiliumConfigMap.BinaryData,
8889
}
89-
cm.Data = maps.Clone(defaultCiliumConfigMap.Data)
9090

9191
if err := client.ServerSideApply(ctx, s.client, cm); err != nil {
9292
return fmt.Errorf(
@@ -95,7 +95,7 @@ func (s crsStrategy) apply(
9595
)
9696
}
9797

98-
if err := utils.EnsureCRSForClusterFromConfigMaps(ctx, cm.Name, s.client, &req.Cluster, cm); err != nil {
98+
if err := utils.EnsureCRSForClusterFromConfigMaps(ctx, cm.Name, s.client, cluster, cm); err != nil {
9999
return fmt.Errorf(
100100
"failed to apply Cilium CNI installation ClusterResourceSet: %w",
101101
err,

pkg/handlers/generic/lifecycle/nfd/strategy_crs.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package nfd
66
import (
77
"context"
88
"fmt"
9-
"maps"
109

1110
"github.com/go-logr/logr"
1211
"github.com/spf13/pflag"
@@ -83,10 +82,11 @@ func (s crsStrategy) apply(
8382
},
8483
ObjectMeta: metav1.ObjectMeta{
8584
Namespace: cluster.Namespace,
86-
Name: defaultCM.Name,
85+
Name: defaultCM.Name + "-" + cluster.Name,
8786
},
87+
Data: defaultCM.Data,
88+
BinaryData: defaultCM.BinaryData,
8889
}
89-
cm.Data = maps.Clone(defaultCM.Data)
9090

9191
if err := client.ServerSideApply(ctx, s.client, cm); err != nil {
9292
return fmt.Errorf(
@@ -95,13 +95,7 @@ func (s crsStrategy) apply(
9595
)
9696
}
9797

98-
if err := utils.EnsureCRSForClusterFromConfigMaps(
99-
ctx,
100-
cm.Name+"-"+req.Cluster.Name,
101-
s.client,
102-
&req.Cluster,
103-
cm,
104-
); err != nil {
98+
if err := utils.EnsureCRSForClusterFromConfigMaps(ctx, cm.Name, s.client, cluster, cm); err != nil {
10599
return fmt.Errorf(
106100
"failed to apply NFD installation ClusterResourceSet: %w",
107101
err,

0 commit comments

Comments
 (0)