-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
skaffold.proto
366 lines (319 loc) · 14.3 KB
/
skaffold.proto
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
syntax = "proto3";
package proto;
option go_package = "github.com/GoogleContainerTools/skaffold/proto";
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import public "enums/enums.proto";
message StateResponse {
State state = 1;
}
message Response {
string msg = 1;
}
message Request {
string name = 1;
}
// `State` represents the current state of the Skaffold components
message State {
BuildState buildState = 1;
DeployState deployState = 2;
reserved 3; // field 3 is obsolete
map<int32, PortEvent> forwardedPorts = 4;
StatusCheckState statusCheckState = 5;
FileSyncState fileSyncState = 6;
repeated DebuggingContainerEvent debuggingContainers = 7;
Metadata metadata = 8;
TestState testState = 9;
}
message Metadata {
BuildMetadata build = 1;
DeployMetadata deploy = 2;
TestMetadata test = 3;
// Additional key value pairs to describe the build pipeline
map<string, string> additional = 99;
}
message BuildMetadata {
message ImageBuilder {
enums.BuilderType type = 1;
int32 count = 2;
}
int32 numberOfArtifacts = 1;
repeated ImageBuilder builders= 2;
enums.BuildType type = 3;
// Additional key value pairs to describe the deploy pipeline
map<string, string> additional = 99;
}
// TestMetadata describes the test pipeline
message TestMetadata {
message Tester {
enums.TesterType type = 1;
int32 count = 2;
}
repeated Tester Testers = 1;
}
message DeployMetadata {
message Deployer {
enums.DeployerType type = 1;
int32 count = 2;
}
repeated Deployer deployers = 1;
enums.ClusterType cluster = 2;
}
// `BuildState` maps Skaffold artifacts to their current build states
message BuildState {
// A map of `artifact name -> build-state`.
// Artifact name is defined in the `skaffold.yaml`.
// The `build-state` can be: <br>
// - `"Not started"`: not yet started <br>
// - `"In progress"`: build started <br>
// - `"Complete"`: build succeeded <br>
// - `"Failed"`: build failed
map<string, string> artifacts = 1;
bool autoTrigger = 2;
enums.StatusCode statusCode = 3;
}
// `TestState` describes the current state of the test
message TestState {
// Status of the current test
string status = 1;
// Teststate status code
enums.StatusCode statusCode = 2;
}
// `DeployState` describes the status of the current deploy
message DeployState {
string status = 1;
bool autoTrigger = 2;
enums.StatusCode statusCode = 3;
}
// `StatusCheckState` describes the state of status check of current deployed resources.
message StatusCheckState {
string status = 1;
// A map of `resource name -> status-check-state`. Where `resource-name` is the kubernetes resource name.
// The `status-check-state` can be <br>
// - `"Not started"`: indicates that `status-check` has just started. <br>
// - `"In progress"`: InProgress is sent after every resource check is complete. <br>
// - `"Succeeded"`:
// - `"Failed"`:
map<string, string> resources = 2;
// StatusCheck statusCode
enums.StatusCode statusCode = 3;
}
// `FileSyncState` contains the status of the current file sync
message FileSyncState {
string status = 1;
bool autoTrigger = 2;
}
// `Event` describes an event in the Skaffold process.
// It is one of MetaEvent, BuildEvent, TestEvent, DeployEvent, PortEvent, StatusCheckEvent, ResourceStatusCheckEvent, FileSyncEvent, or DebuggingContainerEvent.
message Event {
oneof event_type {
MetaEvent metaEvent = 1; // contains general information regarding Skaffold like version info
BuildEvent buildEvent = 2; // describes if the build status per artifact. Status could be one of "InProgress", "Completed" or "Failed".
DeployEvent deployEvent = 3; // describes if the deployment has started, is in progress or is complete.
PortEvent portEvent = 4; // describes each port forwarding event.
StatusCheckEvent statusCheckEvent = 5; // describes if the Status check has started, is in progress, has succeeded or failed.
ResourceStatusCheckEvent resourceStatusCheckEvent = 6; // indicates progress for each kubernetes deployment.
FileSyncEvent fileSyncEvent = 7; // describes the sync status.
DebuggingContainerEvent debuggingContainerEvent = 8; // describes the appearance or disappearance of a debugging container
DevLoopEvent devLoopEvent = 9; // describes a start and end of a dev loop.
TerminationEvent terminationEvent = 10; // describes a skaffold termination event
TestEvent TestEvent = 11; // describes if the test has started, is in progress or is complete.
}
}
// `TerminationEvent` marks the end of the skaffold session
message TerminationEvent {
string status = 1; // status oneof: Completed or Failed
ActionableErr err = 2; // actionable error message
}
// `DevLoopEvent` marks the start and end of a dev loop.
message DevLoopEvent {
int32 iteration = 1; // dev loop iteration. 0 represents initialization loop.
string status = 2; // dev loop status oneof: In Progress, Completed, Failed
ActionableErr err = 3; // actionable error message
}
// `ActionableErr` defines an error that occurred along with an optional list of suggestions
message ActionableErr {
enums.StatusCode errCode = 1; // error code representing the error
string message = 2; // message describing the error.
repeated Suggestion suggestions = 3; // list of suggestions
}
// `MetaEvent` provides general information regarding Skaffold
message MetaEvent {
// entry, for example: `"Starting Skaffold: {Version:v0.39.0-16-g5bb7c9e0 ConfigVersion:skaffold/v1 GitVersion: GitCommit:5bb7c9e078e4d522a5ffc42a2f1274fd17d75902 GitTreeState:dirty BuildDate01:29Z GoVersion:go1.13rc1 Compiler:gc Platform:linux/amd64}"`
string entry = 1;
// Metadata describing skaffold pipeline
Metadata metadata = 2;
}
// `BuildEvent` describes the build status per artifact, and will be emitted by Skaffold anytime a build starts or finishes, successfully or not.
// If the build fails, an error will be attached to the event.
message BuildEvent {
string artifact = 1; // artifact name
string status = 2; // artifact build status oneof: InProgress, Completed, Failed
string err = 3; // Deprecated. Use actionableErr.message. error when build status is Failed.
enums.StatusCode errCode = 4; // Deprecated. Use actionableErr.errCode. status code representing success or failure
ActionableErr actionableErr = 5; // actionable error message
string hostPlatform = 6; // architecture of the host machine. For example `linux/amd64`
string targetPlatforms = 7; // comma-delimited list of build target architectures. For example `linux/amd64,linux/arm64`
}
// `TestEvent` represents the status of a test, and is emitted by Skaffold
// anytime a test starts or completes, successfully or not.
message TestEvent {
string status = 1; // test status oneof: InProgress, Completed, Failed
ActionableErr actionableErr = 2; // actionable error message
}
// `DeployEvent` represents the status of a deployment, and is emitted by Skaffold
// anytime a deployment starts or completes, successfully or not.
message DeployEvent {
string status = 1; // deployment status oneof: InProgress, Completed, Failed
string err = 2; // Deprecated. Use actionableErr.message. error when status is Failed
enums.StatusCode errCode = 3; // Deprecated. Use actionableErr.errCode. status code representing success or failure
ActionableErr actionableErr = 4; // actionable error message
}
// `StatusCheckEvent` describes if the status check for kubernetes rollout has started, is in progress, has succeeded or failed.
message StatusCheckEvent {
string status = 1;
string message = 2;
string err = 3; // Deprecated. Use actionableErr.message.
enums.StatusCode errCode = 4; // Deprecated. Use actionableErr.errCode. status code representing success or failure
ActionableErr actionableErr = 5; // actionable error message
}
// A Resource StatusCheck Event, indicates progress for each kubernetes deployment.
// For every resource, there will be exactly one event with `status` *Succeeded* or *Failed* event.
// There can be multiple events with `status` *Pending*.
// Skaffold polls for resource status every 0.5 second. If the resource status changes, an event with `status` “Pending”, “Complete” and “Failed”
// will be sent with the new status.
message ResourceStatusCheckEvent {
string resource = 1;
string status = 2;
string message = 3;
string err = 4; // Deprecated. Use actionableErr.message.
enums.StatusCode statusCode = 5;
ActionableErr actionableErr = 6; // actionable error message
}
// PortEvent Event describes each port forwarding event.
message PortEvent {
int32 localPort = 1; // local port for forwarded resource
int32 remotePort = 2; // Deprecated. Uses targetPort.intVal.
string podName = 3; // pod name if port forwarded resourceType is Pod
string containerName = 4; // container name if specified in the kubernetes spec
string namespace = 5; // the namespace of the resource to port forward.
string portName = 6;
string resourceType = 7; // resource type e.g. "pod", "service".
string resourceName = 8; // name of the resource to forward.
string address=9; // address on which to bind
IntOrString targetPort = 10; // target port is the resource port that will be forwarded.
}
// FileSyncEvent describes the sync status.
message FileSyncEvent {
int32 fileCount = 1; // number of files synced
string image = 2; // the container image to which files are sycned.
string status = 3; // status of file sync. one of: Not Started, In progress, Succeeded, Failed.
string err = 4; // Deprecated. Use actionableErr.message. error in case of status failed.
enums.StatusCode errCode = 5; //// Deprecated. Use actionableErr.errCode. status code representing success or failure
ActionableErr actionableErr = 6; // actionable error message
}
// DebuggingContainerEvent is raised when a debugging container is started or terminated
message DebuggingContainerEvent {
string status = 1; // the container status oneof: Started, Terminated
string podName = 2; // the pod name with the debugging container
string containerName = 3; // the name of the container configured for debugging
string namespace = 4; // the namespace of the debugging container
string artifact = 5; // the corresponding artifact's image name
string runtime = 6; // the detected language runtime
string workingDir = 7; // the working directory in the container image
map<string,uint32> debugPorts = 8; // the exposed debugging-related ports
}
// LogEntry describes an event and a string description of the event.
message LogEntry {
google.protobuf.Timestamp timestamp = 1; // timestamp of the event.
Event event = 2; // the actual event that is one of
string entry = 3; // description of the event.
}
message UserIntentRequest {
Intent intent = 1;
}
message TriggerRequest {
TriggerState state = 1;
}
// TriggerState represents trigger state for a given phase.
message TriggerState {
oneof val {
bool enabled = 1; // enable or disable a trigger state
}
}
// Intent represents user intents for a given phase.
message Intent {
bool build = 1; // in case skaffold dev is ran with autoBuild=false, a build intent enables building once
bool sync = 2; // in case skaffold dev is ran with autoSync=false, a sync intent enables file sync once
bool deploy = 3; // in case skaffold dev is ran with autoDeploy=false, a deploy intent enables deploys once
bool devloop = 4; // in case skaffold dev is ran with autoDeploy=false, autoSync=false and autoBuild=false a devloop intent enables the entire dev loop once
}
// Suggestion defines the action a user needs to recover from an error.
message Suggestion {
enums.SuggestionCode suggestionCode = 1; // code representing a suggestion
string action = 2; // action represents the suggestion action
}
// IntOrString is a type that can hold an int32 or a string.
message IntOrString {
int32 type = 1; // type of stored value
int32 intVal = 2; // int value
string strVal = 3; // string value
}
// Describes all the methods for the Skaffold API
service SkaffoldService {
// Returns the state of the current Skaffold execution
rpc GetState (google.protobuf.Empty) returns (State) {
option (google.api.http) = {
get: "/v1/state"
};
}
// DEPRECATED. Events should be used instead.
// TODO remove (https://github.com/GoogleContainerTools/skaffold/issues/3168)
rpc EventLog(stream LogEntry) returns (stream LogEntry) {
option (google.api.http) = {
get: "/v1/event_log"
};
}
// Returns all the events of the current Skaffold execution from the start
rpc Events(google.protobuf.Empty) returns (stream LogEntry) {
option (google.api.http) = {
get: "/v1/events"
};
}
// Allows for a single execution of some or all of the phases (build, sync, deploy) in case autoBuild, autoDeploy or autoSync are disabled.
rpc Execute (UserIntentRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/v1/execute"
body: "intent"
};
}
// Allows for enabling or disabling automatic build trigger
rpc AutoBuild (TriggerRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
put: "/v1/build/auto_execute"
body: "state"
};
}
// Allows for enabling or disabling automatic sync trigger
rpc AutoSync (TriggerRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
put: "/v1/sync/auto_execute"
body: "state"
};
}
// Allows for enabling or disabling automatic deploy trigger
rpc AutoDeploy (TriggerRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
put: "/v1/deploy/auto_execute"
body: "state"
};
}
// EXPERIMENTAL. It allows for custom events to be implemented in custom builders for example.
rpc Handle(Event) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/v1/events/handle"
body: "*"
};
}
}