Skip to content

Conversation

ajanikow
Copy link
Collaborator

No description provided.

@cla-bot cla-bot bot added the cla-signed label Aug 15, 2025
@ajanikow ajanikow requested a review from Copilot August 15, 2025 13:02
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds gateway configuration monitoring by implementing a new condition to track the configuration state of Gateway members. The feature introduces a systematic way to monitor whether gateway configurations are present and up-to-date by comparing configuration checksums.

Key changes include:

  • Addition of a new ConditionTypeGatewayConfig condition type for tracking gateway configuration state
  • Implementation of gateway configuration monitoring in the reconciler plan builder
  • Restructuring of gateway configuration generation to calculate checksums after all destinations are configured

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pkg/deployment/reconcile/plan_builder_gateway.go New file implementing gateway config condition monitoring logic
pkg/deployment/client/inventory.go New inventory client for fetching gateway configuration data
pkg/apis/deployment/v1/conditions.go Adds the new GatewayConfig condition type constant
pkg/deployment/resources/config_map_gateway.go Reorders configuration generation to calculate checksum after all destinations
pkg/deployment/reconcile/plan_builder_high.go Integrates gateway config condition into the reconciliation plan
pkg/deployment/reconcile/plan_builder_context.go Updates interface to use DeploymentGetter instead of DeploymentInfoGetter

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

if err != nil {
return nil, err
}

Copy link

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable logger is undefined in this scope. You need to either pass a logger parameter to this function or use a logger from the reconciler context.

Suggested change
logger := log.FromContext(ctx)

Copilot uses AI. Check for mistakes.

}

if c, ok := m.Member.Conditions.Get(api.ConditionTypeGatewayConfig); !ok || c.Status == core.ConditionFalse || c.Hash != inv.GetConfiguration().GetHash() {
plan = append(plan, sharedReconcile.UpdateMemberConditionActionV2("Config Present", api.ConditionTypeGatewayConfig, m.Group, m.Member.ID, false, "Config Present", "Config Present", inv.GetConfiguration().GetHash()))
Copy link

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded string "Config Present" is repeated multiple times. Consider defining a constant for this message to improve maintainability.

Suggested change
plan = append(plan, sharedReconcile.UpdateMemberConditionActionV2("Config Present", api.ConditionTypeGatewayConfig, m.Group, m.Member.ID, false, "Config Present", "Config Present", inv.GetConfiguration().GetHash()))
plan = append(plan, sharedReconcile.UpdateMemberConditionActionV2(gatewayConfigPresentMsg, api.ConditionTypeGatewayConfig, m.Group, m.Member.ID, false, gatewayConfigPresentMsg, gatewayConfigPresentMsg, inv.GetConfiguration().GetHash()))

Copilot uses AI. Check for mistakes.

inv, err := r.getGatewayInventoryConfig(ctx, planCtx, m.Group, m.Member)
if err != nil {
if c, ok := m.Member.Conditions.Get(api.ConditionTypeGatewayConfig); !ok || c.Status == core.ConditionTrue {
plan = append(plan, sharedReconcile.UpdateMemberConditionActionV2("Config is not present", api.ConditionTypeGatewayConfig, m.Group, m.Member.ID, false, "Config is not present", "Config is not present", ""))
Copy link

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded string "Config is not present" is repeated multiple times. Consider defining a constant for this message to improve maintainability.

Suggested change
plan = append(plan, sharedReconcile.UpdateMemberConditionActionV2("Config is not present", api.ConditionTypeGatewayConfig, m.Group, m.Member.ID, false, "Config is not present", "Config is not present", ""))
plan = append(plan, sharedReconcile.UpdateMemberConditionActionV2(configNotPresentMsg, api.ConditionTypeGatewayConfig, m.Group, m.Member.ID, false, configNotPresentMsg, configNotPresentMsg, ""))

Copilot uses AI. Check for mistakes.

}

if c, ok := m.Member.Conditions.Get(api.ConditionTypeGatewayConfig); !ok || c.Status == core.ConditionFalse || c.Hash != inv.GetConfiguration().GetHash() {
plan = append(plan, sharedReconcile.UpdateMemberConditionActionV2("Config Present", api.ConditionTypeGatewayConfig, m.Group, m.Member.ID, false, "Config Present", "Config Present", inv.GetConfiguration().GetHash()))
Copy link

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fourth parameter should be true instead of false when the config is present, as this indicates the condition status (true = condition is met).

Suggested change
plan = append(plan, sharedReconcile.UpdateMemberConditionActionV2("Config Present", api.ConditionTypeGatewayConfig, m.Group, m.Member.ID, false, "Config Present", "Config Present", inv.GetConfiguration().GetHash()))
plan = append(plan, sharedReconcile.UpdateMemberConditionActionV2("Config Present", api.ConditionTypeGatewayConfig, m.Group, m.Member.ID, true, "Config Present", "Config Present", inv.GetConfiguration().GetHash()))

Copilot uses AI. Check for mistakes.

@ajanikow ajanikow merged commit a9ccccf into master Aug 18, 2025
3 checks passed
@ajanikow ajanikow deleted the feature/add_gateway_config branch August 18, 2025 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants