-
Notifications
You must be signed in to change notification settings - Fork 0
/
workload_store.go
34 lines (30 loc) · 1.11 KB
/
workload_store.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
33
34
package workload
import (
"github.com/rancher/norman/types"
"github.com/rancher/rancher/pkg/api/customization/workload"
"github.com/rancher/types/apis/project.cattle.io/v3/schema"
"github.com/rancher/types/config"
)
func ConfigureStore(schemas *types.Schemas, management *config.ScaledContext) {
workloadSchema := schemas.Schema(&schema.Version, "workload")
store := NewAggregateStore(schemas.Schema(&schema.Version, "deployment"),
schemas.Schema(&schema.Version, "replicaSet"),
schemas.Schema(&schema.Version, "replicationController"),
schemas.Schema(&schema.Version, "daemonSet"),
schemas.Schema(&schema.Version, "statefulSet"),
schemas.Schema(&schema.Version, "job"),
schemas.Schema(&schema.Version, "cronJob"))
for _, s := range store.Schemas {
if s.ID == "deployment" {
s.Formatter = workload.DeploymentFormatter
} else {
s.Formatter = workload.Formatter
}
}
workloadSchema.Store = store
actionWrapper := workload.ActionWrapper{
Client: management.UnversionedClient,
}
workloadSchema.ActionHandler = actionWrapper.ActionHandler
workloadSchema.LinkHandler = workload.Handler{}.LinkHandler
}