Documentation ¶
Overview ¶
Package k8s provides functionalities to interact with the Kubernetes API server
Index ¶
- Constants
- func FetchBastionIpAddress(clusterName, namespace, kubeConfigPath string) (string, error)
- func FetchWorkloadConfig(clusterName, clusterNamespace, mgmtKubeConfigPath string) (string, error)
- func GetNodeAddresses(ctx context.Context, kubeconfigPath string, names, labels []string) ([]string, error)
- type Client
- type Config
- type Container
- type ContainerLogsImpl
- type KubeConfig
- type ObjectWriter
- type ResultWriter
- type SearchParams
- type SearchResult
Constants ¶
View Source
const BaseDirname = "kubecapture"
View Source
const (
LegacyGroupName = "core"
)
Variables ¶
This section is empty.
Functions ¶
func FetchBastionIpAddress ¶ added in v0.3.0
func FetchWorkloadConfig ¶ added in v0.3.0
FetchWorkloadConfig...
Types ¶
type Client ¶ added in v0.2.0
type Client struct { Client dynamic.Interface Disco discovery.DiscoveryInterface CoreRest rest.Interface Mapper meta.RESTMapper JsonPrinter printers.JSONPrinter }
Client prepares and exposes a dynamic, discovery, and Rest clients
func New ¶ added in v0.2.0
New returns a *Client built with the kubecontext file path and an optional (at most one) K8s CLI context name.
func (*Client) Search ¶ added in v0.2.1
func (k8sc *Client) Search(ctx context.Context, params SearchParams) ([]SearchResult, error)
type Config ¶ added in v0.3.0
func LoadKubeCfg ¶ added in v0.3.0
type Container ¶ added in v0.3.0
type Container interface { Fetch(context.Context, rest.Interface) (io.ReadCloser, error) Write(io.ReadCloser, string) error }
func GetContainers ¶ added in v0.3.0
func GetContainers(podItem unstructured.Unstructured) ([]Container, error)
type ContainerLogsImpl ¶ added in v0.3.0
type ContainerLogsImpl struct {
// contains filtered or unexported fields
}
func NewContainerLogger ¶ added in v0.3.0
func NewContainerLogger(namespace, podName string, container corev1.Container) ContainerLogsImpl
func (ContainerLogsImpl) Fetch ¶ added in v0.3.0
func (c ContainerLogsImpl) Fetch(ctx context.Context, restApi rest.Interface) (io.ReadCloser, error)
func (ContainerLogsImpl) Write ¶ added in v0.3.0
func (c ContainerLogsImpl) Write(reader io.ReadCloser, rootDir string) error
type KubeConfig ¶ added in v0.3.0
type KubeConfig struct {
// contains filtered or unexported fields
}
func (*KubeConfig) GetClusterName ¶ added in v0.3.0
func (kcfg *KubeConfig) GetClusterName() (string, error)
func (*KubeConfig) GetCurrentContext ¶ added in v0.3.0
func (kcfg *KubeConfig) GetCurrentContext() string
type ObjectWriter ¶ added in v0.3.0
type ObjectWriter struct {
// contains filtered or unexported fields
}
func (ObjectWriter) Write ¶ added in v0.3.0
func (w ObjectWriter) Write(result SearchResult) (string, error)
type ResultWriter ¶ added in v0.3.0
type ResultWriter struct {
// contains filtered or unexported fields
}
func NewResultWriter ¶ added in v0.3.0
func NewResultWriter(workdir, what string, restApi rest.Interface) (*ResultWriter, error)
func (*ResultWriter) GetResultDir ¶ added in v0.3.0
func (w *ResultWriter) GetResultDir() string
func (*ResultWriter) Write ¶ added in v0.3.0
func (w *ResultWriter) Write(ctx context.Context, searchResults []SearchResult) error
type SearchParams ¶ added in v0.3.0
type SearchParams struct { Groups []string Categories []string Kinds []string Namespaces []string Versions []string Names []string Labels []string Containers []string }
func NewSearchParams ¶ added in v0.3.0
func NewSearchParams(p *starlarkstruct.Struct) SearchParams
TODO: Change this to accept a string dictionary instead
func (SearchParams) ContainsContainer ¶ added in v0.3.0
func (sp SearchParams) ContainsContainer(container string) bool
func (SearchParams) ContainsGroup ¶ added in v0.3.0
func (sp SearchParams) ContainsGroup(group string) bool
func (SearchParams) ContainsKind ¶ added in v0.3.0
func (sp SearchParams) ContainsKind(kind string) bool
func (SearchParams) ContainsName ¶ added in v0.3.0
func (sp SearchParams) ContainsName(name string) bool
func (SearchParams) ContainsVersion ¶ added in v0.3.0
func (sp SearchParams) ContainsVersion(version string) bool
type SearchResult ¶ added in v0.2.2
type SearchResult struct { ListKind string ResourceName string ResourceKind string GroupVersionResource schema.GroupVersionResource List *unstructured.UnstructuredList Namespaced bool Namespace string }
SearchResult is the object representation of the kubernetes objects returned by querying the API server
func (SearchResult) ToStarlarkValue ¶ added in v0.3.0
func (sr SearchResult) ToStarlarkValue() *starlarkstruct.Struct
ToStarlarkValue converts the SearchResult object to a starlark dictionary
Click to show internal directories.
Click to hide internal directories.