Skip to content

Commit

Permalink
fix(charts): adds retry_count and retry_interval while applying charts
Browse files Browse the repository at this point in the history
python -m riocli apply --help
Usage: python -m riocli apply [OPTIONS] [FILES]...

  Apply resource manifests

Options:
  -d, --dryrun                   dry run the yaml files without applying any
                                 change
  -g, --show-graph               Opens a mermaid.live dependency graph
  -v, --values TEXT              path to values yaml file. key/values
                                 specified in the values file can be used as
                                 variables in template YAMLs
  -s, --secrets TEXT             secret files are sops encoded value files.
                                 rio-cli expects sops to be authorized for
                                 decoding files on this computer
  -w, --workers INTEGER          number of parallel workers while running
                                 apply command. defaults to 6.
  -f, --force, --silent          Skip confirmation
  -rc, --retry-count INTEGER     Number of retries before a resource creation
                                 times out status, defaults to 50
  -ri, --retry-interval INTEGER  Interval between retries defaults to 6
  --help                         Show this message and exit.
  • Loading branch information
RomilShah committed Aug 10, 2023
1 parent 85611dc commit 32d9dfc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 7 additions & 1 deletion riocli/chart/apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,19 @@
@click.option('--workers', '-w',
help="number of parallel workers while running apply command. "
"defaults to 6.")
@click.option('--retry-count', '-rc', type=int, default=50,
help="Number of retries before a resource creation times out status, defaults to 50")
@click.option('--retry-interval', '-ri', type=int, default=6,
help="Interval between retries defaults to 6")
@click.argument('chart', type=str)
def apply_chart(
chart: str,
values: str,
secrets: str,
dryrun: bool,
workers: int = 6,
retry_count: int = 50,
retry_interval: int = 6,
silent: bool = False) -> None:
"""Install a chart from the rapyuta-charts repository."""
versions = find_chart(chart)
Expand All @@ -59,5 +65,5 @@ def apply_chart(

chart = Chart(**versions[0])
chart.apply_chart(values, secrets, dryrun=dryrun, workers=workers,
silent=silent)
silent=silent, retry_count=retry_count, retry_interval=retry_interval)
chart.cleanup()
5 changes: 3 additions & 2 deletions riocli/chart/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,18 @@ def apply_chart(
secrets: str = None,
dryrun: bool = None,
workers: int = 6,
retry_count: int = 50,
retry_interval: int = 6,
silent: bool = False):
if not self.downloaded:
self.download_chart()

templates_dir = Path(self.tmp_dir.name, self.name, 'templates')
if not values:
values = Path(self.tmp_dir.name, self.name,
'values.yaml').as_posix()

apply.callback(values=values, files=[templates_dir], secrets=secrets,
dryrun=dryrun, workers=workers, silent=silent)
dryrun=dryrun, workers=workers, silent=silent, retry_count=retry_count, retry_interval=retry_interval)

def delete_chart(
self,
Expand Down

0 comments on commit 32d9dfc

Please sign in to comment.