Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The ec2 vpcendpointserviceconfiguration resource crashes with nil pointer error #1367

Closed
EdgeJ opened this issue Jun 22, 2022 · 0 comments · Fixed by #1372
Closed

The ec2 vpcendpointserviceconfiguration resource crashes with nil pointer error #1367

EdgeJ opened this issue Jun 22, 2022 · 0 comments · Fixed by #1372

Comments

@EdgeJ
Copy link
Contributor

EdgeJ commented Jun 22, 2022

While testing another resource, I applied the entirety of the ec2 examples. Afterward, the aws-provider began crashing with nil pointer errors with the following error log:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x3dd116e]

goroutine 5130 [running]:
github.com/crossplane-contrib/provider-aws/pkg/controller/ec2/vpcendpointserviceconfiguration.GenerateObservation(...)
	/Users/jedge/git/crossplane/provider-aws/pkg/controller/ec2/vpcendpointserviceconfiguration/setup.go:287
github.com/crossplane-contrib/provider-aws/pkg/controller/ec2/vpcendpointserviceconfiguration.postObserve({0x0, 0x0}, 0xc00064e480, 0xc00261bbc0, {0x1, 0x1, 0x1, 0x0, {0x0, 0x0}}, ...)
	/Users/jedge/git/crossplane/provider-aws/pkg/controller/ec2/vpcendpointserviceconfiguration/setup.go:84 +0x14e
github.com/crossplane-contrib/provider-aws/pkg/controller/ec2/vpcendpointserviceconfiguration.(*external).Observe(0xc0018640e0, {0x7144250, 0xc002b312c0}, {0x721f2b0, 0xc00064e480})
	/Users/jedge/git/crossplane/provider-aws/pkg/controller/ec2/vpcendpointserviceconfiguration/zz_controller.go:99 +0x3ff
github.com/crossplane/crossplane-runtime/pkg/reconciler/managed.(*Reconciler).Reconcile(0xc00052abb0, {0x7144288, 0xc0011f1290}, {{{0x0, 0x64ba400}, {0xc0004fa920, 0x30}}})
	/Users/jedge/go1.17/pkg/mod/github.com/crossplane/crossplane-runtime@v0.15.1-0.20220315141414-988c9ba9c255/pkg/reconciler/managed/reconciler.go:767 +0x230b
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile(0xc00052ac60, {0x7144288, 0xc0011f11d0}, {{{0x0, 0x64ba400}, {0xc0004fa920, 0x1015034}}})
	/Users/jedge/go1.17/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/internal/controller/controller.go:114 +0x26f
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc00052ac60, {0x71441e0, 0xc0005b73c0}, {0x5ff2d20, 0xc000660120})
	/Users/jedge/go1.17/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/internal/controller/controller.go:311 +0x33e
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc00052ac60, {0x71441e0, 0xc0005b73c0})
	/Users/jedge/go1.17/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/internal/controller/controller.go:266 +0x205
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2()
	/Users/jedge/go1.17/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/internal/controller/controller.go:227 +0x85
created by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2
	/Users/jedge/go1.17/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/internal/controller/controller.go:223 +0x357
exit status 2

Digging in a little, I discovered the error was coming from these lines:

PrivateDNSNameConfiguration: &svcapitypes.PrivateDNSNameConfiguration{
Name: obj.PrivateDnsNameConfiguration.Name,
State: obj.PrivateDnsNameConfiguration.State,
Value: obj.PrivateDnsNameConfiguration.Value,
Type: obj.PrivateDnsNameConfiguration.Type,
},

Describing the generated endpoint service configuration with the aws cli does not have the PrivateDnsNameConfiguration section supplied:

ServiceConfigurations:
- AcceptanceRequired: true
  AvailabilityZones:
  - us-east-1b
  - us-east-1c
  GatewayLoadBalancerArns:
  - arn:aws:elasticloadbalancing:us-east-1:<REDACTED>:loadbalancer/gwy/gatewayloadbalancer/c133378d9015d865
  ManagesVpcEndpoints: false
  ServiceId: vpce-svc-0e8b9215e9b8ef7b8
  ServiceName: com.amazonaws.vpce.us-east-1.vpce-svc-0e8b9215e9b8ef7b8
  ServiceState: Available
  ServiceType:
  - ServiceType: GatewayLoadBalancer
  Tags:
  - Key: crossplane-providerconfig
    Value: example
  - Key: crossplane-kind
    Value: vpcendpointserviceconfiguration.ec2.aws.crossplane.io
  - Key: crossplane-name
    Value: sample-vpc-endpoint-service
  - Key: Name
    Value: sample-vpc-endpoint-service

so, I'm pretty sure that there needs to be a check around this configuration to make sure the result from the Describe action is not nil, before setting values from it.

haarchri added a commit to haarchri/provider-aws that referenced this issue Jun 29, 2022
Signed-off-by: haarchri <chhaar30@googlemail.com>
haarchri added a commit that referenced this issue Jun 30, 2022
…viceconfigurations

bugfix(nil): #1367 check for nil
emelieakerstrom-sb1 pushed a commit to sparebank1utvikling/provider-aws that referenced this issue Sep 28, 2022
Signed-off-by: haarchri <chhaar30@googlemail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant