/
schema.proto
209 lines (190 loc) · 6.3 KB
/
schema.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
syntax = "proto3";
package hpaas;
option go_package = "hpaaspb";
import "google/api/annotations.proto";
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";
// Dependency is a dependency required by a helm chart
message Dependency {
// name of the chart dependency
string chart =1[(validator.field) = {regex : "^.{1,225}$"}];
// name of the chart version
string version =2[(validator.field) = {regex : "^.{1,225}$"}];
// the URL of the helm repository.
string repository =3[(validator.field) = {regex : "^.{1,225}$"}];
}
// Maintainer is the maintainer of a helm chart
message Maintainer {
// name is the name of the maintainer
string name =1[(validator.field) = {regex : "^.{1,225}$"}];
// email is the email of the maintainer
string email =2[(validator.field) = {regex : "^.{1,225}$"}];
}
// ChartFilter is used for filtering helm chart search results
message ChartFilter {
// term to search for
string term =1[(validator.field) = {regex : "^.{1,225}$"}];
// term is a regex expression
bool regex =2;
}
// Chart is a helm chart that may be used to deploy an app/release
message Chart {
// name of the helm chart
string name =1[(validator.field) = {regex : "^.{1,225}$"}];
// home page of the helm chart
string home =2;
// description of the helm chart
string description =3;
// version of the helm chart
string version =4;
repeated string sources =5;
// keywords associated with the helm chart
repeated string keywords =6;
// icon is an the icon/brand associated with the chart
string icon =7;
// chart is not actively maintained if deprecated = true
bool deprecated =8;
// extra charts that this chart depends on
repeated Dependency dependencies =9;
// maintainers of this chart
repeated Maintainer maintainers =10;
// arbitrary metadata associated with the chart
map<string, string> metadata =11;
}
// Charts is a list of helm charts
message Charts {
repeated Chart charts =1;
}
// App is an app/release created from a helm chart
message App {
// name of the application
string name =1[(validator.field) = {regex : "^.{1,225}$"}];
// namespace name the app belongs to(autocreated)
string namespace =2[(validator.field) = {regex : "^.{1,225}$"}];
// release holds information about the currently deployed release of the application
Release release =5;
// chart is the chart used to deploy the App
Chart chart =20;
}
// Apps is a list of apps
message Apps {
repeated App apps =1;
}
message AppFilter {
string namespace =1;
string selector =2;
uint32 limit =3;
uint32 offset =4;
}
// Release tracks the state of an app during the lifecycle of it's current deployment
message Release {
// version of the App. Iterates with each upgrade
uint32 version =1;
// config values
google.protobuf.Struct config =2;
// notes associated with the release
string notes =3;
// description of the release
string description =4;
// status of the release
string status =5;
// lifecycle timestamps related
Timestamps timestamps =6;
}
// Timestamps tracks timestamps related to a release
message Timestamps {
// when the release was first deployed
google.protobuf.Timestamp created =1;
// when the release was last deployed
google.protobuf.Timestamp updated =2;
// when the release was deleted
google.protobuf.Timestamp deleted =3;
}
// AppRef is a generic structure for looking up apps/releases
message AppRef {
// namespace is the k8s namespace the app/release belongs to(autocreated)
string namespace =1[(validator.field) = {regex : "^.{1,225}$"}];
// name is the name of the app/release
string name =2[(validator.field) = {regex : "^.{1,225}$"}];
}
// AppInput is used to create/update an app
message AppInput {
// the namespace the app/release belongs to(autocreated)
string namespace =1[(validator.field) = {regex : "^.{1,225}$"}];
// the helm chart to use
string chart =2[(validator.field) = {regex : "^.{1,225}$"}];
// name of the app/release
string app_name =3[(validator.field) = {regex : "^.{1,225}$"}];
// config values used to render the helm chart
map<string, string> config =4[(validator.field) = {msg_exists : true}];
}
// NamespaceRef is a generic structure for looking up namespaces
message NamespaceRef {
// name of the namespace
string name =1[(validator.field) = {regex : "^.{1,225}$"}];
}
// NamespaceRefs is a list of NamespaceRef
message NamespaceRefs {
repeated NamespaceRef namespaces =1;
}
message HistoryFilter {
AppRef ref =1[(validator.field) = {msg_exists : true}];
uint32 limit =2;
}
// HPaasService is a secure platform as a service for easily deploying applications on Kubernetes with Helm charts
service HPaasService {
// GetApp gets an app/release from the given namespace
rpc GetApp(AppRef) returns(App){
option (google.api.http) = {
get: "/apps/{namespace}"
};
}
// GetHistory gets a list of previous versions of the app/release
rpc GetHistory(HistoryFilter) returns (Apps){
option (google.api.http) = {
get: "/apps/{ref.namespace}/{ref.name}/history"
};
}
// SearchApps searchs for apps/releases
rpc SearchApps(AppFilter) returns(Apps){
option (google.api.http) = {
get: "/apps/{namespace}"
};
}
// UninstallApp uninstalls an app/release from the given namespace
rpc UninstallApp(AppRef) returns(google.protobuf.Empty){
option (google.api.http) = {
delete: "/apps/{namespace}/{name}"
};
}
// RollbackApp rolls the app/release back to the previous version in the given namespace
rpc RollbackApp(AppRef) returns(App){
option (google.api.http) = {
post: "/apps/{namespace}/{name}/rollback"
body: "*"
};
}
// InstallApp installs an app/release in the given namespace
rpc InstallApp(AppInput) returns(App){
option (google.api.http) = {
post: "/apps/{namespace}"
body: "*"
};
}
// UpdateApp updates an app/release in the given namespace
rpc UpdateApp(AppInput) returns(App){
option (google.api.http) = {
put: "/apps/{namespace}/{app_name}"
body: "*"
};
}
// SearchCharts searches for a cached helm chart
rpc SearchCharts(ChartFilter) returns(Charts){
option (google.api.http) = {
get: "/charts"
};
}
}