configmanagement.proto 12 KB

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