github.com/freiheit-com/kuberpult@v1.24.2-0.20240328135542-315d5630abe6/pkg/api/v1/api.proto (about) 1 syntax = "proto3"; 2 3 option go_package = "github.com/freiheit-com/kuberpult/pkg/api"; 4 5 import "google/protobuf/timestamp.proto"; 6 7 package api.v1; 8 9 10 service GitService { 11 rpc GetGitTags (GetGitTagsRequest) returns (GetGitTagsResponse) {} 12 // By "Product" we mean the entire collection of apps 13 rpc GetProductSummary(GetProductSummaryRequest) returns(GetProductSummaryResponse) {} 14 rpc GetCommitInfo(GetCommitInfoRequest) returns(GetCommitInfoResponse) {} 15 } 16 17 message GetGitTagsRequest { 18 } 19 20 message GetGitTagsResponse { 21 repeated TagData tag_data = 1; 22 } 23 24 message GetProductSummaryRequest { 25 string commit_hash = 1; 26 optional string environment = 2; 27 optional string environment_group = 3; 28 } 29 30 message GetProductSummaryResponse { 31 repeated ProductSummary product_summary = 1; 32 } 33 34 message ProductSummary { 35 string app = 1; 36 string version = 2; 37 string commit_id = 3; 38 string display_version = 4; 39 string environment = 5; 40 string team = 6; 41 } 42 43 message GetCommitInfoRequest { 44 // The commit hash requested, can also be a prefix. 45 string commit_hash = 1; 46 } 47 48 message GetCommitInfoResponse { 49 // The full commit hash, so that it can be displayed in case a 50 // prefix was supplied in the request. 51 string commit_hash = 4; 52 string commit_message = 1; 53 repeated string touched_apps = 2; 54 repeated Event events = 3; 55 string next_commit_hash = 5; 56 string previous_commit_hash = 6; 57 } 58 59 message Event { 60 // data that ALL events have: 61 google.protobuf.Timestamp created_at = 1; 62 string uuid = 2; 63 // data that is different per event type: 64 oneof event_type { 65 CreateReleaseEvent create_release_event = 3; 66 DeploymentEvent deployment_event = 4; 67 LockPreventedDeploymentEvent lock_prevented_deployment_event = 5; 68 ReplacedByEvent replaced_by_event = 6; 69 } 70 } 71 72 message CreateReleaseEvent { 73 repeated string environment_names = 1; 74 } 75 76 message DeploymentEvent { 77 message ReleaseTrainSource { 78 string upstream_environment = 1; 79 optional string target_environment_group = 2; 80 } 81 string application = 1; 82 string target_environment = 2; 83 optional ReleaseTrainSource release_train_source = 3; 84 } 85 86 message LockPreventedDeploymentEvent { 87 enum LockType { 88 LOCK_TYPE_UNKNOWN = 0; 89 LOCK_TYPE_ENV = 1; 90 LOCK_TYPE_APP = 2; 91 } 92 string application = 1; 93 string environment = 2; 94 string lock_message = 3; 95 LockType lock_type = 4; 96 } 97 98 message ReplacedByEvent{ 99 string replaced_by_commit_id = 1; 100 string application = 2; 101 string environment = 3; 102 } 103 104 message TagData { 105 string tag = 1; 106 string commit_id = 2; 107 } 108 109 service BatchService { 110 rpc ProcessBatch (BatchRequest) returns (BatchResponse) {} 111 } 112 113 message BatchRequest { 114 repeated BatchAction actions = 1; 115 } 116 117 message BatchAction { 118 oneof action { 119 CreateEnvironmentLockRequest create_environment_lock = 1; 120 DeleteEnvironmentLockRequest delete_environment_lock = 2; 121 CreateEnvironmentApplicationLockRequest create_environment_application_lock = 3; 122 DeleteEnvironmentApplicationLockRequest delete_environment_application_lock = 4; 123 DeployRequest deploy = 5; 124 PrepareUndeployRequest prepare_undeploy = 6; 125 UndeployRequest undeploy = 7; 126 DeleteEnvironmentFromAppRequest delete_env_from_app = 8; 127 CreateEnvironmentRequest create_environment = 9; 128 ReleaseTrainRequest release_train = 10; 129 CreateReleaseRequest create_release = 11; 130 CreateEnvironmentGroupLockRequest create_environment_group_lock = 12; 131 DeleteEnvironmentGroupLockRequest delete_environment_group_lock = 13; 132 } 133 } 134 135 message BatchResponse { 136 repeated BatchResult results = 1; 137 } 138 139 message BatchResult { 140 oneof result { 141 ReleaseTrainResponse release_train = 10; 142 CreateReleaseResponse create_release_response = 11; 143 } 144 } 145 146 message CreateEnvironmentLockRequest { 147 string environment = 1; 148 string lock_id = 2; 149 string message = 3; 150 } 151 152 message DeleteEnvironmentLockRequest { 153 string environment = 1; 154 string lock_id = 2; 155 } 156 157 message CreateEnvironmentGroupLockRequest { 158 string environment_group = 1; 159 string lock_id = 2; 160 string message = 3; 161 } 162 163 message DeleteEnvironmentGroupLockRequest { 164 string environment_group = 1; 165 string lock_id = 2; 166 } 167 168 169 message CreateEnvironmentApplicationLockRequest { 170 string environment = 1; 171 string application = 2; 172 string lock_id = 3; 173 string message = 4; 174 } 175 176 message DeleteEnvironmentApplicationLockRequest { 177 string environment = 1; 178 string application = 2; 179 string lock_id = 3; 180 } 181 182 183 message CreateReleaseRequest { 184 string environment = 1; 185 string application = 2; 186 string team = 3; 187 // env->yaml 188 map<string, string> manifests = 4; 189 uint64 version = 5; 190 string source_commit_id = 6; 191 string source_author = 7; 192 string source_message = 8; 193 string source_repo_url = 9; 194 string display_version = 10; 195 string previous_commit_id = 11; 196 string next_commit_id = 12; 197 } 198 199 message CreateReleaseResponseSuccess { 200 } 201 202 message CreateReleaseResponseGeneralFailure { 203 string message = 1; 204 } 205 206 message CreateReleaseResponseTooOld { 207 } 208 209 message CreateReleaseResponseAppNameTooLong { 210 string app_name = 1; 211 string reg_exp = 2; 212 uint32 max_len = 3; 213 } 214 215 message CreateReleaseResponseAlreadyExistsSame { 216 } 217 218 enum DifferingField { 219 SOURCE_COMMIT_ID = 0; 220 SOURCE_AUTHOR = 1; 221 SOURCE_MESSAGE = 2; 222 SOURCE_REPO_URL = 3; 223 DISPLAY_VERSION = 4; 224 TEAM = 5; 225 MANIFESTS = 6; 226 } 227 228 message CreateReleaseResponseAlreadyExistsDifferent { 229 DifferingField first_differing_field = 1; // there might be more differences, but we only report the first one 230 string diff = 2; 231 } 232 233 message CreateReleaseResponse { 234 oneof response { 235 CreateReleaseResponseSuccess success = 1; 236 CreateReleaseResponseTooOld too_old = 2; 237 CreateReleaseResponseAppNameTooLong too_long = 3; 238 CreateReleaseResponseGeneralFailure general_failure = 4; 239 CreateReleaseResponseAlreadyExistsSame already_exists_same = 5; 240 CreateReleaseResponseAlreadyExistsDifferent already_exists_different = 6; 241 } 242 } 243 244 enum LockBehavior { 245 RECORD = 0; 246 FAIL = 1; 247 IGNORE = 2; 248 } 249 250 message DeployRequest { 251 string environment = 1; 252 string application = 2; 253 uint64 version = 3; 254 bool ignore_all_locks = 4 [deprecated = true]; 255 LockBehavior lock_behavior = 5; 256 } 257 258 message PrepareUndeployRequest { 259 string application = 1; 260 } 261 262 message UndeployRequest { 263 string application = 1; 264 } 265 266 message DeleteEnvironmentFromAppRequest { 267 string application = 1; 268 string environment = 2; 269 } 270 271 message ReleaseTrainRequest { 272 string target = 1; 273 string team = 2; 274 string commit_hash = 3; 275 } 276 277 message ReleaseTrainResponse { 278 string target = 1; 279 string team = 2; 280 } 281 282 message Lock { 283 string message = 1; 284 string lock_id = 3; 285 google.protobuf.Timestamp created_at = 4; 286 Actor created_by = 5; 287 } 288 289 message LockedError { 290 map<string, Lock> environment_locks = 1; 291 map<string, Lock> environment_application_locks = 2; 292 } 293 294 service FrontendConfigService { 295 rpc GetConfig (GetFrontendConfigRequest) returns (GetFrontendConfigResponse) {} 296 } 297 298 message GetFrontendConfigRequest { 299 } 300 301 message GetFrontendConfigResponse { 302 message ArgoCD { 303 string base_url = 1; 304 string namespace = 2; 305 } 306 message Auth { 307 message AzureAuthConfig { 308 bool enabled = 1; 309 string client_id = 2; 310 string tenant_id = 3; 311 string cloud_instance = 4; 312 string redirect_url = 5; 313 } 314 AzureAuthConfig azure_auth= 1; 315 } 316 ArgoCD argo_cd = 1; 317 Auth auth_config = 2; 318 string source_repo_url = 3; 319 string kuberpult_version = 4; 320 string branch = 5; 321 string manifest_repo_url = 6; 322 } 323 324 message GetVersionRequest { 325 string git_revision = 1; 326 string application = 2; 327 string environment = 3; 328 } 329 330 message GetVersionResponse { 331 uint64 version = 1; 332 google.protobuf.Timestamp deployed_at = 2; 333 string source_commit_id = 3; 334 } 335 336 service VersionService { 337 rpc GetVersion (GetVersionRequest) returns (GetVersionResponse) {} 338 rpc GetManifests (GetManifestsRequest) returns (GetManifestsResponse) {} 339 } 340 341 service OverviewService { 342 rpc GetOverview (GetOverviewRequest) returns (GetOverviewResponse) {} 343 rpc StreamOverview (GetOverviewRequest) returns (stream GetOverviewResponse) {} 344 } 345 346 service EnvironmentService { 347 rpc GetEnvironmentConfig(GetEnvironmentConfigRequest) returns (GetEnvironmentConfigResponse) {} 348 } 349 350 message GetOverviewRequest { 351 // Retrieve the overview at a certain state of the repository. If it's empty, the latest commit will be used. 352 string git_revision = 1; 353 } 354 355 message GetOverviewResponse { 356 map<string, Application> applications = 2; 357 repeated EnvironmentGroup environment_groups = 3; 358 string git_revision = 4; 359 string branch = 5; 360 string manifest_repo_url = 6; 361 } 362 363 message EnvironmentGroup { 364 string environment_group_name = 1; 365 repeated Environment environments = 2; 366 // note that the distance_to_upstream should usually be configured to be the same for all envs in this group, but this is not enforced. 367 uint32 distance_to_upstream = 3; 368 /* 369 Even though this field has the same name and type as Environment.priority, it does have difference semantics. 370 371 Environment priority is calculated based on the location of an environment in a chain. Environment group priority is calculated based on the distance to upstream **and** the maximum global distance to upstream. 372 This field therefore characterizes the "layer" of an environment group. The reason it is reusing the name and type of Environment.priority is to keep the calculation of environment colors in the frontend untouched. 373 374 Note: proper calculation of this field assumes there is not more than one environment group hierarchy; that is, there is only one group with distance_to_upstream = 0. 375 */ 376 Priority priority = 4; 377 } 378 379 enum Priority { 380 // PROD is an environment that no environment names as its upstream and has an upstream itself 381 PROD = 0; 382 // PRE_PROD is an environment that is the upstream of a PROD environment (unless it is also an UPSTREAM) 383 PRE_PROD = 1; 384 // UPSTREAM is an environment that has no upstream environment of its own 385 // UPSTREAM takes precendence over PRE_PROD 386 UPSTREAM = 2; 387 // any remaining environment once PROD, PRE_PROD, UPSTREAM and CANARY are assigned in a chain is OTHER 388 OTHER = 3; 389 // CANARY will appear between PRE_PROD and PROD in chains of 4 or more environments 390 CANARY = 4; 391 // YOLO is an environment that is both the first and last in the chain, so it is essentially both upstream and production 392 YOLO = 5; 393 } 394 395 message EnvironmentConfig { 396 message Upstream { 397 optional string environment = 1; 398 optional bool latest = 2; 399 } 400 401 message ArgoCD { 402 message SyncWindows { 403 string kind = 1; // "allow" or "deny" 404 string schedule = 2; // crontab format 405 string duration = 3; // duration the window is open (or closed) 406 repeated string applications = 4; // applications names 407 } 408 message Destination { 409 string name = 1; 410 string server = 2; 411 optional string namespace = 3; 412 optional string app_project_namespace = 4; 413 optional string application_namespace = 5; 414 } 415 message AccessEntry { 416 string group = 1; 417 string kind = 2; 418 } 419 message IgnoreDifferences { 420 string group = 1; 421 string kind = 2; 422 string name = 3; 423 string namespace = 4; 424 repeated string json_pointers = 5; 425 repeated string jq_path_expressions = 6; 426 repeated string managed_fields_managers = 7; 427 } 428 429 repeated SyncWindows sync_windows = 1; 430 Destination destination = 2; 431 repeated AccessEntry access_list = 3; 432 map<string, string> application_annotations = 4; 433 repeated IgnoreDifferences ignore_differences = 5; 434 repeated string sync_options = 6; 435 } 436 437 Upstream upstream = 1; 438 ArgoCD argocd = 2; 439 optional string environment_group = 3; 440 } 441 442 443 message CreateEnvironmentRequest { 444 string environment = 1; 445 EnvironmentConfig config = 2; 446 } 447 448 message GetEnvironmentConfigRequest { 449 string environment = 1; 450 } 451 452 message GetEnvironmentConfigResponse { 453 EnvironmentConfig config = 1; 454 } 455 456 message Warning { 457 oneof warning_type { 458 UnusualDeploymentOrder unusual_deployment_order = 1; 459 UpstreamNotDeployed upstream_not_deployed = 2; 460 } 461 } 462 463 message UnusualDeploymentOrder { 464 uint64 upstream_version = 1; 465 string upstream_environment = 2; 466 uint64 this_version = 3; 467 string this_environment = 4; 468 } 469 470 message UpstreamNotDeployed { 471 string upstream_environment = 2; 472 uint64 this_version = 3; 473 string this_environment = 4; 474 } 475 476 message Environment { 477 478 message Application { 479 message ArgoCD { 480 message SyncWindow { 481 string kind = 1; // "allow" or "deny" 482 string schedule = 2; // crontab format 483 string duration = 3; // duration the window is open (or closed) 484 } 485 repeated SyncWindow sync_windows = 1; 486 } 487 message DeploymentMetaData { 488 string deploy_author = 1; 489 // we use a string here, because the UI cannot handle int64 as a type. 490 // the string contains the unix timestamps in seconds (utc) 491 string deploy_time = 2; 492 } 493 494 string name = 1; 495 // version=0 means "nothing is deployed" 496 uint64 version = 2; 497 map<string, Lock> locks = 3; 498 // "version" describes the currently deployed version. "queuedVersion" describes a version that was to be deployed, but a lock stopped the deployment: 499 // "queuedVersion" has nothing to do with queue.go 500 // queued_version=0 means "nothing is queued" 501 uint64 queued_version = 4; 502 // google.protobuf.Timestamp deploy_date = 5; // This is never used 503 bool undeploy_version = 6; 504 ArgoCD argo_cd = 7; 505 DeploymentMetaData deployment_meta_data = 8; 506 } 507 508 string name = 1; 509 EnvironmentConfig config = 2; 510 map<string, Lock> locks = 3; 511 map<string, Application> applications = 4; 512 uint32 distance_to_upstream = 5; 513 Priority priority = 6; 514 } 515 516 message Release { 517 uint64 version = 1; 518 string source_commit_id = 2; 519 string source_author = 3; 520 string source_message = 4; 521 google.protobuf.Timestamp created_at = 5; 522 bool undeploy_version = 6; 523 string pr_number = 7; 524 string display_version = 8; 525 } 526 527 enum UndeploySummary { 528 // "normal": usual case for an active app, there is no undeploy version deployed in any environment 529 NORMAL = 0; 530 // "undeploy": all versions are in "undeploy" or don't exist on an environment 531 UNDEPLOY = 1; 532 // "mixed": undeploy is deployed in one or more, but not all environments 533 MIXED = 2; 534 } 535 536 message Application { 537 string name = 1; 538 repeated Release releases = 2; 539 string source_repo_url= 3; 540 string team = 4; 541 UndeploySummary undeploy_summary = 5; 542 repeated Warning warnings = 8; 543 } 544 545 message Actor { 546 string name = 1; 547 string email = 2; 548 } 549 550 service RolloutService { 551 rpc StreamStatus (StreamStatusRequest) returns (stream StreamStatusResponse) {} 552 rpc GetStatus (GetStatusRequest) returns (GetStatusResponse) {} 553 } 554 555 message StreamStatusRequest {} 556 message GetStatusRequest { 557 string environment_group = 1; 558 string team = 2; 559 uint64 wait_seconds = 3; 560 } 561 562 /* 563 564 Unknown = can't tell 565 Successful = everything is fine 566 Progressing = waiting for something 567 Error = error 568 */ 569 enum RolloutStatus { 570 ROLLOUT_STATUS_UNKNOWN = 0; // argocd didn't report anything for this app 571 ROLLOUT_STATUS_SUCCESFUL = 1; // sync succesful 572 ROLLOUT_STATUS_PROGRESSING = 2; // argocd picked up the change but didn't apply it yet 573 ROLLOUT_STATUS_ERROR = 3; // argocd applied the change but failed 574 ROLLOUT_STATUS_PENDING = 4; // argocd hasn't yet picked up the change 575 ROLLOUT_STATUS_UNHEALTHY = 5; // argocd applied the change succesfully, but the app is unhealthy 576 } 577 578 message StreamStatusResponse { 579 string environment = 1; 580 string application = 2; 581 uint64 version = 3; 582 RolloutStatus rollout_status = 4; 583 } 584 585 message GetStatusResponse { 586 message ApplicationStatus { 587 string environment = 1; 588 string application = 2; 589 RolloutStatus rollout_status = 3; 590 } 591 RolloutStatus status = 1; 592 repeated ApplicationStatus applications = 2; 593 } 594 595 service ReleaseTrainPrognosisService { 596 rpc GetReleaseTrainPrognosis (ReleaseTrainRequest) returns (GetReleaseTrainPrognosisResponse) {} 597 } 598 599 enum ReleaseTrainAppSkipCause { 600 APP_HAS_NO_VERSION_IN_UPSTREAM_ENV = 0; 601 APP_ALREADY_IN_UPSTREAM_VERSION = 1; 602 APP_IS_LOCKED = 2; 603 APP_DOES_NOT_EXIST_IN_ENV = 3; 604 } 605 606 message ReleaseTrainAppPrognosis { 607 oneof outcome { 608 ReleaseTrainAppSkipCause skip_cause = 1; 609 uint64 deployed_version = 2; 610 } 611 } 612 613 enum ReleaseTrainEnvSkipCause { 614 ENV_HAS_NO_UPSTREAM = 0; 615 ENV_HAS_NO_UPSTREAM_LATEST_OR_UPSTREAM_ENV = 1; 616 ENV_HAS_BOTH_UPSTREAM_LATEST_AND_UPSTREAM_ENV = 2; 617 UPSTREAM_ENV_CONFIG_NOT_FOUND = 3; 618 ENV_IS_LOCKED = 4; 619 } 620 621 message ReleaseTrainEnvPrognosis { 622 message AppsPrognosesWrapper { 623 map<string, ReleaseTrainAppPrognosis> prognoses = 1; 624 } 625 oneof outcome { 626 ReleaseTrainEnvSkipCause skip_cause = 1; 627 AppsPrognosesWrapper apps_prognoses = 2; 628 } 629 } 630 631 message GetReleaseTrainPrognosisResponse { 632 map<string, ReleaseTrainEnvPrognosis> envs_prognoses = 1; 633 } 634 635 message GetManifestsRequest { 636 string application = 1; 637 string release = 2; 638 } 639 640 message Manifest { 641 string environment = 1; 642 string content = 2; 643 } 644 645 message GetManifestsResponse { 646 Release release = 1; 647 map<string, Manifest> manifests = 2; 648 }