sparse-intern-71089
01/10/2024, 1:57 PMstraight-beach-79533
01/12/2024, 5:22 PMipv4Address := ipv4.IpAddress.ApplyT(func(val string) string {
return val
})
This will NOT do what you think it will do.
The return type of ApplyT is still a pulumi.Output.
Only inside the closure (the func passed to ApplyT) the type is a plain string...straight-beach-79533
01/12/2024, 5:24 PMstraight-beach-79533
01/12/2024, 5:27 PMstraight-beach-79533
01/12/2024, 5:29 PMminiature-library-50162
01/12/2024, 6:25 PMfreezing-vase-18205
01/17/2024, 8:44 AMyaml_done = kubeone_cluster.render_yaml(
cp_host=cp_fip.address,
cp_int_ip=cp_inst.access_ip_v4,
cp_hostname=cp_inst.name,
static_workers=worker_instances,
)
# renderYAML waits for outputs to be ready
# and renders the kubeone_cluster to a YAML file
def render_yaml(
cp_host, cp_int_ip, cp_hostname, static_workers: List[compute.Instance]
) -> pulumi.Output[bool]:
def populate_spec(outputs):
kubeone_cluster["apiEndpoint"]["host"] = outputs["cp_host"]
kubeone_cluster["controlPlane"]["hosts"][0]["publicAddress"] = outputs[
"cp_host"
]
kubeone_cluster["controlPlane"]["hosts"][0]["hostname"] = outputs["cp_hostname"]
kubeone_cluster["controlPlane"]["hosts"][0]["privateAddress"] = outputs[
"cp_int_ip"
]
for worker_out in outputs["workers_output"]:
kubeone_cluster["staticWorkers"]["hosts"].append(
{
"publicAddress": worker_out[0],
"privateAddress": worker_out[0],
"sshUsername": "root",
"hostname": worker_out[1],
"bastion": outputs["cp_host"],
}
)
# writing kubeone yaml to file
with open("kubeone.yaml", "w") as f:
yaml.dump(
kubeone_cluster,
f,
sort_keys=False,
)
return True
PS. It still boggles me that none of that is linked from the outputs docs to a blog post or smth. This is table stakes to many, it seems.miniature-library-50162
01/17/2024, 11:57 AM