Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix SingleSourceResolver to use plan namespace for resolved CSVs #387

Merged
merged 1 commit into from
Jul 18, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pkg/controller/registry/resolver/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
// should behave
type DependencyResolver interface {
ResolveInstallPlan(sources map[registry.SourceKey]registry.Source, firstSrcKey registry.SourceKey, catalogLabelKey string, plan *v1alpha1.InstallPlan) ([]v1alpha1.Step, error)
resolveCSV(sources map[registry.SourceKey]registry.Source, firstSrcKey registry.SourceKey, catalogLabelKey, csvName string) (stepResourceMap, error)
resolveCSV(sources map[registry.SourceKey]registry.Source, firstSrcKey registry.SourceKey, catalogLabelKey, planNamespace, csvName string) (stepResourceMap, error)
resolveCRDDescription(sources map[registry.SourceKey]registry.Source, firstSrcKey registry.SourceKey, catalogLabelKey string, crdDesc csvv1alpha1.CRDDescription, owned bool) (v1alpha1.StepResource, string, error)
}

Expand All @@ -26,7 +26,7 @@ type SingleSourceResolver struct{}
func (resolver *SingleSourceResolver) ResolveInstallPlan(sources map[registry.SourceKey]registry.Source, firstSrcKey registry.SourceKey, catalogLabelKey string, plan *v1alpha1.InstallPlan) ([]v1alpha1.Step, error) {
srm := make(stepResourceMap)
for _, csvName := range plan.Spec.ClusterServiceVersionNames {
csvSRM, err := resolver.resolveCSV(sources, firstSrcKey, catalogLabelKey, csvName)
csvSRM, err := resolver.resolveCSV(sources, firstSrcKey, catalogLabelKey, plan.Namespace, csvName)
if err != nil {
return nil, err
}
Expand All @@ -37,7 +37,7 @@ func (resolver *SingleSourceResolver) ResolveInstallPlan(sources map[registry.So
return srm.Plan(), nil
}

func (resolver *SingleSourceResolver) resolveCSV(sources map[registry.SourceKey]registry.Source, firstSrcKey registry.SourceKey, catalogLabelKey, csvName string) (stepResourceMap, error) {
func (resolver *SingleSourceResolver) resolveCSV(sources map[registry.SourceKey]registry.Source, firstSrcKey registry.SourceKey, catalogLabelKey, planNamespace, csvName string) (stepResourceMap, error) {
log.Debugf("resolving CSV with name: %s", csvName)

steps := make(stepResourceMap)
Expand Down Expand Up @@ -85,7 +85,7 @@ func (resolver *SingleSourceResolver) resolveCSV(sources map[registry.SourceKey]

// Manually override the namespace and create the final step for the CSV,
// which is for the CSV itself.
csv.SetNamespace(firstSrcKey.Namespace)
csv.SetNamespace(planNamespace)

// Add the sourcename as a label on the CSV, so that we know where it came from
labels := csv.GetLabels()
Expand Down