This repository has been archived by the owner on Oct 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmachineinfo.go
117 lines (103 loc) · 3.54 KB
/
machineinfo.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
* Copyright (c) 2020 by The metal-stack Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package v1alpha1
import (
"github.com/gardener/controller-manager-library/pkg/types"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type MachineInfoList struct {
metav1.TypeMeta `json:",inline"`
// Standard list metadata
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
metav1.ListMeta `json:"metadata,omitempty"`
Items []MachineInfo `json:"items"`
}
// +kubebuilder:storageversion
// +kubebuilder:object:root=true
// +kubebuilder:resource:scope=Namespaced,shortName=machi,path=machineinfos,singular=machineinfo
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name=UUID,JSONPath=".spec.uuid",type=string
// +kubebuilder:printcolumn:name=State,JSONPath=".status.state",type=string
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type MachineInfo struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec MachineInfoSpec `json:"spec"`
// +optional
Status MachineInfoStatus `json:"status,omitempty"`
}
type MachineInfoSpec struct {
// UUID of Machine
// +optional
UUID string `json:"uuid,omitempty"`
// Network interfaces
// +optional
NICs []NIC `json:"nics,omitempty"`
// CPU information
// +optional
CPUs []CPU `json:"cpus,omitempty"`
// Memory information
// +optional
Memory []Memory `json:"memory,omitempty"`
// +optional
Disks []Disk `json:"disks,omitempty"`
// +kubebuilder:validation:XPreserveUnknownFields
// +kubebuilder:pruning:PreserveUnknownFields
// +optional
Values types.Values `json:"values,omitempty"`
}
type NIC struct {
Name string `json:"name"`
MAC string `json:"mac"`
// +optional
Bandwidth int `json:"bandwidth,omitempty"`
}
type CPU struct {
// +optional
CPUInfo string `json:"cpuInfo,omitempty"`
// +optional
BogoMips int `json:"bogoMips,omitempty"`
// +optional
MHZ int `json:"mhz,omitempty"`
Cores int `json:"cores,omitempty"`
}
type Memory struct {
Size int `json:"size"`
// +kubebuilder:validation:XPreserveUnknownFields
// +kubebuilder:pruning:PreserveUnknownFields
// +optional
Numa types.Values `json:"numa,omitempty"`
}
type Disk struct {
Id string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Size int `json:"size"`
}
type MachineInfoStatus struct {
// +optional
State string `json:"state"`
// +optional
Message string `json:"message,omitempty"`
}