generator

package
v2.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 28 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// DevfileSourceVolumeMount is the default directory to mount the volume in the container
	DevfileSourceVolumeMount = "/projects"

	// EnvProjectsRoot is the env defined for project mount in a component container when component's mountSources=true
	EnvProjectsRoot = "PROJECTS_ROOT"

	// EnvProjectsSrc is the env defined for path to the project source in a component container
	EnvProjectsSrc = "PROJECT_SOURCE"
)
View Source
const (
	ContainerOverridesAttribute = "container-overrides"
	PodOverridesAttribute       = "pod-overrides"
)

Variables

This section is empty.

Functions

func GetBuildConfig

func GetBuildConfig(buildConfigParams BuildConfigParams) *buildv1.BuildConfig

GetBuildConfig gets a build config

func GetContainers deprecated

func GetContainers(devfileObj parser.DevfileObj, options common.DevfileOptions) ([]corev1.Container, error)

GetContainers iterates through all container components, filters out init containers and returns corresponding containers

Deprecated: in favor of GetPodTemplateSpec

func GetDeployment

func GetDeployment(devfileObj parser.DevfileObj, deployParams DeploymentParams) (*appsv1.Deployment, error)

GetDeployment gets a deployment object

func GetDockerBuildStrategy

func GetDockerBuildStrategy(dockerfilePath string, env []corev1.EnvVar) buildv1.BuildStrategy

GetDockerBuildStrategy gets the docker build strategy

func GetImageStream

func GetImageStream(imageStreamParams ImageStreamParams) imagev1.ImageStream

GetImageStream is a function to return the image stream

func GetIngress

func GetIngress(endpoint v1.Endpoint, ingressParams IngressParams) *extensionsv1.Ingress

GetIngress gets an ingress

func GetInitContainers deprecated

func GetInitContainers(devfileObj parser.DevfileObj) ([]corev1.Container, error)

GetInitContainers gets the init container for every preStart devfile event

Deprecated: in favor of GetPodTemplateSpec

func GetNetworkingV1Ingress

func GetNetworkingV1Ingress(endpoint v1.Endpoint, ingressParams IngressParams) *networkingv1.Ingress

GetNetworkingV1Ingress gets a networking v1 ingress

func GetObjectMeta

func GetObjectMeta(name, namespace string, labels, annotations map[string]string) metav1.ObjectMeta

GetObjectMeta gets an object meta with the parameters

func GetOwnerReference

func GetOwnerReference(deployment *appsv1.Deployment) metav1.OwnerReference

GetOwnerReference generates 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 GetPVC

func GetPVC(pvcParams PVCParams) *corev1.PersistentVolumeClaim

GetPVC returns a PVC

func GetPodTemplateSpec added in v2.2.1

func GetPodTemplateSpec(devfileObj parser.DevfileObj, podTemplateParams PodTemplateParams) (*corev1.PodTemplateSpec, error)

GetPodTemplateSpec returns a pod template The function: - iterates through all container components, filters out init containers and gets corresponding containers - gets the init container for every preStart devfile event - patches the pod template and containers to satisfy PodSecurityAdmissionPolicy - patches the pod template and containers to apply pod and container overrides The containers included in the podTemplateSpec can be filtered using podTemplateParams.Options

func GetRoute

func GetRoute(endpoint v1.Endpoint, routeParams RouteParams) *routev1.Route

GetRoute gets a route

func GetService

func GetService(devfileObj parser.DevfileObj, serviceParams ServiceParams, options common.DevfileOptions) (*corev1.Service, error)

GetService gets the service

func GetSourceBuildStrategy

func GetSourceBuildStrategy(imageName, imageNamespace string) buildv1.BuildStrategy

GetSourceBuildStrategy gets the source build strategy

func GetTypeMeta

func GetTypeMeta(kind string, APIVersion string) metav1.TypeMeta

GetTypeMeta gets a type meta of the specified kind and version

func GetVolumeMountPath

func GetVolumeMountPath(volumeMount v1.VolumeMount) string

GetVolumeMountPath gets the volume mount's path.

func GetVolumesAndVolumeMounts

func GetVolumesAndVolumeMounts(devfileObj parser.DevfileObj, volumeParams VolumeParams, options common.DevfileOptions) ([]corev1.Volume, error)

GetVolumesAndVolumeMounts gets the PVC volumes and updates the containers with the volume mounts.

Types

type BuildConfigParams

type BuildConfigParams struct {
	TypeMeta              metav1.TypeMeta
	ObjectMeta            metav1.ObjectMeta
	BuildConfigSpecParams BuildConfigSpecParams
}

BuildConfigParams is a struct that contains the required data to create a build config object

type BuildConfigSpecParams

type BuildConfigSpecParams struct {
	ImageStreamTagName string
	GitURL             string
	GitRef             string
	ContextDir         string
	BuildStrategy      buildv1.BuildStrategy
}

BuildConfigSpecParams is a struct to create build config spec

type ContainerVisitor added in v2.2.1

type ContainerVisitor func(container *corev1.Container)

ContainerVisitor is called with each container

type DeploymentParams

type DeploymentParams struct {
	TypeMeta   metav1.TypeMeta
	ObjectMeta metav1.ObjectMeta
	// Deprecated: InitContainers, Containers and Volumes are deprecated and are replaced by PodTemplateSpec.
	// A PodTemplateSpec value can be obtained calling GetPodTemplateSpec function, instead of calling GetContainers and GetInitContainers
	InitContainers []corev1.Container
	// Deprecated: see InitContainers
	Containers []corev1.Container
	// Deprecated: see InitContainers
	Volumes           []corev1.Volume
	PodTemplateSpec   *corev1.PodTemplateSpec
	PodSelectorLabels map[string]string
	Replicas          *int32
}

DeploymentParams is a struct that contains the required data to create a deployment object

type ImageStreamParams

type ImageStreamParams struct {
	TypeMeta   metav1.TypeMeta
	ObjectMeta metav1.ObjectMeta
}

ImageStreamParams is a struct that contains the required data to create an image stream object

type IngressParams

type IngressParams struct {
	TypeMeta          metav1.TypeMeta
	ObjectMeta        metav1.ObjectMeta
	IngressSpecParams IngressSpecParams
}

IngressParams is a struct that contains the required data to create an ingress object

type IngressSpecParams

type IngressSpecParams struct {
	ServiceName   string
	IngressDomain string
	PortNumber    intstr.IntOrString
	TLSSecretName string
	Path          string
}

IngressSpecParams struct for function GenerateIngressSpec 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 Path is the path of the ingress TLSSecretName is the target TLS Secret name of the ingress

type PVCParams

type PVCParams struct {
	TypeMeta   metav1.TypeMeta
	ObjectMeta metav1.ObjectMeta
	Quantity   resource.Quantity
}

PVCParams is a struct to create PVC

type PodTemplateParams added in v2.2.1

type PodTemplateParams struct {
	ObjectMeta metav1.ObjectMeta
	Options    common.DevfileOptions
	// PodSecurityAdmissionPolicy is the policy to be respected by the created pod
	// The pod will be patched, if necessary, to respect the policies
	PodSecurityAdmissionPolicy psaapi.Policy
}

PodTemplateParams is a struct that contains the required data to create a podtemplatespec object

type RouteParams

type RouteParams struct {
	TypeMeta        metav1.TypeMeta
	ObjectMeta      metav1.ObjectMeta
	RouteSpecParams RouteSpecParams
}

RouteParams is a struct that contains the required data to create a route object

type RouteSpecParams

type RouteSpecParams struct {
	ServiceName string
	PortNumber  intstr.IntOrString
	Path        string
	Secure      bool
}

RouteSpecParams struct for function GenerateRouteSpec serviceName is the name of the service for the target reference portNumber is the target port of the ingress Path is the path of the route

type ServiceParams

type ServiceParams struct {
	TypeMeta       metav1.TypeMeta
	ObjectMeta     metav1.ObjectMeta
	SelectorLabels map[string]string
}

ServiceParams is a struct that contains the required data to create a service object

type VolumeInfo

type VolumeInfo struct {
	PVCName    string
	VolumeName string
}

VolumeInfo is a struct to hold the pvc name and the volume name to create a volume.

type VolumeParams

type VolumeParams struct {
	// Containers is a list of containers that needs to be updated for the volume mounts
	Containers []corev1.Container

	// VolumeNameToVolumeInfo is a map of the devfile volume name to the volume info containing the pvc name and the volume name.
	VolumeNameToVolumeInfo map[string]VolumeInfo
}

VolumeParams is a struct that contains the required data to create Kubernetes Volumes and mount Volumes in Containers

Jump to

Keyboard shortcuts

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