Skip to content

Commit 8662168

Browse files
committed
fix key in ack/nack map
Signed-off-by: Joe McGuire <[email protected]> Signed-off-by: Joe McGuire <[email protected]>
1 parent 9f53605 commit 8662168

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

internal/kgateway/agentgatewaysyncer/nack/handler.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
var nackHandlerLog = logging.New("nack/handler")
1616

1717
type NackHandler struct {
18-
nackStateStore map[*types.NamespacedName]map[string]string
18+
nackStateStore map[types.NamespacedName]map[string]string
1919
nackPublisher *Publisher
2020
mu sync.RWMutex
2121
}
@@ -38,7 +38,7 @@ type AckEvent struct {
3838

3939
func NewNackHandler(nackPublisher *Publisher) *NackHandler {
4040
return &NackHandler{
41-
nackStateStore: make(map[*types.NamespacedName]map[string]string),
41+
nackStateStore: make(map[types.NamespacedName]map[string]string),
4242
nackPublisher: nackPublisher,
4343
mu: sync.RWMutex{},
4444
}
@@ -76,18 +76,18 @@ func (h *NackHandler) FilterEventsAndUpdateState(event *corev1.Event) error {
7676
if !hasRecovery || recoveryOf == "" {
7777
return fmt.Errorf("ACK event missing recovery annotation: %v", event.Annotations)
7878
}
79-
h.removeNack(&types.NamespacedName{Name: event.InvolvedObject.Name, Namespace: event.InvolvedObject.Namespace}, recoveryOf)
79+
h.removeNack(types.NamespacedName{Name: event.InvolvedObject.Name, Namespace: event.InvolvedObject.Namespace}, recoveryOf)
8080
return nil
8181
}
82-
h.addNack(&types.NamespacedName{Name: event.InvolvedObject.Name, Namespace: event.InvolvedObject.Namespace}, nackID, event.Message)
82+
h.addNack(types.NamespacedName{Name: event.InvolvedObject.Name, Namespace: event.InvolvedObject.Namespace}, nackID, event.Message)
8383
return nil
8484
}
8585

8686
// ComputeStatus computes the Gateway status condition based on the current set of active NACKs for a gateway.
8787
// - No active NACKs: No status returned
8888
// - One active NACK: Programmed=False with specific error message
8989
// - Multiple active NACKs: Programmed=False with aggregated error count
90-
func (h *NackHandler) ComputeStatus(gateway *types.NamespacedName) *metav1.Condition {
90+
func (h *NackHandler) ComputeStatus(gateway types.NamespacedName) *metav1.Condition {
9191
h.mu.RLock()
9292
defer h.mu.RUnlock()
9393
activeNacks := h.nackStateStore[gateway]
@@ -116,7 +116,7 @@ func (h *NackHandler) ComputeStatus(gateway *types.NamespacedName) *metav1.Condi
116116
}
117117

118118
// addNack adds a NACK to the Gateway's active NACK set when a NACK event is received via the Kubernetes Event API.
119-
func (h *NackHandler) addNack(gateway *types.NamespacedName, nackID, message string) {
119+
func (h *NackHandler) addNack(gateway types.NamespacedName, nackID, message string) {
120120
h.mu.Lock()
121121
defer h.mu.Unlock()
122122
if h.nackStateStore[gateway] == nil {
@@ -126,7 +126,7 @@ func (h *NackHandler) addNack(gateway *types.NamespacedName, nackID, message str
126126
}
127127

128128
// removeNack removes a NACK from the Gateway's active set when an ACK event is received via the Kubernetes Event API.
129-
func (h *NackHandler) removeNack(gateway *types.NamespacedName, nackID string) {
129+
func (h *NackHandler) removeNack(gateway types.NamespacedName, nackID string) {
130130
h.mu.Lock()
131131
defer h.mu.Unlock()
132132
if h.nackStateStore[gateway] == nil {

internal/kgateway/agentgatewaysyncer/syncer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ func (s *Syncer) buildFinalGatewayStatus(
177177
logger.Warn("failed to filter nack/ack events and update state", "error", err)
178178
}
179179
}
180-
nackCondition := s.NackHandler.ComputeStatus(&types.NamespacedName{Name: i.Obj.Name, Namespace: i.Obj.Namespace})
180+
nackCondition := s.NackHandler.ComputeStatus(types.NamespacedName{Name: i.Obj.Name, Namespace: i.Obj.Namespace})
181181
if nackCondition != nil {
182182
for i := 0; i < len(status.Conditions); i++ {
183183
condition := &status.Conditions[i]

0 commit comments

Comments
 (0)