k8sclient

package
v0.0.0-...-db043a3 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ExternalDNSHostnameAnnotation is the external-dns service's annotaiton denoting the hostname
	ExternalDNSHostnameAnnotation = "external-dns.alpha.kunernetes.io/hostname"

	// KubernetesIngressTLSRedirect annotation indicating enforcement of https redirect
	// Traefik and some other ingresses read this
	KubernetesIngressTLSRedirect = "ingress.kubernetes.io/ssl-redirect"

	// NginxIngressTLSRedirect annotation indicating enforcement of https redirect
	NginxIngressTLSRedirect = "nginx.ingress.kubernetes.io/ssl-redirect"

	// AppGWIngressTLSRedirect annotation indicating enforcement of https redirect
	AppGWIngressTLSRedirect = "appgw.ingress.kubernetes.io/ssl-redirect"

	// IngressClassAnnotation determines what ingress controller is responsible for the Ingress
	IngressClassAnnotation = "kubernetes.io/ingress.class"
)

Variables

View Source
var (
	// IngressTLSRedirectAnnotations collection of annotations whose boolean value enforces https redirect at the Ingress
	IngressTLSRedirectAnnotations = []string{
		KubernetesIngressTLSRedirect,
		NginxIngressTLSRedirect,
		AppGWIngressTLSRedirect,
	}
)

Functions

func DeploymentListContains

func DeploymentListContains(deploymentList *v1.DeploymentList, deployment v1.Deployment) bool

DeploymentListContains is a helper for determining if a deployment pointer exists in a DeploymentList

func DeploymentPods

func DeploymentPods(clientset *kubernetes.Clientset, deployment v1.Deployment) (*apiv1.PodList, error)

DeploymentPods uses the Deployment's spec.Selector.matchLabels field to select pods

func GetServiceIngresses

func GetServiceIngresses(clientset *kubernetes.Clientset, service apiv1.Service) (*v1beta1.IngressList, error)

GetServiceIngresses returns a ServiceList whose selectors match the labels on passed deployment

func IngressExternalDNSName

func IngressExternalDNSName(ing *v1beta1.Ingress) string

IngressExternalDNSName returns the value of the external-dns annotation

func IngressHostTLS

func IngressHostTLS(needle string, ingTLSs []v1beta1.IngressTLS) bool

IngressHostTLS returns true if the path has a corresponding TLS host entry

func IngressStatusName

func IngressStatusName(ing *v1beta1.Ingress) string

IngressStatusName returns the first available hostname or IP reported in the status field

func IngressURLs

func IngressURLs(ing v1beta1.Ingress) []url.URL

IngressURLs returns a slice of URLs that are captured by the Ingress supports external-dns annotation external-dns.alpha.kubernetes.io/hostname=fqdn.

func ListContains

func ListContains(haystack interface{}, needle interface{}) bool

ListContains is a helper for determining if a deployment pointer exists in a <T>List

func NewClient

func NewClient(masterURL, kubeconfig string) (*kubernetes.Clientset, error)

NewClient returns a new kubernetes.clientset

func ServicePortsContains

func ServicePortsContains(servicePorts []apiv1.ServicePort, port intstr.IntOrString) bool

ServicePortsContains is a helper for determining if a Port exists in a slice of ServicePorts

Types

type DeploymentIngressPath

type DeploymentIngressPath struct {
	Deployment  v1.Deployment
	StatefulSet v1.StatefulSet
	Pods        []apiv1.Pod
	Services    []apiv1.Service
	Ingresses   []v1beta1.Ingress
}

DeploymentIngressPath represents the deployment -> ingress path.

type DeploymentIngressPaths

type DeploymentIngressPaths []DeploymentIngressPath

DeploymentIngressPaths represents a slice of DeploymentIngressPath structs

func GetDeploymentIngressPaths

func GetDeploymentIngressPaths(clientset *kubernetes.Clientset, namespace string) (DeploymentIngressPaths, error)

GetDeploymentIngressPaths ...

func (DeploymentIngressPaths) FPrintTable

func (dips DeploymentIngressPaths) FPrintTable(w io.Writer)

FPrintTable prints the DeploymentIngressPath as an ascii table

func (DeploymentIngressPaths) NewTable

func (dips DeploymentIngressPaths) NewTable() table.Writer

NewTable creates a populated table writer

type ServiceDeployments

type ServiceDeployments struct {
	Service     apiv1.Service
	Deployments *v1.DeploymentList
}

ServiceDeployments contains a service and its selected deployments

func GetServiceDeployments

func GetServiceDeployments(clientset *kubernetes.Clientset, namespace string) ([]ServiceDeployments, error)

GetServiceDeployments returns a ServiceList whose selectors match the labels on passed deployment

func (*ServiceDeployments) SelectsDeployment

func (sd *ServiceDeployments) SelectsDeployment(deployment v1.Deployment) bool

SelectsDeployment is a helper for determining if a deployment pointer exists in a DeploymentList

Jump to

Keyboard shortcuts

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