openshift

package
v0.0.0-...-6054725 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const ProviderName = "openshift"

ProviderName of the cloud platform provider

Variables

This section is empty.

Functions

func CheckKubeConfigExist

func CheckKubeConfigExist() bool

CheckKubeConfigExist checks for existence of kubeconfig

func CheckPathExists

func CheckPathExists(path string) bool

CheckPathExists checks if a path exists or not

func GetHostWithPort

func GetHostWithPort(inputURL string) (string, error)

GetHostWithPort parses provided url and returns string formated as host:port even if port was not specifically specified in the origin url. If port is not specified, standart port corresponding to url schema is provided. example: for url https://example.com function will return "example.com:443" for url https://example.com:8443 function will return "example:8443"

Types

type Client

type Client struct {
	KubeClient       kubernetes.Interface
	KubeConfig       clientcmd.ClientConfig
	KubeClientConfig *rest.Config
	Namespace        string
	OperatorClient   *operatorsclientset.OperatorsV1alpha1Client
}

Client is a collection of fields used for client configuration and interaction

func New

func New() (*Client, error)

New creates a new client

func NewForConfig

func NewForConfig(config clientcmd.ClientConfig) (client *Client, err error)

NewForConfig creates a new client with the provided configuration or initializes the configuration if none is provided

func (*Client) IsServerUp

func (c *Client) IsServerUp(timeout time.Duration) (bool, error)

IsServerUp checks if a openshift cluster is up or not

type OpenShift

type OpenShift struct {
	// contains filtered or unexported fields
}

OpenShift provides access to the OpenShift/Kubernetes API and implements the provider interface.

func NewProvider

func NewProvider() *OpenShift

NewProvider Openshift

func (*OpenShift) AttachVolume

func (oc *OpenShift) AttachVolume(ctx *lepton.Context, instanceName, volumeName string, attachID int) error

AttachVolume attaches a volume to a nano instance

func (*OpenShift) BuildImage

func (oc *OpenShift) BuildImage(ctx *lepton.Context) (string, error)

BuildImage builds the image

func (*OpenShift) BuildImageWithPackage

func (oc *OpenShift) BuildImageWithPackage(ctx *lepton.Context, pkgpath string) (string, error)

BuildImageWithPackage builds the image with package

func (*OpenShift) CreateImage

func (oc *OpenShift) CreateImage(ctx *lepton.Context, imagePath string) error

CreateImage creates the image

func (*OpenShift) CreateInstance

func (oc *OpenShift) CreateInstance(ctx *lepton.Context) error

CreateInstance creates nano instance

func (*OpenShift) CreateVolume

func (oc *OpenShift) CreateVolume(ctx *lepton.Context, volumeName, data, provider string) (lepton.NanosVolume, error)

CreateVolume creates a volume on the openshift cluster

func (*OpenShift) CustomizeImage

func (oc *OpenShift) CustomizeImage(ctx *lepton.Context) (string, error)

CustomizeImage customizes the images

func (*OpenShift) DeleteImage

func (oc *OpenShift) DeleteImage(ctx *lepton.Context, imagename string) error

DeleteImage deletes the image using the image name

func (*OpenShift) DeleteInstance

func (oc *OpenShift) DeleteInstance(ctx *lepton.Context, instancename string) error

DeleteInstance deletes a nano instance using the name

func (*OpenShift) DeleteVolume

func (oc *OpenShift) DeleteVolume(ctx *lepton.Context, volumeName string) error

DeleteVolume deletes a volume

func (*OpenShift) DetachVolume

func (oc *OpenShift) DetachVolume(ctx *lepton.Context, instanceName, volumeName string) error

DetachVolume detaches a volume from a nano instance

func (*OpenShift) GetAllVolumes

func (oc *OpenShift) GetAllVolumes(ctx *lepton.Context) (*[]lepton.NanosVolume, error)

GetAllVolumes gets all volumes

func (*OpenShift) GetImages

func (oc *OpenShift) GetImages(ctx *lepton.Context) ([]lepton.CloudImage, error)

GetImages gets all the images

func (*OpenShift) GetInstanceByName

func (oc *OpenShift) GetInstanceByName(ctx *lepton.Context, name string) (*lepton.CloudInstance, error)

GetInstanceByName gets a nano instance by name

func (*OpenShift) GetInstanceLogs

func (oc *OpenShift) GetInstanceLogs(ctx *lepton.Context, instancename string) (string, error)

GetInstanceLogs gets the logs from a nanos instance

func (*OpenShift) GetInstances

func (oc *OpenShift) GetInstances(ctx *lepton.Context) ([]lepton.CloudInstance, error)

GetInstances gets all nano instances

func (*OpenShift) Initialize

func (oc *OpenShift) Initialize(config *types.ProviderConfig) error

Initialize prepares the openshift client and checks if the openshift server is up

func (*OpenShift) ListImages

func (oc *OpenShift) ListImages(ctx *lepton.Context) error

ListImages lists all the images

func (*OpenShift) ListInstances

func (oc *OpenShift) ListInstances(ctx *lepton.Context) error

ListInstances lists all nano instances locally or on the provider

func (*OpenShift) PrintInstanceLogs

func (oc *OpenShift) PrintInstanceLogs(ctx *lepton.Context, instancename string, watch bool) error

PrintInstanceLogs prints the logs from a nanos instance

func (*OpenShift) RebootInstance

func (oc *OpenShift) RebootInstance(ctx *lepton.Context, instanceName string) error

RebootInstance reboots a nanos instance.

func (*OpenShift) ResizeImage

func (oc *OpenShift) ResizeImage(ctx *lepton.Context, imagename string, hbytes string) error

ResizeImage resizes the image

func (*OpenShift) StartInstance

func (oc *OpenShift) StartInstance(ctx *lepton.Context, instancename string) error

StartInstance starts a nanos instance

func (*OpenShift) StopInstance

func (oc *OpenShift) StopInstance(ctx *lepton.Context, instancename string) error

StopInstance stops a nanos instance

func (*OpenShift) SyncImage

func (oc *OpenShift) SyncImage(config *types.Config, target lepton.Provider, imagename string) error

SyncImage sync an image from one provider to another

Jump to

Keyboard shortcuts

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