forked from rancher/rancher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
crd.go
32 lines (26 loc) · 765 Bytes
/
crd.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package managementstored
import (
"context"
"sync"
"github.com/rancher/norman/store/crd"
"github.com/rancher/norman/types"
"github.com/rancher/types/config"
)
func createCrd(ctx context.Context, wg *sync.WaitGroup, factory *crd.Factory, schemas *types.Schemas, version *types.APIVersion, schemaIDs ...string) {
wg.Add(1)
go func() {
defer wg.Done()
var schemasToCreate []*types.Schema
for _, schemaID := range schemaIDs {
s := schemas.Schema(version, schemaID)
if s == nil {
panic("can not find schema " + schemaID)
}
schemasToCreate = append(schemasToCreate, s)
}
err := factory.AssignStores(ctx, config.ManagementStorageContext, schemasToCreate...)
if err != nil {
panic("creating CRD store " + err.Error())
}
}()
}