kube

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	KubeClient kubernetes.Interface
}

Client encapsulates a client for a Kubernetes cluster.

func NewClient

func NewClient(opts ...Option) (*Client, error)

NewClient builds a kubernetes client to interact with the live cluster. The kube config file path or the kubeconfig yaml must be specified If not specified, defaults are assumed - configPath: ~/.kube/config, configContext: current context

func (*Client) FetchObjects

func (c *Client) FetchObjects(ctx context.Context) (*Objects, error)

FetchObjects returns the objects from a Kubernetes cluster. ctx is currently unused during API calls. More info: https://github.com/kubernetes/community/pull/1166

type Identifier

type Identifier struct {
	Name      string
	Namespace string
}

Identifier is used to identify a specific namspace scoped object.

type Objects

type Objects struct {
	Nodes                           *corev1.NodeList
	PersistentVolumes               *corev1.PersistentVolumeList
	ComponentStatuses               *corev1.ComponentStatusList
	SystemNamespace                 *corev1.Namespace
	Pods                            *corev1.PodList
	PodTemplates                    *corev1.PodTemplateList
	PersistentVolumeClaims          *corev1.PersistentVolumeClaimList
	ConfigMaps                      *corev1.ConfigMapList
	Services                        *corev1.ServiceList
	Secrets                         *corev1.SecretList
	ServiceAccounts                 *corev1.ServiceAccountList
	ResourceQuotas                  *corev1.ResourceQuotaList
	LimitRanges                     *corev1.LimitRangeList
	MutatingWebhookConfigurations   *ar.MutatingWebhookConfigurationList
	ValidatingWebhookConfigurations *ar.ValidatingWebhookConfigurationList
	Namespaces                      *corev1.NamespaceList
}

Objects encapsulates all the objects from a Kubernetes cluster.

type Option

type Option func(*options) error

Option function that allows injecting options while building kube.Client.

func WithConfigFile

func WithConfigFile(path string) Option

WithConfigFile returns an Option injected with a config file path.

func WithKubeContext

func WithKubeContext(kubeContext string) Option

WithKubeContext returns an Option injected with a kubernetes context.

func WithMergedConfigFiles added in v0.1.1

func WithMergedConfigFiles(paths []string) Option

WithMergedConfigFiles returns an Option injected with value of $KUBECONFIG

func WithTimeout

func WithTimeout(t time.Duration) Option

WithTimeout returns an Option injected with a timeout option while building client.

func WithYaml

func WithYaml(yaml []byte) Option

WithYaml returns an Option injected with a kubeconfig yaml.

Jump to

Keyboard shortcuts

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