k8s

package
v0.1.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package k8s provides datagatherers for different parts of the Kubernetes API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDynamicClient

func NewDynamicClient(kubeconfigPath string) (dynamic.Interface, error)

NewDynamicClient creates a new 'dynamic' clientset using the provided kubeconfig. If kubeconfigPath is not set/empty, it will attempt to load the InClusterConfig.

Types

type Config

type Config struct {
	// KubeConfigPath is the path to the kubeconfig file. If empty, will assume it runs in-cluster.
	KubeConfigPath string `yaml:"kubeconfig"`
	// GroupVersionResource identifies the resource type to gather.
	GroupVersionResource schema.GroupVersionResource
}

Config contains the configuration for the data-gatherer.

func (*Config) NewDataGatherer

func (c *Config) NewDataGatherer(ctx context.Context) (datagatherer.DataGatherer, error)

NewDataGatherer constructs a new instance of the generic K8s data-gatherer for the provided GroupVersionResource.

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshals the Config resolving GroupVersionResource.

type DataGatherer

type DataGatherer struct {
	// contains filtered or unexported fields
}

DataGatherer is a generic gatherer for Kubernetes. It knows how to request a list of generic resources from the Kubernetes apiserver. It does not deserialize the objects into structured data, instead utilising the Kubernetes `Unstructured` type for data handling. This is to allow us to support arbitrary CRDs and resources that Preflight does not have registered as part of its `runtime.Scheme`.

func (*DataGatherer) Fetch

func (g *DataGatherer) Fetch() (interface{}, error)

Fetch will fetch the requested data from the apiserver, or return an error if fetching the data fails.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL