...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package v1alpha1
17
18 import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
19
20
21 type PodIOChaosSpec struct {
22
23
24
25
26 VolumeMountPath string `json:"volumeMountPath"`
27
28
29
30 Container *string `json:"container,omitempty"`
31
32
33
34 Actions []IOChaosAction `json:"actions,omitempty"`
35 }
36
37
38 type IOChaosAction struct {
39 Type IOChaosType `json:"type"`
40
41 Filter `json:",inline"`
42
43
44
45 Faults []IoFault `json:"faults,omitempty"`
46
47
48
49 Latency string `json:"latency,omitempty"`
50
51
52
53 *AttrOverrideSpec `json:",inline"`
54
55
56
57 *MistakeSpec `json:"mistake,omitempty"`
58
59
60 Source string `json:"source,omitempty"`
61 }
62
63
64 type IOChaosType string
65
66 const (
67
68 IoLatency IOChaosType = "latency"
69
70
71 IoFaults IOChaosType = "fault"
72
73
74 IoAttrOverride IOChaosType = "attrOverride"
75
76
77 IoMistake IOChaosType = "mistake"
78 )
79
80
81
82 type Filter struct {
83
84 Path string `json:"path"`
85
86
87
88 Methods []IoMethod `json:"methods,omitempty"`
89
90
91 Percent int `json:"percent"`
92 }
93
94
95 type IoFault struct {
96 Errno uint32 `json:"errno"`
97 Weight int32 `json:"weight"`
98 }
99
100
101 type AttrOverrideSpec struct {
102
103 Ino *uint64 `json:"ino,omitempty"`
104
105 Size *uint64 `json:"size,omitempty"`
106
107 Blocks *uint64 `json:"blocks,omitempty"`
108
109 Atime *Timespec `json:"atime,omitempty"`
110
111 Mtime *Timespec `json:"mtime,omitempty"`
112
113 Ctime *Timespec `json:"ctime,omitempty"`
114
115 Kind *FileType `json:"kind,omitempty"`
116
117 Perm *uint16 `json:"perm,omitempty"`
118
119 Nlink *uint32 `json:"nlink,omitempty"`
120
121 UID *uint32 `json:"uid,omitempty"`
122
123 GID *uint32 `json:"gid,omitempty"`
124
125 Rdev *uint32 `json:"rdev,omitempty"`
126 }
127
128
129 type MistakeSpec struct {
130
131
132
133 Filling FillingType `json:"filling,omitempty"`
134
135
136
137
138 MaxOccurrences int64 `json:"maxOccurrences,omitempty"`
139
140
141
142
143 MaxLength int64 `json:"maxLength,omitempty"`
144 }
145
146
147 type FillingType string
148
149 const (
150
151 Zero FillingType = "zero"
152
153
154 Random FillingType = "random"
155 )
156
157
158 type Timespec struct {
159 Sec int64 `json:"sec"`
160 Nsec int64 `json:"nsec"`
161 }
162
163
164 type FileType string
165
166 const (
167 NamedPipe FileType = "namedPipe"
168 CharDevice FileType = "charDevice"
169 BlockDevice FileType = "blockDevice"
170 Directory FileType = "directory"
171 RegularFile FileType = "regularFile"
172 TSymlink FileType = "symlink"
173 Socket FileType = "socket"
174 )
175
176 type IoMethod string
177
178 const (
179 LookUp IoMethod = "lookup"
180 Forget IoMethod = "forget"
181 GetAttr IoMethod = "getattr"
182 SetAttr IoMethod = "setattr"
183 ReadLink IoMethod = "readlink"
184 Mknod IoMethod = "mknod"
185 Mkdir IoMethod = "mkdir"
186 UnLink IoMethod = "unlink"
187 Rmdir IoMethod = "rmdir"
188 MSymlink IoMethod = "symlink"
189 Rename IoMethod = "rename"
190 Link IoMethod = "link"
191 Open IoMethod = "open"
192 Read IoMethod = "read"
193 Write IoMethod = "write"
194 Flush IoMethod = "flush"
195 Release IoMethod = "release"
196 Fsync IoMethod = "fsync"
197 Opendir IoMethod = "opendir"
198 Readdir IoMethod = "readdir"
199 Releasedir IoMethod = "releasedir"
200 Fsyncdir IoMethod = "fsyncdir"
201 Statfs IoMethod = "statfs"
202 SetXAttr IoMethod = "setxattr"
203 GetXAttr IoMethod = "getxattr"
204 ListXAttr IoMethod = "listxattr"
205 RemoveXAttr IoMethod = "removexattr"
206 Access IoMethod = "access"
207 Create IoMethod = "create"
208 GetLk IoMethod = "getlk"
209 SetLk IoMethod = "setlk"
210 Bmap IoMethod = "bmap"
211 )
212
213
214
215
216
217
218 type PodIOChaos struct {
219 metav1.TypeMeta `json:",inline"`
220 metav1.ObjectMeta `json:"metadata,omitempty"`
221
222 Spec PodIOChaosSpec `json:"spec,omitempty"`
223
224
225 Status PodIOChaosStatus `json:"status,omitempty"`
226 }
227
228 type PodIOChaosStatus struct {
229
230
231
232 Pid int64 `json:"pid,omitempty"`
233
234
235
236 StartTime int64 `json:"startTime,omitempty"`
237
238
239 FailedMessage string `json:"failedMessage,omitempty"`
240
241
242 ObservedGeneration int64 `json:"observedGeneration,omitempty"`
243 }
244
245
246
247
248 type PodIOChaosList struct {
249 metav1.TypeMeta `json:",inline"`
250 metav1.ListMeta `json:"metadata,omitempty"`
251 Items []PodIOChaos `json:"items"`
252 }
253