Documentation ¶
Index ¶
- func AddAllowFirewallRule()
- func AllContainerIsRunning(pod *v1.Pod) bool
- func BytesToInt(b []byte) uint32
- func CanI(clientset *kubernetes.Clientset, sa, ns string, resource *rbacv1.PolicyRule) (allowed bool, err error)
- func CleanExtensionLib()
- func Deduplicate(cidr []*net.IPNet) (result []*net.IPNet)
- func DeleteAllowFirewallRule()
- func DeleteBlockFirewallRule(_ context.Context)
- func DoReq(request *http.Request) (body []byte, err error)
- func FindAllowFirewallRule() bool
- func GetAnnotation(f util.Factory, ns string, resources string) (map[string]string, error)
- func GetAvailableTCPPortOrDie() int
- func GetAvailableUDPPortOrDie() int
- func GetCIDRElegant(clientset *kubernetes.Clientset, restclient *rest.RESTClient, ...) (result []*net.IPNet, err1 error)
- func GetCIDRFromResourceUgly(clientset *kubernetes.Clientset, namespace string) ([]*net.IPNet, error)
- func GetEnv(ctx context.Context, f util.Factory, ns, pod string) (map[string][]string, error)
- func GetPodTemplateSpecPath(u *unstructured.Unstructured) (*v1.PodTemplateSpec, []string, error)
- func GetTlsDomain(namespace string) string
- func GetTopOwnerReference(factory cmdutil.Factory, namespace, workload string) (*runtimeresource.Info, error)
- func GetTopOwnerReferenceBySelector(factory cmdutil.Factory, namespace, selector string) (sets.Set[string], error)
- func GetUnstructuredObject(f cmdutil.Factory, namespace string, workloads string) (*runtimeresource.Info, error)
- func GetUnstructuredObjectBySelector(f cmdutil.Factory, namespace string, selector string) ([]*runtimeresource.Info, error)
- func GetUnstructuredObjectList(f cmdutil.Factory, namespace string, workloads []string) ([]*runtimeresource.Info, error)
- func Heartbeats()
- func InitLogger(debug bool)
- func IsAdmin() bool
- func IsIPv4(packet []byte) bool
- func IsIPv6(packet []byte) bool
- func IsPortListening(port int) bool
- func IsWindows() bool
- func Main(remoteEndpoint, localEndpoint *netip.AddrPort, conf *SshConfig, ...) error
- func MoveToTemp()
- func Ping(targetIP string) (bool, error)
- func PortForwardPod(config *rest.Config, clientset *rest.RESTClient, ...) error
- func Print(writer io.Writer, slogan string)
- func PrintStatus(pod *corev1.Pod, writer io.Writer)
- func PrintStatusInline(pod *corev1.Pod) string
- func RolloutStatus(ctx1 context.Context, factory cmdutil.Factory, namespace, workloads string, ...) error
- func RunWithElevated()
- func RunWithRollingOutWithChecker(cmd *osexec.Cmd, checker func(log string)) (string, string, error)
- func SCP(conf *SshConfig, filename string, commands ...string) error
- func Shell(clientset *kubernetes.Clientset, restclient *rest.RESTClient, ...) (string, error)
- func StartupPProf(port int)
- func WaitPod(podInterface v12.PodInterface, list metav1.ListOptions, ...) error
- func WaitPodToBeReady(ctx context.Context, podInterface v12.PodInterface, ...) error
- func WaitPortToBeFree(ctx context.Context, port int) error
- type Format
- type ForwardedPort
- type PodRouteConfig
- type PortForwarder
- type SshConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAllowFirewallRule ¶
func AddAllowFirewallRule()
func AllContainerIsRunning ¶
func BytesToInt ¶
func CanI ¶
func CanI(clientset *kubernetes.Clientset, sa, ns string, resource *rbacv1.PolicyRule) (allowed bool, err error)
func CleanExtensionLib ¶
func CleanExtensionLib()
func DeleteAllowFirewallRule ¶
func DeleteAllowFirewallRule()
func DeleteBlockFirewallRule ¶
func FindAllowFirewallRule ¶
func FindAllowFirewallRule() bool
func GetAnnotation ¶
func GetAvailableTCPPortOrDie ¶
func GetAvailableTCPPortOrDie() int
func GetAvailableUDPPortOrDie ¶
func GetAvailableUDPPortOrDie() int
func GetCIDRElegant ¶
func GetCIDRElegant(clientset *kubernetes.Clientset, restclient *rest.RESTClient, restconfig *rest.Config, namespace string) (result []*net.IPNet, err1 error)
GetCIDRElegant 1) dump cluster info 2) grep cmdline 3) create svc + cat *.conflist 4) create svc + get pod ip with svc mask
func GetCIDRFromResourceUgly ¶
func GetCIDRFromResourceUgly(clientset *kubernetes.Clientset, namespace string) ([]*net.IPNet, error)
GetCIDRFromResourceUgly use podIP/24 and serviceIP/16 as cidr
func GetPodTemplateSpecPath ¶
func GetPodTemplateSpecPath(u *unstructured.Unstructured) (*v1.PodTemplateSpec, []string, error)
func GetTlsDomain ¶
func GetTopOwnerReference ¶
func GetTopOwnerReferenceBySelector ¶
func GetTopOwnerReferenceBySelector(factory cmdutil.Factory, namespace, selector string) (sets.Set[string], error)
GetTopOwnerReferenceBySelector assume pods, controller has same labels
func GetUnstructuredObject ¶
func Heartbeats ¶
func Heartbeats()
func InitLogger ¶
func InitLogger(debug bool)
func IsPortListening ¶
func MoveToTemp ¶
func MoveToTemp()
func PortForwardPod ¶
func PrintStatusInline ¶
func RolloutStatus ¶
func RunWithElevated ¶
func RunWithElevated()
func Shell ¶
func Shell(clientset *kubernetes.Clientset, restclient *rest.RESTClient, config *rest.Config, podName, containerName, namespace string, cmd []string) (string, error)
func StartupPProf ¶
func StartupPProf(port int)
func WaitPod ¶
func WaitPod(podInterface v12.PodInterface, list metav1.ListOptions, checker func(*v1.Pod) bool) error
func WaitPodToBeReady ¶
func WaitPodToBeReady(ctx context.Context, podInterface v12.PodInterface, selector metav1.LabelSelector) error
Types ¶
type ForwardedPort ¶
ForwardedPort contains a Local:Remote port pairing.
type PodRouteConfig ¶
type PortForwarder ¶
type PortForwarder struct { Ready chan struct{} // contains filtered or unexported fields }
PortForwarder knows how to listen for local connections and forward them to a remote pod via an upgraded HTTP request.
func NewOnAddresses ¶
func NewOnAddresses(dialer httpstream.Dialer, addresses []string, ports []string, stopChan <-chan struct{}, readyChan chan struct{}, out, errOut io.Writer) (*PortForwarder, error)
NewOnAddresses creates a new PortForwarder with custom listen addresses.
func (*PortForwarder) Close ¶
func (pf *PortForwarder) Close()
Close stops all listeners of PortForwarder.
func (*PortForwarder) ForwardPorts ¶
func (pf *PortForwarder) ForwardPorts() error
ForwardPorts formats and executes a port forwarding request. The connection will remain open until stopChan is closed.
func (*PortForwarder) GetPorts ¶
func (pf *PortForwarder) GetPorts() ([]ForwardedPort, error)
GetPorts will return the ports that were forwarded; this can be used to retrieve the locally-bound port in cases where the input was port 0. This function will signal an error if the Ready channel is nil or if the listeners are not ready yet; this function will succeed after the Ready channel has been closed.