Skip to content

Commit

Permalink
Move util to specific package location
Browse files Browse the repository at this point in the history
  • Loading branch information
rikatz committed Jul 21, 2022
1 parent 0cc43d5 commit 7304086
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion internal/ingress/annotations/authreq/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"k8s.io/ingress-nginx/internal/ingress/annotations/parser"
ing_errors "k8s.io/ingress-nginx/internal/ingress/errors"
"k8s.io/ingress-nginx/internal/ingress/resolver"
"k8s.io/ingress-nginx/internal/sets"
"k8s.io/ingress-nginx/pkg/util/sets"
)

// Config returns external authentication configuration for an Ingress rule
Expand Down
2 changes: 1 addition & 1 deletion internal/ingress/annotations/globalratelimit/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
ing_errors "k8s.io/ingress-nginx/internal/ingress/errors"
"k8s.io/ingress-nginx/internal/ingress/resolver"
"k8s.io/ingress-nginx/internal/net"
"k8s.io/ingress-nginx/internal/sets"
"k8s.io/ingress-nginx/pkg/util/sets"
)

const defaultKey = "$remote_addr"
Expand Down
2 changes: 1 addition & 1 deletion internal/ingress/annotations/ipwhitelist/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"k8s.io/ingress-nginx/internal/ingress/annotations/parser"
ing_errors "k8s.io/ingress-nginx/internal/ingress/errors"
"k8s.io/ingress-nginx/internal/ingress/resolver"
"k8s.io/ingress-nginx/internal/sets"
"k8s.io/ingress-nginx/pkg/util/sets"
)

// SourceRange returns the CIDR
Expand Down
2 changes: 1 addition & 1 deletion internal/ingress/annotations/ratelimit/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"k8s.io/ingress-nginx/internal/ingress/annotations/parser"
"k8s.io/ingress-nginx/internal/ingress/resolver"
"k8s.io/ingress-nginx/internal/net"
"k8s.io/ingress-nginx/internal/sets"
"k8s.io/ingress-nginx/pkg/util/sets"
)

const (
Expand Down
5 changes: 2 additions & 3 deletions internal/ingress/controller/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ import (
"k8s.io/ingress-nginx/internal/net/ssl"
"k8s.io/ingress-nginx/internal/nginx"
"k8s.io/ingress-nginx/internal/task"
"k8s.io/ingress-nginx/internal/watch"

"k8s.io/ingress-nginx/pkg/util/file"
klog "k8s.io/klog/v2"
Expand Down Expand Up @@ -172,7 +171,7 @@ func NewNGINXController(config *Configuration, mc metric.Collector) *NGINXContro

n.t = ngxTpl

_, err = watch.NewFileWatcher(nginx.TemplatePath, onTemplateChange)
_, err = file.NewFileWatcher(nginx.TemplatePath, onTemplateChange)
if err != nil {
klog.Fatalf("Error creating file watcher for %v: %v", nginx.TemplatePath, err)
}
Expand All @@ -196,7 +195,7 @@ func NewNGINXController(config *Configuration, mc metric.Collector) *NGINXContro
}

for _, f := range filesToWatch {
_, err = watch.NewFileWatcher(f, func() {
_, err = file.NewFileWatcher(f, func() {
klog.InfoS("File changed detected. Reloading NGINX", "path", f)
n.syncQueue.EnqueueTask(task.GetDummyObject("file-change"))
})
Expand Down
2 changes: 1 addition & 1 deletion internal/ingress/types_equals.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package ingress

import (
"k8s.io/ingress-nginx/internal/sets"
"k8s.io/ingress-nginx/pkg/util/sets"
)

// Equal tests for equality between two Configuration types
Expand Down
7 changes: 3 additions & 4 deletions internal/net/ssl/ssl.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ import (
"k8s.io/ingress-nginx/internal/ingress"

ngx_config "k8s.io/ingress-nginx/internal/ingress/controller/config"
"k8s.io/ingress-nginx/internal/watch"

"k8s.io/ingress-nginx/pkg/util/file"

klog "k8s.io/klog/v2"
)

Expand Down Expand Up @@ -509,8 +508,8 @@ func NewTLSListener(certificate, key string) *TLSListener {

l.load()

_, _ = watch.NewFileWatcher(certificate, l.load)
_, _ = watch.NewFileWatcher(key, l.load)
_, _ = file.NewFileWatcher(certificate, l.load)
_, _ = file.NewFileWatcher(key, l.load)

return &l
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package watch
package file

import (
"log"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package watch
package file

import (
"os"
"path"
"path/filepath"
"testing"
"time"

"k8s.io/ingress-nginx/pkg/util/file"
)

func prepareTimeout() chan bool {
Expand Down Expand Up @@ -61,7 +59,7 @@ func TestFileWatcher(t *testing.T) {
t.Fatalf("expected no events before writing a file")
case <-timeoutChan:
}
os.WriteFile(f.Name(), []byte{}, file.ReadWriteByUser)
os.WriteFile(f.Name(), []byte{}, ReadWriteByUser)
select {
case <-events:
case <-timeoutChan:
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 7304086

Please sign in to comment.