-
Notifications
You must be signed in to change notification settings - Fork 0
/
kdeploy.proto
259 lines (232 loc) · 9.1 KB
/
kdeploy.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
syntax = "proto3";
package kdeploy;
option go_package = "kdeploypb";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/any.proto";
import "google/protobuf/empty.proto";
import "github.com/mwitkow/go-proto-validators/validator.proto";
enum Protocol {
INVALID_PROTOCOL =0;
HTTP =1;
HTTPS =2;
GRPC =3;
HTTP2 =4;
MONGO =5;
TCP =6;
TLS =7;
}
enum TLSmode {
PASSTHROUGH = 0;
SIMPLE = 1;
MUTUAL = 2;
AUTO_PASSTHROUGH = 3;
ISTIO_MUTUAL = 4;
};
message ServerTLSSettings {
bool https_redirect = 1;
TLSmode mode = 2;
string server_certificate = 3;
string private_key = 4;
string ca_certificates = 5;
string credential_name = 10;
repeated string subject_alt_names = 6;
repeated string verify_certificate_spki = 11;
repeated string verify_certificate_hash = 12;
repeated string cipher_suites = 9;
}
message GatewayListener {
uint32 port =1[(validator.field) = {int_gt : 0}];
string name =2[(validator.field) = {regex : "^.{1,225}$"}];
Protocol protocol =3[(validator.field) = {int_gt : 0}];
repeated string hosts =4[(validator.field) = {repeated_count_min : 0}];
ServerTLSSettings tls_config =5;
}
message Gateway {
// name of the application
string name =1;
// application namespace
string namespace =2;
repeated GatewayListener listeners = 3;
map<string, string> labels =4;
map<string, string> selector =5;
}
message GatewayInput {
// name of the application
string name =1[(validator.field) = {regex : "^.{1,225}$"}];
// application namespace
string namespace =2[(validator.field) = {regex : "^.{1,225}$"}];
repeated GatewayListener listeners = 3;
map<string, string> labels =4[(validator.field) = {msg_exists : true}];
map<string, string> selector =5[(validator.field) = {msg_exists : true}];
}
// HTTPRoute is a single http route(istio HttpRoute)
message HTTPRoute {
string name =1[(validator.field) = {regex : "^.{1,225}$"}];
uint32 port =2[(validator.field) = {int_gt : 0}];
string path_prefix =3;
string rewrite_uri = 4;
// The list of origins that are allowed to perform CORS requests
repeated string allow_origins =5;
// The list of methods that are allowed to perform CORS requests
repeated string allow_methods =6;
// The list of headers that are allowed to perform CORS requests
repeated string allow_headers =7;
// The list of origins that are allowed to perform CORS requests
repeated string expose_headers =8;
// adds `Access-Control-Allow-Credentials` header
bool allow_credentials =9;
}
message Networking {
repeated string gateways =1;
repeated string hosts =2;
bool export =3;
repeated HTTPRoute http_routes =4;
}
// App is a stateless application
message App {
// name of the application
string name =1[(validator.field) = {regex : "^.{1,225}$"}];
// application namespace
string namespace =2[(validator.field) = {regex : "^.{1,225}$"}];
// docker image of application
string image =3[(validator.field) = {regex : "^.{1,225}$"}];
// args are arguments given to the docker image at startup
repeated string args =5;
// k/v map of environmental variables
map<string, string> env =6;
// k/v map of ports to expose ex: http: 80 https: 443
map<string, uint32> ports =7[(validator.field) = {msg_exists : true}];
// number of deployment replicas
uint32 replicas =8;
map<string, string> labels =9[(validator.field) = {msg_exists : true}];
map<string, string> selector =10[(validator.field) = {msg_exists : true}];
// gateway/service-mesh networking
Networking networking =11[(validator.field) = {msg_exists : true}];
// status tracks the state of the application during it's lifecycle
AppStatus status =20[(validator.field) = {msg_exists : true}];
}
// Task is scheduled cron job
message Task {
// name of the task
string name =1[(validator.field) = {regex : "^.{1,225}$"}];
// task namespace
string namespace =2[(validator.field) = {regex : "^.{1,225}$"}];
// docker image of task
string image =3[(validator.field) = {regex : "^.{1,225}$"}];
// args are arguments given to docker image at startup
repeated string args =5;
// k/v map of environmental variables
map<string, string> env =6;
// schedule is the cron schedule: https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/
string schedule = 7[(validator.field) = {regex : "^.{1,225}$"}];
// completions is the number of times to execute the task. If completions = 0, the task will run forever
uint32 completions = 8;
map<string, string> labels =9[(validator.field) = {msg_exists : true}];
map<string, string> selector =10[(validator.field) = {msg_exists : true}];
}
// TaskInput creates/updates a task(cron job)
message TaskInput {
// name of the task
string name =1[(validator.field) = {regex : "^.{1,225}$"}];
// task namespace
string namespace =2[(validator.field) = {regex : "^.{1,225}$"}];
// docker image of task
string image =3[(validator.field) = {regex : "^.{1,225}$"}];
// args are arguments given to docker image at startup
repeated string args =5;
// k/v map of environmental variables
map<string, string> env =6;
// schedule is the cron schedule: https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/
string schedule = 7[(validator.field) = {regex : "^.{1,225}$"}];
// completions is the number of times to execute the task. If completions = 0, the task will run forever
uint32 completions = 8;
map<string, string> labels =9[(validator.field) = {msg_exists : true}];
map<string, string> selector =10[(validator.field) = {msg_exists : true}];
}
// AppInput creates/replaces an app
message AppInput {
// name of the application
string name =1[(validator.field) = {regex : "^.{1,225}$"}];
// application namespace
string namespace =2[(validator.field) = {regex : "^.{1,225}$"}];
// docker image of application
string image =3[(validator.field) = {regex : "^.{1,225}$"}];
// args are arguments given to the docker image at startup
repeated string args =4;
// k/v map of environmental variables
map<string, string> env =5;
// k/v map of ports to expose ex: http: 80 https: 443
map<string, uint32> ports =6[(validator.field) = {msg_exists : true}];
// number of deployment replicas
uint32 replicas =7;
Networking networking =9[(validator.field) = {msg_exists : true}];
map<string, string> labels =10[(validator.field) = {msg_exists : true}];
map<string, string> selector =11[(validator.field) = {msg_exists : true}];
}
message Ref {
// name of the application
string name =1[(validator.field) = {regex : "^.{1,225}$"}];
// application namespace
string namespace =2[(validator.field) = {regex : "^.{1,225}$"}];
}
//repeated_count_min
message Replica {
string phase =1;
string condition =2;
string reason =3;
}
message AppStatus {
repeated Replica replicas =1;
}
message Log {
string message =1;
}
message Apps {
repeated App applications =1;
}
message Tasks {
repeated Task tasks =1;
}
message Namespace {
string namespace =1;
}
message Namespaces {
repeated string namespaces =1;
}
//
service KdeployService {
// CreateApp creates a new stateless application(k8s deployment & service) within a single namespace(k8s namespace)
// the namespace will automatically be created if one does not already exist
rpc CreateApp(AppInput) returns(App){}
// UpdateApp edits/patches an existing stateless application(k8s deployment & service) within an existing namespace(k8s namespace)
rpc UpdateApp(AppInput) returns(App){}
// DeleteApp deletes a single stateless application(k8s deployment & service) within an existing namespace
rpc DeleteApp(Ref) returns(google.protobuf.Empty){}
// GetApp gets an app by name within an existing namespace
rpc GetApp(Ref) returns(App){}
// ListApps lists all apps within an existing namespace
rpc ListApps(Namespace) returns(Apps){}
// ListNamespaces lists all namespaces created by kdeploy
rpc ListNamespaces(google.protobuf.Empty) returns(Namespaces){}
// DeleteAll deletes all apps/tasks within an existing namespace
rpc DeleteAll(Namespace) returns(google.protobuf.Empty){}
// CreateTask creates a new task(k8s cron job) within a single namespace(k8s namespace)
// the namespace will automatically be created if one does not already exist
rpc CreateTask(TaskInput) returns(Task){}
// UpdateTask edits/patches an existing task(k8s cron job) within an existing namespace(k8s namespace)
rpc UpdateTask(TaskInput) returns(Task){}
// DeleteTask deletes a single task(k8s cron job) within an existing namespace
rpc DeleteTask(Ref) returns(google.protobuf.Empty){}
// GetTask gets a task(k8s cron job) by name within an existing namespace
rpc GetTask(Ref) returns(Task){}
// ListTasks lists all tasks(k8s cron jobs) within an existing namespace
rpc ListTasks(Namespace) returns(Tasks){}
// StreamLogs streams logs from an app/task within an existing namespace.
// Streams are opened to all replicas & converted into a single stream
rpc StreamLogs(Ref) returns (stream Log){}
rpc CreateGateway(GatewayInput) returns(Gateway){}
rpc UpdateGateway(GatewayInput) returns(Gateway){}
rpc DeleteGateway(Ref) returns(google.protobuf.Empty){}
rpc GetGateway(Ref) returns(Gateway){}
}