forked from rancher/types
/
types.go
90 lines (78 loc) · 1.82 KB
/
types.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package schema
import (
"github.com/rancher/norman/types"
m "github.com/rancher/norman/types/mapper"
"github.com/rancher/types/apis/project.cattle.io/v3"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
var (
handlerMapper = &m.UnionEmbed{
Fields: []m.UnionMapping{
{
FieldName: "exec",
CheckFields: []string{"command"},
},
{
FieldName: "tcpSocket",
CheckFields: []string{"tcp", "port"},
},
{
FieldName: "httpGet",
CheckFields: []string{"port"},
},
},
}
)
type ScalingGroup struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec interface{} `json:"spec"`
Status interface{} `json:"status"`
}
type handlerOverride struct {
TCP bool
}
type EnvironmentFrom struct {
Source string
SourceName string
SourceKey string
Prefix string
Optional bool
TargetKey string
}
type Resources struct {
CPU *ResourceRequest
Memory *ResourceRequest
NvidiaGPU *ResourceRequest
}
type ResourceRequest struct {
Request string
Limit string
}
type Scheduling struct {
Node *NodeScheduling
Tolerate []v1.Toleration
Scheduler string
Priority *int64
PriorityClassName string
}
type NodeScheduling struct {
NodeName string `json:"nodeName" norman:"type=reference[node]"`
RequireAll []string
RequireAny []string
Preferred []string
}
type deployOverride struct {
v3.DeployConfig
}
type projectOverride struct {
types.Namespaced
ProjectID string `norman:"type=reference[/v3/schemas/project],noupdate"`
}
type Target struct {
Addresses []string `json:"addresses"`
NotReadyAddresses []string `json:"notReadyAddresses"`
Port *int32 `json:"port"`
Protocol string `json:"protocol" norman:"type=enum,options=TCP|UDP"`
}