Documentation
¶
Index ¶
- func AddModeFlags(mode *Mode, command *cobra.Command)
- func AppendErrors(err error, errs ...error) error
- func ClientVersionCheck(ctx context.Context, clientFactory ClientFactory) error
- func Confirm(prompt string) bool
- func DeprecationMessage(flag *pflag.Flag) string
- func ExtractFileFromTarGz(filename string, r io.ReadCloser) ([]byte, error)
- func ExtractTarGz(localPath string, r io.ReadCloser) error
- func FormatLabels(labels map[string]string) string
- func MachineConfigUpdater(ctx context.Context, clientFactory *global.ClientFactory, ...) error
- func MarkFlagDeprecated(flags *pflag.FlagSet, name, message string) error
- func NonFatalError(err error) error
- func PrintApplyResults(resp *machine.ApplyConfigurationResponse)
- func ReadGRPCStream[S Stream[T], T Message](stream S, handler func(T, string, bool) error) error
- func TalosVersionCheck(ctx context.Context, clientFactory ClientFactory, desired semver.Range) error
- type ClientFactory
- type ErrNonFatalError
- type Message
- type Mode
- type Stream
- type VersionOutsideRangeError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddModeFlags ¶
AddModeFlags adds deprecated flags to the command and registers mode flag with it's parser.
func AppendErrors ¶
AppendErrors adds errors to the multierr wrapper.
func ClientVersionCheck ¶
func ClientVersionCheck(ctx context.Context, clientFactory ClientFactory) error
ClientVersionCheck verifies that client is not outdated vs. Talos version.
func Confirm ¶ added in v1.4.0
Confirm asks the user to confirm their action. Anything other than `y` and `yes` returns false.
func DeprecationMessage ¶ added in v1.14.0
DeprecationMessage returns the message registered for the flag by MarkFlagDeprecated, or an empty string if the flag is not deprecated.
It stands in for pflag's own Flag.Deprecated field, which is left unset so that pflag does not print the warning itself.
func ExtractFileFromTarGz ¶
func ExtractFileFromTarGz(filename string, r io.ReadCloser) ([]byte, error)
ExtractFileFromTarGz reads a single file data from an archive.
func ExtractTarGz ¶
func ExtractTarGz(localPath string, r io.ReadCloser) error
ExtractTarGz extracts .tar.gz archive from r into filesystem under localPath.
The archive is a dump of node's filesystem which might contain symlinks or other special files, handle them in a safe way for the client.
func FormatLabels ¶ added in v1.13.0
FormatLabels formats labels as a comma-separated key=value pairs.
func MachineConfigUpdater ¶ added in v1.14.0
func MachineConfigUpdater(ctx context.Context, clientFactory *global.ClientFactory, callback func(ctx context.Context, client *client.Client, node string, mc resource.Resource) error, args []string, ) error
MachineConfigUpdater gets resources from the controller runtime and runs a callback for each resource.
func MarkFlagDeprecated ¶ added in v1.14.0
MarkFlagDeprecated marks the named flag as deprecated: it is hidden from the help output, and using it prints a warning.
It replaces pflag's own MarkDeprecated, which leaves the warning for cobra to print via cmd.Print, i.e. to the command's output stream. That stream is stdout for talosctl (the help output goes there), so the warning would land in the middle of the command output instead of on stderr.
func NonFatalError ¶
NonFatalError wraps another error into a ErrNonFatal.
func PrintApplyResults ¶
func PrintApplyResults(resp *machine.ApplyConfigurationResponse)
PrintApplyResults prints out all warnings and auto apply results.
func ReadGRPCStream ¶
ReadGRPCStream consumes all messages from the gRPC stream, handles errors, calls the passed handler for each message.
func TalosVersionCheck ¶ added in v1.13.0
func TalosVersionCheck(ctx context.Context, clientFactory ClientFactory, desired semver.Range) error
TalosVersionCheck verifies that all nodes are running the desired Talos version.
Types ¶
type ClientFactory ¶ added in v1.14.0
type ClientFactory interface {
BuildClient(ctx context.Context, node string) (context.Context, *client.Client, error)
Nodes() []string
}
ClientFactory is the interface for the client factory.
type ErrNonFatalError ¶
type ErrNonFatalError struct {
// contains filtered or unexported fields
}
ErrNonFatalError represents the error that can be returned from the handler in the gRPC stream reader which doesn't mean that we should stop iterating over the messages in the stream, but log this error and continue the process.
func (*ErrNonFatalError) Error ¶
func (e *ErrNonFatalError) Error() string
Error implements error interface.
type Message ¶
type Message interface {
GetMetadata() *common.Metadata //nolint:staticcheck // to be refactored next
proto.Message
}
Message defines the contract for the grpc message.
type Mode ¶
type Mode struct {
Mode machine.ApplyConfigurationRequest_Mode
// contains filtered or unexported fields
}
Mode apply, patch, edit config update mode.
type Stream ¶
type Stream[T proto.Message] interface { Recv() (T, error) grpc.ClientStream }
Stream implements the contract for the grpc stream of a specific type.
type VersionOutsideRangeError ¶ added in v1.13.0
type VersionOutsideRangeError struct{}
VersionOutsideRangeError is returned when a node is running a Talos version that is outside the desired range.