File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed
Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -1606,18 +1606,38 @@ end
16061606def scale
16071607 application = ARGV . delete_at ( 0 )
16081608
1609- if application . nil? || ARGV . empty?
1609+ if application . nil?
16101610 puts "DESCRIPTION:"
16111611 puts "Scale number of replicas of application deployments."
16121612 puts
16131613 puts "USAGE:"
1614- puts "k scale <application> <deployment1>:<replicas1> [<deployment2>:<replicas2> ...]"
1614+ puts "k scale <application> " + gray ( "# List deployments" )
1615+ puts "k scale <application> <deployment1>:<replicas1> [<deployment2>:<replicas2> ...] " + gray ( "# Scale deployments" )
16151616 puts
16161617 puts "EXAMPLE:"
16171618 puts "k scale myapp web:2 solidQueue:3"
16181619 exit
16191620 end
16201621
1622+ # Just list deployments if no deployments are given
1623+ if ARGV . empty?
1624+ in_argo_repo do
1625+ values_path = "applications/#{ application } /values.yaml"
1626+ abort "Error: no application named '#{ application } ' found in repo" unless File . exist? ( values_path )
1627+ values = YAML . load_file ( values_path )
1628+
1629+ puts
1630+ puts "#{ gray ( '===' ) } #{ bold ( application ) } "
1631+ deployments = values . fetch ( "deployments" , { } ) . map do |deployment , config |
1632+ [ deployment , config . fetch ( "replicas" ) ] . join ( ":" )
1633+ end
1634+
1635+ puts deployments . join ( " " )
1636+ end
1637+
1638+ exit
1639+ end
1640+
16211641 # validate input
16221642 deployment_and_replicas = ARGV . map do |arg |
16231643 deployment , replicas = arg . split ( ":" )
You can’t perform that action at this time.
0 commit comments