kube

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SkupperImageRegistryEnvKey string = "SKUPPER_IMAGE_REGISTRY"
	DefaultImageRegistry       string = "quay.io/skupper"
)
View Source
const (
	BridgeTargetEvent string = "BridgeTargetEvent"
)
View Source
const NamespaceFile string = "/var/run/secrets/kubernetes.io/serviceaccount/namespace"

Variables

This section is empty.

Functions

func AppendConfigVolume

func AppendConfigVolume(volumes *[]corev1.Volume, mounts *[]corev1.VolumeMount, volName string, refName string, path string)

func AppendSecretVolume

func AppendSecretVolume(volumes *[]corev1.Volume, mounts *[]corev1.VolumeMount, name string, path string)

func AppendSharedSecretVolume

func AppendSharedSecretVolume(volumes *[]corev1.Volume, mounts []*[]corev1.VolumeMount, name string, path string)

func AppendSharedVolume

func AppendSharedVolume(volumes *[]corev1.Volume, mounts []*[]corev1.VolumeMount, volumename string, path string)

func CheckProbesForConfigSync

func CheckProbesForConfigSync(c *corev1.Container) bool

func CheckProbesForControllerContainer

func CheckProbesForControllerContainer(c *corev1.Container) bool

func CheckProbesForTransportContainer

func CheckProbesForTransportContainer(c *corev1.Container) bool

func CheckProxyStatefulSet

func CheckProxyStatefulSet(image types.ImageDetails, desired types.ServiceInterface, actual *appsv1.StatefulSet, desiredConfig string, namespace string, cli kubernetes.Interface) (*appsv1.StatefulSet, error)

func ContainerForConfigSync

func ContainerForConfigSync(ds types.DeploymentSpec) *corev1.Container

func ContainerForController

func ContainerForController(ds types.DeploymentSpec) corev1.Container

func ContainerForFlowCollector

func ContainerForFlowCollector(ds types.DeploymentSpec) *corev1.Container

func ContainerForTransport

func ContainerForTransport(ds types.DeploymentSpec) corev1.Container

func CopyClusterRole

func CopyClusterRole(src string, dest string, kubeclient kubernetes.Interface) error

func CopyRole

func CopyRole(src string, dest string, namespace string, kubeclient kubernetes.Interface) error

func CopySecret

func CopySecret(src string, dest string, namespace string, kubeclient kubernetes.Interface) error

func CopyService

func CopyService(src string, dest string, annotations map[string]string, namespace string, kubeclient kubernetes.Interface) (*corev1.Service, error)

func CopyServiceAccount

func CopyServiceAccount(src string, dest string, annotations map[string]string, namespace string, kubeclient kubernetes.Interface) error

func CreateClusterRole

func CreateClusterRole(clusterRole *rbacv1.ClusterRole, kubeclient kubernetes.Interface) (*rbacv1.ClusterRole, error)

func CreateClusterRoleBinding

func CreateClusterRoleBinding(crb *rbacv1.ClusterRoleBinding, kubeclient kubernetes.Interface) (*rbacv1.ClusterRoleBinding, error)

func CreateContourProxies

func CreateContourProxies(routes []IngressRoute, owner *metav1.OwnerReference, client dynamic.Interface, namespace string) error

func CreateContourProxy

func CreateContourProxy(client dynamic.Interface, namespace string, name string, def IngressRoute, owner *metav1.OwnerReference) error

func CreateIngress

func CreateIngress(name string, routes []IngressRoute, isNginx bool, sslPassthrough bool, ownerRefs []metav1.OwnerReference, namespace string, annotations map[string]string, clients Clients) error

func CreateNetworkPolicy

func CreateNetworkPolicy(ownerrefs []metav1.OwnerReference, namespace string, cli kubernetes.Interface) error

func CreateRole

func CreateRole(namespace string, role *rbacv1.Role, kubeclient kubernetes.Interface) (*rbacv1.Role, error)

func CreateRoleBinding

func CreateRoleBinding(namespace string, rb *rbacv1.RoleBinding, kubeclient kubernetes.Interface) (*rbacv1.RoleBinding, error)

func CreateRoute

func CreateRoute(route *routev1.Route, namespace string, rc *routev1client.RouteV1Client) (*routev1.Route, error)

func CreateService

func CreateService(service *corev1.Service, namespace string, kubeclient kubernetes.Interface) (*corev1.Service, error)

func CreateServiceAccount

func CreateServiceAccount(namespace string, sa *corev1.ServiceAccount, cli kubernetes.Interface) (*corev1.ServiceAccount, error)

func CurrentNamespace

func CurrentNamespace() (string, error)

func DeleteDeployment

func DeleteDeployment(name string, namespace string, cli kubernetes.Interface) error

func DeleteEnvVarForDeployment

func DeleteEnvVarForDeployment(dep *appsv1.Deployment, name string)

func DeleteNamespace

func DeleteNamespace(name string, cli kubernetes.Interface) error

func DeleteSecret

func DeleteSecret(name string, namespace string, cli kubernetes.Interface) error

func DeleteService

func DeleteService(name string, namespace string, kubeclient kubernetes.Interface) error

func EquivalentSelectors

func EquivalentSelectors(a map[string]string, b map[string]string) bool

func ExecCommandInContainer

func ExecCommandInContainer(command []string, podName string, containerName string, namespace string, clientset kubernetes.Interface, config *restclient.Config) (*bytes.Buffer, error)

func FindEnvVar

func FindEnvVar(env []corev1.EnvVar, name string) *corev1.EnvVar

func FirstReadyPod

func FirstReadyPod(list []corev1.Pod) *corev1.Pod

func GetAllContainerPorts

func GetAllContainerPorts(container corev1.Container) map[int]int

func GetApplicationSelector

func GetApplicationSelector(service *corev1.Service) string

func GetComponentVersion

func GetComponentVersion(namespace string, clientset kubernetes.Interface, component string, container string) string

func GetConfigMap

func GetConfigMap(name string, namespace string, cli kubernetes.Interface) (*corev1.ConfigMap, error)

func GetConfigMapOwnerReference

func GetConfigMapOwnerReference(config *corev1.ConfigMap) metav1.OwnerReference

func GetContainerPort

func GetContainerPort(deployment *appsv1.Deployment) map[int]int

func GetContainerPortForDaemonSet

func GetContainerPortForDaemonSet(daemonSet *appsv1.DaemonSet) map[int]int

func GetContainerPortForDeploymentConfig

func GetContainerPortForDeploymentConfig(deploymentConfig *appv1.DeploymentConfig) map[int]int

func GetContainerPortForStatefulSet

func GetContainerPortForStatefulSet(statefulSet *appsv1.StatefulSet) map[int]int

func GetContainerPorts

func GetContainerPorts(spec *corev1.PodSpec) []corev1.ContainerPort

func GetDeployment

func GetDeployment(name string, namespace string, cli kubernetes.Interface) (*appsv1.Deployment, error)

TODO, pass full client object with namespace and clientset

func GetDeploymentConfig

func GetDeploymentConfig(name string, namespace string, appsClient versioned.Interface) (*appv1.DeploymentConfig, error)

func GetDeploymentLabel

func GetDeploymentLabel(name string, key string, namespace string, cli kubernetes.Interface) string

func GetDeploymentOwnerReference

func GetDeploymentOwnerReference(dep *appsv1.Deployment) metav1.OwnerReference

func GetEnvVarForDeployment

func GetEnvVarForDeployment(dep *appsv1.Deployment, name string) string

func GetImageVersion

func GetImageVersion(pod *corev1.Pod, container string) string

func GetLabelsForRouter

func GetLabelsForRouter() map[string]string

func GetLoadBalancerHostOrIP

func GetLoadBalancerHostOrIP(service *corev1.Service) string

func GetLoadBalancerHostOrIp

func GetLoadBalancerHostOrIp(service *corev1.Service) string

func GetOriginalAssignedPorts

func GetOriginalAssignedPorts(service *corev1.Service) map[int]int

func GetOriginalTargetPorts

func GetOriginalTargetPorts(service *corev1.Service) map[int]int

func GetPodContainerLogs

func GetPodContainerLogs(podName string, containerName string, namespace string, clientset kubernetes.Interface) (string, error)

func GetPodContainerLogsWithOpts

func GetPodContainerLogsWithOpts(podName string, containerName string, namespace string, clientset kubernetes.Interface, podLogOpts corev1.PodLogOptions) (string, error)

func GetPods

func GetPods(selector string, namespace string, cli kubernetes.Interface) ([]corev1.Pod, error)

func GetPortsForServiceTarget

func GetPortsForServiceTarget(targetName string, defaultNamespace string, kubeclient kubernetes.Interface) (map[int]int, error)

func GetPullPolicy

func GetPullPolicy(policy string) corev1.PullPolicy

func GetReadyPod

func GetReadyPod(namespace string, clientset kubernetes.Interface, component string) (*corev1.Pod, error)

func GetRoute

func GetRoute(name string, namespace string, rc *routev1client.RouteV1Client) (*routev1.Route, error)

func GetSelectorAsMap

func GetSelectorAsMap(selector string) (map[string]string, error)

func GetService

func GetService(name string, namespace string, kubeclient kubernetes.Interface) (*corev1.Service, error)

func GetServiceInterfaceTarget

func GetServiceInterfaceTarget(targetType string, targetName string, deducePort bool, namespace string, cli kubernetes.Interface, appscli versioned.Interface) (*types.ServiceInterfaceTarget, error)

func GetServicePort

func GetServicePort(service *corev1.Service, port int) *corev1.ServicePort

func GetServicePortMap

func GetServicePortMap(service *corev1.Service) map[int]int

func HasRouterSelector

func HasRouterSelector(service corev1.Service) bool

func IndexServicePorts

func IndexServicePorts(service *corev1.Service) map[int]int

func IsOriginalServiceModified

func IsOriginalServiceModified(name, namespace string, kubeclient kubernetes.Interface) bool

func IsPodReady

func IsPodReady(pod *corev1.Pod) bool

func IsPodRunning

func IsPodRunning(pod *corev1.Pod) bool

func NewCertAuthority

func NewCertAuthority(ca types.CertAuthority, owner *metav1.OwnerReference, namespace string, cli kubernetes.Interface) (*corev1.Secret, error)

func NewConfigMap

func NewConfigMap(name string, data *map[string]string, labels *map[string]string, annotations *map[string]string, owner *metav1.OwnerReference, namespace string, kubeclient kubernetes.Interface) (*corev1.ConfigMap, error)

func NewControllerDeployment

func NewControllerDeployment(van *types.RouterSpec, ownerRef *metav1.OwnerReference, securityContext *corev1.SecurityContext, cli kubernetes.Interface) (*appsv1.Deployment, error)

func NewExternalBridge

func NewExternalBridge(deployments Deployments, def *types.ServiceInterface) service.ExternalBridge

func NewHeadlessService

func NewHeadlessService(name string, address string, ports []int, targetPorts []int, labels map[string]string, owner *metav1.OwnerReference, namespace string, kubeclient kubernetes.Interface) (*corev1.Service, error)

func NewHeadlessServiceForAddress

func NewHeadlessServiceForAddress(address string, ports []int, targetPorts []int, labels map[string]string, owner *metav1.OwnerReference, namespace string, kubeclient kubernetes.Interface) (*corev1.Service, error)

func NewHeadlessServiceIngress

func NewHeadlessServiceIngress(s Services, origin string) service.ServiceIngress

func NewNamespace

func NewNamespace(name string, cli kubernetes.Interface) (*corev1.Namespace, error)

func NewProxyStatefulSet

func NewProxyStatefulSet(image types.ImageDetails, serviceInterface types.ServiceInterface, config string, namespace string, cli kubernetes.Interface) (*appsv1.StatefulSet, error)

func NewSecret

func NewSecret(cred types.Credential, owner *metav1.OwnerReference, namespace string, cli kubernetes.Interface) (*corev1.Secret, error)

func NewServiceIngressAlways

func NewServiceIngressAlways(s Services) service.ServiceIngress

func NewServiceIngressExternalBridge

func NewServiceIngressExternalBridge(s Services, address string) service.ServiceIngress

func NewServiceIngressNever

func NewServiceIngressNever(s Services, isowned IsOwned) service.ServiceIngress

func NewTransportDeployment

func NewTransportDeployment(van *types.RouterSpec, ownerRef *metav1.OwnerReference, securityContext *corev1.SecurityContext, cli kubernetes.Interface) (*appsv1.Deployment, error)

func PortLabelStrToMap

func PortLabelStrToMap(portsStr string) map[int]int

func PortMapToLabelStr

func PortMapToLabelStr(portMap map[int]int) string

func PortsAsString

func PortsAsString(ports []corev1.ServicePort) string

func RegenerateCertAuthority

func RegenerateCertAuthority(name string, namespace string, cli kubernetes.Interface) (*corev1.Secret, error)

func RegenerateCredentials

func RegenerateCredentials(credential types.Credential, namespace string, ca *corev1.Secret, cli kubernetes.Interface) (*corev1.Secret, error)

func RemoveSecretVolumeForDeployment

func RemoveSecretVolumeForDeployment(name string, dep *appsv1.Deployment, index int)

func RemoveServiceAnnotations

func RemoveServiceAnnotations(name, namespace string, kubeclient kubernetes.Interface, annotations []string) (*corev1.Service, error)

func SetAnnotation

func SetAnnotation(o *metav1.ObjectMeta, key string, value string)

func SetEnvVarForDeployment

func SetEnvVarForDeployment(dep *appsv1.Deployment, name string, value string)

func SetEnvVarForStatefulSet

func SetEnvVarForStatefulSet(dep *appsv1.StatefulSet, name string, value string)

func SetLabel

func SetLabel(o *metav1.ObjectMeta, key string, value string)

func UpdateAnnotations

func UpdateAnnotations(o *metav1.ObjectMeta, desired map[string]string) bool

func UpdateClusterRole

func UpdateClusterRole(name string, rules []rbacv1.PolicyRule, kubeclient kubernetes.Interface) error

func UpdateEnvVar

func UpdateEnvVar(original []corev1.EnvVar, name string, value string) []corev1.EnvVar

func UpdateLabels

func UpdateLabels(o *metav1.ObjectMeta, desired map[string]string) bool

func UpdatePorts

func UpdatePorts(spec *corev1.ServiceSpec, desiredPortMappings map[int]int, protocol corev1.Protocol) bool

func UpdateRole

func UpdateRole(namespace string, name string, rules []rbacv1.PolicyRule, kubeclient kubernetes.Interface) error

func UpdateSecretVolume

func UpdateSecretVolume(spec *corev1.PodSpec, oldname string, name string)

func UpdateSelector

func UpdateSelector(spec *corev1.ServiceSpec, selector string) (bool, error)

func UpdateSelectorFromMap

func UpdateSelectorFromMap(spec *corev1.ServiceSpec, desired map[string]string) bool

func UpdateSkupperServices

func UpdateSkupperServices(changed []types.ServiceInterface, deleted []string, origin string, namespace string, cli kubernetes.Interface) error

func UpdateTargetServiceForRoute

func UpdateTargetServiceForRoute(routeName string, serviceName string, namespace string, rc *routev1client.RouteV1Client) error

func WaitDaemonSetReady

func WaitDaemonSetReady(name string, namespace string, cli kubernetes.Interface, timeout, interval time.Duration) (*appsv1.DaemonSet, error)

func WaitDeploymentReady

func WaitDeploymentReady(name string, namespace string, cli kubernetes.Interface, timeout, interval time.Duration) (*appsv1.Deployment, error)

WaitDeploymentReady waits till given deployment contains at least one ReadyReplicas, or until it times out

func WaitDeploymentReadyReplicas

func WaitDeploymentReadyReplicas(name string, namespace string, readyReplicas int, cli kubernetes.Interface, timeout, interval time.Duration) (*appsv1.Deployment, error)

WaitDeploymentReadyReplicas waits till given deployment contains the expected number of readyReplicas, or until it times out

func WaitForPodStatus

func WaitForPodStatus(namespace string, clientset kubernetes.Interface, podName string, status corev1.PodPhase, timeout time.Duration, interval time.Duration) (*corev1.Pod, error)

func WaitForPodsStatus

func WaitForPodsStatus(namespace string, clientset kubernetes.Interface, selector string, status corev1.PodPhase, timeout time.Duration, interval time.Duration) error

func WaitServiceExists

func WaitServiceExists(name string, namespace string, cli kubernetes.Interface, timeout, interval time.Duration) (*corev1.Service, error)

func WaitStatefulSetReadyReplicas

func WaitStatefulSetReadyReplicas(name string, namespace string, readyReplicas int, cli kubernetes.Interface, timeout, interval time.Duration) (*appsv1.StatefulSet, error)

Types

type CachedDeploymentsImpl

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

func (*CachedDeploymentsImpl) CreateDeployment

func (i *CachedDeploymentsImpl) CreateDeployment(d *appsv1.Deployment) error

func (*CachedDeploymentsImpl) GetDeployment

func (i *CachedDeploymentsImpl) GetDeployment(name string) (*appsv1.Deployment, bool, error)

func (*CachedDeploymentsImpl) UpdateDeployment

func (i *CachedDeploymentsImpl) UpdateDeployment(d *appsv1.Deployment) error

type Clients

type Clients interface {
	GetKubeClient() kubernetes.Interface
	GetDynamicClient() dynamic.Interface
	GetDiscoveryClient() *discovery.DiscoveryClient
}

type Deployments

type Deployments interface {
	GetDeployment(name string) (*appsv1.Deployment, bool, error)
	CreateDeployment(d *appsv1.Deployment) error
	UpdateDeployment(d *appsv1.Deployment) error
}

func NewDeployments

func NewDeployments(client kubernetes.Interface, namespace string, informer cache.SharedIndexInformer, ownerRefs []metav1.OwnerReference) Deployments

type ExternalBridge

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

func (*ExternalBridge) Matches

func (b *ExternalBridge) Matches(def *types.ServiceInterface) bool

func (*ExternalBridge) Realise

func (b *ExternalBridge) Realise() error

type IngressRoute

type IngressRoute struct {
	Name        string
	Host        string
	ServiceName string
	ServicePort int
	Resolve     bool
}

func GetContourProxy

func GetContourProxy(client dynamic.Interface, namespace string, name string) (*IngressRoute, error)

func GetIngressRoutes

func GetIngressRoutes(name string, namespace string, clients Clients) ([]IngressRoute, error)

type IsOwned

type IsOwned func(*corev1.Service) bool

type PodTargetResolver

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

func NewPodTargetResolver

func NewPodTargetResolver(cli kubernetes.Interface, namespace string, address string, selector string, skipPodStatus bool) *PodTargetResolver

func (*PodTargetResolver) AddEventHandler

func (o *PodTargetResolver) AddEventHandler(handler *cache.ResourceEventHandlerFuncs)

func (*PodTargetResolver) Close

func (o *PodTargetResolver) Close()

func (*PodTargetResolver) HasTarget

func (o *PodTargetResolver) HasTarget() bool

func (*PodTargetResolver) List

func (o *PodTargetResolver) List() []string

func (*PodTargetResolver) Start

func (o *PodTargetResolver) Start() error

type ServiceIngressAlways

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

func (*ServiceIngressAlways) Matches

func (si *ServiceIngressAlways) Matches(def *types.ServiceInterface) bool

func (*ServiceIngressAlways) Mode

func (*ServiceIngressAlways) Realise

func (si *ServiceIngressAlways) Realise(desired *service.ServiceBindings) error

type ServiceIngressHeadlessInOrigin

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

func (*ServiceIngressHeadlessInOrigin) Matches

func (*ServiceIngressHeadlessInOrigin) Mode

func (*ServiceIngressHeadlessInOrigin) Realise

type ServiceIngressHeadlessRemote

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

func (*ServiceIngressHeadlessRemote) Matches

func (*ServiceIngressHeadlessRemote) Mode

func (*ServiceIngressHeadlessRemote) Realise

type ServiceIngressNever

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

func (*ServiceIngressNever) Matches

func (si *ServiceIngressNever) Matches(def *types.ServiceInterface) bool

func (*ServiceIngressNever) Mode

func (*ServiceIngressNever) Realise

func (si *ServiceIngressNever) Realise(desired *service.ServiceBindings) error

type Services

type Services interface {
	GetService(name string) (*corev1.Service, bool, error)
	DeleteService(svc *corev1.Service) error
	CreateService(svc *corev1.Service) error
	UpdateService(svc *corev1.Service) error
	IsOwned(service *corev1.Service) bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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