wso2 / k8s-api-operator

API Operator for Kubernetes
Apache License 2.0
115 stars 48 forks source link

Fix EI operator ingress adding hosts issue #608

Closed tharakamd closed 3 years ago

tharakamd commented 3 years ago

Purpose

Fix: https://github.com/wso2/k8s-api-operator/issues/607

codecov-commenter commented 3 years ago

Codecov Report

Merging #608 (473865b) into master (e6d9df7) will increase coverage by 2.37%. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #608      +/-   ##
==========================================
+ Coverage   42.02%   44.39%   +2.37%     
==========================================
  Files          14       14              
  Lines         652      705      +53     
==========================================
+ Hits          274      313      +39     
- Misses        329      342      +13     
- Partials       49       50       +1     
Flag Coverage Δ
unit_tests 44.39% <ø> (+2.37%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
api-operator/pkg/config/system.go 88.88% <0.00%> (-2.42%) :arrow_down:
api-operator/pkg/k8s/new.go 100.00% <0.00%> (ø)
api-operator/pkg/str/utils.go 100.00% <0.00%> (ø)
api-operator/pkg/envoy/rest.go 0.00% <0.00%> (ø)
api-operator/pkg/maps/utils.go 100.00% <0.00%> (ø)
api-operator/pkg/envoy/sendAPIs.go 0.00% <0.00%> (ø)
api-operator/pkg/envoy/deleteAPI.go 0.00% <0.00%> (ø)
api-operator/pkg/envoy/deployAPI.go 0.00% <0.00%> (ø)
api-operator/pkg/swagger/swagger.go 100.00% <0.00%> (ø)
api-operator/pkg/swagger/extensions.go 76.47% <0.00%> (+1.47%) :arrow_up:
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 992189d...473865b. Read the comment docs.

renuka-fernando commented 3 years ago

As I understand, this updated function is used to check current and new ingress rules right? And the issue was since this check fails (i.e. ingress rules are not matching) so ingress rules are appending repeatedly. https://github.com/wso2/k8s-api-operator/blob/473865be3bb09d14187029375afee60918ba07c0/api-operator/pkg/controller/integration/integration_functions.go#L66-L93

tharakamd commented 3 years ago

As I understand, this updated function is used to check current and new ingress rules right? And the issue was since this check fails (i.e. ingress rules are not matching) so ingress rules are appending repeatedly. https://github.com/wso2/k8s-api-operator/blob/473865be3bb09d14187029375afee60918ba07c0/api-operator/pkg/controller/integration/integration_functions.go#L66-L93

Yes, that was the issue. That was happening because the PathType was not setting in the GenerateIngressPaths function. Because of that in the newRule the GenerateIngressPaths of PathType was not set. (That's the default value, hence it won't affect the ingress creation). But this leads to a mismatch in deep equal check. Because of that, an ingress is created every time the deep check is done.