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

Local building improvements #1135

Merged
merged 1 commit into from
Jun 13, 2024
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
default: build

GOOS=linux
GOARCH?=amd64
GOARCH?=$(shell go env GOARCH)
GIT_REPO=$(shell git config --get remote.origin.url)
GIT_COMMIT=git-$(shell git rev-parse --short HEAD)
VERSION_PKG=github.com/jcmoraisjr/haproxy-ingress/pkg/version
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,12 @@ Dependencies to run locally:

* Golang
* HAProxy compiled with `USE_OPENSSL=1` and `USE_LUA=1`
* [golangci-lint](https://golangci-lint.run/) is used when running `make lint` or `make test` targets
* Lua with `lua-json` (`luarocks install lua-json`) if using Auth External or OAuth
* Kubernetes network should be reachable from the local machine for a proper e2e test

**Building container image:**

Fast build - cross compile for linux/amd64 (locally) and generate `localhost/haproxy-ingress:latest`:
Fast build - cross compile for linux (locally) and generate `localhost/haproxy-ingress:latest`:

```
make image
Expand Down
8 changes: 4 additions & 4 deletions pkg/controller/services/svcleader.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ func initSvcLeader(ctx context.Context, cfg *config.Config) (*svcLeader, error)
RenewDeadline: defaultRenewDeadline,
RetryPeriod: defaultRetryPeriod,
Callbacks: leaderelection.LeaderCallbacks{
OnStartedLeading: s.OnStartedLeading,
OnStoppedLeading: s.OnStoppedLeading,
OnStartedLeading: s.onStartedLeading,
OnStoppedLeading: s.onStoppedLeading,
},
})
if err != nil {
Expand Down Expand Up @@ -101,7 +101,7 @@ func (s *svcLeader) Start(ctx context.Context) error {
return nil
}

func (s *svcLeader) OnStartedLeading(ctx context.Context) {
func (s *svcLeader) onStartedLeading(ctx context.Context) {
s.log.Info("leader acquired")

ctxwg, cancel := context.WithCancel(ctx)
Expand All @@ -120,7 +120,7 @@ func (s *svcLeader) OnStartedLeading(ctx context.Context) {
}
}

func (s *svcLeader) OnStoppedLeading() {
func (s *svcLeader) onStoppedLeading() {
for _, f := range s.subscribers {
go f(s.ctx, false)
}
Expand Down
3 changes: 0 additions & 3 deletions pkg/controller/services/svcstatusing.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ import (
)

func initSvcStatusIng(ctx context.Context, config *config.Config, client client.Client, cache *c, status svcStatusUpdateFnc) *svcStatusIng {
// TODO this service mimics the old controller behavior but it might worth
// to make a refactor, e.g. watching ingress pod updates or lb service,
// depending on how the hostname/ip are read
return &svcStatusIng{
log: logr.FromContextOrDiscard(ctx).WithName("status").WithName("ingress"),
cfg: config,
Expand Down