Documentation ¶
Overview ¶
Package cluster provides functions to access, check and inspect Talos clusters.
Index ¶
- Constants
- Variables
- func GetKubernetesSupportBundle(ctx context.Context, options *BundleOptions) error
- func GetNodeSupportBundle(ctx context.Context, options *BundleOptions) error
- func MapProvisionNodeInfosToNodeInfosByType(nodes []provision.NodeInfo) (map[machine.Type][]NodeInfo, error)
- func NodesMatch(expected, actual []NodeInfo) error
- type APIBootstrapper
- type APICrashDumper
- type ApplyConfigClient
- type Bootstrapper
- type BundleArchive
- type BundleError
- type BundleOptions
- type BundleProgress
- type ClientProvider
- type ConfigClientProvider
- type CrashDumper
- type Info
- type K8sProvider
- type KubernetesClient
- func (k *KubernetesClient) K8sClient(ctx context.Context) (*kubernetes.Clientset, error)
- func (k *KubernetesClient) K8sClose() error
- func (k *KubernetesClient) K8sHelper(ctx context.Context) (*k8s.Client, error)
- func (k *KubernetesClient) K8sRestConfig(ctx context.Context) (*rest.Config, error)
- func (k *KubernetesClient) Kubeconfig(ctx context.Context) ([]byte, error)
- type KubernetesFromKubeletClient
- type LocalClientProvider
- type NodeInfo
Constants ¶
const DefaultServiceLogTailLines = 100
DefaultServiceLogTailLines specifies number of log lines to tail from each service.
Variables ¶
var LogLinesPerService = map[string]int32{
"etcd": 5000,
}
LogLinesPerService customizes defaults for specific services.
Functions ¶
func GetKubernetesSupportBundle ¶
func GetKubernetesSupportBundle(ctx context.Context, options *BundleOptions) error
GetKubernetesSupportBundle writes cluster wide kubernetes information into a zip archive.
func GetNodeSupportBundle ¶
func GetNodeSupportBundle(ctx context.Context, options *BundleOptions) error
GetNodeSupportBundle writes all node information we can gather into a zip archive.
func MapProvisionNodeInfosToNodeInfosByType ¶
func MapProvisionNodeInfosToNodeInfosByType(nodes []provision.NodeInfo) (map[machine.Type][]NodeInfo, error)
MapProvisionNodeInfosToNodeInfosByType maps provision.NodeInfos to cluster.NodeInfos, grouping them by machine type.
func NodesMatch ¶
NodesMatch asserts that the provided expected set of nodes match the actual set of nodes.
Each expectedNode IPs should have a non-empty intersection with actualNode IPs.
Types ¶
type APIBootstrapper ¶
type APIBootstrapper struct { ClientProvider Info }
APIBootstrapper bootstraps cluster via Talos API.
func (*APIBootstrapper) ApplyConfig ¶
func (s *APIBootstrapper) ApplyConfig(ctx context.Context, nodes []provision.NodeRequest, out io.Writer) error
ApplyConfig on the node via the API using insecure mode.
type APICrashDumper ¶
type APICrashDumper struct { ClientProvider Info }
APICrashDumper collects crash dump via Talos API.
type ApplyConfigClient ¶
type ApplyConfigClient struct { ClientProvider Info }
ApplyConfigClient client to apply config.
type Bootstrapper ¶
Bootstrapper performs Talos cluster bootstrap.
type BundleArchive ¶
BundleArchive wraps archive writer in a thread safe implementation.
type BundleError ¶
type BundleError struct { Source string // contains filtered or unexported fields }
BundleError wraps all bundle collection errors and adds source context.
func (*BundleError) Error ¶
func (b *BundleError) Error() string
type BundleOptions ¶
type BundleOptions struct { LogOutput io.Writer NumWorkers int Source string Client *client.Client Archive *BundleArchive Progress chan BundleProgress // contains filtered or unexported fields }
BundleOptions defines GetSupportBundle options.
func (*BundleOptions) Log ¶
func (options *BundleOptions) Log(line string, args ...interface{})
Log writes the line to logger or to stdout if no logger was provided.
type BundleProgress ¶
BundleProgress reports current bundle collection progress.
type ClientProvider ¶
type ClientProvider interface { // Client returns Talos client instance for default (if no endpoints are given) or // specific endpoint. Client(endpoints ...string) (*client.Client, error) // Close client connections. Close() error }
ClientProvider builds Talos client by endpoint.
Client instance should be cached and closed when Close() is called.
type ConfigClientProvider ¶
type ConfigClientProvider struct { // DefaultClient to be used when using default endpoints. // // Not required, if missing client will be constructed from the config. DefaultClient *client.Client // TalosConfig is a client Talos configuration. TalosConfig *clientconfig.Config // contains filtered or unexported fields }
ConfigClientProvider builds Talos client from client config.
func (*ConfigClientProvider) Client ¶
func (c *ConfigClientProvider) Client(endpoints ...string) (*client.Client, error)
Client returns Talos client instance for default (if no endpoints are given) or specific endpoints.
Client implements ClientProvider interface.
func (*ConfigClientProvider) Close ¶
func (c *ConfigClientProvider) Close() error
Close all the client connections.
type CrashDumper ¶
CrashDumper captures Talos cluster state to the specified writer for debugging.
type Info ¶
type Info interface { // Nodes returns list of all node infos. Nodes() []NodeInfo // NodesByType return list of node endpoints by type. NodesByType(machine.Type) []NodeInfo }
Info describes the Talos cluster.
type K8sProvider ¶
type K8sProvider interface { Kubeconfig(ctx context.Context) ([]byte, error) K8sRestConfig(ctx context.Context) (*rest.Config, error) K8sClient(ctx context.Context) (*kubernetes.Clientset, error) K8sHelper(ctx context.Context) (*k8s.Client, error) K8sClose() error }
K8sProvider builds Kubernetes client to access Talos cluster.
type KubernetesClient ¶
type KubernetesClient struct { // Base Talos client provider. ClientProvider // ForceEndpoint overrides default Kubernetes API endpoint. ForceEndpoint string KubeHelper *k8s.Client // contains filtered or unexported fields }
KubernetesClient provides Kubernetes client built via Talos API Kubeconfig.
func (*KubernetesClient) K8sClient ¶
func (k *KubernetesClient) K8sClient(ctx context.Context) (*kubernetes.Clientset, error)
K8sClient builds Kubernetes client via Talos Kubeconfig API.
Kubernetes client instance is cached.
func (*KubernetesClient) K8sClose ¶
func (k *KubernetesClient) K8sClose() error
K8sClose closes Kubernetes client.
func (*KubernetesClient) K8sRestConfig ¶
K8sRestConfig returns *rest.Config (parsed kubeconfig).
func (*KubernetesClient) Kubeconfig ¶
func (k *KubernetesClient) Kubeconfig(ctx context.Context) ([]byte, error)
Kubeconfig returns raw kubeconfig.
Kubeconfig is cached.
type KubernetesFromKubeletClient ¶
type KubernetesFromKubeletClient struct { KubeHelper *kubernetes.Client // contains filtered or unexported fields }
KubernetesFromKubeletClient provides Kubernetes client built from local kubelet config.
func (*KubernetesFromKubeletClient) K8sClient ¶
K8sClient builds Kubernetes client from local kubelet config.
Kubernetes client instance is cached.
func (*KubernetesFromKubeletClient) K8sClose ¶
func (k *KubernetesFromKubeletClient) K8sClose() error
K8sClose closes Kubernetes client.
func (*KubernetesFromKubeletClient) K8sHelper ¶
func (k *KubernetesFromKubeletClient) K8sHelper(ctx context.Context) (*kubernetes.Client, error)
K8sHelper returns wrapper around K8sClient.
type LocalClientProvider ¶
type LocalClientProvider struct {
// contains filtered or unexported fields
}
LocalClientProvider builds Talos client to connect to same-node apid instance over file socket.
func (*LocalClientProvider) Client ¶
func (c *LocalClientProvider) Client(endpoints ...string) (*client.Client, error)
Client returns Talos client instance for default (if no endpoints are given) or specific endpoints.
Client implements ClientProvider interface.
func (*LocalClientProvider) Close ¶
func (c *LocalClientProvider) Close() error
Close all the client connections.
type NodeInfo ¶
NodeInfo describes a Talos node.
func IPToNodeInfo ¶
IPToNodeInfo converts a node internal IP to a NodeInfo.
func IPsToNodeInfos ¶
IPsToNodeInfos converts list of IPs to a list of NodeInfos.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package check provides set of checks to verify cluster readiness.
|
Package check provides set of checks to verify cluster readiness. |
Package kubernetes provides cluster-wide kubernetes utilities.
|
Package kubernetes provides cluster-wide kubernetes utilities. |
Package sonobuoy provides functions to run Kubernetes e2e tests.
|
Package sonobuoy provides functions to run Kubernetes e2e tests. |