args

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

The args package contains arguments for running controllers and admission webhooks

Example
package main

import (
	"flag"
	"github.com/kubernetes-sigs/kubebuilder/pkg/config"
	"github.com/kubernetes-sigs/kubebuilder/pkg/inject/args"
)

func main() {
	flag.Parse()
	config := config.GetConfigOrDie()

	// Create base arguments for initializing controllers
	var _ = args.CreateInjectArgs(config)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InjectArgs

type InjectArgs struct {
	// Config is the rest config to talk to an API server
	Config *rest.Config

	// KubernetesClientSet is a clientset to talk to Kuberntes apis
	KubernetesClientSet kubernetes.Interface

	// KubernetesInformers contains a Kubernetes informers factory
	KubernetesInformers informers.SharedInformerFactory

	// ControllerManager is the controller manager
	ControllerManager *controller.ControllerManager

	// EventBroadcaster
	EventBroadcaster record.EventBroadcaster
}

InjectArgs are the common arguments for initializing controllers and admission hooks

func CreateInjectArgs

func CreateInjectArgs(config *rest.Config) InjectArgs

CreateInjectArgs returns new arguments for initializing objects

Example
package main

import (
	"flag"
	"github.com/kubernetes-sigs/kubebuilder/pkg/config"
	"github.com/kubernetes-sigs/kubebuilder/pkg/inject/args"
)

func main() {
	flag.Parse()
	config := config.GetConfigOrDie()

	// Create base arguments for initializing controllers
	var _ = args.CreateInjectArgs(config)
}
Output:

func (InjectArgs) CreateRecorder

func (iargs InjectArgs) CreateRecorder(name string) record.EventRecorder

CreateRecorder returns a new recorder

Example
package main

import (
	"flag"
	"github.com/kubernetes-sigs/kubebuilder/pkg/config"
	"github.com/kubernetes-sigs/kubebuilder/pkg/inject/args"
)

func main() {
	flag.Parse()
	config := config.GetConfigOrDie()

	iargs := args.CreateInjectArgs(config)
	var _ = iargs.CreateRecorder("ControllerName")
}
Output:

type Injector

type Injector struct {
	// CRDs are CRDs that may be created / updated at startup
	CRDs []*apiextensionsv1beta1.CustomResourceDefinition

	// PolicyRules are RBAC policy rules that may be installed with the controller
	PolicyRules []rbacv1.PolicyRule

	// GroupVersions are the api group versions in the CRDs
	GroupVersions []schema.GroupVersion

	// Runnables objects run with RunArguments
	Runnables []Runnable

	// RunFns are functions run with RunArguments
	RunFns []RunFn

	// ControllerManager is used to register Informers and Controllers
	ControllerManager *controller.ControllerManager
}

Injector is used by code generators to register code generated objects

func (Injector) Run

func (i Injector) Run(a run.RunArguments) error

Run will run all of the registered RunFns and Runnables

type RunFn

type RunFn func(arguments run.RunArguments) error

RunFn can be registered with an Injector and run

type Runnable

type Runnable interface {
	Run(arguments run.RunArguments) error
}

Runnable can be registered with an Injector and run

Jump to

Keyboard shortcuts

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