Skip to content

Commit 7e77408

Browse files
authored
bump envtest, golangci-lint, and kind (#6088)
Signed-off-by: Bryce Palmer <[email protected]>
1 parent a5e0e28 commit 7e77408

File tree

5 files changed

+29
-8
lines changed

5 files changed

+29
-8
lines changed

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export IMAGE_VERSION = v1.24.0
99
export SIMPLE_VERSION = $(shell (test "$(shell git describe --tags)" = "$(shell git describe --tags --abbrev=0)" && echo $(shell git describe --tags)) || echo $(shell git describe --tags --abbrev=0)+git)
1010
export GIT_VERSION = $(shell git describe --dirty --tags --always)
1111
export GIT_COMMIT = $(shell git rev-parse HEAD)
12-
export K8S_VERSION = 1.24.2
12+
export K8S_VERSION = 1.25.0
1313

1414
# Build settings
1515
export TOOLS_DIR = tools/bin
@@ -57,7 +57,7 @@ fix: ## Fixup files in the repo.
5757

5858
.PHONY: setup-lint
5959
setup-lint: ## Setup the lint
60-
$(SCRIPTS_DIR)/fetch golangci-lint 1.46.2
60+
$(SCRIPTS_DIR)/fetch golangci-lint 1.50.0
6161

6262
.PHONY: lint
6363
lint: setup-lint ## Run the lint check
@@ -175,12 +175,12 @@ cluster-create::
175175

176176
.PHONY: dev-install
177177
dev-install::
178-
$(SCRIPTS_DIR)/fetch kind 0.14.0
178+
$(SCRIPTS_DIR)/fetch kind 0.16.0
179179
$(SCRIPTS_DIR)/fetch kubectl $(K8S_VERSION) # Install kubectl AFTER envtest because envtest includes its own kubectl binary
180180

181181
.PHONY: test-e2e-teardown
182182
test-e2e-teardown:
183-
$(SCRIPTS_DIR)/fetch kind 0.14.0
183+
$(SCRIPTS_DIR)/fetch kind 0.16.0
184184
$(TOOLS_DIR)/kind delete cluster --name $(KIND_CLUSTER)
185185
rm -f $(KUBECONFIG)
186186

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# entries is a list of entries to include in
2+
# release notes and/or the migration guide
3+
entries:
4+
- description: >
5+
(ansible/v1): updates the base ansible base operator event api, api server,
6+
and proxy to now have a 5 second timeout when reading the request headers.
7+
This is to prevent the possibility of a [Slowloris attack](https://www.cloudflare.com/learning/ddos/ddos-attack-tools/slowloris/).
8+
9+
# kind is one of:
10+
# - addition
11+
# - change
12+
# - deprecation
13+
# - removal
14+
# - bugfix
15+
kind: "change"
16+
17+
# Is this a breaking change?
18+
breaking: false

internal/ansible/apiserver/apiserver.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"fmt"
2020
"io"
2121
"net/http"
22+
"time"
2223

2324
logf "sigs.k8s.io/controller-runtime/pkg/log"
2425
crmetrics "sigs.k8s.io/controller-runtime/pkg/metrics"
@@ -38,8 +39,9 @@ func Run(options Options) error {
3839
mux.HandleFunc("/metrics", metricsHandler)
3940

4041
server := http.Server{
41-
Addr: fmt.Sprintf("%s:%d", options.Address, options.Port),
42-
Handler: mux,
42+
Addr: fmt.Sprintf("%s:%d", options.Address, options.Port),
43+
Handler: mux,
44+
ReadHeaderTimeout: 5 * time.Second,
4345
}
4446
log.Info("Starting to serve metrics listener", "Address", server.Addr)
4547
return server.ListenAndServe()

internal/ansible/proxy/kubectl.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,8 @@ func (s *server) ListenUnix(path string) (net.Listener, error) {
254254
// ServeOnListener starts the server using given listener, loops forever.
255255
func (s *server) ServeOnListener(l net.Listener) error {
256256
server := http.Server{
257-
Handler: s.Handler,
257+
Handler: s.Handler,
258+
ReadHeaderTimeout: 5 * time.Second,
258259
}
259260
return server.Serve(l)
260261
}

internal/ansible/runner/eventapi/eventapi.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func New(ident string, errChan chan<- error) (*EventReceiver, error) {
8080

8181
mux := http.NewServeMux()
8282
mux.HandleFunc(rec.URLPath, rec.handleEvents)
83-
srv := http.Server{Handler: mux}
83+
srv := http.Server{Handler: mux, ReadHeaderTimeout: 5 * time.Second}
8484
rec.server = &srv
8585

8686
go func() {

0 commit comments

Comments
 (0)