-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathkind.go
96 lines (85 loc) · 2.27 KB
/
kind.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
91
92
93
94
95
96
package kubernetes
type NamespaceKind string
type ClusterKind string
const (
Deployments NamespaceKind = "deployments"
ReplicaSets NamespaceKind = "replicasets"
ReplicationControllers NamespaceKind = "replicationcontrollers"
StatefulSets NamespaceKind = "statefulsets"
DaemonSets NamespaceKind = "daemonsets"
CronJobs NamespaceKind = "cronjobs"
Services NamespaceKind = "services"
Jobs NamespaceKind = "jobs"
Pods NamespaceKind = "pods"
ConfigMaps NamespaceKind = "configmaps"
Roles NamespaceKind = "roles"
RoleBindings NamespaceKind = "rolebindings"
NetworkPolicys NamespaceKind = "networkpolicies"
Ingresss NamespaceKind = "ingresses"
ResourceQuotas NamespaceKind = "resourcequotas"
LimitRanges NamespaceKind = "limitranges"
Secrets NamespaceKind = "secrets"
)
const (
ComponentStatus ClusterKind = "componentstatuses"
Nodes ClusterKind = "nodes"
Namespaces ClusterKind = "namespaces"
PersistentVolumes ClusterKind = "persistentvolumes"
ClusterRoles ClusterKind = "clusterroles"
ClusterRoleBindings ClusterKind = "clusterrolebindings"
PodSecurityPolicies ClusterKind = "podsecuritypolicies"
)
func (k NamespaceKind) String() string {
return string(k)
}
func (k ClusterKind) String() string {
return string(k)
}
func GetNamespaceKinds() []NamespaceKind {
return []NamespaceKind{
Deployments,
ReplicaSets,
ReplicationControllers,
StatefulSets,
DaemonSets,
CronJobs,
Services,
Jobs,
Pods,
ConfigMaps,
Roles,
RoleBindings,
NetworkPolicys,
Ingresss,
ResourceQuotas,
LimitRanges,
Secrets,
}
}
func GetClusterKinds() []ClusterKind {
return []ClusterKind{
ComponentStatus,
Nodes,
Namespaces,
PersistentVolumes,
ClusterRoles,
ClusterRoleBindings,
PodSecurityPolicies,
}
}
func IsNamespaceKind(kind string) bool {
for _, namespaceKind := range GetNamespaceKinds() {
if namespaceKind.String() == kind {
return true
}
}
return false
}
func IsClusterKind(kind string) bool {
for _, clusterKind := range GetClusterKinds() {
if clusterKind.String() == kind {
return true
}
}
return false
}