configmanagement.proto 11 KB

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