2023-09-14 17:17:02 +02:00
|
|
|
package data
|
|
|
|
|
|
|
|
import (
|
|
|
|
"embed"
|
2025-03-06 07:24:48 +01:00
|
|
|
"encoding/json"
|
2023-09-14 17:17:02 +02:00
|
|
|
"io/fs"
|
2025-03-06 07:24:48 +01:00
|
|
|
"sync"
|
|
|
|
|
|
|
|
"k8s.io/client-go/restmapper"
|
2023-09-14 17:17:02 +02:00
|
|
|
)
|
|
|
|
|
2024-06-04 15:09:44 +08:00
|
|
|
const crdsFolder = "crds"
|
2023-09-14 17:17:02 +02:00
|
|
|
|
|
|
|
//go:embed crds
|
|
|
|
var crdsFs embed.FS
|
|
|
|
|
2025-03-06 07:24:48 +01:00
|
|
|
//go:embed api-group-resources.json
|
|
|
|
var apiGroupResources []byte
|
|
|
|
|
|
|
|
var _apiGroupResources = sync.OnceValues(func() ([]*restmapper.APIGroupResources, error) {
|
|
|
|
var out []*restmapper.APIGroupResources
|
|
|
|
err := json.Unmarshal(apiGroupResources, &out)
|
|
|
|
return out, err
|
|
|
|
})
|
|
|
|
|
2024-06-04 15:09:44 +08:00
|
|
|
func Crds() (fs.FS, error) {
|
|
|
|
return fs.Sub(crdsFs, crdsFolder)
|
2023-09-14 17:17:02 +02:00
|
|
|
}
|
2025-03-06 07:24:48 +01:00
|
|
|
|
|
|
|
func APIGroupResources() ([]*restmapper.APIGroupResources, error) {
|
|
|
|
return _apiGroupResources()
|
|
|
|
}
|