Skip to content

Commit 255df4b

Browse files
ivanmatmatiMo3m3n
authored andcommitted
REORG/MAJOR: move packages at top level.
1 parent 698397b commit 255df4b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+383
-399
lines changed

controller/types.go

Lines changed: 0 additions & 61 deletions
This file was deleted.

external.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import (
1919
"path"
2020
"path/filepath"
2121

22-
config "github.com/haproxytech/kubernetes-ingress/controller/configuration"
23-
"github.com/haproxytech/kubernetes-ingress/controller/utils"
22+
config "github.com/haproxytech/kubernetes-ingress/pkg/configuration"
23+
"github.com/haproxytech/kubernetes-ingress/pkg/utils"
2424
)
2525

2626
// When controller is not running on a containerized

main.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package main
1717
import (
1818
_ "embed"
1919
"fmt"
20+
"log"
2021
"net/http"
2122
"os"
2223
"os/signal"
@@ -26,13 +27,13 @@ import (
2627
_ "net/http/pprof"
2728

2829
"github.com/google/renameio"
29-
c "github.com/haproxytech/kubernetes-ingress/controller"
30-
"github.com/haproxytech/kubernetes-ingress/controller/annotations"
31-
config "github.com/haproxytech/kubernetes-ingress/controller/configuration"
32-
"github.com/haproxytech/kubernetes-ingress/controller/store"
33-
"github.com/haproxytech/kubernetes-ingress/controller/utils"
34-
"github.com/haproxytech/kubernetes-ingress/prometheus"
30+
config "github.com/haproxytech/kubernetes-ingress/pkg/configuration"
31+
c "github.com/haproxytech/kubernetes-ingress/pkg/controller"
32+
"github.com/haproxytech/kubernetes-ingress/pkg/controller/annotations"
33+
"github.com/haproxytech/kubernetes-ingress/pkg/store"
34+
"github.com/haproxytech/kubernetes-ingress/pkg/utils"
3535
"github.com/jessevdk/go-flags"
36+
"github.com/prometheus/client_golang/prometheus/promhttp"
3637
)
3738

3839
//go:embed fs/usr/local/etc/haproxy/haproxy.cfg
@@ -57,7 +58,12 @@ func main() {
5758
return
5859
}
5960

60-
go prometheus.Start(osArgs)
61+
if osArgs.PromotheusPort != 0 {
62+
http.Handle("/metrics", promhttp.Handler())
63+
go func() {
64+
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", osArgs.PromotheusPort), nil))
65+
}()
66+
}
6167

6268
logger := utils.GetLogger()
6369
logger.SetLevel(osArgs.LogLevel.LogLevel)

controller/configuration/defaults.go renamed to pkg/configuration/defaults.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package configuration
33
import (
44
"github.com/haproxytech/client-native/v2/models"
55

6-
"github.com/haproxytech/kubernetes-ingress/controller/utils"
6+
"github.com/haproxytech/kubernetes-ingress/pkg/utils"
77
)
88

99
// SetGlobal will set default values for Global section config.

controller/configuration/main.go renamed to pkg/configuration/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ import (
1919
"os"
2020
"path/filepath"
2121

22-
"github.com/haproxytech/kubernetes-ingress/controller/haproxy/certs"
23-
"github.com/haproxytech/kubernetes-ingress/controller/haproxy/maps"
24-
"github.com/haproxytech/kubernetes-ingress/controller/haproxy/rules"
25-
"github.com/haproxytech/kubernetes-ingress/controller/utils"
22+
"github.com/haproxytech/kubernetes-ingress/pkg/haproxy/certs"
23+
"github.com/haproxytech/kubernetes-ingress/pkg/haproxy/maps"
24+
"github.com/haproxytech/kubernetes-ingress/pkg/haproxy/rules"
25+
"github.com/haproxytech/kubernetes-ingress/pkg/utils"
2626
)
2727

2828
type ControllerCfg struct {

controller/annotations/annotations.go renamed to pkg/controller/annotations/annotations.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import (
66

77
"github.com/haproxytech/client-native/v2/models"
88

9-
"github.com/haproxytech/kubernetes-ingress/controller/annotations/common"
10-
"github.com/haproxytech/kubernetes-ingress/controller/annotations/global"
11-
"github.com/haproxytech/kubernetes-ingress/controller/annotations/ingress"
12-
"github.com/haproxytech/kubernetes-ingress/controller/annotations/service"
13-
"github.com/haproxytech/kubernetes-ingress/controller/haproxy/certs"
14-
"github.com/haproxytech/kubernetes-ingress/controller/haproxy/maps"
15-
"github.com/haproxytech/kubernetes-ingress/controller/haproxy/rules"
16-
"github.com/haproxytech/kubernetes-ingress/controller/store"
17-
"github.com/haproxytech/kubernetes-ingress/controller/utils"
9+
"github.com/haproxytech/kubernetes-ingress/pkg/controller/annotations/common"
10+
"github.com/haproxytech/kubernetes-ingress/pkg/controller/annotations/global"
11+
"github.com/haproxytech/kubernetes-ingress/pkg/controller/annotations/ingress"
12+
"github.com/haproxytech/kubernetes-ingress/pkg/controller/annotations/service"
13+
"github.com/haproxytech/kubernetes-ingress/pkg/haproxy/certs"
14+
"github.com/haproxytech/kubernetes-ingress/pkg/haproxy/maps"
15+
"github.com/haproxytech/kubernetes-ingress/pkg/haproxy/rules"
16+
"github.com/haproxytech/kubernetes-ingress/pkg/store"
17+
"github.com/haproxytech/kubernetes-ingress/pkg/utils"
1818
)
1919

2020
type Annotation interface {

controller/annotations/cfgSnippet.go renamed to pkg/controller/annotations/cfgSnippet.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import (
55

66
"github.com/go-test/deep"
77

8-
"github.com/haproxytech/kubernetes-ingress/controller/annotations/common"
9-
"github.com/haproxytech/kubernetes-ingress/controller/haproxy/api"
10-
"github.com/haproxytech/kubernetes-ingress/controller/store"
8+
"github.com/haproxytech/kubernetes-ingress/pkg/controller/annotations/common"
9+
"github.com/haproxytech/kubernetes-ingress/pkg/haproxy/api"
10+
"github.com/haproxytech/kubernetes-ingress/pkg/store"
1111
)
1212

1313
type CfgSnippet struct {

controller/annotations/global/hardStopAfter.go renamed to pkg/controller/annotations/global/hardStopAfter.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ package global
33
import (
44
"github.com/haproxytech/client-native/v2/models"
55

6-
"github.com/haproxytech/kubernetes-ingress/controller/annotations/common"
7-
"github.com/haproxytech/kubernetes-ingress/controller/store"
8-
"github.com/haproxytech/kubernetes-ingress/controller/utils"
6+
"github.com/haproxytech/kubernetes-ingress/pkg/controller/annotations/common"
7+
"github.com/haproxytech/kubernetes-ingress/pkg/store"
8+
"github.com/haproxytech/kubernetes-ingress/pkg/utils"
99
)
1010

1111
type HardStopAfter struct {

controller/annotations/global/logFormat.go renamed to pkg/controller/annotations/global/logFormat.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55

66
"github.com/haproxytech/client-native/v2/models"
77

8-
"github.com/haproxytech/kubernetes-ingress/controller/annotations/common"
9-
"github.com/haproxytech/kubernetes-ingress/controller/store"
8+
"github.com/haproxytech/kubernetes-ingress/pkg/controller/annotations/common"
9+
"github.com/haproxytech/kubernetes-ingress/pkg/store"
1010
)
1111

1212
type LogFormat struct {

controller/annotations/global/maxconn.go renamed to pkg/controller/annotations/global/maxconn.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55

66
"github.com/haproxytech/client-native/v2/models"
77

8-
"github.com/haproxytech/kubernetes-ingress/controller/annotations/common"
9-
"github.com/haproxytech/kubernetes-ingress/controller/store"
8+
"github.com/haproxytech/kubernetes-ingress/pkg/controller/annotations/common"
9+
"github.com/haproxytech/kubernetes-ingress/pkg/store"
1010
)
1111

1212
type Maxconn struct {

controller/annotations/global/nbthread.go renamed to pkg/controller/annotations/global/nbthread.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66

77
"github.com/haproxytech/client-native/v2/models"
88

9-
"github.com/haproxytech/kubernetes-ingress/controller/annotations/common"
10-
"github.com/haproxytech/kubernetes-ingress/controller/store"
9+
"github.com/haproxytech/kubernetes-ingress/pkg/controller/annotations/common"
10+
"github.com/haproxytech/kubernetes-ingress/pkg/store"
1111
)
1212

1313
type Nbthread struct {

controller/annotations/global/option.go renamed to pkg/controller/annotations/global/option.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import (
55

66
"github.com/haproxytech/client-native/v2/models"
77

8-
"github.com/haproxytech/kubernetes-ingress/controller/annotations/common"
9-
"github.com/haproxytech/kubernetes-ingress/controller/store"
10-
"github.com/haproxytech/kubernetes-ingress/controller/utils"
8+
"github.com/haproxytech/kubernetes-ingress/pkg/controller/annotations/common"
9+
"github.com/haproxytech/kubernetes-ingress/pkg/store"
10+
"github.com/haproxytech/kubernetes-ingress/pkg/utils"
1111
)
1212

1313
type Option struct {

controller/annotations/global/syslogServer.go renamed to pkg/controller/annotations/global/syslogServer.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import (
77

88
"github.com/haproxytech/client-native/v2/models"
99

10-
"github.com/haproxytech/kubernetes-ingress/controller/annotations/common"
11-
"github.com/haproxytech/kubernetes-ingress/controller/store"
12-
"github.com/haproxytech/kubernetes-ingress/controller/utils"
10+
"github.com/haproxytech/kubernetes-ingress/pkg/controller/annotations/common"
11+
"github.com/haproxytech/kubernetes-ingress/pkg/store"
12+
"github.com/haproxytech/kubernetes-ingress/pkg/utils"
1313
)
1414

1515
type SyslogServers struct {

controller/annotations/global/timeout.go renamed to pkg/controller/annotations/global/timeout.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import (
55

66
"github.com/haproxytech/client-native/v2/models"
77

8-
"github.com/haproxytech/kubernetes-ingress/controller/annotations/common"
9-
"github.com/haproxytech/kubernetes-ingress/controller/store"
10-
"github.com/haproxytech/kubernetes-ingress/controller/utils"
8+
"github.com/haproxytech/kubernetes-ingress/pkg/controller/annotations/common"
9+
"github.com/haproxytech/kubernetes-ingress/pkg/store"
10+
"github.com/haproxytech/kubernetes-ingress/pkg/utils"
1111
)
1212

1313
type Timeout struct {

controller/annotations/ingress/accessControl.go renamed to pkg/controller/annotations/ingress/accessControl.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import (
55
"net"
66
"strings"
77

8-
"github.com/haproxytech/kubernetes-ingress/controller/annotations/common"
9-
"github.com/haproxytech/kubernetes-ingress/controller/haproxy/maps"
10-
"github.com/haproxytech/kubernetes-ingress/controller/haproxy/rules"
11-
"github.com/haproxytech/kubernetes-ingress/controller/store"
12-
"github.com/haproxytech/kubernetes-ingress/controller/utils"
8+
"github.com/haproxytech/kubernetes-ingress/pkg/controller/annotations/common"
9+
"github.com/haproxytech/kubernetes-ingress/pkg/haproxy/maps"
10+
"github.com/haproxytech/kubernetes-ingress/pkg/haproxy/rules"
11+
"github.com/haproxytech/kubernetes-ingress/pkg/store"
12+
"github.com/haproxytech/kubernetes-ingress/pkg/utils"
1313
)
1414

1515
type AccessControl struct {

controller/annotations/ingress/basicAuth.go renamed to pkg/controller/annotations/ingress/basicAuth.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import (
44
"fmt"
55
"strings"
66

7-
"github.com/haproxytech/kubernetes-ingress/controller/annotations/common"
8-
"github.com/haproxytech/kubernetes-ingress/controller/haproxy/rules"
9-
"github.com/haproxytech/kubernetes-ingress/controller/store"
7+
"github.com/haproxytech/kubernetes-ingress/pkg/controller/annotations/common"
8+
"github.com/haproxytech/kubernetes-ingress/pkg/haproxy/rules"
9+
"github.com/haproxytech/kubernetes-ingress/pkg/store"
1010
)
1111

1212
type ReqAuth struct {

controller/annotations/ingress/hostRedirect.go renamed to pkg/controller/annotations/ingress/hostRedirect.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import (
44
"fmt"
55
"strconv"
66

7-
"github.com/haproxytech/kubernetes-ingress/controller/annotations/common"
8-
"github.com/haproxytech/kubernetes-ingress/controller/haproxy/rules"
9-
"github.com/haproxytech/kubernetes-ingress/controller/store"
7+
"github.com/haproxytech/kubernetes-ingress/pkg/controller/annotations/common"
8+
"github.com/haproxytech/kubernetes-ingress/pkg/haproxy/rules"
9+
"github.com/haproxytech/kubernetes-ingress/pkg/store"
1010
)
1111

1212
type HostRedirect struct {

controller/annotations/ingress/httpsRedirect.go renamed to pkg/controller/annotations/ingress/httpsRedirect.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import (
44
"fmt"
55
"strconv"
66

7-
"github.com/haproxytech/kubernetes-ingress/controller/annotations/common"
8-
"github.com/haproxytech/kubernetes-ingress/controller/haproxy/rules"
9-
"github.com/haproxytech/kubernetes-ingress/controller/store"
10-
"github.com/haproxytech/kubernetes-ingress/controller/utils"
7+
"github.com/haproxytech/kubernetes-ingress/pkg/controller/annotations/common"
8+
"github.com/haproxytech/kubernetes-ingress/pkg/haproxy/rules"
9+
"github.com/haproxytech/kubernetes-ingress/pkg/store"
10+
"github.com/haproxytech/kubernetes-ingress/pkg/utils"
1111
)
1212

1313
type HTTPSRedirect struct {

controller/annotations/ingress/reqCapture.go renamed to pkg/controller/annotations/ingress/reqCapture.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import (
55
"strconv"
66
"strings"
77

8-
"github.com/haproxytech/kubernetes-ingress/controller/annotations/common"
9-
"github.com/haproxytech/kubernetes-ingress/controller/haproxy/rules"
10-
"github.com/haproxytech/kubernetes-ingress/controller/store"
8+
"github.com/haproxytech/kubernetes-ingress/pkg/controller/annotations/common"
9+
"github.com/haproxytech/kubernetes-ingress/pkg/haproxy/rules"
10+
"github.com/haproxytech/kubernetes-ingress/pkg/store"
1111
)
1212

1313
type ReqCapture struct {

controller/annotations/ingress/reqPathRewrite.go renamed to pkg/controller/annotations/ingress/reqPathRewrite.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import (
44
"fmt"
55
"strings"
66

7-
"github.com/haproxytech/kubernetes-ingress/controller/annotations/common"
8-
"github.com/haproxytech/kubernetes-ingress/controller/haproxy/rules"
9-
"github.com/haproxytech/kubernetes-ingress/controller/store"
7+
"github.com/haproxytech/kubernetes-ingress/pkg/controller/annotations/common"
8+
"github.com/haproxytech/kubernetes-ingress/pkg/haproxy/rules"
9+
"github.com/haproxytech/kubernetes-ingress/pkg/store"
1010
)
1111

1212
type ReqPathRewrite struct {

controller/annotations/ingress/reqRateLimit.go renamed to pkg/controller/annotations/ingress/reqRateLimit.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import (
44
"fmt"
55
"strconv"
66

7-
"github.com/haproxytech/kubernetes-ingress/controller/annotations/common"
8-
"github.com/haproxytech/kubernetes-ingress/controller/haproxy/rules"
9-
"github.com/haproxytech/kubernetes-ingress/controller/store"
10-
"github.com/haproxytech/kubernetes-ingress/controller/utils"
7+
"github.com/haproxytech/kubernetes-ingress/pkg/controller/annotations/common"
8+
"github.com/haproxytech/kubernetes-ingress/pkg/haproxy/rules"
9+
"github.com/haproxytech/kubernetes-ingress/pkg/store"
10+
"github.com/haproxytech/kubernetes-ingress/pkg/utils"
1111
)
1212

1313
type ReqRateLimit struct {

controller/annotations/ingress/reqSetHdr.go renamed to pkg/controller/annotations/ingress/reqSetHdr.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import (
44
"fmt"
55
"strings"
66

7-
"github.com/haproxytech/kubernetes-ingress/controller/annotations/common"
8-
"github.com/haproxytech/kubernetes-ingress/controller/haproxy/rules"
9-
"github.com/haproxytech/kubernetes-ingress/controller/store"
7+
"github.com/haproxytech/kubernetes-ingress/pkg/controller/annotations/common"
8+
"github.com/haproxytech/kubernetes-ingress/pkg/haproxy/rules"
9+
"github.com/haproxytech/kubernetes-ingress/pkg/store"
1010
)
1111

1212
type SetHdr struct {

controller/annotations/ingress/reqSetHost.go renamed to pkg/controller/annotations/ingress/reqSetHost.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package ingress
22

33
import (
4-
"github.com/haproxytech/kubernetes-ingress/controller/annotations/common"
5-
"github.com/haproxytech/kubernetes-ingress/controller/haproxy/rules"
6-
"github.com/haproxytech/kubernetes-ingress/controller/store"
4+
"github.com/haproxytech/kubernetes-ingress/pkg/controller/annotations/common"
5+
"github.com/haproxytech/kubernetes-ingress/pkg/haproxy/rules"
6+
"github.com/haproxytech/kubernetes-ingress/pkg/store"
77
)
88

99
type ReqSetHost struct {

0 commit comments

Comments
 (0)