Documentation ¶
Index ¶
- Constants
- func IsAssetsPath(path string) bool
- func WritePlan(path string, plan Plan) error
- type BuildArtifactTypeValue
- type ContainerBuildTypeValue
- type Inputs
- type KubernetesOutput
- type Outputs
- type Plan
- type PlanSpec
- type RepoInfo
- type Service
- func (service *Service) AddBuildArtifact(sat BuildArtifactTypeValue, value string)
- func (service *Service) AddSourceArtifact(sat SourceArtifactTypeValue, value string)
- func (service *Service) AddSourceType(st SourceTypeValue) bool
- func (service *Service) GatherGitInfo(path string, plan Plan) (bool, error)
- type SourceArtifactTypeValue
- type SourceTypeValue
- type TargetArtifactTypeValue
- type TargetClusterType
- type TargetInfoArtifactTypeValue
- type TranslationTypeValue
Constants ¶
const PlanKind types.Kind = "Plan"
PlanKind is kind of plan file
Variables ¶
This section is empty.
Functions ¶
func IsAssetsPath ¶
IsAssetsPath returns true if it is a m2kassets path.
Types ¶
type BuildArtifactTypeValue ¶
type BuildArtifactTypeValue string
BuildArtifactTypeValue defines the build artifact type
const ( // SourceDirectoryBuildArtifactType defines source data artifact type SourceDirectoryBuildArtifactType BuildArtifactTypeValue = "SourceCode" )
type ContainerBuildTypeValue ¶
type ContainerBuildTypeValue string
ContainerBuildTypeValue defines the containerization type
const ( // DockerFileContainerBuildTypeValue defines the containerization type as docker file DockerFileContainerBuildTypeValue ContainerBuildTypeValue = "NewDockerfile" // ReuseDockerFileContainerBuildTypeValue defines the containerization type as reuse of dockerfile ReuseDockerFileContainerBuildTypeValue ContainerBuildTypeValue = "ReuseDockerfile" // ReuseContainerBuildTypeValue defines the containerization type as reuse of an existing container ReuseContainerBuildTypeValue ContainerBuildTypeValue = "Reuse" // CNBContainerBuildTypeValue defines the containerization type of cloud native buildpack CNBContainerBuildTypeValue ContainerBuildTypeValue = "CNB" // ManualContainerBuildTypeValue defines that the tool assumes that the image will be created manually ManualContainerBuildTypeValue ContainerBuildTypeValue = "Manual" // S2IContainerBuildTypeValue defines the containerization type of S2I S2IContainerBuildTypeValue ContainerBuildTypeValue = "S2I" )
type Inputs ¶
type Inputs struct { RootDir string `yaml:"rootDir"` K8sFiles []string `yaml:"kubernetesYamls,omitempty" m2kpath:"normal"` Services map[string][]Service `yaml:"services"` // [serviceName][Services] TargetInfoArtifacts map[TargetInfoArtifactTypeValue][]string `yaml:"targetInfoArtifacts,omitempty" m2kpath:"normal"` //[targetinfoartifacttype][List of artifacts] }
Inputs defines the input section of plan
type KubernetesOutput ¶
type KubernetesOutput struct { RegistryURL string `yaml:"registryURL,omitempty"` RegistryNamespace string `yaml:"registryNamespace,omitempty"` ArtifactType TargetArtifactTypeValue `yaml:"artifactType"` TargetCluster TargetClusterType `yaml:"targetCluster,omitempty"` IgnoreUnsupportedKinds bool `yaml:"ignoreUnsupportedKinds,omitempty"` }
KubernetesOutput defines the output format for kubernetes deployable artifacts
func (*KubernetesOutput) Merge ¶
func (output *KubernetesOutput) Merge(newoutput KubernetesOutput)
Merge allows merge of two Kubernetes Outputs
type Outputs ¶
type Outputs struct {
Kubernetes KubernetesOutput `yaml:"kubernetes"`
}
Outputs defines the output section of plan
type Plan ¶
type Plan struct { types.TypeMeta `yaml:",inline"` types.ObjectMeta `yaml:"metadata,omitempty"` Spec PlanSpec `yaml:"spec,omitempty"` }
Plan defines the format of plan
func NewPlan ¶
func NewPlan() Plan
NewPlan creates a new plan Sets the version and optionally fills in some default values
func (*Plan) AddServicesToPlan ¶
AddServicesToPlan adds a list of services to a plan
func (*Plan) GetAbsolutePath ¶
GetAbsolutePath takes a path relative to the plan's root directory or assets path and makes it absolute.
func (*Plan) GetRelativePath ¶
GetRelativePath returns a path relative to the root directory of the plan
func (*Plan) SetRootDir ¶
SetRootDir changes the root directory of the plan. The `rootDir` must be an cleaned absolute path.
type RepoInfo ¶
type RepoInfo struct { GitRepoDir string `yaml:"gitRepoDir" m2kpath:"normal"` GitRepoURL string `yaml:"gitRepoURL"` GitRepoBranch string `yaml:"gitRepoBranch"` TargetPath string `yaml:"targetPath" m2kpath:"normal"` }
RepoInfo contains information specific to creating the CI/CD pipeline.
type Service ¶
type Service struct { ServiceName string `yaml:"serviceName"` ServiceRelPath string `yaml:"serviceRelPath,omitempty"` Image string `yaml:"image"` TranslationType TranslationTypeValue `yaml:"translationType"` ContainerBuildType ContainerBuildTypeValue `yaml:"containerBuildType"` SourceTypes []SourceTypeValue `yaml:"sourceType"` ContainerizationTargetOptions []string `yaml:"targetOptions,omitempty" m2kpath:"if:ContainerBuildType:in:NewDockerfile,ReuseDockerfile,S2I"` SourceArtifacts map[SourceArtifactTypeValue][]string `yaml:"sourceArtifacts" m2kpath:"keys:Kubernetes,Knative,DockerCompose,CfManifest,CfRunningManifest,SourceCode,Dockerfile"` //[translationartifacttype][List of artifacts] BuildArtifacts map[BuildArtifactTypeValue][]string `yaml:"buildArtifacts,omitempty" m2kpath:"normal"` //[buildartifacttype][List of artifacts] UpdateContainerBuildPipeline bool `yaml:"updateContainerBuildPipeline"` UpdateDeployPipeline bool `yaml:"updateDeployPipeline"` RepoInfo RepoInfo `yaml:"repoInfo,omitempty"` }
Service defines a plan service
func NewService ¶
func NewService(serviceName string, translationtype TranslationTypeValue) Service
NewService creates a new service
func (*Service) AddBuildArtifact ¶
func (service *Service) AddBuildArtifact(sat BuildArtifactTypeValue, value string)
AddBuildArtifact adds a build artifact to a plan service
func (*Service) AddSourceArtifact ¶
func (service *Service) AddSourceArtifact(sat SourceArtifactTypeValue, value string)
AddSourceArtifact adds a source artifact to a plan service
func (*Service) AddSourceType ¶
func (service *Service) AddSourceType(st SourceTypeValue) bool
AddSourceType adds source type to a plan service
type SourceArtifactTypeValue ¶
type SourceArtifactTypeValue string
SourceArtifactTypeValue defines the source artifact type
const ( // K8sFileArtifactType defines the source artifact type of K8s K8sFileArtifactType SourceArtifactTypeValue = "Kubernetes" // KnativeFileArtifactType defines the source artifact type of KNative KnativeFileArtifactType SourceArtifactTypeValue = "Knative" // ComposeFileArtifactType defines the source artifact type of Docker compose ComposeFileArtifactType SourceArtifactTypeValue = "DockerCompose" // ImageInfoArtifactType defines the source artifact type of image info ImageInfoArtifactType SourceArtifactTypeValue = "ImageInfo" // CfManifestArtifactType defines the source artifact type of cf manifest CfManifestArtifactType SourceArtifactTypeValue = "CfManifest" // CfRunningManifestArtifactType defines the source artifact type of a manifest of a running instance CfRunningManifestArtifactType SourceArtifactTypeValue = "CfRunningManifest" // SourceDirectoryArtifactType defines the source artifact type of normal source code directory SourceDirectoryArtifactType SourceArtifactTypeValue = "SourceCode" // DockerfileArtifactType defines the source artifact type of dockerfile DockerfileArtifactType SourceArtifactTypeValue = "Dockerfile" )
type SourceTypeValue ¶
type SourceTypeValue string
SourceTypeValue defines the type of source
const ( // ComposeSourceTypeValue defines the source as docker compose ComposeSourceTypeValue SourceTypeValue = "DockerCompose" // DirectorySourceTypeValue defines the source as a simple directory DirectorySourceTypeValue SourceTypeValue = "Directory" // CfManifestSourceTypeValue defines the source as cf manifest CfManifestSourceTypeValue SourceTypeValue = "CfManifest" // KNativeSourceTypeValue defines the source as KNative KNativeSourceTypeValue SourceTypeValue = "Knative" // K8sSourceTypeValue defines the source as Kubernetes K8sSourceTypeValue SourceTypeValue = "Kubernetes" )
type TargetArtifactTypeValue ¶
type TargetArtifactTypeValue string
TargetArtifactTypeValue defines the target artifact type
const ( // Helm defines helm artifact type Helm TargetArtifactTypeValue = "Helm" // Yamls defines K8s artifact type Yamls TargetArtifactTypeValue = "Yamls" // Knative defines Knative artifact type Knative TargetArtifactTypeValue = "Knative" )
type TargetClusterType ¶
type TargetClusterType struct { Type string `yaml:"type,omitempty"` Path string `yaml:"path,omitempty" m2kpath:"normal"` }
TargetClusterType contains either the type of the target cluster or path to a file containing the target cluster metadata. Specify one or the other, not both.
type TargetInfoArtifactTypeValue ¶
type TargetInfoArtifactTypeValue string
TargetInfoArtifactTypeValue defines the target info type
const ( // K8sClusterArtifactType defines target info K8sClusterArtifactType TargetInfoArtifactTypeValue = "KubernetesCluster" )
type TranslationTypeValue ¶
type TranslationTypeValue string
TranslationTypeValue defines the translation type
const ( // Compose2KubeTranslation translation type is used when source is docker compose Compose2KubeTranslation TranslationTypeValue = "DockerCompose" // CfManifest2KubeTranslation translation type is used when source is cloud foundry manifest CfManifest2KubeTranslation TranslationTypeValue = "CloudFoundry" // Any2KubeTranslation translation type is used when source is of an unknown platform Any2KubeTranslation TranslationTypeValue = "Containerize" // Kube2KubeTranslation translation type is used when source is Kubernetes Kube2KubeTranslation TranslationTypeValue = "Kubernetes" // Dockerfile2KubeTranslation translation type is used when source is Knative Dockerfile2KubeTranslation TranslationTypeValue = "Dockerfile" )