Skip to content

Commit 3d6b009

Browse files
authored
FIXME Review (#666)
Reviewed FIXMEs with team and updated comments.
1 parent b00216e commit 3d6b009

File tree

13 files changed

+19
-29
lines changed

13 files changed

+19
-29
lines changed

internal/events/event.go

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
)
77

88
// EventBatch is a batch of events to be handled at once.
9-
// FIXME(pleshakov): think about how to avoid using an interface{} here
109
type EventBatch []interface{}
1110

1211
// UpsertEvent represents upserting a resource.

internal/events/handler.go

+3
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ func (h *EventHandlerImpl) updateNginx(ctx context.Context, conf dataplane.Confi
9494
// Write all secrets (nuke and pave).
9595
// This will remove all secrets in the secrets directory before writing the requested secrets.
9696
// FIXME(kate-osborn): We may want to rethink this approach in the future and write and remove secrets individually.
97+
// https://github.com/nginxinc/nginx-kubernetes-gateway/issues/561
9798
err := h.cfg.SecretMemoryManager.WriteAllRequestedSecrets()
9899
if err != nil {
99100
return err
@@ -124,6 +125,7 @@ func (h *EventHandlerImpl) propagateUpsert(e *UpsertEvent) {
124125
h.cfg.Processor.CaptureUpsertChange(r)
125126
case *apiv1.Secret:
126127
// FIXME(kate-osborn): need to handle certificate rotation
128+
// https://github.com/nginxinc/nginx-kubernetes-gateway/issues/553
127129
h.cfg.SecretStore.Upsert(r)
128130
case *discoveryV1.EndpointSlice:
129131
h.cfg.Processor.CaptureUpsertChange(r)
@@ -144,6 +146,7 @@ func (h *EventHandlerImpl) propagateDelete(e *DeleteEvent) {
144146
h.cfg.Processor.CaptureDeleteChange(e.Type, e.NamespacedName)
145147
case *apiv1.Secret:
146148
// FIXME(kate-osborn): make sure that affected servers are updated
149+
// https://github.com/nginxinc/nginx-kubernetes-gateway/issues/553
147150
h.cfg.SecretStore.Delete(e.NamespacedName)
148151
case *discoveryV1.EndpointSlice:
149152
h.cfg.Processor.CaptureDeleteChange(e.Type, e.NamespacedName)

internal/events/loop.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
// (2) A reload can have side-effects for the data plane traffic.
2222
// FIXME(pleshakov): better document the side effects and how to prevent and mitigate them.
2323
// So when the EventLoop have 100 saved events, it is better to process them at once rather than one by one.
24+
// https://github.com/nginxinc/nginx-kubernetes-gateway/issues/551
2425
type EventLoop struct {
2526
handler EventHandler
2627
preparer FirstEventBatchPreparer
@@ -113,7 +114,6 @@ func (el *EventLoop) Start(ctx context.Context) error {
113114
// Add the event to the current batch.
114115
el.nextBatch = append(el.nextBatch, e)
115116

116-
// FIXME(pleshakov): Log more details about the event like resource GVK and ns/name.
117117
el.logger.Info(
118118
"added an event to the next batch",
119119
"type", fmt.Sprintf("%T", e),

internal/manager/manager.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,8 @@ func Start(cfg config.Config) error {
138138
GatewayClassName: cfg.GatewayClassName,
139139
Client: mgr.GetClient(),
140140
PodIP: cfg.PodIP,
141-
// FIXME(pleshakov) Make sure each component:
142-
// (1) Has a dedicated named logger.
143-
// (2) Get it from the Manager (the WithName is done here for all components).
144-
Logger: cfg.Logger.WithName("statusUpdater"),
145-
Clock: status.NewRealClock(),
141+
Logger: cfg.Logger.WithName("statusUpdater"),
142+
Clock: status.NewRealClock(),
146143
})
147144

148145
eventHandler := events.NewEventHandlerImpl(events.EventHandlerConfig{

internal/nginx/config/servers.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ func createLocations(pathRules []dataplane.PathRule, listenerPort int) []http.Lo
124124
// FIXME(pleshakov): Ensure dataplane.Configuration -related types don't include v1beta1 types, so that
125125
// we don't need to make any assumptions like above here. After fixing this, ensure that there is a test
126126
// for checking the imported Webhook validation catches the case above.
127+
// https://github.com/nginxinc/nginx-kubernetes-gateway/issues/660
127128

128129
// RequestRedirect and proxying are mutually exclusive.
129130
if r.Filters.RequestRedirect != nil {
@@ -146,6 +147,7 @@ func createLocations(pathRules []dataplane.PathRule, listenerPort int) []http.Lo
146147
if len(matches) > 0 {
147148
// FIXME(sberman): De-dupe matches and associated locations
148149
// so we don't need nginx/njs to perform unnecessary matching.
150+
// https://github.com/nginxinc/nginx-kubernetes-gateway/issues/662
149151
b, err := json.Marshal(matches)
150152
if err != nil {
151153
// panic is safe here because we should never fail to marshal the match unless we constructed it incorrectly.
@@ -244,7 +246,6 @@ func createHTTPMatch(match v1beta1.HTTPRouteMatch, redirectPath string) httpMatc
244246
headers := make([]string, 0, len(match.Headers))
245247
headerNames := make(map[string]struct{})
246248

247-
// FIXME(kate-osborn): For now we only support type "Exact".
248249
for _, h := range match.Headers {
249250
if *h.Type == v1beta1.HeaderMatchExact {
250251
// duplicate header names are not permitted by the spec
@@ -262,7 +263,6 @@ func createHTTPMatch(match v1beta1.HTTPRouteMatch, redirectPath string) httpMatc
262263
if match.QueryParams != nil {
263264
params := make([]string, 0, len(match.QueryParams))
264265

265-
// FIXME(kate-osborn): For now we only support type "Exact".
266266
for _, p := range match.QueryParams {
267267
if *p.Type == v1beta1.QueryParamMatchExact {
268268
params = append(params, createQueryParamKeyValString(p))

internal/nginx/config/upstreams_template.go

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package config
22

33
// FIXME(kate-osborn): Dynamically calculate upstream zone size based on the number of upstreams.
44
// 512k will support up to 648 upstream servers.
5+
// https://github.com/nginxinc/nginx-kubernetes-gateway/issues/483
56
var upstreamsTemplateText = `
67
{{ range $u := . }}
78
upstream {{ $u.Name }} {

internal/nginx/config/validation/http_njs_match.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ func (HTTPNJSMatchValidator) ValidatePathInMatch(path string) error {
3737
return errors.New(msg)
3838
}
3939

40-
// FIXME(pleshakov): This is temporary until https://github.com/nginxinc/nginx-kubernetes-gateway/issues/428
41-
// is fixed.
40+
// FIXME(pleshakov): This function will no longer be
41+
// needed once https://github.com/nginxinc/nginx-kubernetes-gateway/issues/428 is fixed.
4242
// That's because the location path gets into the set directive in the location block.
4343
// Example: set $http_matches "[{\"redirectPath\":\"/coffee_route0\" ...
4444
// Where /coffee is tha path.

internal/nginx/runtime/manager.go

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ func (m *ManagerImpl) Reload(ctx context.Context) error {
5252
// FIXME(pleshakov)
5353
// (1) ensure the reload actually happens.
5454
// (2) ensure that in case of an error, the error message can be seen by the admins.
55+
// https://github.com/nginxinc/nginx-kubernetes-gateway/issues/664
5556

5657
// for now, to prevent a subsequent reload starting before the in-flight reload finishes, we simply sleep.
5758
// Fixing (1) will make the sleep unnecessary.

internal/state/change_processor.go

-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ func NewChangeProcessorImpl(cfg ChangeProcessorConfig) *ChangeProcessorImpl {
172172
}
173173
}
174174

175-
// FIXME(pleshakov)
176175
// Currently, changes (upserts/delete) trigger rebuilding of the configuration, even if the change doesn't change
177176
// the configuration or the statuses of the resources. For example, a change in a Gateway resource that doesn't
178177
// belong to the NGINX Gateway or an HTTPRoute that doesn't belong to any of the Gateways of the NGINX Gateway.

internal/state/dataplane/configuration.go

+3-8
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ const (
2323
// Configuration is an intermediate representation of dataplane configuration.
2424
type Configuration struct {
2525
// HTTPServers holds all HTTPServers.
26-
// FIXME(pleshakov) We assume that all servers are HTTP and listen on port 80.
26+
// We assume that all servers are HTTP and listen on port 80.
2727
HTTPServers []VirtualServer
2828
// SSLServers holds all SSLServers.
29-
// FIXME(kate-osborn) We assume that all SSL servers listen on port 443.
29+
// We assume that all SSL servers listen on port 443.
3030
SSLServers []VirtualServer
3131
// Upstreams holds all unique Upstreams.
3232
Upstreams []Upstream
@@ -87,8 +87,6 @@ type MatchRule struct {
8787
// Filters holds the filters for the MatchRule.
8888
Filters Filters
8989
// Source is the corresponding HTTPRoute resource.
90-
// FIXME(pleshakov): Consider referencing only the parts needed for the config generation rather than
91-
// the entire resource.
9290
Source *v1beta1.HTTPRoute
9391
// BackendGroup is the group of Backends that the rule routes to.
9492
BackendGroup BackendGroup
@@ -135,7 +133,6 @@ func (r *MatchRule) GetMatch() v1beta1.HTTPRouteMatch {
135133
}
136134

137135
// BuildConfiguration builds the Configuration from the Graph.
138-
// FIXME(pleshakov) For now we only handle paths with prefix matches. Handle exact and regex matches
139136
func BuildConfiguration(ctx context.Context, g *graph.Graph, resolver resolver.ServiceResolver) Configuration {
140137
if g.GatewayClass == nil || !g.GatewayClass.Valid {
141138
return Configuration{}
@@ -372,8 +369,6 @@ func (hpr *hostPathRules) buildServers() []VirtualServer {
372369
hostname := getListenerHostname(l.Source.Hostname)
373370
// Generate a 404 ssl server block for listeners with no routes or listeners with wildcard (match-all) routes.
374371
// This server overrides the default ssl server.
375-
// FIXME(kate-osborn): when we support regex hostnames (e.g. *.example.com)
376-
// we will have to modify this check to catch regex hostnames.
377372
if len(l.Routes) == 0 || hostname == wildcardHostname {
378373
s := VirtualServer{
379374
Hostname: hostname,
@@ -503,7 +498,7 @@ func convertPathType(pathType v1beta1.PathMatchType) PathType {
503498

504499
// listenerHostnameMoreSpecific returns true if host1 is more specific than host2 (using length).
505500
//
506-
// FIXME(sberman): Since the only caller of this function specifies listener hostnames that are both
501+
// Since the only caller of this function specifies listener hostnames that are both
507502
// bound to the same route hostname, this function assumes that host1 and host2 match, either
508503
// exactly or as a substring.
509504
//

internal/state/graph/gateway_listener.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
)
1313

1414
// Listener represents a Listener of the Gateway resource.
15-
// FIXME(pleshakov) For now, we only support HTTP and HTTPS listeners.
15+
// For now, we only support HTTP and HTTPS listeners.
1616
type Listener struct {
1717
// Source holds the source of the Listener from the Gateway resource.
1818
Source v1beta1.Listener

internal/state/graph/httproute.go

+2-8
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ type ParentRefAttachmentStatus struct {
5353
// Route represents an HTTPRoute.
5454
type Route struct {
5555
// Source is the source resource of the Route.
56-
// FIXME(pleshakov)
57-
// For now, we assume that the source is only HTTPRoute.
58-
// Later we can support more types - TLSRoute, TCPRoute and UDPRoute.
5956
Source *v1beta1.HTTPRoute
6057
// ParentRefs includes ParentRefs with NKG Gateways only.
6158
ParentRefs []ParentRef
@@ -231,7 +228,7 @@ func buildRoute(
231228

232229
if atLeastOneValid {
233230
// FIXME(pleshakov): Partial validity for HTTPRoute rules is not defined in the Gateway API spec yet.
234-
// See https://github.com/kubernetes-sigs/gateway-api/issues/1696
231+
// See https://github.com/nginxinc/nginx-kubernetes-gateway/issues/485
235232
msg = "Some rules are invalid: " + msg
236233
r.Conditions = append(r.Conditions, conditions.NewTODO(msg))
237234
} else {
@@ -311,9 +308,6 @@ func bindRouteToListeners(r *Route, gw *Gateway) {
311308
// tryToAttachRouteToListeners tries to attach the route to the listeners that match the parentRef and the hostnames.
312309
// If it succeeds in attaching at least one listener it will return true and the condition will be empty.
313310
// If it fails to attach the route, it will return false and the failure condition.
314-
// FIXME(pleshakov)
315-
// For now, let's do simple matching.
316-
// However, we need to also support wildcard matching.
317311
func tryToAttachRouteToListeners(
318312
refStatus *ParentRefAttachmentStatus,
319313
sectionName *v1beta1.SectionName,
@@ -324,7 +318,7 @@ func tryToAttachRouteToListeners(
324318

325319
if !listenerExists {
326320
// FIXME(pleshakov): Add a proper condition once it is available in the Gateway API.
327-
// https://github.com/nginxinc/nginx-kubernetes-gateway/issues/306
321+
// https://github.com/nginxinc/nginx-kubernetes-gateway/issues/665
328322
return conditions.NewTODO("listener is not found"), false
329323
}
330324

internal/state/secrets/secrets.go

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ type FileManager interface {
9292
}
9393

9494
// FIXME(kate-osborn): Is it necessary to make this concurrent-safe?
95+
// https://github.com/nginxinc/nginx-kubernetes-gateway/issues/441
9596
type SecretDiskMemoryManagerImpl struct {
9697
requestedSecrets map[types.NamespacedName]requestedSecret
9798
secretStore SecretStore

0 commit comments

Comments
 (0)