lcm

package
v0.0.0-...-3f238fb Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2025 License: MIT Imports: 48 Imported by: 0

Documentation

Overview

* Copyright Skyramp Authors 2024

Index

Constants

This section is empty.

Variables

View Source
var (
	DockerEngineAPIVersion = "1.44"
)

Functions

func DialerToPod

func DialerToPod(conf *rest.Config, clientSet kubernetes.Interface, podName string, namespace string) (httpstream.Dialer, error)

func InstallHelmChart

func InstallHelmChart(
	namespace, deploymentName string,
	helmOptions *types.HelmOptions,
	releaseName, kubeconfigPath, k8sContext string,
	values map[string]interface{},
) error

func IsInDefaultBridgeNetwork

func IsInDefaultBridgeNetwork(container *dockerTypes.ContainerJSON) bool

func NewK8sConfig

func NewK8sConfig(configPath, context string) (*restclient.Config, error)

func RemoveSkyrampWorkerInDocker

func RemoveSkyrampWorkerInDocker(containerName string) error

Helper method that will bring down skyramp worker in a docker network

func RunSkyrampWorkerInDockerNetwork

func RunSkyrampWorkerInDockerNetwork(image, tag string, hostPort int, targetNetworkName string) error

Helper method that will bring up skyramp worker in a docker network

func UninstallHelmChart

func UninstallHelmChart(namespace, releaseName, kubeconfigPath string) error

Types

type DockerLCM

type DockerLCM struct {

	// docker container object
	Container *dockerTypes.ContainerJSON
	// docker network ID that the work is in
	NetworkID string
	// docker network name
	NetworkName string
	// contains filtered or unexported fields
}

func NewDockerLCM

func NewDockerLCM() (*DockerLCM, error)

generic docker LCM to communicate with docker API

func (*DockerLCM) FindContainerByBoundAddress

func (d *DockerLCM) FindContainerByBoundAddress(address string) (*dockerTypes.ContainerJSON, error)

find container in docker using address and IP there could be some edges cases that this does not properly handle

func (*DockerLCM) FindNetworkByName

func (d *DockerLCM) FindNetworkByName(networkName string) (*network.Inspect, error)

func (*DockerLCM) RestartWithNewPorts

func (d *DockerLCM) RestartWithNewPorts(container *dockerTypes.ContainerJSON, ports []int) error

exposing new ports requires recreating container this applies to standalone container, that does not belong to docker network

type K8SLCM

type K8SLCM struct {
	Namespace     string // Namespace to deploy
	LabelSelector string // labels for filter

	// Results for cache
	Deployments []*apiAppsv1.Deployment
	Services    []*apiCorev1.Service
	ConfigMaps  []*apiCorev1.ConfigMap
	// contains filtered or unexported fields
}

func NewK8SLCM

func NewK8SLCM(configPath, context, namespace string, labelMap map[string]string, option *LCMOption) (*K8SLCM, error)

func (*K8SLCM) ExecCommand

func (l *K8SLCM) ExecCommand(ctx context.Context, namespace, podName, containerName, dir, command string) (string, error)

exec sh command over k8s api

func (*K8SLCM) GetClientSet

func (l *K8SLCM) GetClientSet() *kubernetes.Clientset

func (*K8SLCM) GetDeployments

func (l *K8SLCM) GetDeployments(deployments []string) ([]*apiAppsv1.Deployment, error)

func (*K8SLCM) GetPodName

func (l *K8SLCM) GetPodName(deploymentName string) (string, error)

func (*K8SLCM) GetWorkerPodName

func (l *K8SLCM) GetWorkerPodName() (string, error)

func (*K8SLCM) K8sDashboardPortForward

func (l *K8SLCM) K8sDashboardPortForward(serviceName, namespace, path string) error

func (*K8SLCM) NewK8sPortForward

func (l *K8SLCM) NewK8sPortForward(serviceName, namespace string, dstPort int) (*K8sPortForwarder, error)

type K8sPortForwarder

type K8sPortForwarder struct {
	LocalPort int32
	// contains filtered or unexported fields
}

func NewK8sPortForwarder

func NewK8sPortForwarder(dialer httpstream.Dialer, localPort, dstPort int32) (*K8sPortForwarder, error)

func (*K8sPortForwarder) Done

func (pf *K8sPortForwarder) Done() <-chan struct{}

func (*K8sPortForwarder) Start

func (pf *K8sPortForwarder) Start(readyFunc func(pf *K8sPortForwarder) error) error

func (*K8sPortForwarder) Stop

func (pf *K8sPortForwarder) Stop()

type LCMOption

type LCMOption struct {
	DeployIngress bool
}

Jump to

Keyboard shortcuts

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