configmanagement.proto 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  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.v1alpha;
  16. import "google/protobuf/timestamp.proto";
  17. import "google/api/annotations.proto";
  18. option csharp_namespace = "Google.Cloud.GkeHub.ConfigManagement.V1Alpha";
  19. option go_package = "google.golang.org/genproto/googleapis/cloud/gkehub/configmanagement/v1alpha;configmanagement";
  20. option java_multiple_files = true;
  21. option java_outer_classname = "ConfigManagementProto";
  22. option java_package = "com.google.cloud.gkehub.configmanagement.v1alpha";
  23. option php_namespace = "Google\\Cloud\\GkeHub\\ConfigManagement\\V1alpha";
  24. option ruby_package = "Google::Cloud::GkeHub::ConfigManagement::V1alpha";
  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. // Enable users to try out mutation for PolicyController.
  122. bool mutation_enabled = 7;
  123. }
  124. // Configuration for Binauthz
  125. message BinauthzConfig {
  126. // Whether binauthz is enabled in this cluster.
  127. bool enabled = 1;
  128. }
  129. // Configuration for Hierarchy Controller
  130. message HierarchyControllerConfig {
  131. // Whether Hierarchy Controller is enabled in this cluster.
  132. bool enabled = 1;
  133. // Whether pod tree labels are enabled in this cluster.
  134. bool enable_pod_tree_labels = 2;
  135. // Whether hierarchical resource quota is enabled in this cluster.
  136. bool enable_hierarchical_resource_quota = 3;
  137. }
  138. // Deployment state for Hierarchy Controller
  139. message HierarchyControllerDeploymentState {
  140. // The deployment state for open source HNC (e.g. v0.7.0-hc.0)
  141. DeploymentState hnc = 1;
  142. // The deployment state for Hierarchy Controller extension (e.g. v0.7.0-hc.1)
  143. DeploymentState extension = 2;
  144. }
  145. // Version for Hierarchy Controller
  146. message HierarchyControllerVersion {
  147. // Version for open source HNC
  148. string hnc = 1;
  149. // Version for Hierarchy Controller extension
  150. string extension = 2;
  151. }
  152. // State for Hierarchy Controller
  153. message HierarchyControllerState {
  154. // The version for Hierarchy Controller
  155. HierarchyControllerVersion version = 1;
  156. // The deployment state for Hierarchy Controller
  157. HierarchyControllerDeploymentState state = 2;
  158. }
  159. // State information for an ACM's Operator
  160. message OperatorState {
  161. // The semenatic version number of the operator
  162. string version = 1;
  163. // The state of the Operator's deployment
  164. DeploymentState deployment_state = 2;
  165. // Install errors.
  166. repeated InstallError errors = 3;
  167. }
  168. // Errors pertaining to the installation of ACM
  169. message InstallError {
  170. // A string representing the user facing error message
  171. string error_message = 1;
  172. }
  173. // State information for ConfigSync
  174. message ConfigSyncState {
  175. // The version of ConfigSync deployed
  176. ConfigSyncVersion version = 1;
  177. // Information about the deployment of ConfigSync, including the version
  178. // of the various Pods deployed
  179. ConfigSyncDeploymentState deployment_state = 2;
  180. // The state of ConfigSync's process to sync configs to a cluster
  181. SyncState sync_state = 3;
  182. }
  183. // Specific versioning information pertaining to ConfigSync's Pods
  184. message ConfigSyncVersion {
  185. // Version of the deployed importer pod
  186. string importer = 1;
  187. // Version of the deployed syncer pod
  188. string syncer = 2;
  189. // Version of the deployed git-sync pod
  190. string git_sync = 3;
  191. // Version of the deployed monitor pod
  192. string monitor = 4;
  193. // Version of the deployed reconciler-manager pod
  194. string reconciler_manager = 5;
  195. // Version of the deployed reconciler container in root-reconciler pod
  196. string root_reconciler = 6;
  197. }
  198. // The state of ConfigSync's deployment on a cluster
  199. message ConfigSyncDeploymentState {
  200. // Deployment state of the importer pod
  201. DeploymentState importer = 1;
  202. // Deployment state of the syncer pod
  203. DeploymentState syncer = 2;
  204. // Deployment state of the git-sync pod
  205. DeploymentState git_sync = 3;
  206. // Deployment state of the monitor pod
  207. DeploymentState monitor = 4;
  208. // Deployment state of reconciler-manager pod
  209. DeploymentState reconciler_manager = 5;
  210. // Deployment state of root-reconciler
  211. DeploymentState root_reconciler = 6;
  212. }
  213. // State indicating an ACM's progress syncing configurations to a cluster
  214. message SyncState {
  215. // An enum representing an ACM's status syncing configs to a cluster
  216. enum SyncCode {
  217. // ACM cannot determine a sync code
  218. SYNC_CODE_UNSPECIFIED = 0;
  219. // ACM successfully synced the git Repo with the cluster
  220. SYNCED = 1;
  221. // ACM is in the progress of syncing a new change
  222. PENDING = 2;
  223. // Indicates an error configuring ACM, and user action is required
  224. ERROR = 3;
  225. // ACM has been installed (operator manifest deployed),
  226. // but not configured.
  227. NOT_CONFIGURED = 4;
  228. // ACM has not been installed (no operator pod found)
  229. NOT_INSTALLED = 5;
  230. // Error authorizing with the cluster
  231. UNAUTHORIZED = 6;
  232. // Cluster could not be reached
  233. UNREACHABLE = 7;
  234. }
  235. // Token indicating the state of the repo.
  236. string source_token = 1;
  237. // Token indicating the state of the importer.
  238. string import_token = 2;
  239. // Token indicating the state of the syncer.
  240. string sync_token = 3;
  241. // Deprecated: use last_sync_time instead.
  242. // Timestamp of when ACM last successfully synced the repo
  243. // The time format is specified in https://golang.org/pkg/time/#Time.String
  244. string last_sync = 4 [deprecated = true];
  245. // Timestamp type of when ACM last successfully synced the repo
  246. google.protobuf.Timestamp last_sync_time = 7;
  247. // Sync status code
  248. SyncCode code = 5;
  249. // A list of errors resulting from problematic configs.
  250. // This list will be truncated after 100 errors, although it is
  251. // unlikely for that many errors to simultaneously exist.
  252. repeated SyncError errors = 6;
  253. }
  254. // An ACM created error representing a problem syncing configurations
  255. message SyncError {
  256. // An ACM defined error code
  257. string code = 1;
  258. // A description of the error
  259. string error_message = 2;
  260. // A list of config(s) associated with the error, if any
  261. repeated ErrorResource error_resources = 3;
  262. }
  263. // Model for a config file in the git repo with an associated Sync error
  264. message ErrorResource {
  265. // Path in the git repo of the erroneous config
  266. string source_path = 1;
  267. // Metadata name of the resource that is causing an error
  268. string resource_name = 2;
  269. // Namespace of the resource that is causing an error
  270. string resource_namespace = 3;
  271. // Group/version/kind of the resource that is causing an error
  272. GroupVersionKind resource_gvk = 4;
  273. }
  274. // A Kubernetes object's GVK
  275. message GroupVersionKind {
  276. // Kubernetes Group
  277. string group = 1;
  278. // Kubernetes Version
  279. string version = 2;
  280. // Kubernetes Kind
  281. string kind = 3;
  282. }
  283. // State for PolicyControllerState.
  284. message PolicyControllerState {
  285. // The version of Gatekeeper Policy Controller deployed.
  286. PolicyControllerVersion version = 1;
  287. // The state about the policy controller installation.
  288. GatekeeperDeploymentState deployment_state = 2;
  289. }
  290. // The build version of Gatekeeper Policy Controller is using.
  291. message PolicyControllerVersion {
  292. // The gatekeeper image tag that is composed of ACM version, git tag, build
  293. // number.
  294. string version = 1;
  295. }
  296. // State for Binauthz
  297. message BinauthzState {
  298. // The state of the binauthz webhook.
  299. DeploymentState webhook = 1;
  300. // The version of binauthz that is installed.
  301. BinauthzVersion version = 2;
  302. }
  303. // The version of binauthz.
  304. message BinauthzVersion {
  305. // The version of the binauthz webhook.
  306. string webhook_version = 1;
  307. }
  308. // State of Policy Controller installation.
  309. message GatekeeperDeploymentState {
  310. // Status of gatekeeper-controller-manager pod.
  311. DeploymentState gatekeeper_controller_manager_state = 1;
  312. // Status of gatekeeper-audit deployment.
  313. DeploymentState gatekeeper_audit = 2;
  314. // Status of the pod serving the mutation webhook.
  315. DeploymentState gatekeeper_mutation = 3;
  316. }