-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(template): add helm3 template like support
This commit adds a feature in the CLI where you can generate `helm template` like output for your manifests Usage: python -m riocli template [OPTIONS] [FILES]... Print manifests with filled values Options: -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 --help Show this message and exit. Reviewed By: Ankit Gadiya
- Loading branch information
1 parent
2f6ae51
commit ceb12c5
Showing
5 changed files
with
76 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Copyright 2022 Rapyuta Robotics | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from typing import Iterable | ||
|
||
import click | ||
from click_help_colors import HelpColorsCommand | ||
|
||
from riocli.apply.parse import Applier | ||
from riocli.apply.util import process_files_values_secrets | ||
|
||
|
||
@click.command( | ||
'template', | ||
cls=HelpColorsCommand, | ||
help_headers_color='yellow', | ||
help_options_color='green', | ||
) | ||
@click.option('--values', '-v', | ||
help="path to values yaml file. key/values specified in the values file can be used as variables in template yamls") | ||
@click.option('--secrets', '-s', | ||
help="secret files are sops encoded value files. rio-cli expects sops to be authorized for decoding files on this computer") | ||
@click.argument('files', nargs=-1) | ||
def template(values: str, secrets: str, files: Iterable[str]) -> None: | ||
""" | ||
Print manifests with filled values | ||
""" | ||
glob_files, abs_values, abs_secrets = process_files_values_secrets( | ||
files, values, secrets) | ||
|
||
if len(glob_files) == 0: | ||
click.secho('no files specified', fg='red') | ||
raise SystemExit(1) | ||
|
||
rc = Applier(glob_files, abs_values, abs_secrets) | ||
rc.print_resolved_manifests() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters