many-psychiatrist-74327
08/28/2020, 7:54 PMpulumi.export('ingress-address', ingress.status.load_balancer.ingress[0].hostname)
However, that fails (turns out that ingress.status
is {}
). However, the load balancer’s address shows just fine when running kubectl:
$ kubect get ingress -n test
NAME HOSTS ADDRESS PORTS AGE
ingress-main * <http://bdcc2d51-test-ingressmain-8b89-1677642024.us-east-2.elb.amazonaws.com|bdcc2d51-test-ingressmain-8b89-1677642024.us-east-2.elb.amazonaws.com> 80 10m
salmon-ghost-86211
08/29/2020, 9:10 PMingress-main.status.loadBalancer.ingress[0].hostname
My variable name is not ingress-main
. I just copied that from your example. Also, my reference has loadBalancer
instead of load_balancer
. Maybe it depends on the language which is correct, but it works for me.
Also, maybe you are running into an async issue where the new DNS name has not been assigned by the time it gets to the export line.many-psychiatrist-74327
08/29/2020, 9:34 PMload_balancer
instead of loadBalancer
. And well, I printed the entire status
object and it’s an empty dict ({}
).
• Yes, I thought it might be a timing issue.. but the ingress is already running, and kubectl
returns the address just fine.. i dont get why the Python object is not getting populated 😕salmon-ghost-86211
08/31/2020, 1:57 PMingress
the name of the variable you assign the new ingress object to?
<https://www.pulumi.com/docs/reference/pkg/kubernetes/extensions/v1beta1/ingress/>
indicates that the object cannot be marked as successfully created unless "3. Ingress entry exists for ‘.status.loadBalancer.ingress’." That's what makes me think the variable being referenced in your export statement is incorrect.
If you still have issues, maybe you could post a code snippet.gorgeous-egg-16927
08/31/2020, 4:23 PMsalmon-ghost-86211
08/31/2020, 5:35 PMgorgeous-egg-16927
08/31/2020, 5:54 PMmany-psychiatrist-74327
08/31/2020, 11:50 PMingress = k8s.networking.v1beta1.Ingress(
'ingress-main',
metadata={
'name': 'ingress-main',
'namespace': namespace_name,
'annotations': {
'<http://kubernetes.io/ingress.class|kubernetes.io/ingress.class>': 'alb',
'<http://alb.ingress.kubernetes.io/scheme|alb.ingress.kubernetes.io/scheme>': 'internet-facing'
},
'labels': {
'app': service_name
}
},
spec={
'rules': [{
'http': {
'paths': [{
'path': '/*',
'backend': {
'serviceName': f'{service_name}-service',
'servicePort': 80
}
}]
}
}]
},
opts=pulumi.ResourceOptions(provider=provider)
)
pulumi.export(f'ingress-{service_name}-id', ingress.id)
pulumi.export(f'ingress-{service_name}-spec', ingress.spec)
pulumi.export(f'ingress-{service_name}-status', ingress.status)
Then
$ pulumi up
...
Outputs:
ingress-sample-service-id : "uns-sample-project/ingress-main"
ingress-sample-service-spec : {
+ rules: [
+ [0]: {
+ http: {
+ paths: [
+ [0]: {
+ backend: {
+ service_name: "sample-service-service"
+ service_port: 80
}
+ path : "/*"
}
]
}
}
]
}
ingress-sample-service-status: {
}
Notice that the value of ingress.status
is {}
. But if I query the cluster directly, the value of the ingress LB is populated:
$ kubectl get ingress -n uns-sample-project
NAME HOSTS ADDRESS PORTS AGE
ingress-main * <http://bdcc2d56-unssampleproject--b71e-1632089146.us-east-2.elb.amazonaws.com|bdcc2d56-unssampleproject--b71e-1632089146.us-east-2.elb.amazonaws.com> 80 3d2h
Service
resource, while I’m using Ingress
. Still, I suppose they should behave the same way. But I’m accessing the resource just fine (I think). I can access it, but the value is empty.salmon-ghost-86211
09/01/2020, 1:19 AMpulumi.export('ingress-address', ingress.status.load_balancer.ingress[0].hostname)
but it looks like you aren't drilling down that far in the ingress object
pulumi.export(f'ingress-{service_name}-id', ingress.id)
pulumi.export(f'ingress-{service_name}-spec', ingress.spec)
pulumi.export(f'ingress-{service_name}-status', ingress.status)
Levi's suggestion looks like it will solve your problem.
https://pulumi-community.slack.com/archives/CRFURDVQB/p1598891003000800?thread_ts=1598644442.023700&cid=CRFURDVQBmany-psychiatrist-74327
09/01/2020, 5:55 PMpulumi.export('ingress-address', ingress.status.load_balancer.ingress[0].hostname)
But that fails, because ingress.status
is {}
, so I cannot call ingress.status.load_balancer
Just to be extra extra careful, I just tried drilling down by using ingress.status['load_balancer']
as @gorgeous-egg-16927’s example suggests, but the result is the same: ingress.status
is empty.