Skip to content

Create a package for scheme setup #322

@m1kola

Description

@m1kola

We already have multiple places where we setup scheme:

  • utilruntime.Must(clientgoscheme.AddToScheme(scheme))
    utilruntime.Must(operatorsv1alpha1.AddToScheme(scheme))
    utilruntime.Must(rukpakv1alpha1.AddToScheme(scheme))
    utilruntime.Must(catalogd.AddToScheme(scheme))
  • utilruntime.Must(clientgoscheme.AddToScheme(scheme))
    utilruntime.Must(operatorsv1alpha1.AddToScheme(scheme))
    utilruntime.Must(rukpakv1alpha1.AddToScheme(scheme))
    utilruntime.Must(catalogd.AddToScheme(scheme))
  • sch = runtime.NewScheme()
    err = operatorsv1alpha1.AddToScheme(sch)
    Expect(err).NotTo(HaveOccurred())
    err = rukpakv1alpha1.AddToScheme(sch)
    Expect(err).NotTo(HaveOccurred())
  • Various tests

And more will be introduced (e.g #286 adds a new one, see test/operator-framework-e2e/operator_framework_test.go).

To avoid having this repeated setup and inconsistent schemas we should consider creating a scheme package in the project which will be setting up a scheme. In rest of the places we will just be able to import already constructed scheme.

Example:

Metadata

Metadata

Assignees

Labels

good first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.kind/cleanupCategorizes issue or PR as related to cleaning up code, process, or technical debt.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions