client

package
v0.20.0-m1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewProducerFromRestConfig = func(config *rest.Config) (Producer, error) {
	var err error
	p := &DefaultProducer{}

	p.KubeClient, err = kubernetes.NewForConfig(config)
	if err != nil {
		return nil, errors.Wrap(err, "error creating kube client")
	}

	p.DynamicClient, err = dynamic.NewForConfig(config)
	if err != nil {
		return nil, errors.Wrap(err, "error creating dynamic client")
	}

	p.GeneralClient, err = client.New(config, client.Options{})
	if err != nil {
		return nil, errors.Wrap(err, "error creating controller client")
	}

	return p, nil
}

Functions

This section is empty.

Types

type DefaultProducer

type DefaultProducer struct {
	KubeClient    kubernetes.Interface
	DynamicClient dynamic.Interface
	GeneralClient client.Client
}

func (*DefaultProducer) ForDynamic

func (p *DefaultProducer) ForDynamic() dynamic.Interface

func (*DefaultProducer) ForGeneral

func (p *DefaultProducer) ForGeneral() client.Client

func (*DefaultProducer) ForKubernetes

func (p *DefaultProducer) ForKubernetes() kubernetes.Interface

type Producer

type Producer interface {
	// This is a general client that can be used for any resource type and for most operations.
	ForGeneral() client.Client

	// This is needed for operations that aren't supported by the general client (eg, accessing subresources like pod logs).
	ForKubernetes() kubernetes.Interface

	// While the general client supports Unstructured, this client provides a direct API via GVR which may be easier or
	// preferable in some cases.
	ForDynamic() dynamic.Interface
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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