apiserver

package
v0.0.0-...-b2dbf94 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AuthTypeNone means no auth is required
	AuthTypeNone AuthType = "none"
	// AuthTypeServiceAccount means to use the built-in service account that
	// K8s automatically provisions for each pod.
	AuthTypeServiceAccount AuthType = "serviceAccount"
	// AuthTypeKubeConfig uses local credentials like those used by kubectl.
	AuthTypeKubeConfig AuthType = "kubeConfig"
	// DefaultKubeConfigPath Default kubeconfig path
	DefaultKubeConfigPath string = "~/.kube/config"
)

Variables

This section is empty.

Functions

func MakeClient

func MakeClient(apiConf APIConfig) (*k8s.Clientset, string, error)

MakeClient can take configuration if needed for other types of auth

Types

type APIConfig

type APIConfig struct {
	// How to authenticate to the K8s API server.  This can be one of `none`
	// (for no auth), `serviceAccount` (to use the standard service account
	// token provided to the agent pod), or `kubeConfig` to use credentials
	// from user-defined file
	AuthType     AuthType `mapstructure:"auth_type"`
	AuthFilePath string
}

APIConfig contains options relevant to connecting to the K8s API

func (APIConfig) Validate

func (c APIConfig) Validate() error

Validate validates the K8s API config

type AuthType

type AuthType string

AuthType describes the type of authentication to use for the K8s API

type IWatcher

type IWatcher interface {
	Init(
		ctx context.Context,
		client *kubernetes.Clientset,
		factory informers.SharedInformerFactory,
		namespace string,
		handlersMap ResourceHandlersMap,
	)
	Run()
}

type NodeWatcher

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

func (*NodeWatcher) Init

func (w *NodeWatcher) Init(ctx context.Context, client *kubernetes.Clientset, factory informers.SharedInformerFactory, namespace string, handlersMap ResourceHandlersMap)

func (*NodeWatcher) Run

func (w *NodeWatcher) Run()

type PodWatcher

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

func (*PodWatcher) Init

func (w *PodWatcher) Init(
	ctx context.Context,
	client *kubernetes.Clientset,
	factory informers.SharedInformerFactory,
	namespace string,
	handlersMap ResourceHandlersMap,
)

func (*PodWatcher) Run

func (w *PodWatcher) Run()

type ResourceHandlersMap

type ResourceHandlersMap map[resource.ResType][]resource.ResHandler

type ServiceWatcher

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

func (*ServiceWatcher) Init

func (w *ServiceWatcher) Init(
	ctx context.Context,
	client *kubernetes.Clientset,
	factory informers.SharedInformerFactory,
	namespace string,
	handlersMap ResourceHandlersMap,
)

func (*ServiceWatcher) Run

func (w *ServiceWatcher) Run()

type Watchers

type Watchers struct {
	Watchers   map[resource.ResType]IWatcher
	HandlerMap ResourceHandlersMap

	K8sConfig APIConfig
	ClusterID string

	HttpServer     *server.HTTPServer
	ExportResource resource.Exporter
	// contains filtered or unexported fields
}
var K8sWatcher Watchers = Watchers{
	Watchers:       map[resource.ResType]IWatcher{},
	HandlerMap:     map[resource.ResType][]resource.ResHandler{},
	ExportResource: export.NonExporter,
	// contains filtered or unexported fields
}

func (*Watchers) Handlers

func (w *Watchers) Handlers() map[string]http.HandlerFunc

func (*Watchers) Run

func (w *Watchers) Run() error

func (*Watchers) Stop

func (w *Watchers) Stop() error

func (*Watchers) WithExporter

func (w *Watchers) WithExporter(exportResource resource.Exporter) *Watchers

func (*Watchers) WithExporters

func (w *Watchers) WithExporters(exporters ...resource.Exporter) *Watchers

func (*Watchers) WithHandler

func (w *Watchers) WithHandler(resType resource.ResType, handler resource.ResHandler) *Watchers

func (*Watchers) WithHttpServer

func (w *Watchers) WithHttpServer(s *server.HTTPServer) *Watchers

Jump to

Keyboard shortcuts

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