k8s.min.proto 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. // Copyright 2022 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.run.v2;
  16. import "google/api/field_behavior.proto";
  17. import "google/api/resource.proto";
  18. option go_package = "google.golang.org/genproto/googleapis/cloud/run/v2;run";
  19. option java_multiple_files = true;
  20. option java_outer_classname = "K8sMinProto";
  21. option java_package = "com.google.cloud.run.v2";
  22. option (google.api.resource_definition) = {
  23. type: "cloudkms.googleapis.com/CryptoKey"
  24. pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}"
  25. };
  26. option (google.api.resource_definition) = {
  27. type: "secretmanager.googleapis.com/Secret"
  28. pattern: "projects/{project}/secrets/{secret}"
  29. };
  30. option (google.api.resource_definition) = {
  31. type: "secretmanager.googleapis.com/SecretVersion"
  32. pattern: "projects/{project}/secrets/{secret}/versions/{version}"
  33. };
  34. option (google.api.resource_definition) = {
  35. type: "vpcaccess.googleapis.com/Connector"
  36. pattern: "projects/{project}/locations/{location}/connectors/{connector}"
  37. };
  38. // A single application container.
  39. // This specifies both the container to run, the command to run in the container
  40. // and the arguments to supply to it.
  41. // Note that additional arguments may be supplied by the system to the container
  42. // at runtime.
  43. message Container {
  44. // Name of the container specified as a DNS_LABEL.
  45. string name = 1;
  46. // Required. URL of the Container image in Google Container Registry or Google Artifact
  47. // Registry. More info: https://kubernetes.io/docs/concepts/containers/images
  48. string image = 2 [(google.api.field_behavior) = REQUIRED];
  49. // Entrypoint array. Not executed within a shell.
  50. // The docker image's ENTRYPOINT is used if this is not provided.
  51. // Variable references $(VAR_NAME) are expanded using the container's
  52. // environment. If a variable cannot be resolved, the reference in the input
  53. // string will be unchanged. The $(VAR_NAME) syntax can be escaped with a
  54. // double $$, ie: $$(VAR_NAME). Escaped references will never be expanded,
  55. // regardless of whether the variable exists or not.
  56. // More info:
  57. // https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
  58. repeated string command = 3;
  59. // Arguments to the entrypoint.
  60. // The docker image's CMD is used if this is not provided.
  61. // Variable references $(VAR_NAME) are expanded using the container's
  62. // environment. If a variable cannot be resolved, the reference in the input
  63. // string will be unchanged. The $(VAR_NAME) syntax can be escaped with a
  64. // double $$, ie: $$(VAR_NAME). Escaped references will never be expanded,
  65. // regardless of whether the variable exists or not.
  66. // More info:
  67. // https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
  68. repeated string args = 4;
  69. // List of environment variables to set in the container.
  70. repeated EnvVar env = 5;
  71. // Compute Resource requirements by this container.
  72. // More info:
  73. // https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources
  74. ResourceRequirements resources = 6;
  75. // List of ports to expose from the container. Only a single port can be
  76. // specified. The specified ports must be listening on all interfaces
  77. // (0.0.0.0) within the container to be accessible.
  78. //
  79. // If omitted, a port number will be chosen and passed to the container
  80. // through the PORT environment variable for the container to listen on.
  81. repeated ContainerPort ports = 7;
  82. // Volume to mount into the container's filesystem.
  83. repeated VolumeMount volume_mounts = 8;
  84. // Container's working directory.
  85. // If not specified, the container runtime's default will be used, which
  86. // might be configured in the container image.
  87. string working_dir = 9;
  88. // Periodic probe of container liveness.
  89. // Container will be restarted if the probe fails.
  90. // More info:
  91. // https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
  92. Probe liveness_probe = 10;
  93. // Startup probe of application within the container.
  94. // All other probes are disabled if a startup probe is provided, until it
  95. // succeeds. Container will not be added to service endpoints if the probe
  96. // fails.
  97. // More info:
  98. // https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
  99. Probe startup_probe = 11;
  100. }
  101. // ResourceRequirements describes the compute resource requirements.
  102. message ResourceRequirements {
  103. // Only memory and CPU are supported. Note: The only
  104. // supported values for CPU are '1', '2', '4', and '8'. Setting 4 CPU
  105. // requires at least 2Gi of memory. The values of the map is string form of
  106. // the 'quantity' k8s type:
  107. // https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go
  108. map<string, string> limits = 1;
  109. // Determines whether CPU should be throttled or not outside of requests.
  110. bool cpu_idle = 2;
  111. }
  112. // EnvVar represents an environment variable present in a Container.
  113. message EnvVar {
  114. // Required. Name of the environment variable. Must be a C_IDENTIFIER, and mnay not
  115. // exceed 32768 characters.
  116. string name = 1 [(google.api.field_behavior) = REQUIRED];
  117. oneof values {
  118. // Variable references $(VAR_NAME) are expanded
  119. // using the previous defined environment variables in the container and
  120. // any route environment variables. If a variable cannot be resolved,
  121. // the reference in the input string will be unchanged. The $(VAR_NAME)
  122. // syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped
  123. // references will never be expanded, regardless of whether the variable
  124. // exists or not.
  125. // Defaults to "", and the maximum length is 32768 bytes.
  126. string value = 2;
  127. // Source for the environment variable's value.
  128. EnvVarSource value_source = 3;
  129. }
  130. }
  131. // EnvVarSource represents a source for the value of an EnvVar.
  132. message EnvVarSource {
  133. // Selects a secret and a specific version from Cloud Secret Manager.
  134. SecretKeySelector secret_key_ref = 1;
  135. }
  136. // SecretEnvVarSource represents a source for the value of an EnvVar.
  137. message SecretKeySelector {
  138. // Required. The name of the secret in Cloud Secret Manager.
  139. // Format: {secret_name} if the secret is in the same project.
  140. // projects/{project}/secrets/{secret_name} if the secret is
  141. // in a different project.
  142. string secret = 1 [
  143. (google.api.field_behavior) = REQUIRED,
  144. (google.api.resource_reference) = {
  145. type: "secretmanager.googleapis.com/Secret"
  146. }
  147. ];
  148. // The Cloud Secret Manager secret version.
  149. // Can be 'latest' for the latest version, an integer for a specific version,
  150. // or a version alias.
  151. string version = 2 [(google.api.resource_reference) = {
  152. type: "secretmanager.googleapis.com/SecretVersion"
  153. }];
  154. }
  155. // ContainerPort represents a network port in a single container.
  156. message ContainerPort {
  157. // If specified, used to specify which protocol to use.
  158. // Allowed values are "http1" and "h2c".
  159. string name = 1;
  160. // Port number the container listens on.
  161. // This must be a valid TCP port number, 0 < container_port < 65536.
  162. int32 container_port = 3;
  163. }
  164. // VolumeMount describes a mounting of a Volume within a container.
  165. message VolumeMount {
  166. // Required. This must match the Name of a Volume.
  167. string name = 1 [(google.api.field_behavior) = REQUIRED];
  168. // Required. Path within the container at which the volume should be mounted. Must
  169. // not contain ':'. For Cloud SQL volumes, it can be left empty, or must
  170. // otherwise be `/cloudsql`. All instances defined in the Volume will be
  171. // available as `/cloudsql/[instance]`. For more information on Cloud SQL
  172. // volumes, visit https://cloud.google.com/sql/docs/mysql/connect-run
  173. string mount_path = 3 [(google.api.field_behavior) = REQUIRED];
  174. }
  175. // Volume represents a named volume in a container.
  176. message Volume {
  177. // Required. Volume's name.
  178. string name = 1 [(google.api.field_behavior) = REQUIRED];
  179. oneof volume_type {
  180. // Secret represents a secret that should populate this volume.
  181. // More info: https://kubernetes.io/docs/concepts/storage/volumes#secret
  182. SecretVolumeSource secret = 2;
  183. // For Cloud SQL volumes, contains the specific instances that should be
  184. // mounted. Visit https://cloud.google.com/sql/docs/mysql/connect-run for
  185. // more information on how to connect Cloud SQL and Cloud Run.
  186. CloudSqlInstance cloud_sql_instance = 3;
  187. }
  188. }
  189. // The secret's value will be presented as the content of a file whose
  190. // name is defined in the item path. If no items are defined, the name of
  191. // the file is the secret.
  192. message SecretVolumeSource {
  193. // Required. The name of the secret in Cloud Secret Manager.
  194. // Format: {secret} if the secret is in the same project.
  195. // projects/{project}/secrets/{secret} if the secret is
  196. // in a different project.
  197. string secret = 1 [(google.api.field_behavior) = REQUIRED];
  198. // If unspecified, the volume will expose a file whose name is the
  199. // secret, relative to VolumeMount.mount_path.
  200. // If specified, the key will be used as the version to fetch from Cloud
  201. // Secret Manager and the path will be the name of the file exposed in the
  202. // volume. When items are defined, they must specify a path and a version.
  203. repeated VersionToPath items = 2;
  204. // Integer representation of mode bits to use on created files by default.
  205. // Must be a value between 0000 and 0777 (octal), defaulting to 0444.
  206. // Directories within the path are not affected by this setting.
  207. //
  208. // Notes
  209. //
  210. // * Internally, a umask of 0222 will be applied to any non-zero value.
  211. // * This is an integer representation of the mode bits. So, the octal
  212. // integer value should look exactly as the chmod numeric notation with a
  213. // leading zero. Some examples: for chmod 777 (a=rwx), set to 0777 (octal) or
  214. // 511 (base-10). For chmod 640 (u=rw,g=r), set to 0640 (octal) or
  215. // 416 (base-10). For chmod 755 (u=rwx,g=rx,o=rx), set to 0755 (octal) or 493
  216. // (base-10).
  217. // * This might be in conflict with other options that affect the
  218. // file mode, like fsGroup, and the result can be other mode bits set.
  219. //
  220. // This might be in conflict with other options that affect the
  221. // file mode, like fsGroup, and as a result, other mode bits could be set.
  222. int32 default_mode = 3;
  223. }
  224. // VersionToPath maps a specific version of a secret to a relative file to mount
  225. // to, relative to VolumeMount's mount_path.
  226. message VersionToPath {
  227. // Required. The relative path of the secret in the container.
  228. string path = 1 [(google.api.field_behavior) = REQUIRED];
  229. // The Cloud Secret Manager secret version.
  230. // Can be 'latest' for the latest value, or an integer or a secret alias for a
  231. // specific version.
  232. string version = 2;
  233. // Integer octal mode bits to use on this file, must be a value between
  234. // 01 and 0777 (octal). If 0 or not set, the Volume's default mode will be
  235. // used.
  236. //
  237. // Notes
  238. //
  239. // * Internally, a umask of 0222 will be applied to any non-zero value.
  240. // * This is an integer representation of the mode bits. So, the octal
  241. // integer value should look exactly as the chmod numeric notation with a
  242. // leading zero. Some examples: for chmod 777 (a=rwx), set to 0777 (octal) or
  243. // 511 (base-10). For chmod 640 (u=rw,g=r), set to 0640 (octal) or
  244. // 416 (base-10). For chmod 755 (u=rwx,g=rx,o=rx), set to 0755 (octal) or 493
  245. // (base-10).
  246. // * This might be in conflict with other options that affect the
  247. // file mode, like fsGroup, and the result can be other mode bits set.
  248. int32 mode = 3;
  249. }
  250. // Represents a specific Cloud SQL instance.
  251. message CloudSqlInstance {
  252. // The Cloud SQL instance connection names, as can be found in
  253. // https://console.cloud.google.com/sql/instances. Visit
  254. // https://cloud.google.com/sql/docs/mysql/connect-run for more information on
  255. // how to connect Cloud SQL and Cloud Run. Format:
  256. // {project}:{location}:{instance}
  257. repeated string instances = 1;
  258. }
  259. // Probe describes a health check to be performed against a container to
  260. // determine whether it is alive or ready to receive traffic.
  261. message Probe {
  262. // Number of seconds after the container has started before the probe is
  263. // initiated.
  264. // Defaults to 0 seconds. Minimum value is 0. Maximum value for liveness probe
  265. // is 3600. Maximum value for startup probe is 240.
  266. // More info:
  267. // https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
  268. int32 initial_delay_seconds = 1;
  269. // Number of seconds after which the probe times out.
  270. // Defaults to 1 second. Minimum value is 1. Maximum value is 3600.
  271. // Must be smaller than period_seconds.
  272. // More info:
  273. // https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
  274. int32 timeout_seconds = 2;
  275. // How often (in seconds) to perform the probe.
  276. // Default to 10 seconds. Minimum value is 1. Maximum value for liveness probe
  277. // is 3600. Maximum value for startup probe is 240.
  278. // Must be greater or equal than timeout_seconds.
  279. int32 period_seconds = 3;
  280. // Minimum consecutive failures for the probe to be considered failed after
  281. // having succeeded. Defaults to 3. Minimum value is 1.
  282. int32 failure_threshold = 4;
  283. oneof probe_type {
  284. // HTTPGet specifies the http request to perform.
  285. // Exactly one of httpGet, tcpSocket, or grpc must be specified.
  286. HTTPGetAction http_get = 5;
  287. // TCPSocket specifies an action involving a TCP port.
  288. // Exactly one of httpGet, tcpSocket, or grpc must be specified.
  289. TCPSocketAction tcp_socket = 6;
  290. // GRPC specifies an action involving a gRPC port.
  291. // Exactly one of httpGet, tcpSocket, or grpc must be specified.
  292. GRPCAction grpc = 7;
  293. }
  294. }
  295. // HTTPGetAction describes an action based on HTTP Get requests.
  296. message HTTPGetAction {
  297. // Path to access on the HTTP server. Defaults to '/'.
  298. string path = 1;
  299. // Custom headers to set in the request. HTTP allows repeated headers.
  300. repeated HTTPHeader http_headers = 4;
  301. }
  302. // HTTPHeader describes a custom header to be used in HTTP probes
  303. message HTTPHeader {
  304. // Required. The header field name
  305. string name = 1 [(google.api.field_behavior) = REQUIRED];
  306. // The header field value
  307. string value = 2;
  308. }
  309. // TCPSocketAction describes an action based on opening a socket
  310. message TCPSocketAction {
  311. // Port number to access on the container. Must be in the range 1 to 65535.
  312. // If not specified, defaults to 8080.
  313. int32 port = 1;
  314. }
  315. // GRPCAction describes an action involving a GRPC port.
  316. message GRPCAction {
  317. // Port number of the gRPC service. Number must be in the range 1 to 65535.
  318. // If not specified, defaults to 8080.
  319. int32 port = 1;
  320. // Service is the name of the service to place in the gRPC HealthCheckRequest
  321. // (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). If
  322. // this is not specified, the default behavior is defined by gRPC.
  323. string service = 2;
  324. }