Documentation
¶
Index ¶
- Variables
- func DecodeKptfile(in io.Reader) (*kptfilev1.KptFile, error)
- func DefaultKptfile(name string) *kptfilev1.KptFile
- func Equal(kf1, kf2 *kptfilev1.KptFile) (bool, error)
- func FromKptGVK(gvk kptapischema.GroupVersionKind) machineryschema.GroupVersionKind
- func MergeKptfiles(localKf, updatedKf, originalKf *kptfilev1.KptFile) error
- func ReadKptfile(fs filesys.FileSystem, p string) (*kptfilev1.KptFile, error)
- func ToKptGVK(gvk machineryschema.GroupVersionKind) kptapischema.GroupVersionKind
- func UpdateKptfile(localPath, updatedPath, originPath string, updateUpstream bool) error
- func UpdateKptfileWithoutOrigin(localPath, updatedPath string, updateUpstream bool) error
- func UpdateUpstreamLockFromGit(path string, spec *gitutil.RepoSpec) error
- func ValidateInventory(inv *kptfilev1.Inventory) (bool, error)
- func WriteFile(dir string, k any) error
- func WriteKptfileToFS(fs filesys.FileSystem, dir string, k any) error
- type DeprecatedKptfileError
- type KptfileError
- type UnknownKptfileResourceError
Constants ¶
This section is empty.
Variables ¶
var DeprecatedKptfileVersions = []schema.GroupVersionKind{ kptfilev1.KptFileGVK().GroupKind().WithVersion("v1alpha1"), kptfilev1.KptFileGVK().GroupKind().WithVersion("v1alpha2"), }
var SupportedKptfileVersions = []schema.GroupVersionKind{ kptfilev1.KptFileGVK(), }
Functions ¶
func DefaultKptfile ¶
DefaultKptfile returns a new minimal Kptfile.
func FromKptGVK ¶
func FromKptGVK(gvk kptapischema.GroupVersionKind) machineryschema.GroupVersionKind
FromKptGVK converts a kpt API schema GroupVersionKind to an apimachinery GroupVersionKind.
func MergeKptfiles ¶
MergeKptfiles merges the Kptfiles from various sources and updates localKf with output please refer to https://github.com/kptdev/kpt/blob/main/docs/design-docs/03-pipeline-merge.md for related design
func ReadKptfile ¶
ReadKptfile reads the KptFile in the given pkg. TODO(droot): This method exists for current version of Kptfile. Need to reconcile with the team how we want to handle multiple versions of Kptfile in code. One option is to follow Kubernetes approach to have an internal version of Kptfile that all the code uses. In that case, we will have to implement pieces for IO/Conversion with right interfaces.
func ToKptGVK ¶
func ToKptGVK(gvk machineryschema.GroupVersionKind) kptapischema.GroupVersionKind
ToKptGVK converts an apimachinery GroupVersionKind to the kpt API schema GroupVersionKind.
func UpdateKptfile ¶
UpdateKptfile updates the Kptfile in the package specified by localPath with values from the packages specified in updatedPath using the package specified by originPath as the common ancestor. If updateUpstream is true, the values from the upstream and upstreamLock sections will also be copied into local.
func UpdateKptfileWithoutOrigin ¶
UpdateKptfileWithoutOrigin updates the Kptfile in the package specified by localPath with values from the package specified by updatedPath using a 3-way merge strategy, but where origin does not have any values. If updateUpstream is true, the values from the upstream and upstreamLock sections will also be copied into local.
func UpdateUpstreamLockFromGit ¶
UpdateUpstreamLockFromGit updates the upstreamLock of the package specified by path by using the values from spec. It will also populate the commit field in upstreamLock using the latest commit of the git repo given by spec.
func ValidateInventory ¶
ValidateInventory returns true and a nil error if the passed inventory is valid; otherwiste, false and the reason the inventory is not valid is returned. A valid inventory must have a non-empty namespace, name, and id.
func WriteKptfileToFS ¶
func WriteKptfileToFS(fs filesys.FileSystem, dir string, k any) error
WriteKptfileToFS writes a Kptfile to the given filesystem at the specified directory.
Types ¶
type DeprecatedKptfileError ¶
type DeprecatedKptfileError struct {
Version string
}
DeprecatedKptfileError is an implementation of the error interface that is returned whenever kpt encounters a Kptfile using the legacy format.
func (*DeprecatedKptfileError) Error ¶
func (e *DeprecatedKptfileError) Error() string
type KptfileError ¶
type KptfileError struct {
Path kptfilev1.UniquePath
Err error
}
KptfileError records errors regarding reading or parsing of a Kptfile.
func (*KptfileError) Error ¶
func (k *KptfileError) Error() string
func (*KptfileError) Unwrap ¶
func (k *KptfileError) Unwrap() error
type UnknownKptfileResourceError ¶
type UnknownKptfileResourceError struct {
GVK schema.GroupVersionKind
}
func (*UnknownKptfileResourceError) Error ¶
func (e *UnknownKptfileResourceError) Error() string