cmd

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2019 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTaintEffect = corev1.TaintEffectNoSchedule
	DefaultTaintKey    = "virtual-kubelet.io/provider"
)

Default taint values

Variables

AcceptedCiphers is the list of accepted TLS ciphers, with known weak ciphers elided Note this list should be a moving target.

View Source
var RootCmd = &cobra.Command{
	Use:   "virtual-kubelet",
	Short: "virtual-kubelet provides a virtual kubelet interface for your kubernetes cluster.",
	Long: `virtual-kubelet implements the Kubelet interface with a pluggable
backend implementation allowing users to create kubernetes nodes without running the kubelet.
This allows users to schedule kubernetes workloads on nodes that aren't running Kubernetes.`,
	Run: func(cmd *cobra.Command, args []string) {
		initConfig()

		defer rootContextCancel()

		pNode := NodeFromProvider(rootContext, nodeName, taint, p)
		node, err := vkubelet.NewNode(
			vkubelet.NaiveNodeProvider{},
			pNode,
			k8sClient.Coordination().Leases(corev1.NamespaceNodeLease),
			k8sClient.CoreV1().Nodes(),
			vkubelet.WithNodeDisableLease(!enableNodeLease),
		)
		if err != nil {
			log.G(rootContext).Fatal(err)
		}

		vk := vkubelet.New(vkubelet.Config{
			Client:          k8sClient,
			Namespace:       kubeNamespace,
			NodeName:        pNode.Name,
			Provider:        p,
			ResourceManager: rm,
			PodSyncWorkers:  podSyncWorkers,
			PodInformer:     podInformer,
		})

		sig := make(chan os.Signal, 1)
		signal.Notify(sig, syscall.SIGINT, syscall.SIGTERM)
		go func() {
			<-sig
			rootContextCancel()
		}()

		cancelHTTP, err := setupHTTPServer(rootContext, apiConfig)
		if err != nil {
			log.G(rootContext).Fatal(err)
		}
		defer cancelHTTP()

		go func() {
			if err := vk.Run(rootContext); err != nil && errors.Cause(err) != context.Canceled {
				log.G(rootContext).Fatal(err)
			}
		}()

		go func() {
			if err := node.Run(rootContext); err != nil {
				log.G(rootContext).Fatal(err)
			}
		}()
		<-rootContext.Done()
	},
}

RootCmd represents the base command when called without any subcommands

Functions

func AvailableTraceExporters added in v0.6.3

func AvailableTraceExporters() []string

AvailableTraceExporters gets the list of registered exporters

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func GetTracingExporter added in v0.6.3

func GetTracingExporter(name string, opts TracingExporterOptions) (trace.Exporter, error)

GetTracingExporter gets the specified tracing exporter passing in the options to the exporter init function. For an exporter to be availbale here it must be registered with `RegisterTracingExporter`.

func NewJaegerExporter added in v0.6.3

func NewJaegerExporter(opts TracingExporterOptions) (trace.Exporter, error)

NewJaegerExporter creates a new opencensus tracing exporter.

func NewOCAgentExporter added in v0.7.3

func NewOCAgentExporter(opts TracingExporterOptions) (trace.Exporter, error)

NewOCAgentExporter creates a new opencensus tracing exporter using the opencensus agent forwarder.

func NodeFromProvider added in v0.9.0

func NodeFromProvider(ctx context.Context, name string, taint *v1.Taint, p providers.Provider) *v1.Node

NodeFromProvider builds a kubernetes node object from a provider This is a temporary solution until node stuff actually split off from the provider interface itself.

func RegisterTracingExporter added in v0.6.3

func RegisterTracingExporter(name string, f TracingExporterInitFunc)

RegisterTracingExporter registers a tracing exporter. For a user to select an exporter, it must be registered here.

Types

type TracingExporterInitFunc added in v0.6.3

type TracingExporterInitFunc func(TracingExporterOptions) (trace.Exporter, error)

TracingExporterInitFunc is the function that is called to initialize an exporter. This is used when registering an exporter and called when a user specifed they want to use the exporter.

type TracingExporterOptions added in v0.6.3

type TracingExporterOptions struct {
	Tags        map[string]string
	ServiceName string
}

TracingExporterOptions is used to pass options to the configured tracer

Jump to

Keyboard shortcuts

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