Documentation
¶
Index ¶
- func ApplyUnstructured(ctx context.Context, objects []*unstructured.Unstructured, ...) error
- func CheckRollingRestartLogic(events []watch.Event) bool
- func DecodeYAML(r io.Reader) ([]*unstructured.Unstructured, error)
- func ForwardOnePort(fw PortForwarder, ns, resourceName string, port uint16) (fwdHost string, fwdPort uint16, cancel context.CancelFunc, err error)
- func GetPodUIDMap(ctx context.Context, clientSet kubernetes.Interface, namespace string, ...) (map[string]string, error)
- func GetPodUIDMapFromPodList(ctx context.Context, podList *corev1.PodList) map[string]string
- func LoadConfig() (*rest.Config, error)
- type PortForwarder
- type YAMLApplier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyUnstructured ¶
func ApplyUnstructured(ctx context.Context, objects []*unstructured.Unstructured, dynamicClient dynamic.Interface, mapper *restmapper.DeferredDiscoveryRESTMapper) error
ApplyUnstructured applies a list of unstructured objects to the K8s cluster.
func CheckRollingRestartLogic ¶
CheckRollingRestartLogic checks if the rolling restart logic is correctly followed based on the provided list of Kubernetes watch events. The function first sort events by time, then checks for pod creation events and verifies the restart events to ensure that the rolling restart logic is adhered to. An example of a rolling restart event sequence is like:
- pod1 added
- pod2 added
- pod2 deleted
- pod2 added
- pod1 deleted
- pod1 added
func DecodeYAML ¶
func DecodeYAML(r io.Reader) ([]*unstructured.Unstructured, error)
DecodeYAML decodes a YAML file into a list of unstructured objects.
func ForwardOnePort ¶
func ForwardOnePort(fw PortForwarder, ns, resourceName string, port uint16) ( fwdHost string, fwdPort uint16, cancel context.CancelFunc, err error)
ForwardOnePort is a helper utility to forward one port of Kubernetes resource.
func GetPodUIDMap ¶
func GetPodUIDMap(ctx context.Context, clientSet kubernetes.Interface, namespace string, opts metav1.ListOptions) (map[string]string, error)
func GetPodUIDMapFromPodList ¶
func LoadConfig ¶
LoadConfig loads the k8s config from the default location.
Types ¶
type PortForwarder ¶
type PortForwarder interface {
Forward(namespace, resourceName string, addresses []string, ports []string) ([]portforward.ForwardedPort, context.CancelFunc, error)
ForwardPod(pod *corev1.Pod, addresses []string, ports []string) ([]portforward.ForwardedPort, context.CancelFunc, error)
}
PortForwarder represents an interface which can forward local ports to a pod.
func NewPortForwarder ¶
func NewPortForwarder(ctx context.Context, restClientGetter genericclioptions.RESTClientGetter) (PortForwarder, error)
type YAMLApplier ¶
type YAMLApplier struct {
DynamicClient dynamic.Interface
Mapper *restmapper.DeferredDiscoveryRESTMapper
}
YAMLApplier applies a list of unstructured objects to the K8s cluster.
func NewYAMLApplier ¶
func NewYAMLApplier(dynamicClient dynamic.Interface, mapper *restmapper.DeferredDiscoveryRESTMapper) *YAMLApplier
NewYAMLApplier creates a new YAMLApplier.