Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ require (
modernc.org/mathutil v1.7.1 // indirect
modernc.org/memory v1.11.0 // indirect
modernc.org/sqlite v1.46.1
sigs.k8s.io/controller-runtime v0.23.3
sigs.k8s.io/controller-runtime v0.23.3 // indirect
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
sigs.k8s.io/kustomize/kustomize/v5 v5.7.1 // indirect
sigs.k8s.io/release-utils v0.12.4 // indirect
Expand Down
11 changes: 5 additions & 6 deletions src/pkg/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ import (
kerrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v1ac "k8s.io/client-go/applyconfigurations/core/v1"
"k8s.io/client-go/discovery"
"k8s.io/client-go/discovery/cached/memory"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/restmapper"
"k8s.io/client-go/tools/clientcmd"
"sigs.k8s.io/cli-utils/pkg/kstatus/watcher"
"sigs.k8s.io/controller-runtime/pkg/client/apiutil"
)

const (
Expand Down Expand Up @@ -147,14 +149,11 @@ func WatcherForConfig(cfg *rest.Config) (watcher.StatusWatcher, error) {
if err != nil {
return nil, err
}
httpClient, err := rest.HTTPClientFor(cfg)
if err != nil {
return nil, err
}
restMapper, err := apiutil.NewDynamicRESTMapper(cfg, httpClient)
discoveryClient, err := discovery.NewDiscoveryClientForConfig(cfg)
if err != nil {
return nil, err
}
restMapper := restmapper.NewDeferredDiscoveryRESTMapper(memory.NewMemCacheClient(discoveryClient))
sw := watcher.NewDefaultStatusWatcher(dynamicClient, restMapper)
return sw, nil
}
Expand Down
3 changes: 2 additions & 1 deletion src/pkg/packager/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"net/url"
"os"
"path/filepath"
"slices"
"time"

"github.com/zarf-dev/zarf/src/pkg/logger"
Expand Down Expand Up @@ -159,7 +160,7 @@ func pullOCI(ctx context.Context, opts pullOCIOptions) (*layout.PackageLayout, e
if len(layerTypes) == 0 {
layerTypes = zoci.GetAllLayerTypes()
}
layerTypes = helpers.RemoveMatches(layerTypes, func(lt zoci.LayerType) bool {
layerTypes = slices.DeleteFunc(layerTypes, func(lt zoci.LayerType) bool {
return lt == zoci.ImageLayers
})
}
Expand Down
5 changes: 2 additions & 3 deletions src/pkg/packager/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"slices"
"time"

"github.com/defenseunicorns/pkg/helpers/v2"
"github.com/zarf-dev/zarf/src/internal/packager/helm"
"github.com/zarf-dev/zarf/src/internal/packager/requirements"
"github.com/zarf-dev/zarf/src/pkg/feature"
Expand Down Expand Up @@ -133,7 +132,7 @@ func Remove(ctx context.Context, pkg v1alpha1.ZarfPackage, opts RemoveOptions) e
}

// remove the helm chart from the installed charts slice.
depComp.InstalledCharts = helpers.RemoveMatches(depComp.InstalledCharts, func(t state.InstalledChart) bool {
depComp.InstalledCharts = slices.DeleteFunc(depComp.InstalledCharts, func(t state.InstalledChart) bool {
return t.ChartName == chart.ChartName
})

Expand All @@ -156,7 +155,7 @@ func Remove(ctx context.Context, pkg v1alpha1.ZarfPackage, opts RemoveOptions) e

// remove the component from deploy components slice.
if opts.Cluster != nil {
depPkg.DeployedComponents = helpers.RemoveMatches(depPkg.DeployedComponents, func(t state.DeployedComponent) bool {
depPkg.DeployedComponents = slices.DeleteFunc(depPkg.DeployedComponents, func(t state.DeployedComponent) bool {
return t.Name == depComp.Name
})
err = opts.Cluster.UpdateDeployedPackage(ctx, *depPkg)
Expand Down
Loading