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

Bug 1787660: Add CLI flag to set ClusterOperator name. #280

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 18 additions & 5 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
configv1 "github.com/operator-framework/operator-marketplace/pkg/apis/config/v1"
"github.com/operator-framework/operator-marketplace/pkg/catalogsourceconfig"
"github.com/operator-framework/operator-marketplace/pkg/controller"
"github.com/operator-framework/operator-marketplace/pkg/controller/options"
"github.com/operator-framework/operator-marketplace/pkg/defaults"
"github.com/operator-framework/operator-marketplace/pkg/migrator"
"github.com/operator-framework/operator-marketplace/pkg/operatorhub"
Expand Down Expand Up @@ -60,6 +61,8 @@ func main() {
registry.DefaultServerImage, "the image to use for creating the operator registry pod")
flag.StringVar(&defaults.Dir, "defaultsDir",
"", "the directory where the default OperatorSources are stored")
var clusterOperatorName string
flag.StringVar(&clusterOperatorName, "clusterOperatorName", "", "the name of the OpenShift ClusterOperator that should reflect this operator's status, or the empty string to disable ClusterOperator updates")
flag.Parse()

// Check if version flag was set
Expand Down Expand Up @@ -118,8 +121,18 @@ func main() {
}
}

stopCh := signals.SetupSignalHandler()

var statusReporter status.Reporter = &status.NoOpReporter{}
if clusterOperatorName != "" {
statusReporter, err = status.NewReporter(cfg, mgr, namespace, clusterOperatorName, os.Getenv("RELEASE_VERSION"), stopCh)
if err != nil {
exit(err)
}
}

// Setup all Controllers
if err := controller.AddToManager(mgr); err != nil {
if err := controller.AddToManager(mgr, options.ControllerOptions{SyncSender: statusReporter}); err != nil {
exit(err)
}

Expand Down Expand Up @@ -152,10 +165,10 @@ func main() {
exit(err)
}

stopCh := signals.SetupSignalHandler()

// set ClusterOperator status to report Migration
status.ReportMigration(cfg, mgr, namespace, os.Getenv("RELEASE_VERSION"), stopCh)
if err := statusReporter.ReportMigration(); err != nil {
exit(err)
}

client, err := client.New(cfg, client.Options{})
if err != nil {
Expand All @@ -170,7 +183,7 @@ func main() {
}

// statusReportingDoneCh will be closed after the operator has successfully stopped reporting ClusterOperator status.
statusReportingDoneCh := status.StartReporting(cfg, mgr, namespace, os.Getenv("RELEASE_VERSION"), stopCh)
statusReportingDoneCh := statusReporter.StartReporting()

go registrySyncer.Sync(stopCh)
go catalogsourceconfig.Syncer.Sync(stopCh)
Expand Down
9 changes: 0 additions & 9 deletions deploy/configmap.yaml

This file was deleted.

145 changes: 0 additions & 145 deletions deploy/crds/operators_v1_operatorsource_crd.yaml

This file was deleted.

123 changes: 0 additions & 123 deletions deploy/crds/operators_v2_catalogsourceconfig_crd.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions deploy/marketplace.ns.yaml

This file was deleted.