github.com/argoproj/argo-cd@v1.8.7/ui/src/app/shared/models.ts (about) 1 import {models} from 'argo-ui'; 2 3 interface ItemsList<T> { 4 /** 5 * APIVersion defines the versioned schema of this representation of an object. 6 * Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. 7 */ 8 apiVersion?: string; 9 items: T[]; 10 /** 11 * Kind is a string value representing the REST resource this object represents. 12 * Servers may infer this from the endpoint the client submits requests to. 13 */ 14 kind?: string; 15 metadata: models.ListMeta; 16 } 17 18 export interface ApplicationList extends ItemsList<Application> {} 19 20 export interface SyncOperationResource { 21 group: string; 22 kind: string; 23 name: string; 24 } 25 26 export interface SyncStrategy { 27 apply?: {force?: boolean}; 28 hook?: {force?: boolean}; 29 } 30 31 export interface SyncOperation { 32 revision: string; 33 prune: boolean; 34 dryRun: boolean; 35 resources?: SyncOperationResource[]; 36 } 37 38 export interface RollbackOperation { 39 id: number; 40 prune: boolean; 41 dryRun: boolean; 42 } 43 44 export interface OperationInitiator { 45 username: string; 46 automated: boolean; 47 } 48 49 export interface Operation { 50 sync: SyncOperation; 51 initiatedBy: OperationInitiator; 52 } 53 54 export type OperationPhase = 'Running' | 'Error' | 'Failed' | 'Succeeded' | 'Terminating'; 55 56 export const OperationPhases = { 57 Running: 'Running' as OperationPhase, 58 Failed: 'Failed' as OperationPhase, 59 Error: 'Error' as OperationPhase, 60 Succeeded: 'Succeeded' as OperationPhase, 61 Terminating: 'Terminating' as OperationPhase 62 }; 63 64 /** 65 * OperationState contains information about state of currently performing operation on application. 66 */ 67 export interface OperationState { 68 operation: Operation; 69 phase: OperationPhase; 70 message: string; 71 syncResult: SyncOperationResult; 72 startedAt: models.Time; 73 finishedAt: models.Time; 74 } 75 76 export type HookType = 'PreSync' | 'Sync' | 'PostSync' | 'SyncFail' | 'Skip'; 77 78 export interface RevisionMetadata { 79 author?: string; 80 date: models.Time; 81 tags?: string[]; 82 message?: string; 83 signatureInfo?: string; 84 } 85 86 export interface SyncOperationResult { 87 resources: ResourceResult[]; 88 revision: string; 89 } 90 91 export type ResultCode = 'Synced' | 'SyncFailed' | 'Pruned' | 'PruneSkipped'; 92 93 export const ResultCodes = { 94 Synced: 'Synced', 95 SyncFailed: 'SyncFailed', 96 Pruned: 'Pruned', 97 PruneSkipped: 'PruneSkipped' 98 }; 99 100 export interface ResourceResult { 101 name: string; 102 group: string; 103 kind: string; 104 version: string; 105 namespace: string; 106 status: ResultCode; 107 message: string; 108 hookType: HookType; 109 hookPhase: OperationPhase; 110 } 111 112 export const AnnotationRefreshKey = 'argocd.argoproj.io/refresh'; 113 114 export interface Application { 115 apiVersion?: string; 116 kind?: string; 117 metadata: models.ObjectMeta; 118 spec: ApplicationSpec; 119 status: ApplicationStatus; 120 operation?: Operation; 121 } 122 123 type WatchType = 'ADDED' | 'MODIFIED' | 'DELETED' | 'ERROR'; 124 125 export interface ApplicationWatchEvent { 126 type: WatchType; 127 application: Application; 128 } 129 130 export interface ComponentParameter { 131 component: string; 132 name: string; 133 value: string; 134 } 135 136 export interface ApplicationDestination { 137 /** 138 * Server overrides the environment server value in the ksonnet app.yaml 139 */ 140 server: string; 141 /** 142 * Namespace overrides the environment namespace value in the ksonnet app.yaml 143 */ 144 namespace: string; 145 /** 146 * Name of the destination cluster which can be used instead of server (url) field 147 */ 148 name: string; 149 } 150 151 export interface OrphanedResource { 152 group: string; 153 kind: string; 154 name: string; 155 } 156 157 export interface ApplicationSource { 158 targetRevision: string; 159 /** 160 * RepoURL is repository URL which contains application project. 161 */ 162 repoURL: string; 163 164 /** 165 * Path is a directory path within repository which 166 */ 167 path?: string; 168 169 chart?: string; 170 171 helm?: ApplicationSourceHelm; 172 173 kustomize?: ApplicationSourceKustomize; 174 175 ksonnet?: ApplicationSourceKsonnet; 176 177 plugin?: ApplicationSourcePlugin; 178 179 directory?: ApplicationSourceDirectory; 180 } 181 182 export interface ApplicationSourceHelm { 183 valueFiles: string[]; 184 values?: string; 185 parameters: HelmParameter[]; 186 fileParameters: HelmFileParameter[]; 187 } 188 189 export interface ApplicationSourceKustomize { 190 namePrefix: string; 191 nameSuffix: string; 192 images: string[]; 193 version: string; 194 } 195 196 export interface ApplicationSourceKsonnet { 197 environment: string; 198 parameters: KsonnetParameter[]; 199 } 200 201 export interface EnvEntry { 202 name: string; 203 value: string; 204 } 205 206 export interface ApplicationSourcePlugin { 207 name: string; 208 env: EnvEntry[]; 209 } 210 211 export interface JsonnetVar { 212 name: string; 213 value: string; 214 code: boolean; 215 } 216 217 interface ApplicationSourceJsonnet { 218 extVars: JsonnetVar[]; 219 tlas: JsonnetVar[]; 220 } 221 222 export interface ApplicationSourceDirectory { 223 recurse: boolean; 224 jsonnet?: ApplicationSourceJsonnet; 225 } 226 227 export interface Automated { 228 prune: boolean; 229 selfHeal: boolean; 230 } 231 232 export interface SyncPolicy { 233 automated?: Automated; 234 syncOptions?: string[]; 235 } 236 237 export interface Info { 238 name: string; 239 value: string; 240 } 241 242 export interface ApplicationSpec { 243 project: string; 244 source: ApplicationSource; 245 destination: ApplicationDestination; 246 syncPolicy?: SyncPolicy; 247 info?: Info[]; 248 revisionHistoryLimit?: number; 249 } 250 251 /** 252 * RevisionHistory contains information relevant to an application deployment 253 */ 254 export interface RevisionHistory { 255 id: number; 256 revision: string; 257 source: ApplicationSource; 258 deployStartedAt: models.Time; 259 deployedAt: models.Time; 260 } 261 262 export type SyncStatusCode = 'Unknown' | 'Synced' | 'OutOfSync'; 263 264 export const SyncStatuses: {[key: string]: SyncStatusCode} = { 265 Unknown: 'Unknown', 266 Synced: 'Synced', 267 OutOfSync: 'OutOfSync' 268 }; 269 270 export type HealthStatusCode = 'Unknown' | 'Progressing' | 'Healthy' | 'Suspended' | 'Degraded' | 'Missing'; 271 272 export const HealthStatuses: {[key: string]: HealthStatusCode} = { 273 Unknown: 'Unknown', 274 Progressing: 'Progressing', 275 Suspended: 'Suspended', 276 Healthy: 'Healthy', 277 Degraded: 'Degraded', 278 Missing: 'Missing' 279 }; 280 281 export interface HealthStatus { 282 status: HealthStatusCode; 283 message: string; 284 } 285 286 export type State = models.TypeMeta & {metadata: models.ObjectMeta} & {status: any; spec: any}; 287 288 export interface ResourceStatus { 289 group: string; 290 version: string; 291 kind: string; 292 namespace: string; 293 name: string; 294 status: SyncStatusCode; 295 health: HealthStatus; 296 hook?: boolean; 297 requiresPruning?: boolean; 298 } 299 300 export interface ResourceRef { 301 uid: string; 302 kind: string; 303 namespace: string; 304 name: string; 305 version: string; 306 group: string; 307 } 308 309 export interface ResourceNetworkingInfo { 310 targetLabels: {[name: string]: string}; 311 targetRefs: ResourceRef[]; 312 labels: {[name: string]: string}; 313 ingress: LoadBalancerIngress[]; 314 externalURLs: string[]; 315 } 316 317 export interface LoadBalancerIngress { 318 hostname: string; 319 ip: string; 320 } 321 322 export interface ResourceNode extends ResourceRef { 323 parentRefs: ResourceRef[]; 324 info: {name: string; value: string}[]; 325 networkingInfo?: ResourceNetworkingInfo; 326 images?: string[]; 327 resourceVersion: string; 328 createdAt?: models.Time; 329 } 330 331 export interface ApplicationTree { 332 nodes: ResourceNode[]; 333 orphanedNodes: ResourceNode[]; 334 } 335 336 export interface ResourceID { 337 group: string; 338 kind: string; 339 namespace: string; 340 name: string; 341 } 342 343 export interface ResourceDiff extends ResourceID { 344 targetState: State; 345 liveState: State; 346 predictedLiveState: State; 347 normalizedLiveState: State; 348 hook: boolean; 349 } 350 351 export interface SyncStatus { 352 comparedTo: ApplicationSource; 353 status: SyncStatusCode; 354 revision: string; 355 } 356 357 export interface ApplicationCondition { 358 type: string; 359 message: string; 360 lastTransitionTime: string; 361 } 362 363 export interface ApplicationSummary { 364 externalURLs?: string[]; 365 images?: string[]; 366 } 367 368 export interface ApplicationStatus { 369 observedAt: models.Time; 370 resources: ResourceStatus[]; 371 sync: SyncStatus; 372 conditions?: ApplicationCondition[]; 373 history: RevisionHistory[]; 374 health: HealthStatus; 375 operationState?: OperationState; 376 summary?: ApplicationSummary; 377 } 378 379 export interface JwtTokens { 380 items: JwtToken[]; 381 } 382 export interface AppProjectStatus { 383 jwtTokensByRole: {[name: string]: JwtTokens}; 384 } 385 386 export interface LogEntry { 387 content: string; 388 timeStamp: models.Time; 389 last: boolean; 390 } 391 392 // describes plugin settings 393 export interface Plugin { 394 name: string; 395 } 396 397 export interface AuthSettings { 398 url: string; 399 statusBadgeEnabled: boolean; 400 googleAnalytics: { 401 trackingID: string; 402 anonymizeUsers: boolean; 403 }; 404 dexConfig: { 405 connectors: { 406 name: string; 407 type: string; 408 }[]; 409 }; 410 oidcConfig: { 411 name: string; 412 }; 413 help: { 414 chatUrl: string; 415 chatText: string; 416 }; 417 plugins: Plugin[]; 418 userLoginsDisabled: boolean; 419 kustomizeVersions: string[]; 420 uiCssURL: string; 421 } 422 423 export interface UserInfo { 424 loggedIn: boolean; 425 username: string; 426 iss: string; 427 groups: string[]; 428 } 429 430 export type ConnectionStatus = 'Unknown' | 'Successful' | 'Failed'; 431 432 export const ConnectionStatuses = { 433 Unknown: 'Unknown', 434 Failed: 'Failed', 435 Successful: 'Successful' 436 }; 437 438 export interface ConnectionState { 439 status: ConnectionStatus; 440 message: string; 441 attemptedAt: models.Time; 442 } 443 444 export interface RepoCert { 445 serverName: string; 446 certType: string; 447 certSubType: string; 448 certData: string; 449 certInfo: string; 450 } 451 452 export interface RepoCertList extends ItemsList<RepoCert> {} 453 454 export interface Repository { 455 repo: string; 456 type?: string; 457 name?: string; 458 connectionState: ConnectionState; 459 } 460 461 export interface RepositoryList extends ItemsList<Repository> {} 462 463 export interface RepoCreds { 464 url: string; 465 username?: string; 466 } 467 468 export interface RepoCredsList extends ItemsList<RepoCreds> {} 469 470 export interface Cluster { 471 name: string; 472 server: string; 473 namespaces?: []; 474 refreshRequestedAt?: models.Time; 475 config?: { 476 awsAuthConfig?: { 477 clusterName: string; 478 }; 479 execProviderConfig?: { 480 command: string; 481 }; 482 }; 483 info?: { 484 applicationsCount: number; 485 serverVersion: string; 486 connectionState: ConnectionState; 487 cacheInfo: ClusterCacheInfo; 488 }; 489 } 490 491 export interface ClusterCacheInfo { 492 resourcesCount: number; 493 apisCount: number; 494 lastCacheSyncTime: models.Time; 495 } 496 497 export interface ClusterList extends ItemsList<Cluster> {} 498 499 export interface KsonnetEnvironment { 500 k8sVersion: string; 501 path: string; 502 destination: {server: string; namespace: string}; 503 } 504 505 export interface KsonnetParameter { 506 component: string; 507 name: string; 508 value: string; 509 } 510 511 export interface KsonnetAppSpec { 512 name: string; 513 path: string; 514 environments: {[key: string]: KsonnetEnvironment}; 515 parameters: KsonnetParameter[]; 516 } 517 518 export interface HelmChart { 519 name: string; 520 versions: string[]; 521 } 522 523 export type AppSourceType = 'Helm' | 'Kustomize' | 'Ksonnet' | 'Directory' | 'Plugin'; 524 525 export interface RepoAppDetails { 526 type: AppSourceType; 527 path: string; 528 ksonnet?: KsonnetAppSpec; 529 helm?: HelmAppSpec; 530 kustomize?: KustomizeAppSpec; 531 plugin?: PluginAppSpec; 532 directory?: {}; 533 } 534 535 export interface RefsInfo { 536 branches: string[]; 537 tags: string[]; 538 } 539 540 export interface AppInfo { 541 type: string; 542 path: string; 543 } 544 545 export interface HelmParameter { 546 name: string; 547 value: string; 548 } 549 550 export interface HelmFileParameter { 551 name: string; 552 path: string; 553 } 554 555 export interface HelmAppSpec { 556 name: string; 557 path: string; 558 valueFiles: string[]; 559 values?: string; 560 parameters: HelmParameter[]; 561 fileParameters: HelmFileParameter[]; 562 } 563 564 export interface KustomizeAppSpec { 565 path: string; 566 images?: string[]; 567 } 568 569 export interface PluginAppSpec { 570 name: string; 571 env: EnvEntry[]; 572 } 573 574 export interface ObjectReference { 575 kind: string; 576 namespace: string; 577 name: string; 578 uid: string; 579 apiVersion: string; 580 resourceVersion: string; 581 fieldPath: string; 582 } 583 584 export interface EventSource { 585 component: string; 586 host: string; 587 } 588 589 export interface EventSeries { 590 count: number; 591 lastObservedTime: models.Time; 592 state: string; 593 } 594 595 export interface Event { 596 apiVersion?: string; 597 kind?: string; 598 metadata: models.ObjectMeta; 599 involvedObject: ObjectReference; 600 reason: string; 601 message: string; 602 source: EventSource; 603 firstTimestamp: models.Time; 604 lastTimestamp: models.Time; 605 count: number; 606 type: string; 607 eventTime: models.Time; 608 series: EventSeries; 609 action: string; 610 related: ObjectReference; 611 reportingController: string; 612 reportingInstance: string; 613 } 614 615 export interface EventList extends ItemsList<Event> {} 616 617 export interface ProjectRole { 618 description: string; 619 policies: string[]; 620 name: string; 621 groups: string[]; 622 } 623 624 export interface JwtToken { 625 iat: number; 626 exp: number; 627 id: string; 628 } 629 630 export interface GroupKind { 631 group: string; 632 kind: string; 633 } 634 635 export interface ProjectSignatureKey { 636 keyID: string; 637 } 638 639 export interface ProjectSpec { 640 sourceRepos: string[]; 641 destinations: ApplicationDestination[]; 642 description: string; 643 roles: ProjectRole[]; 644 clusterResourceWhitelist: GroupKind[]; 645 clusterResourceBlacklist: GroupKind[]; 646 namespaceResourceBlacklist: GroupKind[]; 647 namespaceResourceWhitelist: GroupKind[]; 648 signatureKeys: ProjectSignatureKey[]; 649 orphanedResources?: {warn?: boolean; ignore: OrphanedResource[]}; 650 syncWindows?: SyncWindows; 651 } 652 653 export type SyncWindows = SyncWindow[]; 654 655 export interface SyncWindow { 656 kind: string; 657 schedule: string; 658 duration: string; 659 applications: string[]; 660 namespaces: string[]; 661 clusters: string[]; 662 manualSync: boolean; 663 } 664 665 export interface Project { 666 apiVersion?: string; 667 kind?: string; 668 metadata: models.ObjectMeta; 669 spec: ProjectSpec; 670 status: AppProjectStatus; 671 } 672 673 export type ProjectList = ItemsList<Project>; 674 675 export const DEFAULT_PROJECT_NAME = 'default'; 676 677 export interface ManifestResponse { 678 manifests: string[]; 679 namespace: string; 680 server: string; 681 revision: string; 682 } 683 684 export interface ResourceActionParam { 685 name: string; 686 value: string; 687 type: string; 688 default: string; 689 } 690 691 export interface ResourceAction { 692 name: string; 693 params: ResourceActionParam[]; 694 disabled: boolean; 695 } 696 697 export interface SyncWindowsState { 698 windows: SyncWindow[]; 699 } 700 701 export interface ApplicationSyncWindowState { 702 activeWindows: SyncWindow[]; 703 assignedWindows: SyncWindow[]; 704 canSync: boolean; 705 } 706 707 export interface VersionMessage { 708 Version: string; 709 BuildDate: string; 710 GoVersion: string; 711 Compiler: string; 712 Platform: string; 713 KsonnetVersion: string; 714 KustomizeVersion: string; 715 HelmVersion: string; 716 KubectlVersion: string; 717 JsonnetVersion: string; 718 } 719 720 export interface Token { 721 id: string; 722 issuedAt: number; 723 expiresAt: number; 724 } 725 726 export interface Account { 727 name: string; 728 enabled: boolean; 729 capabilities: string[]; 730 tokens: Token[]; 731 } 732 733 export interface GnuPGPublicKey { 734 keyID?: string; 735 fingerprint?: string; 736 subType?: string; 737 owner?: string; 738 keyData?: string; 739 } 740 741 export interface GnuPGPublicKeyList extends ItemsList<GnuPGPublicKey> {} 742 743 // https://kubernetes.io/docs/reference/kubectl/overview/#resource-types 744 745 export const ResourceKinds = [ 746 '*', 747 'Binding', 748 'ComponentStatus', 749 'ConfigMap', 750 'Endpoints', 751 'LimitRange', 752 'Namespace', 753 'Node', 754 'PersistentVolumeClaim', 755 'PersistentVolume', 756 'Pod', 757 'PodTemplate', 758 'ReplicationController', 759 'ResourceQuota', 760 'Secret', 761 'ServiceAccount', 762 'Service', 763 'MutatingWebhookConfiguration', 764 'ValidatingWebhookConfiguration', 765 'CustomResourceDefinition', 766 'APIService', 767 'ControllerRevision', 768 'DaemonSet', 769 'Deployment', 770 'ReplicaSet', 771 'StatefulSet', 772 'TokenReview', 773 'LocalSubjectAccessReview', 774 'SelfSubjectAccessReview', 775 'SelfSubjectRulesReview', 776 'SubjectAccessReview', 777 'HorizontalPodAutoscaler', 778 'CronJob', 779 'Job', 780 'CertificateSigningRequest', 781 'Lease', 782 'Event', 783 'Ingress', 784 'NetworkPolicy', 785 'PodDisruptionBudget', 786 'ClusterRoleBinding', 787 'ClusterRole', 788 'RoleBinding', 789 'Role', 790 'PriorityClass', 791 'CSIDriver', 792 'CSINode', 793 'StorageClass', 794 'Volume' 795 ]; 796 797 export const Groups = [ 798 'admissionregistration.k8s.io', 799 'apiextensions.k8s.io', 800 'apiregistration.k8s.io', 801 'apps', 802 'authentication.k8s.io', 803 'authorization.k8s.io', 804 'autoscaling', 805 'batch', 806 'certificates.k8s.io', 807 'coordination.k8s.io', 808 'events.k8s.io', 809 'extensions', 810 'networking.k8s.io', 811 'node.k8s.io', 812 'policy', 813 'rbac.authorization.k8s.io', 814 'scheduling.k8s.io', 815 'stable.example.com', 816 'storage.k8s.io' 817 ];