configmanagement.proto 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. // Copyright 2021 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.gkehub.configmanagement.v1beta;
  16. import "google/protobuf/timestamp.proto";
  17. import "google/api/annotations.proto";
  18. option csharp_namespace = "Google.Cloud.GkeHub.ConfigManagement.V1Beta";
  19. option go_package = "google.golang.org/genproto/googleapis/cloud/gkehub/configmanagement/v1beta;configmanagement";
  20. option java_multiple_files = true;
  21. option java_outer_classname = "ConfigManagementProto";
  22. option java_package = "com.google.cloud.gkehub.configmanagement.v1beta";
  23. option php_namespace = "Google\\Cloud\\GkeHub\\ConfigManagement\\V1beta";
  24. option ruby_package = "Google::Cloud::GkeHub::ConfigManagement::V1beta";
  25. // Enum representing the state of an ACM's deployment on a cluster
  26. enum DeploymentState {
  27. // Deployment's state cannot be determined
  28. DEPLOYMENT_STATE_UNSPECIFIED = 0;
  29. // Deployment is not installed
  30. NOT_INSTALLED = 1;
  31. // Deployment is installed
  32. INSTALLED = 2;
  33. // Deployment was attempted to be installed, but has errors
  34. ERROR = 3;
  35. }
  36. // **Anthos Config Management**: State for a single cluster.
  37. message MembershipState {
  38. // The user-defined name for the cluster used by ClusterSelectors to group
  39. // clusters together. This should match Membership's membership_name,
  40. // unless the user installed ACM on the cluster manually prior to enabling
  41. // the ACM hub feature.
  42. // Unique within a Anthos Config Management installation.
  43. string cluster_name = 1;
  44. // Membership configuration in the cluster. This represents the actual state
  45. // in the cluster, while the MembershipSpec in the FeatureSpec represents
  46. // the intended state
  47. MembershipSpec membership_spec = 2;
  48. // Current install status of ACM's Operator
  49. OperatorState operator_state = 3;
  50. // Current sync status
  51. ConfigSyncState config_sync_state = 4;
  52. // PolicyController status
  53. PolicyControllerState policy_controller_state = 5;
  54. // Binauthz status
  55. BinauthzState binauthz_state = 6;
  56. // Hierarchy Controller status
  57. HierarchyControllerState hierarchy_controller_state = 7;
  58. }
  59. // **Anthos Config Management**: Configuration for a single cluster.
  60. // Intended to parallel the ConfigManagement CR.
  61. message MembershipSpec {
  62. // Config Sync configuration for the cluster.
  63. ConfigSync config_sync = 1;
  64. // Policy Controller configuration for the cluster.
  65. PolicyController policy_controller = 2;
  66. // Binauthz conifguration for the cluster.
  67. BinauthzConfig binauthz = 3;
  68. // Hierarchy Controller configuration for the cluster.
  69. HierarchyControllerConfig hierarchy_controller = 4;
  70. // Version of ACM installed.
  71. string version = 10;
  72. }
  73. // Configuration for Config Sync
  74. message ConfigSync {
  75. // Git repo configuration for the cluster.
  76. GitConfig git = 7;
  77. // Specifies whether the Config Sync Repo is
  78. // in “hierarchical” or “unstructured” mode.
  79. string source_format = 8;
  80. }
  81. // Git repo configuration for a single cluster.
  82. message GitConfig {
  83. // The URL of the Git repository to use as the source of truth.
  84. string sync_repo = 1;
  85. // The branch of the repository to sync from. Default: master.
  86. string sync_branch = 2;
  87. // The path within the Git repository that represents the top level of the
  88. // repo to sync. Default: the root directory of the repository.
  89. string policy_dir = 3;
  90. // Period in seconds between consecutive syncs. Default: 15.
  91. int64 sync_wait_secs = 4;
  92. // Git revision (tag or hash) to check out. Default HEAD.
  93. string sync_rev = 5;
  94. // Type of secret configured for access to the Git repo.
  95. string secret_type = 6;
  96. // URL for the HTTPS proxy to be used when communicating with the Git repo.
  97. string https_proxy = 7;
  98. // The GCP Service Account Email used for auth when secret_type is
  99. // gcpServiceAccount.
  100. string gcp_service_account_email = 8;
  101. }
  102. // Configuration for Policy Controller
  103. message PolicyController {
  104. // Enables the installation of Policy Controller.
  105. // If false, the rest of PolicyController fields take no
  106. // effect.
  107. bool enabled = 1;
  108. // Installs the default template library along with Policy Controller.
  109. optional bool template_library_installed = 2;
  110. // Sets the interval for Policy Controller Audit Scans (in seconds).
  111. // When set to 0, this disables audit functionality altogether.
  112. optional int64 audit_interval_seconds = 3;
  113. // The set of namespaces that are excluded from Policy Controller checks.
  114. // Namespaces do not need to currently exist on the cluster.
  115. repeated string exemptable_namespaces = 4;
  116. // Enables the ability to use Constraint Templates that reference to objects
  117. // other than the object currently being evaluated.
  118. bool referential_rules_enabled = 5;
  119. // Logs all denies and dry run failures.
  120. bool log_denies_enabled = 6;
  121. }
  122. // Configuration for Binauthz
  123. message BinauthzConfig {
  124. // Whether binauthz is enabled in this cluster.
  125. bool enabled = 1;
  126. }
  127. // Configuration for Hierarchy Controller
  128. message HierarchyControllerConfig {
  129. // Whether Hierarchy Controller is enabled in this cluster.
  130. bool enabled = 1;
  131. // Whether pod tree labels are enabled in this cluster.
  132. bool enable_pod_tree_labels = 2;
  133. // Whether hierarchical resource quota is enabled in this cluster.
  134. bool enable_hierarchical_resource_quota = 3;
  135. }
  136. // Deployment state for Hierarchy Controller
  137. message HierarchyControllerDeploymentState {
  138. // The deployment state for open source HNC (e.g. v0.7.0-hc.0)
  139. DeploymentState hnc = 1;
  140. // The deployment state for Hierarchy Controller extension (e.g. v0.7.0-hc.1)
  141. DeploymentState extension = 2;
  142. }
  143. // Version for Hierarchy Controller
  144. message HierarchyControllerVersion {
  145. // Version for open source HNC
  146. string hnc = 1;
  147. // Version for Hierarchy Controller extension
  148. string extension = 2;
  149. }
  150. // State for Hierarchy Controller
  151. message HierarchyControllerState {
  152. // The version for Hierarchy Controller
  153. HierarchyControllerVersion version = 1;
  154. // The deployment state for Hierarchy Controller
  155. HierarchyControllerDeploymentState state = 2;
  156. }
  157. // State information for an ACM's Operator
  158. message OperatorState {
  159. // The semenatic version number of the operator
  160. string version = 1;
  161. // The state of the Operator's deployment
  162. DeploymentState deployment_state = 2;
  163. // Install errors.
  164. repeated InstallError errors = 3;
  165. }
  166. // Errors pertaining to the installation of ACM
  167. message InstallError {
  168. // A string representing the user facing error message
  169. string error_message = 1;
  170. }
  171. // State information for ConfigSync
  172. message ConfigSyncState {
  173. // The version of ConfigSync deployed
  174. ConfigSyncVersion version = 1;
  175. // Information about the deployment of ConfigSync, including the version
  176. // of the various Pods deployed
  177. ConfigSyncDeploymentState deployment_state = 2;
  178. // The state of ConfigSync's process to sync configs to a cluster
  179. SyncState sync_state = 3;
  180. }
  181. // Specific versioning information pertaining to ConfigSync's Pods
  182. message ConfigSyncVersion {
  183. // Version of the deployed importer pod
  184. string importer = 1;
  185. // Version of the deployed syncer pod
  186. string syncer = 2;
  187. // Version of the deployed git-sync pod
  188. string git_sync = 3;
  189. // Version of the deployed monitor pod
  190. string monitor = 4;
  191. // Version of the deployed reconciler-manager pod
  192. string reconciler_manager = 5;
  193. // Version of the deployed reconciler container in root-reconciler pod
  194. string root_reconciler = 6;
  195. }
  196. // The state of ConfigSync's deployment on a cluster
  197. message ConfigSyncDeploymentState {
  198. // Deployment state of the importer pod
  199. DeploymentState importer = 1;
  200. // Deployment state of the syncer pod
  201. DeploymentState syncer = 2;
  202. // Deployment state of the git-sync pod
  203. DeploymentState git_sync = 3;
  204. // Deployment state of the monitor pod
  205. DeploymentState monitor = 4;
  206. // Deployment state of reconciler-manager pod
  207. DeploymentState reconciler_manager = 5;
  208. // Deployment state of root-reconciler
  209. DeploymentState root_reconciler = 6;
  210. }
  211. // State indicating an ACM's progress syncing configurations to a cluster
  212. message SyncState {
  213. // An enum representing an ACM's status syncing configs to a cluster
  214. enum SyncCode {
  215. // ACM cannot determine a sync code
  216. SYNC_CODE_UNSPECIFIED = 0;
  217. // ACM successfully synced the git Repo with the cluster
  218. SYNCED = 1;
  219. // ACM is in the progress of syncing a new change
  220. PENDING = 2;
  221. // Indicates an error configuring ACM, and user action is required
  222. ERROR = 3;
  223. // ACM has been installed (operator manifest deployed),
  224. // but not configured.
  225. NOT_CONFIGURED = 4;
  226. // ACM has not been installed (no operator pod found)
  227. NOT_INSTALLED = 5;
  228. // Error authorizing with the cluster
  229. UNAUTHORIZED = 6;
  230. // Cluster could not be reached
  231. UNREACHABLE = 7;
  232. }
  233. // Token indicating the state of the repo.
  234. string source_token = 1;
  235. // Token indicating the state of the importer.
  236. string import_token = 2;
  237. // Token indicating the state of the syncer.
  238. string sync_token = 3;
  239. // Deprecated: use last_sync_time instead.
  240. // Timestamp of when ACM last successfully synced the repo
  241. // The time format is specified in https://golang.org/pkg/time/#Time.String
  242. string last_sync = 4 [deprecated = true];
  243. // Timestamp type of when ACM last successfully synced the repo
  244. google.protobuf.Timestamp last_sync_time = 7;
  245. // Sync status code
  246. SyncCode code = 5;
  247. // A list of errors resulting from problematic configs.
  248. // This list will be truncated after 100 errors, although it is
  249. // unlikely for that many errors to simultaneously exist.
  250. repeated SyncError errors = 6;
  251. }
  252. // An ACM created error representing a problem syncing configurations
  253. message SyncError {
  254. // An ACM defined error code
  255. string code = 1;
  256. // A description of the error
  257. string error_message = 2;
  258. // A list of config(s) associated with the error, if any
  259. repeated ErrorResource error_resources = 3;
  260. }
  261. // Model for a config file in the git repo with an associated Sync error
  262. message ErrorResource {
  263. // Path in the git repo of the erroneous config
  264. string source_path = 1;
  265. // Metadata name of the resource that is causing an error
  266. string resource_name = 2;
  267. // Namespace of the resource that is causing an error
  268. string resource_namespace = 3;
  269. // Group/version/kind of the resource that is causing an error
  270. GroupVersionKind resource_gvk = 4;
  271. }
  272. // A Kubernetes object's GVK
  273. message GroupVersionKind {
  274. // Kubernetes Group
  275. string group = 1;
  276. // Kubernetes Version
  277. string version = 2;
  278. // Kubernetes Kind
  279. string kind = 3;
  280. }
  281. // State for PolicyControllerState.
  282. message PolicyControllerState {
  283. // The version of Gatekeeper Policy Controller deployed.
  284. PolicyControllerVersion version = 1;
  285. // The state about the policy controller installation.
  286. GatekeeperDeploymentState deployment_state = 2;
  287. }
  288. // The build version of Gatekeeper Policy Controller is using.
  289. message PolicyControllerVersion {
  290. // The gatekeeper image tag that is composed of ACM version, git tag, build
  291. // number.
  292. string version = 1;
  293. }
  294. // State for Binauthz
  295. message BinauthzState {
  296. // The state of the binauthz webhook.
  297. DeploymentState webhook = 1;
  298. // The version of binauthz that is installed.
  299. BinauthzVersion version = 2;
  300. }
  301. // The version of binauthz.
  302. message BinauthzVersion {
  303. // The version of the binauthz webhook.
  304. string webhook_version = 1;
  305. }
  306. // State of Policy Controller installation.
  307. message GatekeeperDeploymentState {
  308. // Status of gatekeeper-controller-manager pod.
  309. DeploymentState gatekeeper_controller_manager_state = 1;
  310. // Status of gatekeeper-audit deployment.
  311. DeploymentState gatekeeper_audit = 2;
  312. }