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