Class: Captive::Commands::AppsInfo
- Inherits:
-
Object
- Object
- Captive::Commands::AppsInfo
- Defined in:
- lib/captive/commands/apps_info.rb
Overview
L'état d'une app tel que le cluster le sert. Le CLI développeur n'a pas accès au repo GitOps : tout se lit sur les ressources vivantes, ce qui décrit l'état réel plutôt que l'état désiré — un déploiement en cours s'y voit, un manifeste poussé mais non réconcilié ne s'y voit pas encore.
Constant Summary collapse
- TIER_RESOURCES =
{ "xs" => { cpu: "100m → 500m", memory: "256Mi → 512Mi" }, "s" => { cpu: "250m → 1", memory: "512Mi → 1Gi" }, "m" => { cpu: "500m → 2", memory: "1Gi → 2Gi" }, "l" => { cpu: "1 → 4", memory: "2Gi → 4Gi" }, }.freeze
Instance Method Summary collapse
- #gather(app) ⇒ Object
-
#initialize(kubectl:, cluster_apps: nil) ⇒ AppsInfo
constructor
A new instance of AppsInfo.
Constructor Details
#initialize(kubectl:, cluster_apps: nil) ⇒ AppsInfo
Returns a new instance of AppsInfo.
17 18 19 20 |
# File 'lib/captive/commands/apps_info.rb', line 17 def initialize(kubectl:, cluster_apps: nil) @kubectl = kubectl @apps = cluster_apps || ClusterApps.new(kubectl: kubectl) end |
Instance Method Details
#gather(app) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/captive/commands/apps_info.rb', line 22 def gather(app) tier = @apps.tier(app) postgres = @apps.postgres(app) egress = @apps.egress_ip(app) { pod_status: pod_status(app), replicas: replicas(app), postgres: !postgres.nil?, redis: redis?(app), egress_ip: !egress.nil?, tier: tier, resources: TIER_RESOURCES[tier], domains: @apps.domains(app), stage: @apps.stage(app), workers: @apps.workers(app), postgres_details: postgres, redis_details: redis_details(app), egress_ip_details: egress && { ip: egress }, } end |