Skip to content

Check resource generation when processing updates of some resources to skip config regeneration #825

Closed
@pleshakov

Description

@pleshakov

When processing updates to cluster resources, for some resources, we check their generation, so that we don't trigger state change (graph rebuild) if the generation didn't change. This is a performance optimization so that we don't rebuild the graph and as a result do not regenerate NGINX config and reload it.

However, for resources don't trigger state change on upsert, but for which the relationship capturer or triggerStateChange func determines if the resource triggers a change, we don't check the resource generation.

FIXME https://github.com/nginxinc/nginx-kubernetes-gateway/blob/36d5df4f5b047eadcbc2b814f19c216a054c2d6c/internal/state/store.go#L214

We can also filter resource events at the controller level by adding the controller-runtime GenerationChangedPredicate. This would eliminate the need to check the generation in the changeTrackingUpdater and reduce the number of events we process. Adding this predicate may not make sense for all the resources since the generation of a resource is only incremented for spec changes. Changes to metadata -- such as labels and annotations -- do not increment the generation.

Acceptance criteria:

  • check generation for those cases above

Metadata

Metadata

Assignees

Labels

area/performancePerformance relatedbacklogCurrently unprioritized work. May change with user feedback or as the product progresses.enhancementNew feature or requestgood first issueGood for newcomerstech-debtShort-term pain, long-term benefit

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions