Documentation ¶
Index ¶
- Constants
- func EnsureNamespace(client kubernetes.Interface, namespace string) error
- func EnsureNamespaceWithLabel(client kubernetes.Interface, namespace string, labels map[string]string) error
- func FormatResourceQuantity(resourceName v1.ResourceName, q *resource.Quantity) string
- func GetOrCreateBootstrapToken(ctx context.Context, log logrus.FieldLogger, client kubernetes.Interface) (string, error)
- func GetOrCreateClusterRole(log logrus.FieldLogger, client *kubernetes.Clientset, name string, ...) (*rbacv1.ClusterRole, error)
- func GetOrCreateClusterRoleBinding(log logrus.FieldLogger, client *kubernetes.Clientset, name string, ...) (*rbacv1.ClusterRoleBinding, error)
- func GetOrCreateServiceAccount(log logrus.FieldLogger, client *kubernetes.Clientset, namespace, name string) (*v1.ServiceAccount, error)
- func GetPodName(client corev1.PodsGetter, namespace string, selector labels.Selector) (string, error)
- func GetResourceQuantityInBytes(q *resource.Quantity) int
- func IsK8sErrorPermanent(err error) bool
- func NewKubeTunnel(namespace string, client kubernetes.Interface, config *rest.Config, ...) (*kube.Tunnel, error)
- type AuthInfoFactory
- type ConfigBase
- type CreateAuthInfoFunc
- type TunnelDestinationNotFoundError
Constants ¶
const ( KubeSystemNamespace = "kube-system" TokenSecretTypeFieldSelector = "type=bootstrap.kubernetes.io/token" )
Variables ¶
This section is empty.
Functions ¶
func EnsureNamespace ¶
func EnsureNamespace(client kubernetes.Interface, namespace string) error
EnsureNamespace creates a namespace on a cluster if it does not exist.
func EnsureNamespaceWithLabel ¶
func EnsureNamespaceWithLabel(client kubernetes.Interface, namespace string, labels map[string]string) error
EnsureNamespaceWithLabel creates a namespace with optional labels
func FormatResourceQuantity ¶
func FormatResourceQuantity(resourceName v1.ResourceName, q *resource.Quantity) string
func GetOrCreateBootstrapToken ¶
func GetOrCreateBootstrapToken(ctx context.Context, log logrus.FieldLogger, client kubernetes.Interface) (string, error)
GetOrCreateBootstrapToken This function will ensure to have at least 1 token that expire at least 1 hour from now GetOrCreateBootstrapToken returns a token for joining the cluster, creating a new one if there isn't any with enough time until expiration
func GetOrCreateClusterRole ¶
func GetOrCreateClusterRole(log logrus.FieldLogger, client *kubernetes.Clientset, name string, rules []rbacv1.PolicyRule) (*rbacv1.ClusterRole, error)
GetOrCreateClusterRole gets the cluster role with the given name if exists otherwise creates new one and returns it
func GetOrCreateClusterRoleBinding ¶
func GetOrCreateClusterRoleBinding(log logrus.FieldLogger, client *kubernetes.Clientset, name string, serviceAccount *v1.ServiceAccount, clusterRole *rbacv1.ClusterRole, ) (*rbacv1.ClusterRoleBinding, error)
GetOrCreateClusterRoleBinding creates the cluster role binding given its name, service account and cluster role if not exists. It returns the found cluster role binding if one already exists or the newly created one.
func GetOrCreateServiceAccount ¶
func GetOrCreateServiceAccount(log logrus.FieldLogger, client *kubernetes.Clientset, namespace, name string) (*v1.ServiceAccount, error)
GetOrCreateServiceAccount checks is service account with given name exists in the specified namespace and returns it. if it doesn't exists it creates a new one and returns it to the caller.
func GetPodName ¶
func GetPodName(client corev1.PodsGetter, namespace string, selector labels.Selector) (string, error)
GetPodName fetches the name of a pod running in the given namespace.
func IsK8sErrorPermanent ¶
IsK8sErrorPermanent checks if the given error is permanent error or not
Types ¶
type AuthInfoFactory ¶
type AuthInfoFactory interface {
CreateAuthInfo(string) *clientcmdapi.AuthInfo
}
type ConfigBase ¶
func ExtractConfigBase ¶
func ExtractConfigBase(config *clientcmdapi.Config) *ConfigBase
func (*ConfigBase) CreateConfigFromTemplate ¶
func (configBase *ConfigBase) CreateConfigFromTemplate(authInfo AuthInfoFactory) *clientcmdapi.Config
CreateConfigFromTemplate creates a minimal Kubernetes Config based on the given information
type CreateAuthInfoFunc ¶
type CreateAuthInfoFunc func(clusterName string) *clientcmdapi.AuthInfo
CreateAuthInfoFunc creates a provider specific AuthInfo object for the given cluster
func (CreateAuthInfoFunc) CreateAuthInfo ¶
func (f CreateAuthInfoFunc) CreateAuthInfo(clusterName string) *clientcmdapi.AuthInfo
CreateAuthInfo implements AuthInfoFactory for CreateAuthInfoFunc
type TunnelDestinationNotFoundError ¶
type TunnelDestinationNotFoundError error