stale-autumn-24797
07/31/2019, 6:32 PMpublic_ip = PublicIp(
f'{env}_public_ip',
name=f'{PREFIX}-{env}-public-ip',
resource_group_name=aks_stack.get_output('rg_name'),
allocation_method='Static',
domain_name_label=f'{PREFIX}-{env}')
nginx_chart_opts = ChartOpts(f'{env}-nginx-chart-opts')
nginx_chart_opts.transformations = [lambda config_file: set_metadata_namespace(config_file, env)]
nginx_chart_opts.repo = 'stable'
nginx_chart_opts.chart = 'nginx-ingress'
nginx_chart_opts.namespace = env
nginx_chart_opts.values = \
{
'controller':
{
'service':
{
'loadBalancerIP': public_ip.ip_address
},
'replicaCount': 2
},
'rbac':
{
'create': True
}
}
# Deploy the nginx ingress controller.
nginx_ingress = Chart(
f'{env}-nginx-ingress',
nginx_chart_opts,
opts=ResourceOptions(provider=custom_provider, depends_on=[public_ip]))
This produced the following error:
error: Program failed with an unhandled exception:
error: Traceback (most recent call last):
File "/usr/local/bin/pulumi-language-python-exec", line 85, in <module>
loop.run_until_complete(coro)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 484, in run_until_complete
return future.result()
File "/Users/mike/.pyenv/pulumi/lib/python3.6/site-packages/pulumi/runtime/stack.py", line 38, in run_in_stack
await RPC_MANAGER.unhandled_exeception()
File "/Users/mike/.pyenv/pulumi/lib/python3.6/site-packages/pulumi/runtime/rpc_manager.py", line 68, in rpc_wrapper
result = await rpc_function(*args, **kwargs)
File "/Users/mike/.pyenv/pulumi/lib/python3.6/site-packages/pulumi/runtime/resource.py", line 411, in do_register_resource_outputs
serialized_props = await rpc.serialize_properties(outputs, {})
File "/Users/mike/.pyenv/pulumi/lib/python3.6/site-packages/pulumi/runtime/rpc.py", line 57, in serialize_properties
result = await serialize_property(v, deps, input_transformer)
File "/Users/mike/.pyenv/pulumi/lib/python3.6/site-packages/pulumi/runtime/rpc.py", line 146, in serialize_property
value = await serialize_property(value.future(), deps, input_transformer)
File "/Users/mike/.pyenv/pulumi/lib/python3.6/site-packages/pulumi/runtime/rpc.py", line 135, in serialize_property
future_return = await asyncio.ensure_future(value)
File "/Users/mike/.pyenv/pulumi/lib/python3.6/site-packages/pulumi/output.py", line 155, in run
transformed: Input[U] = func(value)
File "/Users/mike/.pyenv/pulumi/lib/python3.6/site-packages/pulumi_kubernetes/helm/v2/helm.py", line 312, in _parse_chart
data = json.dumps(vals).encode('utf-8')
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/encoder.py", line 180, in default
o.__class__.__name__)
TypeError: Object of type 'Output' is not JSON serializable
error: an unhandled error occurred: Program exited with non-zero exit code: 1
stale-autumn-24797
07/31/2019, 6:32 PMpublic_ip = PublicIp(
f'{env}_public_ip',
name=f'{PREFIX}-{env}-public-ip',
resource_group_name=aks_stack.get_output('rg_name'),
allocation_method='Static',
domain_name_label=f'{PREFIX}-{env}')
nginx_chart_opts = ChartOpts(f'{env}-nginx-chart-opts')
nginx_chart_opts.transformations = [lambda config_file: set_metadata_namespace(config_file, env)]
nginx_chart_opts.repo = 'stable'
nginx_chart_opts.chart = 'nginx-ingress'
nginx_chart_opts.namespace = env
nginx_chart_opts.values = \
{
'controller':
{
'service':
{
'loadBalancerIP': 'SET BELOW'
},
'replicaCount': 2
},
'rbac':
{
'create': True
}
}
def set_load_balancer_ip(ip_address):
nginx_chart_opts.values['controller']['service']['loadBalancerIP'] = ip_address
public_ip.ip_address.apply(lambda ip_address: set_load_balancer_ip(ip_address))
# Deploy the nginx ingress controller.
nginx_ingress = Chart(
f'{env}-nginx-ingress',
nginx_chart_opts,
opts=ResourceOptions(provider=custom_provider, depends_on=[public_ip]))
This does not produce an error, but the chart is deployed before the loadBalancerIP value has been written in set_load_balancer_ip (I’ve confirmed by inspecting the yaml of the deployed chart). Any thoughts on how I can ensure that set_load_balancer_ip is called before the Chart deployment?gorgeous-egg-16927
07/31/2019, 9:43 PMbitter-oil-46081
07/31/2019, 9:44 PMnginx_chart_opts.values = Output.from_input({ .... })
stale-autumn-24797
07/31/2019, 10:27 PMstale-autumn-24797
07/31/2019, 11:55 PMstale-autumn-24797
08/01/2019, 12:19 AMgorgeous-egg-16927
08/01/2019, 2:47 PMgorgeous-egg-16927
08/01/2019, 2:48 PMgorgeous-egg-16927
08/01/2019, 2:49 PMstale-autumn-24797
08/01/2019, 6:40 PMstale-autumn-24797
08/02/2019, 5:18 PMgorgeous-egg-16927
08/02/2019, 5:24 PMgorgeous-egg-16927
08/02/2019, 5:24 PMstale-autumn-24797
08/02/2019, 5:54 PMgorgeous-egg-16927
08/02/2019, 9:37 PMgorgeous-egg-16927
08/03/2019, 1:00 AM