Documentation
¶
Index ¶
- Constants
- func InstallFile(dst string, src io.Reader, perms fs.FileMode) error
- func InstallTarGz(dst, src string) error
- func NewChecksumError(src Source) error
- func ParseGNUChecksum(gnuChecksum []byte) ([]byte, error)
- func Upgrade(artifactName, path string, source Source, perms fs.FileMode, log *zap.Logger) error
- type ChecksumError
- type ChecksumVerifier
- type Cmd
- type Package
- type Source
Constants ¶
const ( CniPlugins = "cniPlugins" IamAuthenticator = "iamAuthenticator" IamRolesAnywhere = "iamRolesAnywhere" ImageCredentialProvider = "imageCredentialProvider" Kubectl = "kubectl" Kubelet = "kubelet" Ssm = "ssm" Containerd = "containerd" Iptables = "iptables" )
const DefaultDirPerms = fs.ModeDir | 0o755
DefaultDirPerms are the permissions assigned to a directory when an Install* func is called and it has to create the parent directories for the destination.
Variables ¶
This section is empty.
Functions ¶
func InstallFile ¶
InstallFile installs src to dst with perms permissions. It ensures any base paths exist before installing.
func InstallTarGz ¶
InstallTarGz untars the src file into the dst directory and deletes the src tgz file
func NewChecksumError ¶
NewChecksumError creates an error of type ChecksumError.
func ParseGNUChecksum ¶
ParseGNUChecksum parses r as GNU checksum format and returns the checksum value. GNU checksums are a space separated digest and filename:
<digest> <filename>
Types ¶
type ChecksumError ¶
func (ChecksumError) Error ¶
func (ce ChecksumError) Error() string
Error implements the error interface.
func (ChecksumError) Is ¶
func (ce ChecksumError) Is(err error) bool
Is implements the errors.Is interface.
type ChecksumVerifier ¶
type ChecksumVerifier interface {
// VerifyChecksum returns true if ExpectedChecksum() is equal to ActualChecksum(). Otherwise
// it returns false. If expected and actual are nil, it returns true.
VerifyChecksum() bool
// ExpectedChecksum returns the expected checksum of the underlying data.
ExpectedChecksum() []byte
// ActualChecksum returns the actual checksum of underlying data.
ActualChecksum() []byte
}
ChecksumVerifier verifies the checksum of a data source.
type Package ¶
type Package interface {
// InstallCmd returns the command to install the package.
// Every invocation guarantees a new command.
InstallCmd(context.Context) *exec.Cmd
// UninstallCmd returns the command to uninstall the package.
// Every invocation guarantees a new command.
UninstallCmd(context.Context) *exec.Cmd
// UpgradeCmd return the command to upgrade the package
// Every invocation guarantees a new command.
UpgradeCmd(ctx context.Context) *exec.Cmd
}
Package interface defines a package source It defines the install, uninstall & upgrade commands to be executed
func NewPackageSource ¶
type Source ¶
type Source interface {
io.ReadCloser
ChecksumVerifier
}
Source is a binary data source. Sources must be streamed in their entirety before their checksums can be validated. Sources are closable. It is up to the producer to determine who is responsible for closing the Source.
func GzippedWithChecksum ¶ added in v1.0.6
GzippedWithChecksum creates a gzip reader around rc and a checksum verifier. The returned Source should be used to read the artifact contents.
func WithChecksum ¶
WithChecksum creates a checksumVerifier. The digest is used to calculate srcs checksum. The returned Source should be used to read the artifact contents.
func WithNopChecksum ¶
func WithNopChecksum(rc io.ReadCloser) Source
WithNopChecksum turns rc into a Source that nops when the ChecksumVerifier methods are called. Both ActualChecksum() and ExpectedChecksum() will return nil.