grafana/pkg/registry/corecrd/registry.go
Kristin Laemmert 8745d7ef1b
extract kindsys to external library (#64562)
* extract kindsys

* reinstate kindsys report

This may end up living somewhere else (or not! who knows!), but the important part is that I don't get rid of it right now :)

I hate the package layout (kindsysreport/codegen) for the main function and will take pretty much any alternative suggestion, but we can change also change it later.

Note that the generated report.json is in a different location - anything using this (ops something) needs to be updated.

* kindsysreport in codeowners
2023-03-15 12:04:28 -04:00

28 lines
744 B
Go

package corecrd
import (
"github.com/grafana/kindsys/k8ssys"
"github.com/grafana/thema"
"github.com/grafana/grafana/pkg/registry/corekind"
)
// New constructs a new [Registry].
//
// All calling code within grafana/grafana is expected to use Grafana's
// singleton [thema.Runtime], returned from [cuectx.GrafanaThemaRuntime]. If nil
// is passed, the singleton will be used.
func New(rt *thema.Runtime) *Registry {
breg := corekind.NewBase(rt)
return doNewRegistry(breg)
}
// All returns a slice of all core Grafana CRDs in the registry.
//
// The returned slice is guaranteed to be alphabetically sorted by kind name.
func (r *Registry) All() []k8ssys.Kind {
all := make([]k8ssys.Kind, len(r.all))
copy(all, r.all[:])
return all
}