Skip to content

Commit

Permalink
fixup! refactor: Apply review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmidyson committed Feb 24, 2024
1 parent b1eda00 commit 856b14e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
6 changes: 3 additions & 3 deletions pkg/handlers/generic/lifecycle/cni/cilium/strategy_crs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package cilium
import (
"context"
"fmt"
"maps"

"github.com/go-logr/logr"
"github.com/spf13/pflag"
Expand Down Expand Up @@ -85,8 +84,9 @@ func (s crsStrategy) apply(
Namespace: cluster.Namespace,
Name: "cilium-cni-installation-" + cluster.Name,
},
Data: defaultCiliumConfigMap.Data,
BinaryData: defaultCiliumConfigMap.BinaryData,
}
cm.Data = maps.Clone(defaultCiliumConfigMap.Data)

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

if err := utils.EnsureCRSForClusterFromConfigMaps(ctx, cm.Name, s.client, &req.Cluster, cm); err != nil {
if err := utils.EnsureCRSForClusterFromConfigMaps(ctx, cm.Name, s.client, cluster, cm); err != nil {
return fmt.Errorf(
"failed to apply Cilium CNI installation ClusterResourceSet: %w",
err,
Expand Down
14 changes: 4 additions & 10 deletions pkg/handlers/generic/lifecycle/nfd/strategy_crs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package nfd
import (
"context"
"fmt"
"maps"

"github.com/go-logr/logr"
"github.com/spf13/pflag"
Expand Down Expand Up @@ -83,10 +82,11 @@ func (s crsStrategy) apply(
},
ObjectMeta: metav1.ObjectMeta{
Namespace: cluster.Namespace,
Name: defaultCM.Name,
Name: defaultCM.Name + "-" + cluster.Name,
},
Data: defaultCM.Data,
BinaryData: defaultCM.BinaryData,
}
cm.Data = maps.Clone(defaultCM.Data)

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

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

0 comments on commit 856b14e

Please sign in to comment.