Skip to content

Commit

Permalink
Merge pull request #272 from samira-barouti/deploy-catalogsource
Browse files Browse the repository at this point in the history
Deploy catalogsource resource in the custom namespace
  • Loading branch information
samira-barouti authored Sep 23, 2021
2 parents 9542c69 + e67a34b commit 1b67d3f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
3 changes: 0 additions & 3 deletions certification/internal/policy/operator/default.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package operator

const (
// catalogSourceNS is the namespace in which the CatalogSource CR is installed
catalogSourceNS = "openshift-marketplace"

// packageKey is the packageKey in annotations.yaml that contains the package name.
packageKey = "operators.operatorframework.io.bundle.package.v1"

Expand Down
8 changes: 4 additions & 4 deletions certification/internal/policy/operator/deployable_by_olm.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (p *DeployableByOlmCheck) setUp(operatorData OperatorData) error {
return err
}

if _, err := p.OpenshiftEngine.CreateCatalogSource(cli.CatalogSourceData{Name: operatorData.App, Image: operatorData.CatalogImage}, cli.OpenshiftOptions{Namespace: catalogSourceNS}); err != nil && !kubeErr.IsAlreadyExists(err) {
if _, err := p.OpenshiftEngine.CreateCatalogSource(cli.CatalogSourceData{Name: operatorData.App, Image: operatorData.CatalogImage}, cli.OpenshiftOptions{Namespace: operatorData.InstallNamespace}); err != nil && !kubeErr.IsAlreadyExists(err) {
return err
}

Expand All @@ -120,7 +120,7 @@ func (p *DeployableByOlmCheck) setUp(operatorData OperatorData) error {
Name: operatorData.App,
Channel: operatorData.Channel,
CatalogSource: operatorData.App,
CatalogSourceNamespace: catalogSourceNS,
CatalogSourceNamespace: operatorData.InstallNamespace,
Package: operatorData.PackageName,
}
if _, err := p.OpenshiftEngine.CreateSubscription(subscriptionData, cli.OpenshiftOptions{Namespace: operatorData.InstallNamespace}); err != nil && !kubeErr.IsAlreadyExists(err) {
Expand Down Expand Up @@ -231,7 +231,7 @@ func (p *DeployableByOlmCheck) cleanUp(operatorData OperatorData) {
}
p.writeToFile(subs, operatorData.App, "subscription")

cs, err := p.OpenshiftEngine.GetCatalogSource(operatorData.App, cli.OpenshiftOptions{Namespace: catalogSourceNS})
cs, err := p.OpenshiftEngine.GetCatalogSource(operatorData.App, cli.OpenshiftOptions{Namespace: operatorData.InstallNamespace})
if err != nil {
log.Error("unable to retrieve the catalogsource")
}
Expand All @@ -251,7 +251,7 @@ func (p *DeployableByOlmCheck) cleanUp(operatorData OperatorData) {

log.Trace("Deleting the resources created by Check")
p.OpenshiftEngine.DeleteSubscription(operatorData.App, cli.OpenshiftOptions{Namespace: operatorData.InstallNamespace})
p.OpenshiftEngine.DeleteCatalogSource(operatorData.App, cli.OpenshiftOptions{Namespace: catalogSourceNS})
p.OpenshiftEngine.DeleteCatalogSource(operatorData.App, cli.OpenshiftOptions{Namespace: operatorData.InstallNamespace})
p.OpenshiftEngine.DeleteOperatorGroup(operatorData.App, cli.OpenshiftOptions{Namespace: operatorData.InstallNamespace})
p.OpenshiftEngine.DeleteNamespace(operatorData.InstallNamespace, cli.OpenshiftOptions{})
}
Expand Down

0 comments on commit 1b67d3f

Please sign in to comment.