| 1 |
// |
| 2 |
// Licensed to the Apache Software Foundation (ASF) under one |
| 3 |
// or more contributor license agreements. See the NOTICE file |
| 4 |
// distributed with this work for additional information |
| 5 |
// regarding copyright ownership. The ASF licenses this file |
| 6 |
// to you under the Apache License, Version 2.0 (the |
| 7 |
// "License"); you may not use this file except in compliance |
| 8 |
// with the License. You may obtain a copy of the License at |
| 9 |
// |
| 10 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 11 |
// |
| 12 |
// Unless required by applicable law or agreed to in writing, software |
| 13 |
// distributed under the License is distributed on an "AS IS" BASIS, |
| 14 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 |
// See the License for the specific language governing permissions and |
| 16 |
// limitations under the License. |
| 17 |
|
| 18 |
syntax = "proto2"; |
| 19 |
|
| 20 |
package mesos.quota; |
| 21 |
|
| 22 |
import "github.com/mesos/mesos-go/api/v1/lib/mesos.proto"; |
| 23 |
import "github.com/gogo/protobuf/gogoproto/gogo.proto"; |
| 24 |
|
| 25 |
option go_package = "quota"; |
| 26 |
option (gogoproto.benchgen_all) = true; |
| 27 |
option (gogoproto.enum_stringer_all) = true; |
| 28 |
option (gogoproto.equal_all) = true; |
| 29 |
option (gogoproto.goproto_enum_prefix_all) = false; |
| 30 |
option (gogoproto.goproto_enum_stringer_all) = false; |
| 31 |
option (gogoproto.goproto_stringer_all) = false; |
| 32 |
option (gogoproto.goproto_unrecognized_all) = false; |
| 33 |
option (gogoproto.gostring_all) = true; |
| 34 |
option (gogoproto.marshaler_all) = true; |
| 35 |
option (gogoproto.populate_all) = true; |
| 36 |
option (gogoproto.protosizer_all) = true; |
| 37 |
option (gogoproto.stringer_all) = true; |
| 38 |
option (gogoproto.testgen_all) = true; |
| 39 |
option (gogoproto.unmarshaler_all) = true; |
| 40 |
option (gogoproto.verbose_equal_all) = true; |
| 41 |
|
| 42 |
|
| 43 |
/** |
| 44 |
* `QuotaInfo` describes the guaranteed resource allocation that a role |
| 45 |
* may rely on (i.e. minimum share a role is entitled to receive). |
| 46 |
* |
| 47 |
* As for now, `QuotaInfo` is an internal message used by the master and |
| 48 |
* therefore does not require versioning. However, in the future we may |
| 49 |
* want to expose it in the Framework API, which will render it being |
| 50 |
* external facing. |
| 51 |
*/ |
| 52 |
// TODO(joerg84): Add limits, i.e. upper bounds of resources that a |
| 53 |
// role is allowed to use. |
| 54 |
message QuotaInfo { |
| 55 |
// Quota is granted per role and not per framework, similar to |
| 56 |
// dynamic reservations. |
| 57 |
optional string role = 1; |
| 58 |
|
| 59 |
// Principal which set the quota. Currently only operators can set quotas. |
| 60 |
optional string principal = 2; |
| 61 |
|
| 62 |
// The guarantee that these resources are allocatable for the above role. |
| 63 |
// NOTE: `guarantee.role` should not specify any role except '*', |
| 64 |
// because quota does not reserve specific resources. |
| 65 |
repeated Resource guarantee = 3 [(gogoproto.nullable) = false]; |
| 66 |
} |
| 67 |
|
| 68 |
|
| 69 |
/** |
| 70 |
* `QuotaRequest` provides a schema for set quota JSON requests. |
| 71 |
*/ |
| 72 |
message QuotaRequest { |
| 73 |
// Disables the capacity heuristic check if set to `true`. |
| 74 |
optional bool force = 1 [default = false]; |
| 75 |
|
| 76 |
// The role for which to set quota. |
| 77 |
optional string role = 2; |
| 78 |
|
| 79 |
// The requested guarantee that these resources will be allocatable for |
| 80 |
// the above role. |
| 81 |
repeated Resource guarantee = 3 [(gogoproto.nullable) = false]; |
| 82 |
} |
| 83 |
|
| 84 |
|
| 85 |
/** |
| 86 |
* `QuotaStatus` describes the internal representation for the /quota/status |
| 87 |
* response. |
| 88 |
*/ |
| 89 |
message QuotaStatus { |
| 90 |
// Quotas which are currently set, i.e. known to the master. |
| 91 |
repeated QuotaInfo infos = 1 [(gogoproto.nullable) = false]; |
| 92 |
} |