Skip to content

Commit 09bfd04

Browse files
committed
NLB-6740 Removed values from configuration that were no longer referenced
This includes references to the handler which was removed in an earlier code change. Also cleaned up references to annotations and namespaces that were used by the original NLK code, but are no longer used.
1 parent 879b63f commit 09bfd04

File tree

5 files changed

+8
-97
lines changed

5 files changed

+8
-97
lines changed

internal/configuration/configuration_test.go

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,8 @@ func TestConfiguration_Read(t *testing.T) {
2222
LogLevel: "warn",
2323
NginxPlusHosts: []string{"https://10.0.0.1:9000/api"},
2424
SkipVerifyTLS: false,
25-
Handler: configuration.HandlerSettings{
26-
RetryCount: 5,
27-
Threads: 1,
28-
WorkQueueSettings: configuration.WorkQueueSettings{
29-
RateLimiterBase: time.Second * 2,
30-
RateLimiterMax: time.Second * 60,
31-
Name: "nlk-handler",
32-
},
33-
},
3425
Synchronizer: configuration.SynchronizerSettings{
35-
MaxMillisecondsJitter: 750,
36-
MinMillisecondsJitter: 250,
37-
RetryCount: 5,
38-
Threads: 1,
26+
Threads: 1,
3927
WorkQueueSettings: configuration.WorkQueueSettings{
4028
RateLimiterBase: time.Second * 2,
4129
RateLimiterMax: time.Second * 60,
@@ -54,20 +42,8 @@ func TestConfiguration_Read(t *testing.T) {
5442
LogLevel: "warn",
5543
NginxPlusHosts: []string{"https://10.0.0.1:9000/api", "https://10.0.0.2:9000/api"},
5644
SkipVerifyTLS: true,
57-
Handler: configuration.HandlerSettings{
58-
RetryCount: 5,
59-
Threads: 1,
60-
WorkQueueSettings: configuration.WorkQueueSettings{
61-
RateLimiterBase: time.Second * 2,
62-
RateLimiterMax: time.Second * 60,
63-
Name: "nlk-handler",
64-
},
65-
},
6645
Synchronizer: configuration.SynchronizerSettings{
67-
MaxMillisecondsJitter: 750,
68-
MinMillisecondsJitter: 250,
69-
RetryCount: 5,
70-
Threads: 1,
46+
Threads: 1,
7147
WorkQueueSettings: configuration.WorkQueueSettings{
7248
RateLimiterBase: time.Second * 2,
7349
RateLimiterMax: time.Second * 60,

internal/configuration/settings.go

Lines changed: 5 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -15,38 +15,16 @@ import (
1515
)
1616

1717
const (
18-
// ConfigMapsNamespace is the value used to filter the ConfigMaps Resource in the Informer.
19-
ConfigMapsNamespace = "nlk"
20-
21-
// ConfigMapName is the name of the ConfigMap that contains the configuration for the application.
22-
ConfigMapName = "nlk-config"
23-
24-
// ResyncPeriod is the value used to set the resync period for the Informer.
25-
ResyncPeriod = 0
26-
27-
// NlkPrefix is used to determine if a Port definition should be handled and used to update a Border Server.
28-
// The Port name () must start with this prefix, e.g.:
29-
// nlk-<my-upstream-name>
30-
NlkPrefix = ConfigMapsNamespace + "-"
31-
32-
// PortAnnotationPrefix defines the prefix used when looking up a Port in the Service Annotations.
33-
// The value of the annotation determines which BorderServer implementation will be used.
34-
// See the documentation in the `application/application_constants.go` file for details.
35-
PortAnnotationPrefix = "nginxinc.io"
36-
37-
// ServiceAnnotationMatchKey is the key name of the annotation in the application's config map
38-
// that identifies the ingress service whose events will be monitored.
18+
// ServiceAnnotationMatchKey is the key name of the annotation that
19+
// identifies the services whose events will be monitored.
3920
ServiceAnnotationMatchKey = "service-annotation-match"
4021

41-
// DefaultServiceAnnotation is the default name of the ingress service whose events will be
22+
// DefaultServiceAnnotation is the default name of the services whose events will be
4223
// monitored.
4324
DefaultServiceAnnotation = "nginxaas"
4425
)
4526

46-
// WorkQueueSettings contains the configuration values needed by the Work Queues.
47-
// There are two work queues in the application:
48-
// 1. nlk-handler queue, used to move messages between the Watcher and the Handler.
49-
// 2. nlk-synchronizer queue, used to move message between the Handler and the Synchronizer.
27+
// WorkQueueSettings contains the configuration for the nlk-synchronizer queue.
5028
// The queues are NamedDelayingQueue objects that use an ItemExponentialFailureRateLimiter
5129
// as the underlying rate limiter.
5230
type WorkQueueSettings struct {
@@ -61,18 +39,6 @@ type WorkQueueSettings struct {
6139
RateLimiterMax time.Duration
6240
}
6341

64-
// HandlerSettings contains the configuration values needed by the Handler.
65-
type HandlerSettings struct {
66-
// RetryCount is the number of times the Handler will attempt to process a message before giving up.
67-
RetryCount int
68-
69-
// Threads is the number of threads that will be used to process messages.
70-
Threads int
71-
72-
// WorkQueueSettings is the configuration for the Handler's queue.
73-
WorkQueueSettings WorkQueueSettings
74-
}
75-
7642
// WatcherSettings contains the configuration values needed by the Watcher.
7743
type WatcherSettings struct {
7844
// ServiceAnnotation is the annotation of the ingress service whose events the watcher should monitor.
@@ -84,15 +50,6 @@ type WatcherSettings struct {
8450

8551
// SynchronizerSettings contains the configuration values needed by the Synchronizer.
8652
type SynchronizerSettings struct {
87-
// MaxMillisecondsJitter is the maximum number of milliseconds that will be applied when adding an event to the queue.
88-
MaxMillisecondsJitter int
89-
90-
// MinMillisecondsJitter is the minimum number of milliseconds that will be applied when adding an event to the queue.
91-
MinMillisecondsJitter int
92-
93-
// RetryCount is the number of times the Synchronizer will attempt to process a message before giving up.
94-
RetryCount int
95-
9653
// Threads is the number of threads that will be used to process messages.
9754
Threads int
9855

@@ -114,9 +71,6 @@ type Settings struct {
11471
// APIKey is the api key used to authenticate with the dataplane API.
11572
APIKey string
11673

117-
// Handler contains the configuration values needed by the Handler.
118-
Handler HandlerSettings
119-
12074
// Synchronizer contains the configuration values needed by the Synchronizer.
12175
Synchronizer SynchronizerSettings
12276

@@ -157,20 +111,8 @@ func Read(configName, configPath string) (s Settings, err error) {
157111
NginxPlusHosts: v.GetStringSlice("nginx-hosts"),
158112
SkipVerifyTLS: skipVerifyTLS,
159113
APIKey: base64.StdEncoding.EncodeToString([]byte(v.GetString("NGINXAAS_DATAPLANE_API_KEY"))),
160-
Handler: HandlerSettings{
161-
RetryCount: 5,
162-
Threads: 1,
163-
WorkQueueSettings: WorkQueueSettings{
164-
RateLimiterBase: time.Second * 2,
165-
RateLimiterMax: time.Second * 60,
166-
Name: "nlk-handler",
167-
},
168-
},
169114
Synchronizer: SynchronizerSettings{
170-
MaxMillisecondsJitter: 750,
171-
MinMillisecondsJitter: 250,
172-
RetryCount: 5,
173-
Threads: 1,
115+
Threads: 1,
174116
WorkQueueSettings: WorkQueueSettings{
175117
RateLimiterBase: time.Second * 2,
176118
RateLimiterMax: time.Second * 60,

internal/configuration/testdata/multiple-nginx-hosts.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
ca-certificate: "fakeCAKey"
2-
client-certificate: "fakeCertKey"
31
log-level: "warn"
42
nginx-hosts: ["https://10.0.0.1:9000/api", "https://10.0.0.2:9000/api"]
53
tls-mode: "no-tls"

internal/configuration/testdata/one-nginx-host.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
ca-certificate: "fakeCAKey"
2-
client-certificate: "fakeCertKey"
31
log-level: "warn"
42
nginx-hosts: "https://10.0.0.1:9000/api"
53
service-annotation-match: "fakeServiceMatch"

internal/synchronization/synchronizer_test.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,7 @@ func defaultSettings(nginxHosts ...string) configuration.Settings {
257257
return configuration.Settings{
258258
NginxPlusHosts: nginxHosts,
259259
Synchronizer: configuration.SynchronizerSettings{
260-
MaxMillisecondsJitter: 750,
261-
MinMillisecondsJitter: 250,
262-
RetryCount: 5,
263-
Threads: 1,
260+
Threads: 1,
264261
WorkQueueSettings: configuration.WorkQueueSettings{
265262
RateLimiterBase: time.Second * 2,
266263
RateLimiterMax: time.Second * 60,

0 commit comments

Comments
 (0)