| 1 |
// Copyright 2023 The Kubernetes Authors. |
| 2 |
// SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
// Package pkg has all the helpers to interact with the api. |
| 5 |
package loader |
| 6 |
|
| 7 |
import ( |
| 8 |
"sigs.k8s.io/kustomize/api/internal/loader" |
| 9 |
"sigs.k8s.io/kustomize/kyaml/filesys" |
| 10 |
) |
| 11 |
|
| 12 |
// NewFileLoaderAtCwd returns a loader that loads from PWD. |
| 13 |
// A convenience for kustomize edit commands. |
| 14 |
func NewFileLoaderAtCwd(fSys filesys.FileSystem) *loader.FileLoader { |
| 15 |
return loader.NewLoaderOrDie( |
| 16 |
loader.RestrictionRootOnly, fSys, filesys.SelfDir) |
| 17 |
} |
| 18 |
|
| 19 |
// NewFileLoaderAtRoot returns a loader that loads from "/". |
| 20 |
// A convenience for tests. |
| 21 |
func NewFileLoaderAtRoot(fSys filesys.FileSystem) *loader.FileLoader { |
| 22 |
return loader.NewLoaderOrDie( |
| 23 |
loader.RestrictionRootOnly, fSys, filesys.Separator) |
| 24 |
} |