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:
We already have multiple places where we setup scheme:
operator-controller/cmd/manager/main.go
Lines 49 to 53 in fa84c73
operator-controller/cmd/resolutioncli/main.go
Lines 62 to 65 in fa84c73
operator-controller/internal/controllers/suite_test.go
Lines 70 to 74 in fa84c73
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:
kubectlscheme - https://github.com/kubernetes/kubectl/blob/197123726db24c61aa0f78d1f0ba6e91a2ec2f35/pkg/scheme/install.go