configmanagement.proto 11 KB

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