occlient

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2018 License: Apache-2.0 Imports: 52 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpenShiftNameSpace = "openshift"
)

Variables

This section is empty.

Functions

func FakeNew added in v0.0.6

func FakeNew() (*Client, *FakeClientset)

FakeNew creates new fake client for testing returns Client that is filled with fake clients and FakeClientSet that holds fake Clientsets to access Actions, Reactors etc... in fake client

func ParseImageName added in v0.0.9

func ParseImageName(image string) (string, string, string, string, error)

parseImageName parse image reference returns (imageNamespace, imageName, tag, digest, error) if image is referenced by tag (name:tag) than digest is "" if image is referenced by digest (name@digest) than tag is ""

Types

type Client added in v0.0.3

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

func New added in v0.0.3

func New(connectionCheck bool) (*Client, error)

func (*Client) AddEnvironmentVariablesToDeploymentConfig added in v0.0.4

func (c *Client) AddEnvironmentVariablesToDeploymentConfig(envs []corev1.EnvVar, dc *appsv1.DeploymentConfig) error

AddEnvironmentVariablesToDeploymentConfig adds the given environment variables to the only container in the Deployment Config and updates in the cluster

func (*Client) AddPVCToDeploymentConfig added in v0.0.4

func (c *Client) AddPVCToDeploymentConfig(dc *appsv1.DeploymentConfig, pvc string, path string) error

AddPVCToDeploymentConfig adds the given PVC to the given Deployment Config at the given path

func (*Client) BootstrapSupervisoredS2I added in v0.0.5

func (c *Client) BootstrapSupervisoredS2I(name string, builderImage string, labels map[string]string, annotations map[string]string, inputPorts []string) error

BootstrapSupervisoredS2I uses s2i to inject Supervisor into builder image. Supervisor keeps pod running (runs as pid1), so you it is possible to trigger assembly script inside running pod, and than restart application using Supervisor without need to restart whole container. inputPorts is the array containing the string port values

func (*Client) CleanupAfterSupervisor added in v0.0.9

func (c *Client) CleanupAfterSupervisor(dcName string, projectName string, annotations map[string]string) error

CleanupAfterSupervisor removes the supervisor from the deployment config dcName is the name of the deployment config to be updated projectName is the name of the project annotations are the updated annotations for the new deployment config

func (*Client) CopyFile added in v0.0.5

func (c *Client) CopyFile(localPath string, targetPodName string, targetPath string, copyFiles []string) error

CopyFile copies localPath directory or list of files in copyFiles list to the directory in running Pod. copyFiles is list of changed files captured during `odo watch` as well as binary file path During copying binary components, localPath represent base directory path to binary and copyFiles contains path of binary During copying local source components, localPath represent base directory path whereas copyFiles is empty During `odo watch`, localPath represent base directory path whereas copyFiles contains list of changed Files

func (*Client) CreateNewProject added in v0.0.3

func (c *Client) CreateNewProject(name string) error

func (*Client) CreatePVC added in v0.0.4

func (c *Client) CreatePVC(name string, size string, labels map[string]string) (*corev1.PersistentVolumeClaim, error)

CreatePVC creates a PVC resource in the cluster with the given name, size and labels

func (*Client) CreateRoute added in v0.0.3

func (c *Client) CreateRoute(name string, serviceName string, portNumber intstr.IntOrString, labels map[string]string) (*routev1.Route, error)

CreateRoute creates a route object for the given service and with the given labels serviceName is the name of the service for the target reference portNumber is the target port of the route

func (*Client) CreateService added in v0.0.9

func (c *Client) CreateService(commonObjectMeta metav1.ObjectMeta, containerPorts []corev1.ContainerPort) error

CreateService generates and creates the service commonObjectMeta is the ObjectMeta for the service dc is the deploymentConfig to get the container ports

func (*Client) CreateServiceInstance added in v0.0.11

func (c *Client) CreateServiceInstance(componentName string, componentType string, labels map[string]string) error

CreateServiceInstance creates service instance from service catalog

func (*Client) Delete added in v0.0.3

func (c *Client) Delete(labels map[string]string) error

Delete takes labels as a input and based on it, deletes respective resource

func (*Client) DeletePVC added in v0.0.4

func (c *Client) DeletePVC(name string) error

DeletePVC deletes the given PVC by name

func (*Client) DeleteProject added in v0.0.3

func (c *Client) DeleteProject(name string) error

DeleteProject deletes given project

func (*Client) DeleteRoute added in v0.0.3

func (c *Client) DeleteRoute(name string) error

DeleteRoute deleted the given route

func (*Client) DeleteServiceInstance added in v0.0.11

func (c *Client) DeleteServiceInstance(labels map[string]string) error

DeleteServiceInstance takes labels as a input and based on it, deletes respective service instance

func (*Client) DisplayDeploymentConfigLog added in v0.0.6

func (c *Client) DisplayDeploymentConfigLog(deploymentConfigName string, followLog bool, stdout io.Writer) error

Display DeploymentConfig log to stdout

func (*Client) ExecCMDInContainer added in v0.0.5

func (c *Client) ExecCMDInContainer(podName string, cmd []string, stdout io.Writer, stderr io.Writer, stdin io.Reader, tty bool) error

ExecCMDInContainer execute command in first container of a pod

func (*Client) FollowBuildLog added in v0.0.3

func (c *Client) FollowBuildLog(buildName string, stdout io.Writer) error

FollowBuildLog stream build log to stdout

func (*Client) GetBuildConfigFromName added in v0.0.10

func (c *Client) GetBuildConfigFromName(name string, project string) (*buildv1.BuildConfig, error)

GetBuildConfigFromName get BuildConfig by its name

func (*Client) GetClusterServiceClassExternalNames added in v0.0.3

func (c *Client) GetClusterServiceClassExternalNames() ([]string, error)

GetClusterServiceClassExternalNames returns the names of all the cluster service classes in the cluster

func (*Client) GetClusterServiceClasses added in v0.0.3

func (c *Client) GetClusterServiceClasses() ([]scv1beta1.ClusterServiceClass, error)

GetClusterServiceClasses queries the service service catalog to get available clusterServiceClasses

func (*Client) GetCurrentProjectName added in v0.0.3

func (c *Client) GetCurrentProjectName() string

func (*Client) GetDeploymentConfigFromName added in v0.0.4

func (c *Client) GetDeploymentConfigFromName(name string, project string) (*appsv1.DeploymentConfig, error)

GetDeploymentConfigFromName returns the Deployment Config resource given the Deployment Config name

func (*Client) GetDeploymentConfigsFromSelector added in v0.0.4

func (c *Client) GetDeploymentConfigsFromSelector(selector string) ([]appsv1.DeploymentConfig, error)

GetDeploymentConfigsFromSelector returns an array of Deployment Config resources which match the given selector

func (*Client) GetExposedPorts added in v0.0.5

func (c *Client) GetExposedPorts(imageStream *imagev1.ImageStream, imageTag string) ([]corev1.ContainerPort, error)

GetExposedPorts retruns image namespace and list of ContainerPorts that are exposed by given image

func (*Client) GetImageStream added in v0.0.11

func (c *Client) GetImageStream(imageNS string, imageName string, imageTag string) (*imagev1.ImageStream, error)

GetImageNS returns the imagestream using image details like imageNS, imageName and imageTag imageNS can be empty in which case, this function searches currentNamespace on priority. If imagestream of required tag not found in current namespace, then searches openshift namespace. If not found, error out. If imageNS is not empty string, then, the requested imageNS only is searched for requested imagestream

func (*Client) GetImageStreams added in v0.0.3

func (c *Client) GetImageStreams(namespace string) ([]imagev1.ImageStream, error)

GetImageStreams returns the Image Stream objects in the given namespace

func (*Client) GetImageStreamsNames added in v0.0.3

func (c *Client) GetImageStreamsNames(namespace string) ([]string, error)

GetImageStreamsNames returns the names of the image streams in a given namespace

func (*Client) GetLabelValues added in v0.0.3

func (c *Client) GetLabelValues(project string, label string, selector string) ([]string, error)

GetLabelValues get label values of given label from objects in project that are matching selector returns slice of unique label values

func (*Client) GetLatestBuildName added in v0.0.4

func (c *Client) GetLatestBuildName(buildConfigName string) (string, error)

GetLatestBuildName gets the name of the latest build buildConfigName is the name of the buildConfig for which we are fetching the build name returns the name of the latest build or the error

func (*Client) GetOneDeploymentConfigFromSelector added in v0.0.4

func (c *Client) GetOneDeploymentConfigFromSelector(selector string) (*appsv1.DeploymentConfig, error)

GetOneDeploymentConfigFromSelector returns the Deployment Config object associated with the given selector. An error is thrown when exactly one Deployment Config is not found for the selector.

func (*Client) GetOnePodFromSelector added in v0.0.4

func (c *Client) GetOnePodFromSelector(selector string) (*corev1.Pod, error)

GetOnePodFromSelector returns the Pod object associated with the given selector. An error is thrown when exactly one Pod is not found.

func (*Client) GetOneServiceFromSelector added in v0.0.4

func (c *Client) GetOneServiceFromSelector(selector string) (*corev1.Service, error)

GetOneServiceFromSelector returns the Service object associated with the given selector. An error is thrown when exactly one Service is not found for the selector

func (*Client) GetPVCFromName added in v0.0.6

func (c *Client) GetPVCFromName(pvcName string) (*corev1.PersistentVolumeClaim, error)

GetPVCFromName returns the PVC of the given name

func (*Client) GetPVCNameFromVolumeMountName added in v0.0.6

func (c *Client) GetPVCNameFromVolumeMountName(volumeMountName string, dc *appsv1.DeploymentConfig) string

GetPVCNameFromVolumeMountName returns the PVC associated with the given volume An empty string is returned if the volume is not found

func (*Client) GetPVCNamesFromSelector added in v0.0.4

func (c *Client) GetPVCNamesFromSelector(selector string) ([]string, error)

GetPVCNamesFromSelector returns the PVC names for the given selector

func (*Client) GetPVCsFromSelector added in v0.0.4

func (c *Client) GetPVCsFromSelector(selector string) ([]corev1.PersistentVolumeClaim, error)

GetPVCsFromSelector returns the PVCs based on the given selector

func (*Client) GetProjectNames added in v0.0.4

func (c *Client) GetProjectNames() ([]string, error)

GetProjectNames return list of existing projects that user has access to.

func (*Client) GetServerVersion added in v0.0.5

func (c *Client) GetServerVersion() (*serverInfo, error)

GetServerVersion will fetch the Server Host, OpenShift and Kubernetes Version It will be shown on the execution of odo version command

func (*Client) GetServiceInstanceList added in v0.0.11

func (c *Client) GetServiceInstanceList(namespace string, selector string) ([]scv1beta1.ServiceInstance, error)

GetServiceInstanceList returns list service instances

func (*Client) GetServicesFromSelector added in v0.0.4

func (c *Client) GetServicesFromSelector(selector string) ([]corev1.Service, error)

GetServicesFromSelector returns an array of Service resources which match the given selector

func (*Client) GetVolumeMountsFromDC added in v0.0.6

func (c *Client) GetVolumeMountsFromDC(dc *appsv1.DeploymentConfig) []corev1.VolumeMount

GetVolumeMountsFromDC returns a list of all volume mounts in the given DC

func (*Client) ListRouteNames added in v0.0.3

func (c *Client) ListRouteNames(labelSelector string) ([]string, error)

ListRouteNames lists all the names of the routes based on the given label selector

func (*Client) ListRoutes added in v0.0.3

func (c *Client) ListRoutes(labelSelector string) ([]routev1.Route, error)

ListRoutes lists all the routes based on the given label selector

func (*Client) NewAppS2I added in v0.0.3

func (c *Client) NewAppS2I(name string, builderImage string, gitUrl string, labels map[string]string, annotations map[string]string, inputPorts []string) error

NewAppS2I create new application using S2I gitUrl is the url of the git repo inputPorts is the array containing the string port values

func (*Client) RemoveVolumeFromDeploymentConfig added in v0.0.4

func (c *Client) RemoveVolumeFromDeploymentConfig(pvc string, dcName string) error

RemoveVolumeFromDeploymentConfig removes the volume associated with the given PVC from the Deployment Config. Both, the volume entry and the volume mount entry in the containers, are deleted.

func (*Client) SetCurrentProject added in v0.0.3

func (c *Client) SetCurrentProject(project string) error

func (*Client) SetupForSupervisor added in v0.0.9

func (c *Client) SetupForSupervisor(dcName string, projectName string, annotations map[string]string, labels map[string]string) error

SetupForSupervisor adds the supervisor to the deployment config dcName is the name of the deployment config to be updated projectName is the name of the project annotations are the updated annotations for the new deployment config labels are the labels of the PVC created while setting up the supervisor

func (*Client) StartBuild added in v0.0.3

func (c *Client) StartBuild(name string) (string, error)

StartBuild starts new build as it is, returns name of the build stat was started

func (*Client) UpdateBuildConfig added in v0.0.4

func (c *Client) UpdateBuildConfig(buildConfigName string, projectName string, gitUrl string, annotations map[string]string) error

UpdateBuildConfig updates the BuildConfig file buildConfigName is the name of the BuildConfig file to be updated projectName is the name of the project gitUrl equals to the git URL of the source and is equals to "" if the source is of type dir or binary annotations contains the annotations for the BuildConfig file

func (*Client) UpdateDCAnnotations added in v0.0.9

func (c *Client) UpdateDCAnnotations(dcName string, annotations map[string]string) error

UpdateDCAnnotations updates the DeploymentConfig file dcName is the name of the DeploymentConfig file to be updated annotations contains the annotations for the DeploymentConfig file

func (*Client) UpdatePVCLabels added in v0.0.6

func (c *Client) UpdatePVCLabels(pvc *corev1.PersistentVolumeClaim, labels map[string]string) error

UpdatePVCLabels updates the given PVC with the given labels

func (*Client) WaitAndGetPod added in v0.0.5

func (c *Client) WaitAndGetPod(selector string) (*corev1.Pod, error)

WaitAndGetPod block and waits until pod matching selector is in in Running state

func (*Client) WaitForBuildToFinish added in v0.0.5

func (c *Client) WaitForBuildToFinish(buildName string) error

WaitForBuildToFinish block and waits for build to finish. Returns error if build failed or was canceled.

type FakeClientset added in v0.0.6

type FakeClientset struct {
	Kubernetes              *fakeKubeClientset.Clientset
	AppsClientset           *fakeAppsClientset.Clientset
	BuildClientset          *fakeBuildClientset.Clientset
	ImageClientset          *fakeImageClientset.Clientset
	RouteClientset          *fakeRouteClientset.Clientset
	ProjClientset           *fakeProjClientset.Clientset
	ServiceCatalogClientSet *fakeServiceCatalogClientSet.Clientset
}

FakeClientSet holds fake ClientSets this is returned by FakeNew to access methods of fake client sets

Jump to

Keyboard shortcuts

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