kube

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Copyright 2020 Jared Allard

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePortForward

func CreatePortForward(ctx context.Context, r rest.Interface, rc *rest.Config,
	p *corev1.Pod, ip string, ports []string) (*portforward.PortForwarder, error)

func FindControllersForService

func FindControllersForService(log logrus.FieldLogger, s *corev1.Service) ([]interface{}, error)

FindControllersForService returns the controllers for a given service. Controllers are deployments/statefulsets that match the service's selector in their pod templates.

func GetKubeClient

func GetKubeClient(contextName string) (*rest.Config, kubernetes.Interface, error)

GetKubeClient returns a kubernetes client, and the config used by it, based on a given context. If no context is provided then the default will be used

Types

type KlogtoLogrus

type KlogtoLogrus struct {
	Log logrus.FieldLogger
}

func (*KlogtoLogrus) Enabled

func (l *KlogtoLogrus) Enabled() bool

Enabled tests whether this Logger is enabled. For example, commandline flags might be used to set the logging verbosity and disable some info logs.

func (*KlogtoLogrus) Error

func (l *KlogtoLogrus) Error(err error, msg string, keysAndValues ...interface{})

Error logs an error, with the given message and key/value pairs as context. It functions similarly to calling Info with the "error" named value, but may have unique behavior, and should be preferred for logging errors (see the package documentations for more information).

The msg field should be used to add context to any underlying error, while the err field should be used to attach the actual error that triggered this log line, if present.

func (*KlogtoLogrus) Info

func (l *KlogtoLogrus) Info(msg string, keysAndValues ...interface{})

Info logs a non-error message with the given key/value pairs as context.

The msg argument should be used to add some constant description to the log line. The key/value pairs can then be used to add additional variable information. The key/value pairs should alternate string keys and arbitrary values.

func (*KlogtoLogrus) V

func (l *KlogtoLogrus) V(level int) logr.Logger

V returns an Logger value for a specific verbosity level, relative to this Logger. In other words, V values are additive. V higher verbosity level means a log message is less important. It's illegal to pass a log level less than zero.

func (*KlogtoLogrus) WithName

func (l *KlogtoLogrus) WithName(name string) logr.Logger

WithName adds a new element to the logger's name. Successive calls with WithName continue to append suffixes to the logger's name. It's strongly recommended that name segments contain only letters, digits, and hyphens (see the package documentation for more information).

func (*KlogtoLogrus) WithValues

func (l *KlogtoLogrus) WithValues(keysAndValues ...interface{}) logr.Logger

WithValues adds some key-value pairs of context to a logger. See Info for documentation on how key/value pairs work.

type ResolvedServicePort

type ResolvedServicePort struct {
	corev1.ServicePort

	// OriginalTargetPort is set if the ServicePort
	// was modified
	OriginalTargetPort string

	// MappedPort is the locally mapped port that this should have
	// defaults to the targetPort
	MappedPort uint
}

func ResolveServicePorts

func ResolveServicePorts(log logrus.FieldLogger, s *corev1.Service) ([]ResolvedServicePort, error)

ResolveServicePorts converts named ports into their true format. TargetPort's that have are named become their integer equivalents

func ResolveServicePortsFromControllers

func ResolveServicePortsFromControllers(log logrus.FieldLogger, s *corev1.Service) ([]ResolvedServicePort, error)

ResolveServicePortsFromControllers looks up the controllers of a given service and uses their containerPort declarations to resolve named endpoints of a service

Jump to

Keyboard shortcuts

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