Documentation
¶
Index ¶
- func CreateRbac(kubeClient *kubeclient.Clientset, namespace, name string, ...) error
- func DeleteRbac(kubeClient *kubeclient.Clientset, namespace, name string) error
- func GetDaemonSetPodCollections(kubeClient *kubeclient.Clientset, daemonSet *appsv1.DaemonSet, ...) (*types.PodCollections, error)
- func GetHugePagesCapacity(kubeClient *kubeclient.Clientset) (*resource.Quantity, error)
- func GetKubeConfigFromPath(kubeconfigPath string) (*rest.Config, error)
- func MonitorDaemonSetContainer(kubeClient *kubeclient.Clientset, daemonSet *appsv1.DaemonSet, ...) error
- func NewKubeClient(masterUrl string, kubeconfigPath string) (kubeClient *kubeclient.Clientset, err error)
- func PrepareDaemonSet(daemonSet *appsv1.DaemonSet, kubeClient *kubeclient.Clientset, ...) (*appsv1.DaemonSet, error)
- func WaitForDaemonSetContainersExit(ctx context.Context, logger *logrus.Entry, kubeClient *kubeclient.Clientset, ...) error
- func WaitForDaemonSetContainersReady(ctx context.Context, logger *logrus.Entry, kubeClient *kubeclient.Clientset, ...) error
- type Workload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateRbac ¶ added in v1.10.0
func CreateRbac(kubeClient *kubeclient.Clientset, namespace, name string, rbacRules []rbacv1.PolicyRule) error
CreateRbac creates a new ServiceAccount, ClusterRole, and ClusterRoleBinding. If creation fails, it attempts to clean up any partially created resources before returning the error.
func DeleteRbac ¶ added in v1.10.0
func DeleteRbac(kubeClient *kubeclient.Clientset, namespace, name string) error
DeleteRbac deletes ServiceAccount, ClusterRole, and ClusterRoleBinding
func GetDaemonSetPodCollections ¶
func GetDaemonSetPodCollections(kubeClient *kubeclient.Clientset, daemonSet *appsv1.DaemonSet, containerName string, addPrefix, onlyFailed bool, tailLines *int64) (*types.PodCollections, error)
GetDaemonSetPodCollections retrieves the logs of the specified container within the given DaemonSet. Optionally, it can: - add prefixes to the log lines - only retrieve logs of failed containers - retrieve the last N lines of the logs
func GetHugePagesCapacity ¶ added in v1.10.0
func GetHugePagesCapacity(kubeClient *kubeclient.Clientset) (*resource.Quantity, error)
GetHugePagesCapacity returns hugepages-2Mi capacity of current node
func GetKubeConfigFromPath ¶ added in v1.12.0
func MonitorDaemonSetContainer ¶
func MonitorDaemonSetContainer(kubeClient *kubeclient.Clientset, daemonSet *appsv1.DaemonSet, containerName string, conditionFunc monitorDaemonSetContainerConditionFunc, maxConditionToleration *int) error
MonitorDaemonSetContainer monitors the specified container within the given DaemonSet until a certain condition is met. The condition is defined by the monitorDaemonSetContainerConditionFunc. Returns nil on success, or an error if the condition check fails or the timeout is reached.
func NewKubeClient ¶ added in v1.10.0
func NewKubeClient(masterUrl string, kubeconfigPath string) (kubeClient *kubeclient.Clientset, err error)
func PrepareDaemonSet ¶ added in v1.10.0
func PrepareDaemonSet(daemonSet *appsv1.DaemonSet, kubeClient *kubeclient.Clientset, nodeSelectorRaw, imagePullSecretRaw, tolerationsRaw string) (*appsv1.DaemonSet, error)
PrepareDaemonSet takes DaemonSet object and populates common fields such as NodeSelector, ImagePullSecrets and Tolerations
func WaitForDaemonSetContainersExit ¶
func WaitForDaemonSetContainersExit(ctx context.Context, logger *logrus.Entry, kubeClient *kubeclient.Clientset, daemonSet *appsv1.DaemonSet, containerName string, maxConditionToleration *int) error
WaitForDaemonSetContainersExit waits for the containers in the given DaemonSet to exit.
func WaitForDaemonSetContainersReady ¶
func WaitForDaemonSetContainersReady(ctx context.Context, logger *logrus.Entry, kubeClient *kubeclient.Clientset, daemonSet *appsv1.DaemonSet, containerName string, maxConditionToleration *int) error
WaitForDaemonSetContainersReady waits for the containers in the given DaemonSet to be ready.
Types ¶
type Workload ¶
type Workload struct {
KubeClient *kubeclient.Clientset
Kind string
Namespace string
Name string
// Selector is used to filter pods.
// For example, to filter pod with label app=foo, use the selector "app=foo".
// For multiple selectors, use "app=foo,app=bar".
LabelSelectors string
// contains filtered or unexported fields
}
Workload provide functions for workloads.
func NewWorkload ¶
func NewWorkload(kubeClient *kubeclient.Clientset, obj interface{}, kind, labelSelector string) (*Workload, error)
NewWorkload returns a new Workload.
func (*Workload) GetPodsLogByContainer ¶
func (obj *Workload) GetPodsLogByContainer(ctx context.Context, logger *logrus.Entry, containerName string, addPrefix, onlyFailed bool, tailLines *int64) (*types.PodCollections, error)
GetPodsLogByContainer retrieves logs of the specified container. within the given pods. Optionally, it can: - add prefixes to the log lines - only retrieve logs of failed containers - retrieve the last N lines of the logs