transform

package
v0.1.1-0...-f02a436 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2020 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NoConfidence represents report items we can not migrate
	NoConfidence = iota

	// ModerateConfidence represents report items we can migrate with caveats
	ModerateConfidence

	// HighConfidence represents report items we can migrate without issue
	HighConfidence

	// OCP4InstallMsg message about using generated manifests
	OCP4InstallMsg = `` /* 355-byte string literal not displayed */

)
View Source
const APIComponentName = "API"

APIComponentName is the API component string

View Source
const ClusterTransformName = "Cluster"

ClusterTransformName is the cluster report name

View Source
const CrioComponentName = "Crio"

CrioComponentName is the name of the Crio component

View Source
const DockerComponentName = "Docker"

DockerComponentName is the Docker component string

View Source
const ETCDComponentName = "ETCD"

ETCDComponentName is the ETCD component string

View Source
const ImageComponentName = "Image"

ImageComponentName is the Image component string

View Source
const OAuthComponentName = "OAuth"

OAuthComponentName is the OAuth component string

View Source
const ProjectComponentName = "Project"

ProjectComponentName is the Project component string

View Source
const SDNComponentName = "SDN"

SDNComponentName is the SDN component string

View Source
const SchedulerComponentName = "Scheduler"

SchedulerComponentName is the Scheduler component string

Variables

View Source
var ManifestOutputFlush = func(manifests []Manifest) error {
	logrus.Info("Flushing manifests to disk")
	for _, manifest := range manifests {
		maniftestfile := filepath.Join(env.Config().GetString("WorkDir"), "manifests", manifest.Name)
		os.MkdirAll(path.Dir(maniftestfile), 0755)
		if err := ioutil.WriteFile(maniftestfile, manifest.CRD, 0644); err != nil {
			logrus.Panic(err)
		}
		logrus.Printf("CRD:Added: %s", maniftestfile)
	}
	return nil
}

ManifestOutputFlush flush manifests to disk

View Source
var ReportOutputFlush = func(r Report) error {
	logrus.Info("Flushing reports to disk")
	reportoutput.DumpReports(r.Report)
	return nil
}

ReportOutputFlush flush reports to disk

Functions

func GenYAML

func GenYAML(CR interface{}) ([]byte, error)

GenYAML returns a YAML of the CR

func HandleError

func HandleError(err error, transformType string) error

HandleError handles errors

func Start

func Start()

Start generating manifests to be used with Openshift 4

Types

type APIExtraction

type APIExtraction struct {
	ServingInfo legacyconfigv1.ServingInfo
}

APIExtraction holds API data extracted from OCP3

func (APIExtraction) Transform

func (e APIExtraction) Transform() ([]Output, error)

Transform converts data collected from an OCP3 into a useful output

func (APIExtraction) Validate

func (e APIExtraction) Validate() error

Validate confirms we have recieved API configuration data during Extract

type APITransform

type APITransform struct {
}

APITransform is an API specific transform

func (APITransform) Extract

func (e APITransform) Extract() (Extraction, error)

Extract collects API configuration from an OCP3 cluster

func (APITransform) Name

func (e APITransform) Name() string

Name returns a human readable name for the transform

type Cluster

type Cluster struct {
	Master Master
}

Cluster contains a cluster

type ClusterExtraction

type ClusterExtraction struct {
	api.Resources
}

ClusterExtraction holds data extracted from k8s API resources

func (ClusterExtraction) Transform

func (e ClusterExtraction) Transform() ([]Output, error)

Transform converts data collected from an OCP3 API into a useful output

func (ClusterExtraction) Validate

func (e ClusterExtraction) Validate() (err error)

Validate no need to validate it, data is exctracted from API

type ClusterTransform

type ClusterTransform struct {
}

ClusterTransform reprents transform for k8s API resources

func (ClusterTransform) Extract

func (e ClusterTransform) Extract() (Extraction, error)

Extract collects data for cluster report

func (ClusterTransform) Name

func (e ClusterTransform) Name() string

Name returns a human readable name for the transform

type ContainerRuntimeConfig

type ContainerRuntimeConfig struct {
	PidsLimit  int64  `json:"pidsLimit,omitempty"`
	LogLevel   string `json:"logLevel,omitempty"`
	LogSizeMax int64  `json:"logSizeMax,omitempty"`
	InfraImage string `json:"infraImage,omitempty"`
}

ContainerRuntimeConfig contains a Crio Runtime Machine Config

type CrioCR

type CrioCR struct {
	APIVersion string       `json:"apiVersion"`
	Kind       string       `json:"kind"`
	Metadata   CrioMetadata `json:"metadata"`
	Spec       CrioSpec     `json:"spec"`
}

CrioCR is a is a Crio Cluster Resource

type CrioExtraction

type CrioExtraction struct {
	Runtime runtimeConf
}

CrioExtraction holds Crio data extracted from OCP3

func (CrioExtraction) Transform

func (e CrioExtraction) Transform() ([]Output, error)

Transform converts data collected from an OCP3 into a useful output

func (CrioExtraction) Validate

func (e CrioExtraction) Validate() error

Validate confirms we have recieved good Crio configuration data during Extract

type CrioMetadata

type CrioMetadata struct {
	Name string `json:"name"`
}

CrioMetadata is the Metadata for a Crio CR

type CrioSpec

type CrioSpec struct {
	MachineConfigPoolSelector MachineConfigPoolSelector `json:"machineConfigPoolSelector"`
	ContainerRuntimeConfig    ContainerRuntimeConfig    `json:"containerRuntimeConfig"`
}

CrioSpec is the Spec for a Crio CR

type CrioTransform

type CrioTransform struct {
}

CrioTransform is an Crio specific transform

func (CrioTransform) Extract

func (e CrioTransform) Extract() (Extraction, error)

Extract collects Crio configuration from an OCP3 cluster

func (CrioTransform) Name

func (e CrioTransform) Name() string

Name returns a human readable name for the transform

type Crios

type Crios map[string]crio

Crios is TOML representation of crio config file

type DockerExtraction

type DockerExtraction struct {
}

DockerExtraction holds Docker data extracted from OCP3

func (DockerExtraction) Transform

func (e DockerExtraction) Transform() ([]Output, error)

Transform converts data collected from an OCP3 into a useful output

func (DockerExtraction) Validate

func (e DockerExtraction) Validate() error

Validate confirms we have recieved good Docker configuration data during Extract

type DockerTransform

type DockerTransform struct {
}

DockerTransform is an Docker specific transform

func (DockerTransform) Extract

func (e DockerTransform) Extract() (Extraction, error)

Extract collects Docker configuration from an OCP3 cluster

func (DockerTransform) Name

func (e DockerTransform) Name() string

Name returns a human readable name for the transform

type ETCDExtraction

type ETCDExtraction struct {
	TLSCipherSuites string
	ClientPort      string
}

ETCDExtraction holds ETCD data extracted from OCP3

func (ETCDExtraction) Transform

func (e ETCDExtraction) Transform() ([]Output, error)

Transform converts data collected from an OCP3 into a useful output

func (ETCDExtraction) Validate

func (e ETCDExtraction) Validate() error

Validate confirms we have recieved good ETCD configuration data during Extract

type ETCDTransform

type ETCDTransform struct {
}

ETCDTransform is an ETCD specific transform

func (ETCDTransform) Extract

func (e ETCDTransform) Extract() (Extraction, error)

Extract collects ETCD configuration from an OCP3 cluster

func (ETCDTransform) Name

func (e ETCDTransform) Name() string

Name returns a human readable name for the transform

type Extraction

type Extraction interface {
	Transform() ([]Output, error)
	Validate() error
}

Extraction is a generic data extraction

type ImageExtraction

type ImageExtraction struct {
	MasterConfig     legacyconfigv1.MasterConfig
	RegistriesConfig RegistriesExtraction
}

ImageExtraction is image specific extraction

func (ImageExtraction) Transform

func (e ImageExtraction) Transform() ([]Output, error)

Transform converts data collected from an OCP3 into a useful output

func (ImageExtraction) Validate

func (e ImageExtraction) Validate() error

Validate the data extracted from the OCP3 cluster

type ImageTransform

type ImageTransform struct {
}

ImageTransform is an image specific transform

func (ImageTransform) Extract

func (e ImageTransform) Extract() (Extraction, error)

Extract collects image configuration information from an OCP3 cluster

func (ImageTransform) Name

func (e ImageTransform) Name() string

Name returns a human readable name for the transform

type MachineConfigPoolSelector

type MachineConfigPoolSelector struct {
	MatchLabels MatchLabels `json:"matchLabels"`
}

MachineConfigPoolSelector is the Pool Selector for a Machine Config

type Manifest

type Manifest struct {
	Name string
	CRD  []byte
}

Manifest to be exported for use with OCP 4

type ManifestOutput

type ManifestOutput struct {
	Manifests []Manifest
}

ManifestOutput holds a collection of manifests to be written to fil

func (ManifestOutput) Flush

func (m ManifestOutput) Flush() error

Flush manifests to files

type Master

type Master struct {
	OAuth      configv1.OAuth
	Secrets    []*corev1.Secret
	ConfigMaps []*corev1.ConfigMap
}

Master is a cluster Master

type MatchLabels

type MatchLabels struct {
	CustomCrio string `json:"custom-crio"`
}

MatchLabels matches the labels for a Pool Selector

type OAuthExtraction

type OAuthExtraction struct {
	IdentityProviders []oauth.IdentityProvider
	TokenConfig       oauth.TokenConfig
	Templates         legacyconfigv1.OAuthTemplates
}

OAuthExtraction holds OAuth data extracted from OCP3

func (OAuthExtraction) Transform

func (e OAuthExtraction) Transform() ([]Output, error)

Transform converts data collected from an OCP3 into a useful output

func (OAuthExtraction) Validate

func (e OAuthExtraction) Validate() error

Validate confirms we have recieved good OAuth configuration data during Extract

type OAuthTransform

type OAuthTransform struct {
}

OAuthTransform is an OAuth specific transform

func (OAuthTransform) Extract

func (e OAuthTransform) Extract() (Extraction, error)

Extract collects OAuth configuration from an OCP3 cluster

func (OAuthTransform) Name

func (e OAuthTransform) Name() string

Name returns a human readable name for the transform

type Output

type Output interface {
	Flush() error
}

Output is a generic output type

type ProjectExtraction

type ProjectExtraction struct {
	legacyconfigv1.MasterConfig
}

ProjectExtraction is a Project specific extraction

func (ProjectExtraction) Transform

func (e ProjectExtraction) Transform() ([]Output, error)

Transform converts data collected from an OCP3 into a useful output

func (ProjectExtraction) Validate

func (e ProjectExtraction) Validate() error

Validate the data extracted from the OCP3 cluster

type ProjectTransform

type ProjectTransform struct {
}

ProjectTransform is a Project specific transform

func (ProjectTransform) Extract

func (e ProjectTransform) Extract() (Extraction, error)

Extract collects Project configuration information from an OCP3 cluster

func (ProjectTransform) Name

func (e ProjectTransform) Name() string

Name returns a human readable name for the transform

type Registries

type Registries struct {
	List []string `toml:"registries"`
}

Registries holds a list of Registries

type RegistriesExtraction

type RegistriesExtraction struct {
	Registries map[string]registries.Registries
}

RegistriesExtraction holds registry information extracted from an OCP3 cluster

type Report

type Report struct {
	Report reportoutput.ReportOutput
}

Report represents structure for final output

var FinalReportOutput Report

FinalReportOutput represents final output

func (Report) Flush

func (r Report) Flush() error

Flush reports to files

type Runner

type Runner struct {
}

Runner a generic transform runner

func NewRunner

func NewRunner() *Runner

NewRunner creates a new Runner

func (Runner) Transform

func (r Runner) Transform(transforms []Transform)

Transform is the process run to complete a transform

type SDNExtraction

type SDNExtraction struct {
	legacyconfigv1.MasterConfig
}

SDNExtraction is an SDN specific extraction

func (SDNExtraction) Transform

func (e SDNExtraction) Transform() ([]Output, error)

Transform converts data collected from an OCP3 into a useful output

func (SDNExtraction) Validate

func (e SDNExtraction) Validate() error

Validate the data extracted from the OCP3 cluster

type SDNTransform

type SDNTransform struct {
}

SDNTransform is an SDN specific transform

func (SDNTransform) Extract

func (e SDNTransform) Extract() (Extraction, error)

Extract collects SDN configuration information from an OCP3 cluster

func (SDNTransform) Name

func (e SDNTransform) Name() string

Name returns a human readable name for the transform

type SchedulerExtraction

type SchedulerExtraction struct {
	legacyconfigv1.MasterConfig
}

SchedulerExtraction is a Scheduler specific extraction

func (SchedulerExtraction) Transform

func (e SchedulerExtraction) Transform() ([]Output, error)

Transform converts data collected from an OCP3 into a useful output

func (SchedulerExtraction) Validate

func (e SchedulerExtraction) Validate() error

Validate the data extracted from the OCP3 cluster

type SchedulerTransform

type SchedulerTransform struct {
}

SchedulerTransform is a Scheduler specific transform

func (SchedulerTransform) Extract

func (e SchedulerTransform) Extract() (Extraction, error)

Extract collects Scheduler configuration information from an OCP3 cluster

func (SchedulerTransform) Name

func (e SchedulerTransform) Name() string

Name returns a human readable name for the transform

type Transform

type Transform interface {
	Extract() (Extraction, error)
	Name() string
}

Transform is a generic transform

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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