diff --git a/pkg/build/kube/tarbits.go b/pkg/build/kube/tarbits.go index 21bd71552d..64a19f36fe 100644 --- a/pkg/build/kube/tarbits.go +++ b/pkg/build/kube/tarbits.go @@ -62,6 +62,20 @@ func init() { RegisterNamedBits("tar", NewTarBits) } +// TarBitsExtract extracts bits from a given kubeRoot to the given extractPath +// Please see NewTarBits for information on the valid kubeRoot values. +func TarBitsExtract(kubeRoot, extractPath string) error { + bits, err := NewTarBits(kubeRoot) + if err != nil { + return err + } + tarBits := bits.(*TarBits) + if _, err := tarBits.extract(tarBits.kubeRoot, extractPath); err != nil { + return err + } + return nil +} + // NewTarBits returns a new Bits backed by a version file, the release image // archives and the kubeadm, kubectl, and kubelet binaries. The given kubeRoot // may be defined three ways: