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

fix: prevent nil pointer panic because of nonexist attribute of Access Log #1838

Merged
merged 4 commits into from
Sep 4, 2023

Conversation

ardikabs
Copy link
Contributor

Fixes #1830
Additionally, I also added a test for JSON format type Access Log.

@ardikabs ardikabs requested a review from a team as a code owner August 28, 2023 05:13
@ardikabs ardikabs changed the title fix: prevent nil pointer panic because of nonexist attribute for Access Log fix: prevent nil pointer panic because of nonexist attribute of Access Log Aug 28, 2023
@codecov
Copy link

codecov bot commented Aug 28, 2023

Codecov Report

Merging #1838 (9f74d04) into main (f31fbaa) will increase coverage by 0.30%.
The diff coverage is 71.73%.

@@            Coverage Diff             @@
##             main    #1838      +/-   ##
==========================================
+ Coverage   65.06%   65.36%   +0.30%     
==========================================
  Files          86       86              
  Lines       12480    12526      +46     
==========================================
+ Hits         8120     8188      +68     
+ Misses       3838     3821      -17     
+ Partials      522      517       -5     
Files Changed Coverage Δ
api/config/v1alpha1/validation/validate.go 73.38% <70.45%> (-1.36%) ⬇️
internal/gatewayapi/listener.go 97.68% <100.00%> (+6.45%) ⬆️

... and 2 files with indirect coverage changes

@ardikabs ardikabs force-pushed the fix/1830 branch 2 times, most recently from c7a0dde to 974a7df Compare August 28, 2023 06:03
@Xunzhuo
Copy link
Member

Xunzhuo commented Aug 28, 2023

Plz run make testdata and submit again, thanks.

@ardikabs ardikabs force-pushed the fix/1830 branch 2 times, most recently from de55a08 to 51d3b99 Compare August 28, 2023 06:57
@arkodg
Copy link
Contributor

arkodg commented Aug 28, 2023

imo this should be handled in

func validateEnvoyProxySpec(spec *egcfgv1a1.EnvoyProxySpec) error {
and we must error out early if type: File has a nil , file field, this will be caught in the provider layer which reconciles the resource and the error will surface in the GatewayClass status condition

@ardikabs
Copy link
Contributor Author

imo this should be handled in

func validateEnvoyProxySpec(spec *egcfgv1a1.EnvoyProxySpec) error {

and we must error out early if type: File has a nil , file field, this will be caught in the provider layer which reconciles the resource and the error will surface in the GatewayClass status condition

but @arkodg , as per the docs, it said, it is expected to disable the access log for type: File if path was not defined or empty. So, it seems to me adding an error to the gatewayclass status would against with the docs, wdyt?

@arkodg
Copy link
Contributor

arkodg commented Aug 30, 2023

oh good catch @ardikabs , I think that is a docs error. we have a field called disable to disable access logs now, let me fix that https://gateway.envoyproxy.io/v0.5.0/api/config_types.html#proxyaccesslog

@arkodg
Copy link
Contributor

arkodg commented Aug 30, 2023

raised #1850 to fix doc string discrepancy.

@ardikabs
Copy link
Contributor Author

hi @arkodg, I've added additional validation to error out early regarding Access Log on EnvoyProxy.

Signed-off-by: Ardika Bagus <me@ardikabs.com>
Signed-off-by: Ardika Bagus <me@ardikabs.com>
Signed-off-by: Ardika Bagus <me@ardikabs.com>
@zirain zirain merged commit 85e3acf into envoyproxy:main Sep 4, 2023
18 checks passed
@ardikabs ardikabs deleted the fix/1830 branch September 4, 2023 10:58
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 this pull request may close these issues.

EnvoyGateway crashes (nil pointer) due to inappropriate AccessLog settings
4 participants