many-knife-65312
03/17/2023, 8:43 PM.get()
function for a k8s resource errors out when it doesn't exist. what's the right way to handle this scenario so that the resource is created if it doesn't exist?let sa = k8s.core.v1.ServiceAccount.get(id, `${namespace}/${name}`);
if (sa === undefined)
// create the service account
get
function errors out and says "resource <name> does not exist"refined-engineer-9827
03/22/2023, 5:37 PM# Handle bootstrapping chicken/egg problem. Here in case something
# happens and we need to re-create the world.
initial_setup = False
try:
core_vpc = gcp.compute.get_network(
name = "core-vpc",
project = "prj-core"
)
except:
initial_setup = True
many-knife-65312
03/22/2023, 5:41 PMrefined-engineer-9827
03/22/2023, 5:42 PMmany-knife-65312
03/22/2023, 5:44 PMasync
calls. I'm not a typescript expert, so i'm definitely overlooking somethingtry {
staticIP = gcp.compute.GlobalAddress.get(
`banana`,
`banana`
);
} catch (e) {
console.log('here in catch')
} finally {
console.log('here in finally');
}
here in finally
, and the script exits with:
gcp:compute:GlobalAddress (banana):
error: Preview failed: resource 'banana' does not exist