Documentation
¶
Index ¶
- Constants
- Variables
- func AddBootstrapSupervisordInitContainer(podTemplateSpec *corev1.PodTemplateSpec)
- func AddPVCAndVolumeMount(podTemplateSpec *corev1.PodTemplateSpec, volumeNameToPVCName map[string]string, ...) error
- func AddPVCToPodTemplateSpec(podTemplateSpec *corev1.PodTemplateSpec, volumeName, pvcName string)
- func AddVolumeMountToPodTemplateSpec(podTemplateSpec *corev1.PodTemplateSpec, volumeName string, ...) error
- func CreateObjectMeta(name, namespace string, labels, annotations map[string]string) metav1.ObjectMeta
- func FakeNew() (*Client, *FakeClientset)
- func FakePodStatus(status corev1.PodPhase, podName string) *corev1.Pod
- func GenerateContainer(name, image string, isPrivileged bool, command, args []string, ...) *corev1.Container
- func GenerateDeploymentSpec(podTemplateSpec corev1.PodTemplateSpec) *appsv1.DeploymentSpec
- func GenerateIngressSpec(ingressParam IngressParameter) *extensionsv1.IngressSpec
- func GenerateOwnerReference(deployment *appsv1.Deployment) metav1.OwnerReference
- func GeneratePVCSpec(quantity resource.Quantity) *corev1.PersistentVolumeClaimSpec
- func GeneratePodTemplateSpec(objectMeta metav1.ObjectMeta, containers []corev1.Container) *corev1.PodTemplateSpec
- func GenerateServiceSpec(componentName string, containerPorts []corev1.ContainerPort) *corev1.ServiceSpec
- type Client
- func (c *Client) CreateDeployment(deploymentSpec appsv1.DeploymentSpec) (*appsv1.Deployment, error)
- func (c *Client) CreateDynamicResource(exampleCustomResource map[string]interface{}, group, version, resource string) error
- func (c *Client) CreateIngress(objectMeta metav1.ObjectMeta, spec extensionsv1.IngressSpec) (*extensionsv1.Ingress, error)
- func (c *Client) CreatePVC(objectMeta metav1.ObjectMeta, pvcSpec corev1.PersistentVolumeClaimSpec) (*corev1.PersistentVolumeClaim, error)
- func (c *Client) CreateService(commonObjectMeta metav1.ObjectMeta, svcSpec corev1.ServiceSpec) (*corev1.Service, error)
- func (c *Client) CreateTLSSecret(tlsCertificate []byte, tlsPrivKey []byte, objectMeta metav1.ObjectMeta) (*corev1.Secret, error)
- func (c *Client) DeleteDeployment(labels map[string]string) error
- func (c *Client) DeleteIngress(name string) error
- func (c *Client) ExecCMDInContainer(compInfo common.ComponentInfo, cmd []string, stdout io.Writer, ...) error
- func (c *Client) ExtractProjectToComponent(compInfo common.ComponentInfo, targetPath string, stdin io.Reader) error
- func (c *Client) GetClusterServiceVersion(name string) (olm.ClusterServiceVersion, error)
- func (c *Client) GetClusterServiceVersionList() (*olm.ClusterServiceVersionList, error)
- func (c *Client) GetCustomResourcesFromCSV(csv olm.ClusterServiceVersion) []olm.CRDDescription
- func (c *Client) GetDeploymentByName(name string) (*appsv1.Deployment, error)
- func (c *Client) GetIngress(name string) (*extensionsv1.Ingress, error)
- func (c *Client) GetPVCsFromSelector(selector string) ([]corev1.PersistentVolumeClaim, error)
- func (c *Client) ListDynamicResource(group, version, resource string) (*unstructured.UnstructuredList, error)
- func (c *Client) ListIngresses(labelSelector string) ([]extensionsv1.Ingress, error)
- func (c *Client) UpdateDeployment(deploymentSpec appsv1.DeploymentSpec) (*appsv1.Deployment, error)
- func (c *Client) UpdateService(commonObjectMeta metav1.ObjectMeta, svcSpec corev1.ServiceSpec) (*corev1.Service, error)
- func (c *Client) WaitAndGetPod(watchOptions metav1.ListOptions, desiredPhase corev1.PodPhase, ...) (*corev1.Pod, error)
- func (c *Client) WaitForDeploymentRollout(deploymentName string) (*appsv1.Deployment, error)
- type FakeClientset
- type IngressParameter
- type SelfSignedCertificate
Constants ¶
const ( DeploymentKind = "Deployment" DeploymentAPIVersion = "apps/v1" )
constants for deployments
const ( // OdoSourceVolume is the constant containing the name of the emptyDir volume containing the project source OdoSourceVolume = "odo-projects" // OdoSourceVolumeMount is the directory to mount the volume in the container OdoSourceVolumeMount = "/projects" )
const ( PersistentVolumeClaimKind = "PersistentVolumeClaim" PersistentVolumeClaimAPIVersion = "v1" )
constants for volumes
Variables ¶
var (
ErrNoSuchOperator = errors.New("Could not find specified operator")
)
Functions ¶
func AddBootstrapSupervisordInitContainer ¶ added in v1.1.2
func AddBootstrapSupervisordInitContainer(podTemplateSpec *corev1.PodTemplateSpec)
AddBootstrapSupervisordInitContainer creates an init container that will copy over supervisord to the application image during the start-up procress.
func AddPVCAndVolumeMount ¶ added in v1.1.1
func AddPVCAndVolumeMount(podTemplateSpec *corev1.PodTemplateSpec, volumeNameToPVCName map[string]string, componentAliasToVolumes map[string][]common.DevfileVolume) error
AddPVCAndVolumeMount adds PVC and volume mount to the pod template spec volumeNameToPVCName is a map of volume name to the PVC created componentAliasToVolumes is a map of the Devfile component alias to the Devfile Volumes
func AddPVCToPodTemplateSpec ¶ added in v1.1.1
func AddPVCToPodTemplateSpec(podTemplateSpec *corev1.PodTemplateSpec, volumeName, pvcName string)
AddPVCToPodTemplateSpec adds the given PVC to the podTemplateSpec
func AddVolumeMountToPodTemplateSpec ¶ added in v1.1.1
func AddVolumeMountToPodTemplateSpec(podTemplateSpec *corev1.PodTemplateSpec, volumeName string, componentAliasToMountPaths map[string][]string) error
AddVolumeMountToPodTemplateSpec adds the Volume Mounts in componentAliasToMountPaths to the podTemplateSpec containers for a given pvc and volumeName componentAliasToMountPaths is a map of a container alias to an array of its Mount Paths
func CreateObjectMeta ¶ added in v1.1.1
func CreateObjectMeta(name, namespace string, labels, annotations map[string]string) metav1.ObjectMeta
CreateObjectMeta creates a common object meta
func FakeNew ¶
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 FakePodStatus ¶ added in v1.1.1
FakePodStatus returns a pod with the status
func GenerateContainer ¶ added in v1.1.1
func GenerateContainer(name, image string, isPrivileged bool, command, args []string, envVars []corev1.EnvVar, resourceReqs corev1.ResourceRequirements, ports []corev1.ContainerPort) *corev1.Container
GenerateContainer creates a container spec that can be used when creating a pod
func GenerateDeploymentSpec ¶ added in v1.1.1
func GenerateDeploymentSpec(podTemplateSpec corev1.PodTemplateSpec) *appsv1.DeploymentSpec
GenerateDeploymentSpec creates a deployment spec
func GenerateIngressSpec ¶ added in v1.1.1
func GenerateIngressSpec(ingressParam IngressParameter) *extensionsv1.IngressSpec
GenerateIngressSpec creates an ingress spec
func GenerateOwnerReference ¶ added in v1.1.1
func GenerateOwnerReference(deployment *appsv1.Deployment) metav1.OwnerReference
GenerateOwnerReference genertes an ownerReference from the deployment which can then be set as owner for various Kubernetes objects and ensure that when the owner object is deleted from the cluster, all other objects are automatically removed by Kubernetes garbage collector
func GeneratePVCSpec ¶ added in v1.1.1
func GeneratePVCSpec(quantity resource.Quantity) *corev1.PersistentVolumeClaimSpec
GeneratePVCSpec creates a pvc spec
func GeneratePodTemplateSpec ¶ added in v1.1.1
func GeneratePodTemplateSpec(objectMeta metav1.ObjectMeta, containers []corev1.Container) *corev1.PodTemplateSpec
GeneratePodTemplateSpec creates a pod template spec that can be used to create a deployment spec
func GenerateServiceSpec ¶ added in v1.1.2
func GenerateServiceSpec(componentName string, containerPorts []corev1.ContainerPort) *corev1.ServiceSpec
GenerateServiceSpec creates a service spec
Types ¶
type Client ¶
type Client struct { KubeClient kubernetes.Interface KubeConfig clientcmd.ClientConfig KubeClientConfig *rest.Config Namespace string OperatorClient *operatorsclientset.OperatorsV1alpha1Client // DynamicClient interacts with client-go's `dynamic` package. It is used // to dynamically create service from an operator. It can take an arbitrary // yaml and create k8s/OpenShift resource from it. DynamicClient dynamic.Interface }
Client is a collection of fields used for client configuration and interaction
func (*Client) CreateDeployment ¶ added in v1.1.1
func (c *Client) CreateDeployment(deploymentSpec appsv1.DeploymentSpec) (*appsv1.Deployment, error)
CreateDeployment creates a deployment based on the given deployment spec
func (*Client) CreateDynamicResource ¶ added in v1.1.3
func (c *Client) CreateDynamicResource(exampleCustomResource map[string]interface{}, group, version, resource string) error
CreateDynamicDeployment creates a dynamic deployment for Operator backed service
func (*Client) CreateIngress ¶ added in v1.1.1
func (c *Client) CreateIngress(objectMeta metav1.ObjectMeta, spec extensionsv1.IngressSpec) (*extensionsv1.Ingress, error)
CreateIngress creates an ingress object for the given service and with the given labels
func (*Client) CreatePVC ¶ added in v1.1.1
func (c *Client) CreatePVC(objectMeta metav1.ObjectMeta, pvcSpec corev1.PersistentVolumeClaimSpec) (*corev1.PersistentVolumeClaim, error)
CreatePVC creates a PVC resource in the cluster with the given name, size and labels
func (*Client) CreateService ¶ added in v1.1.2
func (c *Client) CreateService(commonObjectMeta metav1.ObjectMeta, svcSpec corev1.ServiceSpec) (*corev1.Service, error)
CreateService generates and creates the service commonObjectMeta is the ObjectMeta for the service
func (*Client) CreateTLSSecret ¶ added in v1.1.1
func (c *Client) CreateTLSSecret(tlsCertificate []byte, tlsPrivKey []byte, objectMeta metav1.ObjectMeta) (*corev1.Secret, error)
CreateTLSSecret creates a TLS Secret with the given certificate and private key serviceName is the name of the service for the target reference ingressDomain is the ingress domain to use for the ingress
func (*Client) DeleteDeployment ¶ added in v1.1.2
DeleteDeployment deletes the deployments with the given selector
func (*Client) DeleteIngress ¶ added in v1.1.1
DeleteIngress deletes the given ingress
func (*Client) ExecCMDInContainer ¶
func (c *Client) ExecCMDInContainer(compInfo common.ComponentInfo, cmd []string, stdout io.Writer, stderr io.Writer, stdin io.Reader, tty bool) error
ExecCMDInContainer execute command in the container of a pod, pass an empty string for containerName to execute in the first container of the pod
func (*Client) ExtractProjectToComponent ¶ added in v1.2.0
func (c *Client) ExtractProjectToComponent(compInfo common.ComponentInfo, targetPath string, stdin io.Reader) error
ExtractProjectToComponent extracts the project archive(tar) to the target path from the reader stdin
func (*Client) GetClusterServiceVersion ¶ added in v1.1.3
func (c *Client) GetClusterServiceVersion(name string) (olm.ClusterServiceVersion, error)
GetClusterServiceVersion returns a particular CSV from a list of CSVs
func (*Client) GetClusterServiceVersionList ¶ added in v1.1.1
func (c *Client) GetClusterServiceVersionList() (*olm.ClusterServiceVersionList, error)
GetClusterServiceVersionList returns a list of CSVs in the cluster It is equivalent to doing `oc get csvs` using oc cli
func (*Client) GetCustomResourcesFromCSV ¶ added in v1.2.1
func (c *Client) GetCustomResourcesFromCSV(csv olm.ClusterServiceVersion) []olm.CRDDescription
GetCustomResourcesFromCSV returns a list of CRs provided by an operator/CSV.
func (*Client) GetDeploymentByName ¶ added in v1.1.1
func (c *Client) GetDeploymentByName(name string) (*appsv1.Deployment, error)
GetDeploymentByName gets a deployment by querying by name
func (*Client) GetIngress ¶ added in v1.1.2
func (c *Client) GetIngress(name string) (*extensionsv1.Ingress, error)
GetIngress gets an ingress based on the given name
func (*Client) GetPVCsFromSelector ¶ added in v1.1.1
func (c *Client) GetPVCsFromSelector(selector string) ([]corev1.PersistentVolumeClaim, error)
GetPVCsFromSelector returns the PVCs based on the given selector
func (*Client) ListDynamicResource ¶ added in v1.2.1
func (c *Client) ListDynamicResource(group, version, resource string) (*unstructured.UnstructuredList, error)
ListDynamicResource returns an unstructured list of instances of a Custom Resource currently deployed in the active namespace of the cluster
func (*Client) ListIngresses ¶ added in v1.1.1
func (c *Client) ListIngresses(labelSelector string) ([]extensionsv1.Ingress, error)
ListIngresses lists all the ingresses based on the given label selector
func (*Client) UpdateDeployment ¶ added in v1.1.1
func (c *Client) UpdateDeployment(deploymentSpec appsv1.DeploymentSpec) (*appsv1.Deployment, error)
UpdateDeployment updates a deployment based on the given deployment spec
func (*Client) UpdateService ¶ added in v1.1.2
func (c *Client) UpdateService(commonObjectMeta metav1.ObjectMeta, svcSpec corev1.ServiceSpec) (*corev1.Service, error)
UpdateService updates a service based on the given servcie spec
func (*Client) WaitAndGetPod ¶
func (c *Client) WaitAndGetPod(watchOptions metav1.ListOptions, desiredPhase corev1.PodPhase, waitMessage string, hideSpinner bool) (*corev1.Pod, error)
WaitAndGetPod block and waits until pod matching selector is in the desired phase desiredPhase cannot be PodFailed or PodUnknown
func (*Client) WaitForDeploymentRollout ¶ added in v1.1.2
func (c *Client) WaitForDeploymentRollout(deploymentName string) (*appsv1.Deployment, error)
WaitForDeploymentRollout waits for deployment to finish rollout. Returns the state of the deployment after rollout.
type FakeClientset ¶
type FakeClientset struct {
Kubernetes *fakeKubeClientset.Clientset
}
FakeClientset holds fake ClientSets this is returned by FakeNew to access methods of fake client sets
type IngressParameter ¶ added in v1.1.1
type IngressParameter struct { ServiceName string IngressDomain string PortNumber intstr.IntOrString TLSSecretName string }
IngressParameter struct for function createIngress serviceName is the name of the service for the target reference ingressDomain is the ingress domain to use for the ingress portNumber is the target port of the ingress TLSSecretName is the target TLS Secret name of the ingress
type SelfSignedCertificate ¶ added in v1.1.2
SelfSignedCertificate struct is the return type of function GenerateSelfSignedCertificate CertPem is the byte array for certificate pem encode KeyPem is the byte array for key pem encode
func GenerateSelfSignedCertificate ¶ added in v1.1.2
func GenerateSelfSignedCertificate(host string) (SelfSignedCertificate, error)
GenerateSelfSignedCertificate creates a self-signed SSl certificate