Today we have variable sources which create other variable sources which create variables. While this gives us very short and simple units - it makes harder to follow and creates a lot of boilerplate (e.g. need for support of nested variable soruces).
For example OperatorVariableSource creates RequiredPackageVariableSource which creates RequiredPackageVariable:
|
rps, err := NewRequiredPackageVariableSource( |
|
o.catalogClient, |
|
operator.Spec.PackageName, |
|
InVersionRange(operator.Spec.Version), |
|
InChannel(operator.Spec.Channel), |
|
) |
|
return []deppy.Variable{ |
|
olmvariables.NewRequiredPackageVariable(r.packageName, resultSet), |
|
}, nil |
BundleDeploymentVariableSource creates InstalledPackageVariableSource which creates InstalledPackageVariable:
|
ips, err := NewInstalledPackageVariableSource(o.catalogClient, bundleDeployment.Spec.Template.Spec.Source.Image.Ref) |
|
return []deppy.Variable{ |
|
variables.NewInstalledPackageVariable(installedBundle.Package, upgradeEdges), |
|
}, nil |
Today we have variable sources which create other variable sources which create variables. While this gives us very short and simple units - it makes harder to follow and creates a lot of boilerplate (e.g. need for support of nested variable soruces).
For example
OperatorVariableSourcecreatesRequiredPackageVariableSourcewhich createsRequiredPackageVariable:operator-controller/internal/resolution/variablesources/operator.go
Lines 42 to 47 in 6808a50
operator-controller/internal/resolution/variablesources/required_package.go
Lines 88 to 90 in 6808a50
BundleDeploymentVariableSourcecreatesInstalledPackageVariableSourcewhich createsInstalledPackageVariable:operator-controller/internal/resolution/variablesources/bundle_deployment.go
Line 47 in 6808a50
operator-controller/internal/resolution/variablesources/installed_package.go
Lines 53 to 55 in 6808a50