-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[python] Add type annotations to overlays #1259
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,10 @@ class Chart(pulumi.ComponentResource): | |
Kubernetes resources contained in this Chart. | ||
""" | ||
|
||
def __init__(self, release_name, config, opts=None): | ||
def __init__(self, | ||
release_name: str, | ||
config: Union['ChartOpts', 'LocalChartOpts'], | ||
opts: Optional[pulumi.ResourceOptions] = None): | ||
""" | ||
Chart is a component representing a collection of resources described by an arbitrary Helm | ||
Chart. The Chart can be fetched from any source that is accessible to the `helm` command | ||
|
@@ -183,14 +186,17 @@ def omit_resource(obj, opts): | |
self.resources = all_config.apply(_parse_chart) | ||
self.register_outputs({"resources": self.resources}) | ||
|
||
def get_resource(self, group_version_kind, name, namespace=None) -> pulumi.Output[pulumi.CustomResource]: | ||
def get_resource(self, | ||
group_version_kind: str, | ||
name: str, | ||
namespace: Optional[str] = None) -> pulumi.Output[pulumi.CustomResource]: | ||
""" | ||
get_resource returns a resource defined by a built-in Kubernetes group/version/kind and | ||
name. For example: `get_resource("apps/v1/Deployment", "nginx")` | ||
|
||
:param str group_version_kind: Group/Version/Kind of the resource, e.g., `apps/v1/Deployment` | ||
:param str name: Name of the resource to retrieve | ||
:param str namespace: Optional namespace of the resource to retrieve | ||
:param Optional[str] namespace: Optional namespace of the resource to retrieve | ||
""" | ||
|
||
# `id` will either be `${name}` or `${namespace}/${name}`. | ||
|
@@ -285,9 +291,22 @@ class FetchOpts: | |
Verify the package against its signature. | ||
""" | ||
|
||
def __init__(self, version=None, ca_file=None, cert_file=None, key_file=None, destination=None, keyring=None, | ||
password=None, repo=None, untar_dir=None, username=None, home=None, devel=None, prov=None, | ||
untar=None, verify=None): | ||
def __init__(self, | ||
version: Optional[pulumi.Input[str]] = None, | ||
ca_file: Optional[pulumi.Input[str]] = None, | ||
cert_file: Optional[pulumi.Input[str]] = None, | ||
key_file: Optional[pulumi.Input[str]] = None, | ||
destination: Optional[pulumi.Input[str]] = None, | ||
keyring: Optional[pulumi.Input[str]] = None, | ||
password: Optional[pulumi.Input[str]] = None, | ||
repo: Optional[pulumi.Input[str]] = None, | ||
untar_dir: Optional[pulumi.Input[str]] = None, | ||
username: Optional[pulumi.Input[str]] = None, | ||
home: Optional[pulumi.Input[str]] = None, | ||
devel: Optional[pulumi.Input[bool]] = None, | ||
prov: Optional[pulumi.Input[bool]] = None, | ||
untar: Optional[pulumi.Input[bool]] = None, | ||
verify: Optional[pulumi.Input[bool]] = None): | ||
""" | ||
:param Optional[pulumi.Input[str]] version: Specific version of a chart. If unset, | ||
the latest version is fetched. | ||
|
@@ -362,7 +381,11 @@ class BaseChartOpts: | |
Example: A resource created with resource_prefix="foo" would produce a resource named "foo-resourceName". | ||
""" | ||
|
||
def __init__(self, namespace=None, values=None, transformations=None, resource_prefix=None): | ||
def __init__(self, | ||
namespace: Optional[pulumi.Input[str]] = None, | ||
values: Optional[pulumi.Inputs] = None, | ||
transformations: Optional[pulumi.Inputs] = None, | ||
resource_prefix: Optional[str] = None): | ||
""" | ||
:param Optional[pulumi.Input[str]] namespace: Optional namespace to install chart resources into. | ||
:param Optional[pulumi.Inputs] values: Optional overrides for chart values. | ||
|
@@ -406,8 +429,15 @@ class ChartOpts(BaseChartOpts): | |
Additional options to customize the fetching of the Helm chart. | ||
""" | ||
|
||
def __init__(self, chart, namespace=None, values=None, transformations=None, resource_prefix=None, repo=None, | ||
version=None, fetch_opts=None): | ||
def __init__(self, | ||
chart: pulumi.Input[str], | ||
namespace: Optional[pulumi.Input[str]] = None, | ||
values: Optional[pulumi.Inputs] = None, | ||
transformations: Optional[pulumi.Inputs] = None, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we be more specific here? The docstring looks a bit different than this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch. Copy/paste mistake. Will fix. |
||
resource_prefix: Optional[str] = None, | ||
repo: Optional[pulumi.Input[str]] = None, | ||
version: Optional[pulumi.Input[str]] = None, | ||
fetch_opts: Optional[pulumi.Input[FetchOpts]] = None): | ||
""" | ||
:param pulumi.Input[str] chart: The name of the chart to deploy. If `repo` is provided, this chart name | ||
will be prefixed by the repo name. | ||
|
@@ -444,7 +474,12 @@ class LocalChartOpts(BaseChartOpts): | |
The path to the chart directory which contains the `Chart.yaml` file. | ||
""" | ||
|
||
def __init__(self, path, namespace=None, values=None, transformations=None, resource_prefix=None): | ||
def __init__(self, | ||
path: pulumi.Input[str], | ||
namespace: Optional[pulumi.Input[str]] = None, | ||
values: Optional[pulumi.Inputs] = None, | ||
transformations: Optional[pulumi.Inputs] = None, | ||
resource_prefix: Optional[str] = None): | ||
""" | ||
:param pulumi.Input[str] path: The path to the chart directory which contains the | ||
`Chart.yaml` file. | ||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just here to complain about the discrepancy in python's whitespacing convention when there's a type annotation + default value vs. just a default value. Thanks 🐍