Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move constant to configuration #17

Merged
merged 1 commit into from
Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions internal/configuration/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
const (
ConfigMapsNamespace = "nkl"
ResyncPeriod = 0
NklPrefix = ConfigMapsNamespace + "-"
)

type WorkQueueSettings struct {
Expand Down
5 changes: 2 additions & 3 deletions internal/translation/translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ package translation

import (
"fmt"
"github.com/nginxinc/kubernetes-nginx-ingress/internal/configuration"
"github.com/nginxinc/kubernetes-nginx-ingress/internal/core"
nginxClient "github.com/nginxinc/nginx-plus-go-client/client"
"github.com/sirupsen/logrus"
v1 "k8s.io/api/core/v1"
"strings"
)

const NklPrefix = "nkl-"

func Translate(event *core.Event) (core.ServerUpdateEvents, error) {
logrus.Debug("Translate::Translate")

Expand All @@ -27,7 +26,7 @@ func filterPorts(ports []v1.ServicePort) []v1.ServicePort {
var portsOfInterest []v1.ServicePort

for _, port := range ports {
if strings.HasPrefix(port.Name, NklPrefix) {
if strings.HasPrefix(port.Name, configuration.NklPrefix) {
portsOfInterest = append(portsOfInterest, port)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package translation

import (
"fmt"
"github.com/nginxinc/kubernetes-nginx-ingress/internal/configuration"
"github.com/nginxinc/kubernetes-nginx-ingress/internal/core"
v1 "k8s.io/api/core/v1"
"math/rand"
Expand Down Expand Up @@ -653,7 +654,7 @@ func generateUpdatablePorts(portCount int, updatableCount int) []v1.ServicePort
nonupdatable := make([]string, portCount-updatableCount)

for i := range updatable {
updatable[i] = NklPrefix
updatable[i] = configuration.NklPrefix
}

for j := range nonupdatable {
Expand Down