sparse-intern-71089
10/08/2020, 11:23 AMgorgeous-egg-16927
10/08/2020, 5:25 PM.get method that can be used to read resource state.
Something like k8s.networking.v1.Ingress.get('existingResource', 'axiomdb/myIngress') should do the trickbitter-application-91815
10/09/2020, 7:35 PMbitter-application-91815
10/09/2020, 7:35 PMbitter-application-91815
10/09/2020, 7:36 PMbitter-application-91815
10/09/2020, 7:36 PMfunc GetIngressList(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *IngressListState, opts ...pulumi.ResourceOption) (*IngressList, error) {bitter-application-91815
10/09/2020, 7:36 PMbitter-application-91815
10/09/2020, 7:37 PM// helmchart for ALB
albResource, err := helm.NewChart(ctx, fmt.Sprintf("axiom-alb-charts-%s", w.targetEnv), helm.ChartArgs{
Chart: pulumi.String("aws-alb-ingress-controller"),
Namespace: pulumi.String(namespace),
FetchArgs: helm.FetchArgs{
Repo: pulumi.String("http://storage.googleapis.com/kubernetes-charts-incubator"),
},
Values: pulumi.Map{
"clusterName": w.eksCluster.Name,
"awsVpcID": w.vpNetwork.ID(),
"awsRegion": pulumi.String(os.Getenv(PrimaryRegion)),
},
}, pulumi.Provider(k8sProvider))
if err != nil {
return err
}
/*for _, r := range albResource.Resources {
}*/
ingress, err := networking.GetIngress(ctx, fmt.Sprintf("axiom-alb-charts-%s", w.targetEnv), albResource.Resources.ID(), nil)
if err != nil {
return err
}gorgeous-egg-16927
10/09/2020, 8:24 PM[namespace]/name, where name is the name of the actual k8s resource that you would see with kubectl get ingbitter-application-91815
10/09/2020, 8:48 PMbitter-application-91815
10/09/2020, 8:48 PMingress, err := networking.GetIngress(ctx, "axiomdb-ingress", pulumi.IDInput(pulumi.ID(fmt.Sprintf("%s/axiomdb-ingress", namespace))), nil)
if err != nil {
return err
}
ctx.Export("axiomDBIngress", ingress.Kind)bitter-application-91815
10/09/2020, 8:48 PMType Name Plan Info
pulumi:pulumi:Stack staging-axiom-cloud 1 error
~ ├─ aws:ec2:RouteTable axiom-cloud-private-subnet-2-routetable-staging-g update [diff: ~routes]
~ ├─ aws:ec2:RouteTable axiom-cloud-private-subnet-3-routetable-staging-g update [diff: ~routes]
~ ├─ aws:ec2:RouteTable axiom-cloud-private-subnet-1-routetable-staging-g update [diff: ~routes]
├─ kubernetes:helm.sh/v3:Chart axiomdb-charts-staging-g
│ └─ kubernetes:extensions/v1beta1:Ingress axiomdb/axiomdb-ingress 1 warning
└─ kubernetes:networking.k8s.io/v1:Ingress axiomdb-ingress 1 error
Diagnostics:
kubernetes:extensions/v1beta1:Ingress (axiomdb/axiomdb-ingress):
warning: extensions/v1beta1/Ingress is deprecated by networking.k8s.io/v1beta1/Ingress and not supported by Kubernetes v1.20+ clusters.
kubernetes:networking.k8s.io/v1:Ingress (axiomdb-ingress):
error: Preview failed: resource 'axiomdb/axiomdb-ingress' does not exist
pulumi:pulumi:Stack (staging-axiom-cloud):
error: preview failed
ronoc@gunther:~/source/watchly/service/cloud/aws/staging$ kubectl get ing -A
NAMESPACE NAME HOSTS ADDRESS PORTS AGE
axiomdb axiomdb-ingress * internal-2fd8be7b-axiomdb-axiomdbin-0378-1435062635.eu-west-2.elb.amazonaws.com 80 2d9h
ronoc@gunther:~/source/watchly/service/cloud/aws/staging$bitter-application-91815
10/09/2020, 8:49 PMgorgeous-egg-16927
10/09/2020, 8:55 PMGetResource method on the Chart to get that.bitter-application-91815
10/09/2020, 8:55 PMgorgeous-egg-16927
10/09/2020, 8:56 PMAnyOutputbitter-application-91815
10/09/2020, 9:02 PMGetResource(gvk, name, namespace string) => GetResource("ingress", "axiomdb-ingress", "axiom")bitter-application-91815
10/09/2020, 9:02 PMbitter-application-91815
10/09/2020, 9:03 PMgorgeous-egg-16927
10/09/2020, 9:05 PMnetworking/v1/Ingressbitter-application-91815
10/09/2020, 9:05 PMgorgeous-egg-16927
10/09/2020, 9:06 PMaxiomdbbitter-application-91815
10/09/2020, 9:29 PMbitter-application-91815
10/09/2020, 9:29 PMbitter-application-91815
10/09/2020, 9:30 PMgorgeous-egg-16927
10/09/2020, 9:37 PMbitter-application-91815
10/09/2020, 9:38 PMgorgeous-egg-16927
10/09/2020, 9:38 PMbitter-application-91815
10/09/2020, 9:40 PMbitter-application-91815
10/09/2020, 10:55 PMingressIP := ingressChart.GetResource("networking/v1/Ingress", "axiomdb-ingress", "axiomdb").
Apply(func(r interface{}) (interface{}, error) {
svc := r.(*networking.Ingress)
return svc.Status.LoadBalancer.Ingress()[0].Hostname, nil
})
ctx.Export("ingressIP", ingressIP)bitter-application-91815
10/09/2020, 10:55 PMbitter-application-91815
10/09/2020, 10:55 PMhttps://raw.githubusercontent.com/pulumi/pulumi-kubernetes/master/sdk/go/kubernetes/core/v1/pulumiTypes.gobitter-application-91815
10/09/2020, 10:55 PMType Name Plan Info
pulumi:pulumi:Stack staging-axiom-cloud 1 error; 2 messages
Diagnostics:
pulumi:pulumi:Stack (staging-axiom-cloud):
# axicode.axiom.co/watchmakers/watchly/service/cloud/aws
../eks.go:175:34: svc.Status.LoadBalancer.Ingress undefined (type func() "github.com/pulumi/pulumi-kubernetes/sdk/v2/go/kubernetes/core/v1".LoadBalancerStatusPtrOutput has no field or method Ingress)
error: an unhandled error occurred: program exited with non-zero exit code: 2bitter-application-91815
10/12/2020, 11:41 AMbitter-application-91815
10/12/2020, 11:55 AMbitter-application-91815
10/12/2020, 11:58 AMbitter-application-91815
10/12/2020, 11:58 AMingressIP := ingressChart.GetResource("networking/v1/Ingress", "axiomdb-ingress", "axiomdb").
Apply(func(r interface{}) (interface{}, error) {
svc := r.(*networking.Ingress)
return svc.Status.LoadBalancer().Ingress().Index(pulumi.Int(0)).Hostname, nil
})
ctx.Export("ingressIP", ingressIP)bitter-application-91815
10/12/2020, 11:59 AMbitter-application-91815
10/12/2020, 11:59 AMpanic: interface conversion: interface {} is nil, not *v1.Ingress
goroutine 316 [running]:
axicode.axiom.co/watchmakers/watchly/service/cloud/aws.(*worker).buildEks.func1(0x0, 0x0, 0x79715c0, 0xc00008aa80, 0xc000501c10, 0x4155f3)
/home/ronoc/source/watchly/service/cloud/aws/eks.go:174 +0x10a
github.com/pulumi/pulumi/sdk/v2/go/pulumi.(*OutputState).Apply.func1(0x909b940, 0xc000056110, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/ronoc/.axiom-dev/gopath/pkg/mod/github.com/pulumi/pulumi/sdk/v2@v2.9.2/go/pulumi/types.go:305 +0x39
reflect.Value.call(0x7930160, 0xc0005bccd0, 0x13, 0x8f07e20, 0x4, 0xc000501f60, 0x2, 0x2, 0xc0003a4ed8, 0x494add, ...)
/home/ronoc/.axiom-dev/go/src/reflect/value.go:460 +0x5f6
reflect.Value.Call(0x7930160, 0xc0005bccd0, 0x13, 0xc0003a4f60, 0x2, 0x2, 0x0, 0x0, 0x1)
/home/ronoc/.axiom-dev/go/src/reflect/value.go:321 +0xb4
github.com/pulumi/pulumi/sdk/v2/go/pulumi.(*OutputState).ApplyTWithContext.func1(0xc00044a5b0, 0x909b940, 0xc000056110, 0x90f1860, 0xc00044a620, 0x7930160, 0xc0005bccd0, 0x13)
/home/ronoc/.axiom-dev/gopath/pkg/mod/github.com/pulumi/pulumi/sdk/v2@v2.9.2/go/pulumi/types.go:392 +0x23f
created by github.com/pulumi/pulumi/sdk/v2/go/pulumi.(*OutputState).ApplyTWithContext
/home/ronoc/.axiom-dev/gopath/pkg/mod/github.com/pulumi/pulumi/sdk/v2@v2.9.2/go/pulumi/types.go:380 +0x1e0
exit status 2bitter-application-91815
10/12/2020, 12:05 PMbitter-application-91815
10/12/2020, 12:06 PMbitter-application-91815
10/12/2020, 12:06 PMbitter-application-91815
10/12/2020, 12:06 PMpanic: interface conversion: interface {} is nil, not *v1.Ingress
goroutine 316 [running]:gorgeous-egg-16927
10/12/2020, 5:10 PMingressIP := ingressChart.GetResource("networking.k8s.io/v1/Ingress", "axiomdb-ingress", "axiomdb").
It looks like the id field for the Go SDK is using the fully-qualified Group name (i.e., networking.k8s.io rather than networking)gorgeous-egg-16927
10/12/2020, 5:15 PMbitter-application-91815
10/12/2020, 6:43 PMbitter-application-91815
10/12/2020, 6:43 PMerror: an unhandled error occurred: program exited with non-zero exit code: 1
panic: interface conversion: interface {} is nil, not *v1.Ingressbitter-application-91815
10/12/2020, 6:44 PMbitter-application-91815
10/12/2020, 6:44 PM