Documentation ¶
Overview ¶
Package client provides Talos API client.
Index ¶
- Variables
- func AddrFromPeer(remote *peer.Peer) (peerHost string)
- func CertificateFromConfigContext(context *clientconfig.Context) (*tls.Certificate, error)
- func FilterMessages[V any, T Message[V], MR MessageResponse[V, T]](resp MR, err error) (MR, error)
- func ReadStream(stream MachineStream) (io.ReadCloser, error)
- func RemotePeer(ctx context.Context) (peerHost string)
- func Status(err error) *status.Status
- func StatusCode(err error) codes.Code
- func WithGRPCBasicAuth(username, password string) grpc.DialOption
- func WithNode(ctx context.Context, node string) context.Context
- func WithNodes(ctx context.Context, nodes ...string) context.Context
- func WithPowerCycle(req *machineapi.RebootRequest)
- type BasicAuth
- type Client
- func (c *Client) ApplyConfiguration(ctx context.Context, req *machineapi.ApplyConfigurationRequest, ...) (resp *machineapi.ApplyConfigurationResponse, err error)
- func (c *Client) Bootstrap(ctx context.Context, req *machineapi.BootstrapRequest) (err error)
- func (c *Client) Close() error
- func (c *Client) ClusterHealthCheck(ctx context.Context, waitTimeout time.Duration, ...) (clusterapi.ClusterService_HealthCheckClient, error)
- func (c *Client) Conn() *grpc.ClientConn
- func (c *Client) Containers(ctx context.Context, namespace string, driver common.ContainerDriver, ...) (resp *machineapi.ContainersResponse, err error)
- func (c *Client) Copy(ctx context.Context, rootPath string) (io.ReadCloser, error)
- func (c *Client) DiskUsage(ctx context.Context, req *machineapi.DiskUsageRequest) (stream machineapi.MachineService_DiskUsageClient, err error)
- func (c *Client) Disks(ctx context.Context, callOptions ...grpc.CallOption) (resp *storageapi.DisksResponse, err error)
- func (c *Client) Dmesg(ctx context.Context, follow, tail bool) (machineapi.MachineService_DmesgClient, error)
- func (c *Client) EtcdAlarmDisarm(ctx context.Context, opts ...grpc.CallOption) (*machineapi.EtcdAlarmDisarmResponse, error)
- func (c *Client) EtcdAlarmList(ctx context.Context, opts ...grpc.CallOption) (*machineapi.EtcdAlarmListResponse, error)
- func (c *Client) EtcdDefragment(ctx context.Context, opts ...grpc.CallOption) (*machineapi.EtcdDefragmentResponse, error)
- func (c *Client) EtcdForfeitLeadership(ctx context.Context, req *machineapi.EtcdForfeitLeadershipRequest, ...) (*machineapi.EtcdForfeitLeadershipResponse, error)
- func (c *Client) EtcdLeaveCluster(ctx context.Context, req *machineapi.EtcdLeaveClusterRequest, ...) error
- func (c *Client) EtcdMemberList(ctx context.Context, req *machineapi.EtcdMemberListRequest, ...) (*machineapi.EtcdMemberListResponse, error)
- func (c *Client) EtcdRecover(ctx context.Context, snapshot io.Reader, callOptions ...grpc.CallOption) (*machineapi.EtcdRecoverResponse, error)
- func (c *Client) EtcdRemoveMemberByID(ctx context.Context, req *machineapi.EtcdRemoveMemberByIDRequest, ...) error
- func (c *Client) EtcdSnapshot(ctx context.Context, req *machineapi.EtcdSnapshotRequest, ...) (io.ReadCloser, error)
- func (c *Client) EtcdStatus(ctx context.Context, opts ...grpc.CallOption) (*machineapi.EtcdStatusResponse, error)
- func (c *Client) Events(ctx context.Context, opts ...EventsOptionFunc) (stream machineapi.MachineService_EventsClient, err error)
- func (c *Client) EventsWatch(ctx context.Context, watchFunc func(<-chan Event), opts ...EventsOptionFunc) error
- func (c *Client) EventsWatchV2(ctx context.Context, ch chan<- EventResult, opts ...EventsOptionFunc) error
- func (c *Client) GenerateClientConfiguration(ctx context.Context, req *machineapi.GenerateClientConfigurationRequest, ...) (resp *machineapi.GenerateClientConfigurationResponse, err error)
- func (c *Client) GenerateConfiguration(ctx context.Context, req *machineapi.GenerateConfigurationRequest, ...) (resp *machineapi.GenerateConfigurationResponse, err error)
- func (c *Client) GetClusterName() string
- func (c *Client) GetConfigContext() *clientconfig.Context
- func (c *Client) GetEndpoints() []string
- func (c *Client) ImageList(ctx context.Context, namespace common.ContainerdNamespace, ...) (machineapi.MachineService_ImageListClient, error)
- func (c *Client) ImagePull(ctx context.Context, namespace common.ContainerdNamespace, imageRef string, ...) error
- func (c *Client) Kubeconfig(ctx context.Context) ([]byte, error)
- func (c *Client) KubeconfigRaw(ctx context.Context) (io.ReadCloser, error)
- func (c *Client) LS(ctx context.Context, req *machineapi.ListRequest) (stream machineapi.MachineService_ListClient, err error)
- func (c *Client) Logs(ctx context.Context, namespace string, driver common.ContainerDriver, ...) (stream machineapi.MachineService_LogsClient, err error)
- func (c *Client) LogsContainers(ctx context.Context, callOptions ...grpc.CallOption) (resp *machineapi.LogsContainersResponse, err error)
- func (c *Client) Memory(ctx context.Context, callOptions ...grpc.CallOption) (resp *machineapi.MemoryResponse, err error)
- func (c *Client) MetaDelete(ctx context.Context, key uint8, callOptions ...grpc.CallOption) error
- func (c *Client) MetaWrite(ctx context.Context, key uint8, value []byte, callOptions ...grpc.CallOption) error
- func (c *Client) Mounts(ctx context.Context, callOptions ...grpc.CallOption) (resp *machineapi.MountsResponse, err error)
- func (c *Client) Netstat(ctx context.Context, req *machineapi.NetstatRequest, ...) (*machineapi.NetstatResponse, error)
- func (c *Client) PacketCapture(ctx context.Context, req *machineapi.PacketCaptureRequest) (io.ReadCloser, error)
- func (c *Client) Processes(ctx context.Context, callOptions ...grpc.CallOption) (resp *machineapi.ProcessesResponse, err error)
- func (c *Client) Read(ctx context.Context, path string) (io.ReadCloser, error)
- func (c *Client) Reboot(ctx context.Context, opts ...RebootMode) error
- func (c *Client) RebootWithResponse(ctx context.Context, opts ...RebootMode) (*machineapi.RebootResponse, error)
- func (c *Client) Reset(ctx context.Context, graceful, reboot bool) (err error)
- func (c *Client) ResetGeneric(ctx context.Context, req *machineapi.ResetRequest) error
- func (c *Client) ResetGenericWithResponse(ctx context.Context, req *machineapi.ResetRequest) (*machineapi.ResetResponse, error)
- func (c *Client) ResolveResourceKind(ctx context.Context, resourceNamespace *resource.Namespace, ...) (*meta.ResourceDefinition, error)
- func (c *Client) Restart(ctx context.Context, namespace string, driver common.ContainerDriver, ...) (err error)
- func (c *Client) Rollback(ctx context.Context) (err error)
- func (c *Client) ServiceInfo(ctx context.Context, id string, callOptions ...grpc.CallOption) (services []ServiceInfo, err error)
- func (c *Client) ServiceList(ctx context.Context, callOptions ...grpc.CallOption) (resp *machineapi.ServiceListResponse, err error)
- func (c *Client) ServiceRestart(ctx context.Context, id string, callOptions ...grpc.CallOption) (resp *machineapi.ServiceRestartResponse, err error)
- func (c *Client) ServiceStart(ctx context.Context, id string, callOptions ...grpc.CallOption) (resp *machineapi.ServiceStartResponse, err error)
- func (c *Client) ServiceStop(ctx context.Context, id string, callOptions ...grpc.CallOption) (resp *machineapi.ServiceStopResponse, err error)
- func (c *Client) Shutdown(ctx context.Context, opts ...ShutdownOption) error
- func (c *Client) ShutdownWithResponse(ctx context.Context, opts ...ShutdownOption) (*machineapi.ShutdownResponse, error)
- func (c *Client) Stats(ctx context.Context, namespace string, driver common.ContainerDriver, ...) (resp *machineapi.StatsResponse, err error)
- func (c *Client) Time(ctx context.Context, callOptions ...grpc.CallOption) (resp *timeapi.TimeResponse, err error)
- func (c *Client) TimeCheck(ctx context.Context, server string, callOptions ...grpc.CallOption) (resp *timeapi.TimeResponse, err error)
- func (c *Client) Upgrade(ctx context.Context, image string, preserve, stage, force bool, ...) (*machineapi.UpgradeResponse, error)
- func (c *Client) UpgradeWithOptions(ctx context.Context, opts ...UpgradeOption) (*machineapi.UpgradeResponse, error)
- func (c *Client) Version(ctx context.Context, callOptions ...grpc.CallOption) (resp *machineapi.VersionResponse, err error)
- type Event
- type EventResult
- type EventsOptionFunc
- type InspectClient
- type MachineStream
- type Message
- type MessageResponse
- type NodeError
- type OptionFunc
- func WithCluster(cluster string) OptionFunc
- func WithConfig(cfg *clientconfig.Config) OptionFunc
- func WithConfigContext(cfg *clientconfig.Context) OptionFunc
- func WithConfigFromFile(fn string) OptionFunc
- func WithContextName(name string) OptionFunc
- func WithDefaultConfig() OptionFunc
- func WithEndpoints(endpoints ...string) OptionFunc
- func WithGRPCDialOptions(opts ...grpc.DialOption) OptionFunc
- func WithTLSConfig(tlsConfig *tls.Config) OptionFunc
- func WithUnixSocket(path string) OptionFunc
- type Options
- type RebootMode
- type ServiceInfo
- type ShutdownOption
- type UpgradeOption
- func WithUpgradeForce(force bool) UpgradeOption
- func WithUpgradeGRPCCallOptions(opts ...grpc.CallOption) UpgradeOption
- func WithUpgradeImage(image string) UpgradeOption
- func WithUpgradePreserve(preserve bool) UpgradeOption
- func WithUpgradeRebootMode(mode machineapi.UpgradeRequest_RebootMode) UpgradeOption
- func WithUpgradeStage(stage bool) UpgradeOption
- type UpgradeOptions
Constants ¶
This section is empty.
Variables ¶
var ErrEventNotSupported = errors.New("event is not supported")
ErrEventNotSupported is returned from the event decoder when we encounter an unknown event.
Functions ¶
func AddrFromPeer ¶
AddrFromPeer extracts peer address from grpc Peer.
func CertificateFromConfigContext ¶
func CertificateFromConfigContext(context *clientconfig.Context) (*tls.Certificate, error)
CertificateFromConfigContext constructs the client Credentials from the given configuration Context.
func FilterMessages ¶
func FilterMessages[V any, T Message[V], MR MessageResponse[V, T]](resp MR, err error) (MR, error)
FilterMessages removes error Messages from resp and builds multierror.
func ReadStream ¶
func ReadStream(stream MachineStream) (io.ReadCloser, error)
ReadStream converts grpc stream into io.Reader.
func RemotePeer ¶
RemotePeer parses remote peer address from grpc stream context.
func StatusCode ¶
StatusCode returns the Code of the error if it is a Status error, codes.OK if err is nil, or codes.Unknown otherwise correctly unwrapping wrapped errors.
StatusCode is mostly equivalent to grpc `status.Code` method, but it correctly unwraps wrapped errors including `multierror.Error` used when parsing multi-node responses.
func WithGRPCBasicAuth ¶
func WithGRPCBasicAuth(username, password string) grpc.DialOption
WithGRPCBasicAuth returns gRPC credentials for basic auth.
func WithNode ¶
WithNode wraps the context with metadata to send request to a single node.
Request will be proxied by the endpoint to the specified node without any further processing.
func WithNodes ¶
WithNodes wraps the context with metadata to send request to a set of nodes.
Responses from all nodes are aggregated by the `apid` service and sent back as a single response.
func WithPowerCycle ¶
func WithPowerCycle(req *machineapi.RebootRequest)
WithPowerCycle option runs the Reboot fun in powercycle mode.
Types ¶
type BasicAuth ¶
type BasicAuth struct {
// contains filtered or unexported fields
}
BasicAuth implements the credentials.PerRPCCredentials interface and holds credentials for Basic Auth.
func (BasicAuth) GetRequestMetadata ¶
func (c BasicAuth) GetRequestMetadata(ctx context.Context, url ...string) (map[string]string, error)
GetRequestMetadata implements credentials.PerGRPCCredentials.
func (BasicAuth) RequireTransportSecurity ¶
RequireTransportSecurity implements credentials.PerRPCCredentials.
type Client ¶
type Client struct { MachineClient machineapi.MachineServiceClient TimeClient timeapi.TimeServiceClient ClusterClient clusterapi.ClusterServiceClient StorageClient storageapi.StorageServiceClient InspectClient inspectapi.InspectServiceClient COSI state.State Inspect *InspectClient // contains filtered or unexported fields }
Client implements the proto.MachineServiceClient interface. It serves as the concrete type with the required methods.
func New ¶
func New(ctx context.Context, opts ...OptionFunc) (c *Client, err error)
New returns a new Client.
func (*Client) ApplyConfiguration ¶
func (c *Client) ApplyConfiguration(ctx context.Context, req *machineapi.ApplyConfigurationRequest, callOptions ...grpc.CallOption) (resp *machineapi.ApplyConfigurationResponse, err error)
ApplyConfiguration implements proto.MachineServiceClient interface.
func (*Client) Bootstrap ¶
func (c *Client) Bootstrap(ctx context.Context, req *machineapi.BootstrapRequest) (err error)
Bootstrap implements the proto.MachineServiceClient interface.
func (*Client) ClusterHealthCheck ¶
func (c *Client) ClusterHealthCheck(ctx context.Context, waitTimeout time.Duration, clusterInfo *clusterapi.ClusterInfo) (clusterapi.ClusterService_HealthCheckClient, error)
ClusterHealthCheck runs a Talos cluster health check.
func (*Client) Conn ¶
func (c *Client) Conn() *grpc.ClientConn
Conn returns underlying client connection.
func (*Client) Containers ¶
func (c *Client) Containers(ctx context.Context, namespace string, driver common.ContainerDriver, callOptions ...grpc.CallOption) (resp *machineapi.ContainersResponse, err error)
Containers implements the proto.MachineServiceClient interface.
func (*Client) Copy ¶
Copy implements the proto.MachineServiceClient interface.
This method doesn't support multiplexing of the result: * either client.WithNodes is not used, or it contains a single node in the list.
func (*Client) DiskUsage ¶
func (c *Client) DiskUsage(ctx context.Context, req *machineapi.DiskUsageRequest) (stream machineapi.MachineService_DiskUsageClient, err error)
DiskUsage implements the proto.MachineServiceClient interface.
func (*Client) Disks ¶
func (c *Client) Disks(ctx context.Context, callOptions ...grpc.CallOption) (resp *storageapi.DisksResponse, err error)
Disks returns the list of block devices.
func (*Client) Dmesg ¶
func (c *Client) Dmesg(ctx context.Context, follow, tail bool) (machineapi.MachineService_DmesgClient, error)
Dmesg implements the proto.MachineServiceClient interface.
func (*Client) EtcdAlarmDisarm ¶ added in v1.4.0
func (c *Client) EtcdAlarmDisarm(ctx context.Context, opts ...grpc.CallOption) (*machineapi.EtcdAlarmDisarmResponse, error)
EtcdAlarmDisarm disarms etcd alarms for the current node.
This method is available only on control plane nodes (which run etcd).
func (*Client) EtcdAlarmList ¶ added in v1.4.0
func (c *Client) EtcdAlarmList(ctx context.Context, opts ...grpc.CallOption) (*machineapi.EtcdAlarmListResponse, error)
EtcdAlarmList lists etcd alarms for the current node.
This method is available only on control plane nodes (which run etcd).
func (*Client) EtcdDefragment ¶ added in v1.4.0
func (c *Client) EtcdDefragment(ctx context.Context, opts ...grpc.CallOption) (*machineapi.EtcdDefragmentResponse, error)
EtcdDefragment defragments etcd data directory for the current node.
Defragmentation is a resource-heavy operation, so it should only run on a specific node.
This method is available only on control plane nodes (which run etcd).
func (*Client) EtcdForfeitLeadership ¶
func (c *Client) EtcdForfeitLeadership(ctx context.Context, req *machineapi.EtcdForfeitLeadershipRequest, callOptions ...grpc.CallOption) (*machineapi.EtcdForfeitLeadershipResponse, error)
EtcdForfeitLeadership makes node forfeit leadership in the etcd cluster.
func (*Client) EtcdLeaveCluster ¶
func (c *Client) EtcdLeaveCluster(ctx context.Context, req *machineapi.EtcdLeaveClusterRequest, callOptions ...grpc.CallOption) error
EtcdLeaveCluster makes node leave etcd cluster.
func (*Client) EtcdMemberList ¶
func (c *Client) EtcdMemberList(ctx context.Context, req *machineapi.EtcdMemberListRequest, callOptions ...grpc.CallOption) (*machineapi.EtcdMemberListResponse, error)
EtcdMemberList lists etcd members of the cluster.
func (*Client) EtcdRecover ¶
func (c *Client) EtcdRecover(ctx context.Context, snapshot io.Reader, callOptions ...grpc.CallOption) (*machineapi.EtcdRecoverResponse, error)
EtcdRecover uploads etcd snapshot created with EtcdSnapshot to the node.
func (*Client) EtcdRemoveMemberByID ¶
func (c *Client) EtcdRemoveMemberByID(ctx context.Context, req *machineapi.EtcdRemoveMemberByIDRequest, callOptions ...grpc.CallOption) error
EtcdRemoveMemberByID removes a node from etcd cluster by etcd member ID.
func (*Client) EtcdSnapshot ¶
func (c *Client) EtcdSnapshot(ctx context.Context, req *machineapi.EtcdSnapshotRequest, callOptions ...grpc.CallOption) (io.ReadCloser, error)
EtcdSnapshot receives a snapshot of the etcd from the node.
This method doesn't support multiplexing of the result: * either client.WithNodes is not used, or it contains a single node in the list.
func (*Client) EtcdStatus ¶ added in v1.4.0
func (c *Client) EtcdStatus(ctx context.Context, opts ...grpc.CallOption) (*machineapi.EtcdStatusResponse, error)
EtcdStatus returns etcd status for the current member.
This method is available only on control plane nodes (which run etcd).
func (*Client) Events ¶
func (c *Client) Events(ctx context.Context, opts ...EventsOptionFunc) (stream machineapi.MachineService_EventsClient, err error)
Events implements the proto.OSClient interface.
func (*Client) EventsWatch ¶
func (c *Client) EventsWatch(ctx context.Context, watchFunc func(<-chan Event), opts ...EventsOptionFunc) error
EventsWatch wraps Events by providing more simple interface.
func (*Client) EventsWatchV2 ¶
func (c *Client) EventsWatchV2(ctx context.Context, ch chan<- EventResult, opts ...EventsOptionFunc) error
EventsWatchV2 watches events of a single node and wraps the Events by providing a simpler interface. It blocks until the first (empty) event is received, then spawns a goroutine that sends events to the given channel. EventResult objects sent into the channel contain either the errors or the received events.
func (*Client) GenerateClientConfiguration ¶
func (c *Client) GenerateClientConfiguration(ctx context.Context, req *machineapi.GenerateClientConfigurationRequest, callOptions ...grpc.CallOption) (resp *machineapi.GenerateClientConfigurationResponse, err error)
GenerateClientConfiguration implements proto.MachineServiceClient interface.
func (*Client) GenerateConfiguration ¶
func (c *Client) GenerateConfiguration(ctx context.Context, req *machineapi.GenerateConfigurationRequest, callOptions ...grpc.CallOption) (resp *machineapi.GenerateConfigurationResponse, err error)
GenerateConfiguration implements proto.MachineServiceClient interface.
func (*Client) GetClusterName ¶
GetClusterName returns the client's cluster name from the override set with WithClustername or from the configuration.
func (*Client) GetConfigContext ¶
func (c *Client) GetConfigContext() *clientconfig.Context
GetConfigContext returns resolved config context.
func (*Client) GetEndpoints ¶
GetEndpoints returns the client's endpoints from the override set with WithEndpoints or from the configuration.
func (*Client) ImageList ¶ added in v1.5.0
func (c *Client) ImageList(ctx context.Context, namespace common.ContainerdNamespace, callOptions ...grpc.CallOption) (machineapi.MachineService_ImageListClient, error)
ImageList lists images in the CRI.
func (*Client) ImagePull ¶ added in v1.5.0
func (c *Client) ImagePull(ctx context.Context, namespace common.ContainerdNamespace, imageRef string, callOptions ...grpc.CallOption) error
ImagePull pre-pulls an image to the CRI.
func (*Client) Kubeconfig ¶
Kubeconfig returns K8s client config (kubeconfig).
func (*Client) KubeconfigRaw ¶
KubeconfigRaw returns K8s client config (kubeconfig).
This method doesn't support multiplexing of the result: * either client.WithNodes is not used, or it contains a single node in the list.
func (*Client) LS ¶
func (c *Client) LS(ctx context.Context, req *machineapi.ListRequest) (stream machineapi.MachineService_ListClient, err error)
LS implements the proto.MachineServiceClient interface.
func (*Client) Logs ¶
func (c *Client) Logs(ctx context.Context, namespace string, driver common.ContainerDriver, id string, follow bool, tailLines int32) (stream machineapi.MachineService_LogsClient, err error)
Logs implements the proto.MachineServiceClient interface.
func (*Client) LogsContainers ¶ added in v1.7.0
func (c *Client) LogsContainers(ctx context.Context, callOptions ...grpc.CallOption) (resp *machineapi.LogsContainersResponse, err error)
LogsContainers implements the proto.MachineServiceClient interface.
func (*Client) Memory ¶
func (c *Client) Memory(ctx context.Context, callOptions ...grpc.CallOption) (resp *machineapi.MemoryResponse, err error)
Memory implements the proto.MachineServiceClient interface.
func (*Client) MetaDelete ¶ added in v1.4.0
MetaDelete deletes a key from META storage.
func (*Client) MetaWrite ¶ added in v1.4.0
func (c *Client) MetaWrite(ctx context.Context, key uint8, value []byte, callOptions ...grpc.CallOption) error
MetaWrite writes a key to META storage.
func (*Client) Mounts ¶
func (c *Client) Mounts(ctx context.Context, callOptions ...grpc.CallOption) (resp *machineapi.MountsResponse, err error)
Mounts implements the proto.MachineServiceClient interface.
func (*Client) Netstat ¶ added in v1.4.0
func (c *Client) Netstat(ctx context.Context, req *machineapi.NetstatRequest, callOptions ...grpc.CallOption) (*machineapi.NetstatResponse, error)
Netstat lists the network sockets on the current node.
func (*Client) PacketCapture ¶
func (c *Client) PacketCapture(ctx context.Context, req *machineapi.PacketCaptureRequest) (io.ReadCloser, error)
PacketCapture implements the proto.MachineServiceClient interface.
This method doesn't support multiplexing of the result: * either client.WithNodes is not used, or it contains a single node in the list.
func (*Client) Processes ¶
func (c *Client) Processes(ctx context.Context, callOptions ...grpc.CallOption) (resp *machineapi.ProcessesResponse, err error)
Processes implements the proto.MachineServiceClient interface.
func (*Client) Read ¶
Read reads a file.
This method doesn't support multiplexing of the result: * either client.WithNodes is not used, or it contains a single node in the list.
func (*Client) Reboot ¶
func (c *Client) Reboot(ctx context.Context, opts ...RebootMode) error
Reboot implements the proto.MachineServiceClient interface.
func (*Client) RebootWithResponse ¶
func (c *Client) RebootWithResponse(ctx context.Context, opts ...RebootMode) (*machineapi.RebootResponse, error)
RebootWithResponse reboots the machine and returns the response.
func (*Client) ResetGeneric ¶
func (c *Client) ResetGeneric(ctx context.Context, req *machineapi.ResetRequest) error
ResetGeneric implements the proto.MachineServiceClient interface.
func (*Client) ResetGenericWithResponse ¶
func (c *Client) ResetGenericWithResponse(ctx context.Context, req *machineapi.ResetRequest) (*machineapi.ResetResponse, error)
ResetGenericWithResponse resets the machine and returns the response.
func (*Client) ResolveResourceKind ¶
func (c *Client) ResolveResourceKind(ctx context.Context, resourceNamespace *resource.Namespace, resourceType resource.Type) (*meta.ResourceDefinition, error)
ResolveResourceKind resolves potentially aliased 'resourceType' and replaces empty 'resourceNamespace' with the default namespace for the resource.
func (*Client) Restart ¶
func (c *Client) Restart(ctx context.Context, namespace string, driver common.ContainerDriver, id string, callOptions ...grpc.CallOption) (err error)
Restart implements the proto.MachineServiceClient interface.
func (*Client) ServiceInfo ¶
func (c *Client) ServiceInfo(ctx context.Context, id string, callOptions ...grpc.CallOption) (services []ServiceInfo, err error)
ServiceInfo returns info about a single service
This is implemented via service list API, as we don't have many services If service with given id is not registered, function returns nil.
func (*Client) ServiceList ¶
func (c *Client) ServiceList(ctx context.Context, callOptions ...grpc.CallOption) (resp *machineapi.ServiceListResponse, err error)
ServiceList returns list of services with their state.
func (*Client) ServiceRestart ¶
func (c *Client) ServiceRestart(ctx context.Context, id string, callOptions ...grpc.CallOption) (resp *machineapi.ServiceRestartResponse, err error)
ServiceRestart restarts a service.
func (*Client) ServiceStart ¶
func (c *Client) ServiceStart(ctx context.Context, id string, callOptions ...grpc.CallOption) (resp *machineapi.ServiceStartResponse, err error)
ServiceStart starts a service.
func (*Client) ServiceStop ¶
func (c *Client) ServiceStop(ctx context.Context, id string, callOptions ...grpc.CallOption) (resp *machineapi.ServiceStopResponse, err error)
ServiceStop stops a service.
func (*Client) Shutdown ¶
func (c *Client) Shutdown(ctx context.Context, opts ...ShutdownOption) error
Shutdown implements the proto.MachineServiceClient interface.
func (*Client) ShutdownWithResponse ¶
func (c *Client) ShutdownWithResponse(ctx context.Context, opts ...ShutdownOption) (*machineapi.ShutdownResponse, error)
ShutdownWithResponse shuts down the machine and returns the response.
func (*Client) Stats ¶
func (c *Client) Stats(ctx context.Context, namespace string, driver common.ContainerDriver, callOptions ...grpc.CallOption) (resp *machineapi.StatsResponse, err error)
Stats implements the proto.MachineServiceClient interface.
func (*Client) Time ¶
func (c *Client) Time(ctx context.Context, callOptions ...grpc.CallOption) (resp *timeapi.TimeResponse, err error)
Time returns the time.
func (*Client) TimeCheck ¶
func (c *Client) TimeCheck(ctx context.Context, server string, callOptions ...grpc.CallOption) (resp *timeapi.TimeResponse, err error)
TimeCheck returns the time compared to the specified ntp server.
func (*Client) Upgrade ¶
func (c *Client) Upgrade(ctx context.Context, image string, preserve, stage, force bool, callOptions ...grpc.CallOption) (*machineapi.UpgradeResponse, error)
Upgrade initiates a Talos upgrade and implements the proto.MachineServiceClient interface.
func (*Client) UpgradeWithOptions ¶ added in v1.5.0
func (c *Client) UpgradeWithOptions(ctx context.Context, opts ...UpgradeOption) (*machineapi.UpgradeResponse, error)
UpgradeWithOptions initiates a Talos upgrade with the given options.
func (*Client) Version ¶
func (c *Client) Version(ctx context.Context, callOptions ...grpc.CallOption) (resp *machineapi.VersionResponse, err error)
Version implements the proto.MachineServiceClient interface.
type Event ¶
Event as received from the API.
func UnmarshalEvent ¶
func UnmarshalEvent(event *machineapi.Event) (*Event, error)
UnmarshalEvent decodes the event coming from the gRPC stream from any to the exact type.
type EventResult ¶
type EventResult struct { // Event is the event that was received. Event Event // Err is the error that occurred. Error error }
EventResult is the result of an event watch, containing either an Event or an error.
type EventsOptionFunc ¶
type EventsOptionFunc func(opts *machineapi.EventsRequest)
EventsOptionFunc defines the options for the Events API.
func WithActorID ¶
func WithActorID(actorID string) EventsOptionFunc
WithActorID sets up Watcher to return events with the specified actor ID.
func WithTailDuration ¶
func WithTailDuration(dur time.Duration) EventsOptionFunc
WithTailDuration sets up Watcher to return events with timestamp >= (now - tailDuration).
func WithTailEvents ¶
func WithTailEvents(number int32) EventsOptionFunc
WithTailEvents sets up Events API to return specified number of past events.
If number is negative, all the available past events are returned.
func WithTailID ¶
func WithTailID(id string) EventsOptionFunc
WithTailID sets up Events API to return events with ID > TailID.
type InspectClient ¶
type InspectClient struct {
// contains filtered or unexported fields
}
InspectClient provides access to inspect API.
func (*InspectClient) ControllerRuntimeDependencies ¶
func (c *InspectClient) ControllerRuntimeDependencies(ctx context.Context, callOptions ...grpc.CallOption) (*inspectapi.ControllerRuntimeDependenciesResponse, error)
ControllerRuntimeDependencies returns graph describing dependencies between controllers.
type MachineStream ¶
type MachineStream interface { Recv() (*common.Data, error) grpc.ClientStream }
MachineStream is a common interface for streams returned by streaming APIs.
type MessageResponse ¶ added in v1.8.0
MessageResponse is a generic interface for response with Messages.
type OptionFunc ¶
OptionFunc sets an option for the creation of the Client.
func WithCluster ¶
func WithCluster(cluster string) OptionFunc
WithCluster creates a Client which connects to the named cluster.
func WithConfig ¶
func WithConfig(cfg *clientconfig.Config) OptionFunc
WithConfig configures the Client with the configuration provided. Additionally use WithContextName to override the default context in the Config.
func WithConfigContext ¶
func WithConfigContext(cfg *clientconfig.Context) OptionFunc
WithConfigContext configures the Client with the configuration context provided.
func WithConfigFromFile ¶
func WithConfigFromFile(fn string) OptionFunc
WithConfigFromFile creates a Client with its configuration extracted from the given file. Additionally use WithContextName to select a context other than the default.
func WithContextName ¶
func WithContextName(name string) OptionFunc
WithContextName overrides the default context inside a provided client Config.
func WithDefaultConfig ¶
func WithDefaultConfig() OptionFunc
WithDefaultConfig creates a Client with its configuration sourced from the default config file location. Additionally use WithContextName to select a context other than the default.
func WithEndpoints ¶
func WithEndpoints(endpoints ...string) OptionFunc
WithEndpoints overrides the default endpoints with the provided list.
func WithGRPCDialOptions ¶
func WithGRPCDialOptions(opts ...grpc.DialOption) OptionFunc
WithGRPCDialOptions adds the given grpc.DialOptions to a Client.
func WithTLSConfig ¶
func WithTLSConfig(tlsConfig *tls.Config) OptionFunc
WithTLSConfig overrides the default TLS configuration with the one provided.
func WithUnixSocket ¶
func WithUnixSocket(path string) OptionFunc
WithUnixSocket creates a Client which connects to apid over local file socket.
This option disables config parsing and TLS.
Connection over unix socket is only used within the Talos node.
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options contains the set of client configuration options.
type RebootMode ¶
type RebootMode func(*machineapi.RebootRequest)
RebootMode provides various mode through which the reboot process can be done.
type ServiceInfo ¶
type ServiceInfo struct { Metadata *common.Metadata Service *machineapi.ServiceInfo }
ServiceInfo provides info about a service and node metadata.
type ShutdownOption ¶
type ShutdownOption func(*machineapi.ShutdownRequest)
ShutdownOption provides shutdown API options.
func WithShutdownForce ¶
func WithShutdownForce(force bool) ShutdownOption
WithShutdownForce forces the shutdown even if the Kubernetes API is down.
type UpgradeOption ¶ added in v1.5.0
type UpgradeOption func(*UpgradeOptions)
UpgradeOption provides upgrade API options.
func WithUpgradeForce ¶ added in v1.5.0
func WithUpgradeForce(force bool) UpgradeOption
WithUpgradeForce sets the force flag for the upgrade.
func WithUpgradeGRPCCallOptions ¶ added in v1.5.0
func WithUpgradeGRPCCallOptions(opts ...grpc.CallOption) UpgradeOption
WithUpgradeGRPCCallOptions sets the gRPC call options for the upgrade.
func WithUpgradeImage ¶ added in v1.5.0
func WithUpgradeImage(image string) UpgradeOption
WithUpgradeImage sets the image for the upgrade.
func WithUpgradePreserve ¶ added in v1.5.0
func WithUpgradePreserve(preserve bool) UpgradeOption
WithUpgradePreserve sets the preserve flag for the upgrade.
func WithUpgradeRebootMode ¶ added in v1.5.0
func WithUpgradeRebootMode(mode machineapi.UpgradeRequest_RebootMode) UpgradeOption
WithUpgradeRebootMode sets the reboot mode for the upgrade.
func WithUpgradeStage ¶ added in v1.5.0
func WithUpgradeStage(stage bool) UpgradeOption
WithUpgradeStage sets the stage flag for the upgrade.
type UpgradeOptions ¶ added in v1.5.0
type UpgradeOptions struct { Request machineapi.UpgradeRequest GRPCCallOptions []grpc.CallOption }
UpgradeOptions provides upgrade API options.