Skip to content

Commit e62408c

Browse files
committed
kafka 3.8 / 3.9
1 parent 71d0761 commit e62408c

20 files changed

+87
-63
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM --platform=$BUILDPLATFORM golang:1.22-alpine3.19 as builder
1+
FROM --platform=$BUILDPLATFORM golang:1.22-alpine3.19 AS builder
22
RUN apk add alpine-sdk ca-certificates
33

44
ARG TARGETOS

Dockerfile.all

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM --platform=$BUILDPLATFORM golang:1.22-alpine3.19 as builder
1+
FROM --platform=$BUILDPLATFORM golang:1.22-alpine3.19 AS builder
22
RUN apk add alpine-sdk ca-certificates
33

44
ARG TARGETOS

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ VERSION ?= $(shell git describe --tags --always --dirty)
1010
GOPKGS = $(shell go list ./... | grep -v /vendor/)
1111
BUILD_FLAGS ?=
1212
LDFLAGS ?= -X github.com/grepplabs/kafka-proxy/config.Version=$(VERSION) -w -s
13-
TAG ?= "v0.3.11"
13+
TAG ?= "v0.3.12"
1414
GOOS ?= $(if $(TARGETOS),$(TARGETOS),linux)
1515
GOARCH ?= $(if $(TARGETARCH),$(TARGETARCH),amd64)
1616
GOARM ?= $(TARGETVARIANT)

README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,19 @@ As not every Kafka release adds new messages/versions which are relevant to the
4040
| 0.2.9 | to 2.8.0 |
4141
| 0.3.1 | to 3.4.0 |
4242
| 0.3.11 | to 3.7.0 |
43+
| 0.3.12 | to 3.9.0 |
4344

4445
### Install binary release
4546

4647
1. Download the latest release
4748

4849
Linux
4950

50-
curl -Ls https://github.com/grepplabs/kafka-proxy/releases/download/v0.3.11/kafka-proxy-v0.3.11-linux-amd64.tar.gz | tar xz
51+
curl -Ls https://github.com/grepplabs/kafka-proxy/releases/download/v0.3.12/kafka-proxy-v0.3.12-linux-amd64.tar.gz | tar xz
5152

5253
macOS
5354

54-
curl -Ls https://github.com/grepplabs/kafka-proxy/releases/download/v0.3.11/kafka-proxy-v0.3.11-darwin-amd64.tar.gz | tar xz
55+
curl -Ls https://github.com/grepplabs/kafka-proxy/releases/download/v0.3.12/kafka-proxy-v0.3.12-darwin-amd64.tar.gz | tar xz
5556

5657
2. Move the binary in to your PATH.
5758

@@ -69,7 +70,7 @@ Docker images are available on [Docker Hub](https://hub.docker.com/r/grepplabs/k
6970
7071
You can launch a kafka-proxy container for trying it out with
7172
72-
docker run --rm -p 30001-30003:30001-30003 grepplabs/kafka-proxy:0.3.11 \
73+
docker run --rm -p 30001-30003:30001-30003 grepplabs/kafka-proxy:0.3.12 \
7374
server \
7475
--bootstrap-server-mapping "localhost:19092,0.0.0.0:30001" \
7576
--bootstrap-server-mapping "localhost:29092,0.0.0.0:30002" \
@@ -88,7 +89,7 @@ Docker images with precompiled plugins located in `/opt/kafka-proxy/bin/` are ta
8889
8990
You can launch a kafka-proxy container with auth-ldap plugin for trying it out with
9091
91-
docker run --rm -p 30001-30003:30001-30003 grepplabs/kafka-proxy:0.3.11-all \
92+
docker run --rm -p 30001-30003:30001-30003 grepplabs/kafka-proxy:0.3.12-all \
9293
server \
9394
--bootstrap-server-mapping "localhost:19092,0.0.0.0:30001" \
9495
--bootstrap-server-mapping "localhost:29092,0.0.0.0:30002" \

cmd/plugin-auth-ldap/main.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"github.com/hashicorp/go-plugin"
1212
"github.com/pkg/errors"
1313
"github.com/sirupsen/logrus"
14-
"io/ioutil"
1514
"net"
1615
"net/url"
1716
"os"
@@ -317,7 +316,7 @@ func getTlsConfig(caCertFile string, insecureSkipVerify bool) (*tls.Config, erro
317316
if caCertFile == "" {
318317
return &tls.Config{InsecureSkipVerify: insecureSkipVerify}, nil
319318
} else {
320-
certData, err := ioutil.ReadFile(caCertFile)
319+
certData, err := os.ReadFile(caCertFile)
321320
if err != nil {
322321
return nil, errors.Wrapf(err, "reading certificate file %s", caCertFile)
323322
}

config/jaas.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package config
33
import (
44
"errors"
55
"fmt"
6-
"io/ioutil"
6+
"os"
77
"regexp"
88
"strings"
99
)
@@ -19,7 +19,7 @@ type JaasCredentials struct {
1919
}
2020

2121
func NewJaasCredentialFromFile(filename string) (*JaasCredentials, error) {
22-
bytes, err := ioutil.ReadFile(filename)
22+
bytes, err := os.ReadFile(filename)
2323
if err != nil {
2424
return nil, err
2525
}

config/jaas_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package config
22

33
import (
4-
"github.com/stretchr/testify/assert"
5-
"io/ioutil"
64
"os"
75
"testing"
6+
7+
"github.com/stretchr/testify/assert"
88
)
99

1010
func TestExtractsJaasCredentials(t *testing.T) {
@@ -30,7 +30,7 @@ func TestExtractsJaasCredentialsFromFile(t *testing.T) {
3030
password="veyaiThai5que0ieb5le";
3131
};
3232
`
33-
tmpFile, err := ioutil.TempFile("", "kafka-proxy-jaas-test")
33+
tmpFile, err := os.CreateTemp("", "kafka-proxy-jaas-test")
3434
assert.Nil(t, err)
3535
defer os.Remove(tmpFile.Name())
3636
defer tmpFile.Close()

pkg/libs/googleid/certs.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"encoding/json"
88
"fmt"
99
"golang.org/x/net/context/ctxhttp"
10-
"io/ioutil"
10+
"io"
1111
"math/big"
1212
"net/http"
1313
"time"
@@ -59,7 +59,7 @@ func GetCerts(ctx context.Context) (*Certs, error) {
5959
}
6060
defer resp.Body.Close()
6161

62-
body, err := ioutil.ReadAll(resp.Body)
62+
body, err := io.ReadAll(resp.Body)
6363
if err != nil {
6464
return nil, err
6565
}

pkg/libs/googleid/service_account.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ import (
1212
"golang.org/x/oauth2/google"
1313
"golang.org/x/oauth2/jws"
1414
"google.golang.org/api/oauth2/v2"
15-
"io/ioutil"
15+
"io"
1616
"net/http"
1717
"net/url"
18+
"os"
1819
"strings"
1920
"time"
2021
)
@@ -32,7 +33,7 @@ type ServiceAccountTokenSource struct {
3233
}
3334

3435
func NewServiceAccountTokenSource(credentialsFile string, targetAudience string) (*ServiceAccountTokenSource, error) {
35-
data, err := ioutil.ReadFile(credentialsFile)
36+
data, err := os.ReadFile(credentialsFile)
3637
if err != nil {
3738
return nil, err
3839
}
@@ -130,7 +131,7 @@ func doExchange(ctx context.Context, token string) ([]byte, error) {
130131
}
131132
defer resp.Body.Close()
132133

133-
body, err := ioutil.ReadAll(resp.Body)
134+
body, err := io.ReadAll(resp.Body)
134135
if err != nil {
135136
return nil, err
136137
}

pkg/libs/oidc-provider/plugin.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"encoding/json"
66
"fmt"
7-
"io/ioutil"
87
"os"
98
"sync"
109
"time"
@@ -210,7 +209,7 @@ func getTokenResponse(token string, status int) (apis.TokenResponse, error) {
210209
}
211210

212211
func getTokenSource(credentialsFilePath string, targetAud string) (idTokenSource, error) {
213-
data, err := ioutil.ReadFile(credentialsFilePath)
212+
data, err := os.ReadFile(credentialsFilePath)
214213

215214
if err != nil {
216215
return nil, err

pkg/libs/oidc/password_grant.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"encoding/json"
66
"errors"
7-
"io/ioutil"
7+
"os"
88

99
"github.com/sirupsen/logrus"
1010
"golang.org/x/oauth2"
@@ -28,7 +28,7 @@ type PasswordGrantTokenSource struct {
2828
}
2929

3030
func NewPasswordGrantTokenSource(credentialsFile string, targetAudience string) (*PasswordGrantTokenSource, error) {
31-
data, err := ioutil.ReadFile(credentialsFile)
31+
data, err := os.ReadFile(credentialsFile)
3232
source := &PasswordGrantTokenSource{}
3333

3434
if err != nil {

pkg/libs/oidc/service_account.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"encoding/json"
66
"errors"
7-
"io/ioutil"
7+
"os"
88

99
"github.com/sirupsen/logrus"
1010
"golang.org/x/oauth2/clientcredentials"
@@ -26,7 +26,7 @@ type ServiceAccountTokenSource struct {
2626
}
2727

2828
func NewServiceAccountTokenSource(credentialsFile string, targetAudience string) (*ServiceAccountTokenSource, error) {
29-
data, err := ioutil.ReadFile(credentialsFile)
29+
data, err := os.ReadFile(credentialsFile)
3030
source := &ServiceAccountTokenSource{}
3131

3232
if err != nil {

pkg/libs/util/watcher_test.go

+11-12
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package util
33
import (
44
"github.com/sirupsen/logrus"
55
"github.com/stretchr/testify/assert"
6-
"io/ioutil"
76
"os"
87
"path/filepath"
98
"sync/atomic"
@@ -16,18 +15,18 @@ func TestWatchRegularFileChange(t *testing.T) {
1615

1716
a := assert.New(t)
1817

19-
dirName, err := ioutil.TempDir("", "watcher-test-")
18+
dirName, err := os.MkdirTemp("", "watcher-test-")
2019
a.Nil(err)
2120
defer os.Remove(dirName)
2221

23-
targetSecret, err := ioutil.TempFile(dirName, "secret-")
22+
targetSecret, err := os.CreateTemp(dirName, "secret-")
2423
a.Nil(err)
2524
defer os.Remove(targetSecret.Name())
2625

2726
_, err = targetSecret.WriteString("secret1")
2827
a.Nil(err)
2928

30-
data, err := ioutil.ReadFile(targetSecret.Name())
29+
data, err := os.ReadFile(targetSecret.Name())
3130
a.Nil(err)
3231
a.Equal("secret1", string(data))
3332

@@ -59,7 +58,7 @@ func TestWatchRegularFileChange(t *testing.T) {
5958
opsFinal := atomic.LoadInt32(&ops)
6059
a.Equal(int32(1), opsFinal)
6160

62-
data, err = ioutil.ReadFile(targetSecret.Name())
61+
data, err = os.ReadFile(targetSecret.Name())
6362
a.Nil(err)
6463
a.Equal("secret1addition", string(data))
6564
}
@@ -74,23 +73,23 @@ func TestWatchLinkedFileChange(t *testing.T) {
7473
*/
7574
a := assert.New(t)
7675

77-
dirName, err := ioutil.TempDir("", "watcher-test-")
76+
dirName, err := os.MkdirTemp("", "watcher-test-")
7877
a.Nil(err)
7978
defer os.Remove(dirName)
8079

81-
dirTmp1, err := ioutil.TempDir(dirName, "tmp1-")
80+
dirTmp1, err := os.MkdirTemp(dirName, "tmp1-")
8281
a.Nil(err)
8382
defer os.Remove(dirTmp1)
8483

85-
dirTmp2, err := ioutil.TempDir(dirName, "tmp2-")
84+
dirTmp2, err := os.MkdirTemp(dirName, "tmp2-")
8685
a.Nil(err)
8786
defer os.Remove(dirTmp2)
8887

89-
targetSecret1, err := ioutil.TempFile(dirTmp1, "secret-")
88+
targetSecret1, err := os.CreateTemp(dirTmp1, "secret-")
9089
a.Nil(err)
9190
defer os.Remove(targetSecret1.Name())
9291

93-
targetSecret2, err := ioutil.TempFile(dirTmp2, "secret-")
92+
targetSecret2, err := os.CreateTemp(dirTmp2, "secret-")
9493
a.Nil(err)
9594
defer os.Remove(targetSecret2.Name())
9695

@@ -110,7 +109,7 @@ func TestWatchLinkedFileChange(t *testing.T) {
110109
a.Nil(err)
111110
defer os.Remove(secretLink)
112111

113-
data, err := ioutil.ReadFile(secretLink)
112+
data, err := os.ReadFile(secretLink)
114113
a.Nil(err)
115114
a.Equal("secret1", string(data))
116115

@@ -145,7 +144,7 @@ func TestWatchLinkedFileChange(t *testing.T) {
145144
opsFinal := atomic.LoadInt32(&ops)
146145
a.Equal(int32(1), opsFinal)
147146

148-
data, err = ioutil.ReadFile(secretLink)
147+
data, err = os.ReadFile(secretLink)
149148
a.Nil(err)
150149
a.Equal("secret2", string(data))
151150
}

proxy/processor_default.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ func (handler *DefaultRequestHandler) mustReply(requestKeyVersion *protocol.Requ
159159
return false, nil, err
160160
}
161161

162-
case 3, 4, 5, 6, 7, 8, 9, 10:
162+
case 3, 4, 5, 6, 7, 8, 9, 10, 11:
163163
// CorrelationID + ClientID
164164
if err = acksReader.ReadAndDiscardHeaderV1Part(reader); err != nil {
165165
return false, nil, err

proxy/protocol/request_key_version.go

+26
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,32 @@ func (r *RequestKeyVersion) ResponseHeaderVersion() int16 {
360360
return 1
361361
case 74: // ListClientMetricsResources
362362
return 1
363+
case 75: // DescribeTopicPartitions
364+
return 1
365+
case 76: // ShareGroupHeartbeat
366+
return 1
367+
case 77: // ShareGroupDescribe
368+
return 1
369+
case 78: // ShareFetch
370+
return 1
371+
case 79: // ShareAcknowledge
372+
return 1
373+
case 80: // AddRaftVoter
374+
return 1
375+
case 81: // RemoveRaftVoter
376+
return 1
377+
case 82: // UpdateRaftVoter
378+
return 1
379+
case 83: // InitializeShareGroupState
380+
return 1
381+
case 84: // ReadShareGroupState
382+
return 1
383+
case 85: // WriteShareGroupState
384+
return 1
385+
case 86: // DeleteShareGroupState
386+
return 1
387+
case 87: // ReadShareGroupStateSummary
388+
return 1
363389
default:
364390
// throw new UnsupportedVersionException("Unsupported API key " + apiKey);
365391
return -1

proxy/protocol/request_produce_reader.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package protocol
33
import (
44
"encoding/binary"
55
"io"
6-
"io/ioutil"
76
)
87

98
type RequestAcksReader struct {
@@ -18,7 +17,7 @@ func (r RequestAcksReader) readAndDiscardNullableString(reader io.Reader) (err e
1817
return errInvalidStringLength
1918
}
2019
if length > 0 {
21-
if _, err = io.CopyN(ioutil.Discard, reader, int64(length)); err != nil {
20+
if _, err = io.CopyN(io.Discard, reader, int64(length)); err != nil {
2221
return err
2322
}
2423
}

proxy/protocol/response_header.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"fmt"
77
"github.com/pkg/errors"
88
"io"
9-
"io/ioutil"
109
)
1110

1211
type ResponseHeader struct {
@@ -78,7 +77,7 @@ func (r *ResponseHeaderTaggedFields) MaybeRead(reader io.Reader) ([]byte, error)
7877
} else if size == 0 {
7978
continue
8079
} else {
81-
if _, err := io.CopyN(ioutil.Discard, reader, int64(size)); err != nil {
80+
if _, err := io.CopyN(io.Discard, reader, int64(size)); err != nil {
8281
return nil, errors.Wrap(err, "error while reading tagged field data")
8382
}
8483
}

proxy/protocol/responses.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,10 @@ func createFindCoordinatorResponseSchemaVersions() []Schema {
293293
&CompactArray{Name: coordinatorsKeyName, Ty: findCoordinatorCoordinatorsSchema4},
294294
&SchemaTaggedFields{Name: "response_tagged_fields"},
295295
)
296-
return []Schema{findCoordinatorResponseV0, findCoordinatorResponseV1, findCoordinatorResponseV2, findCoordinatorResponseV3, findCoordinatorResponseV4}
296+
findCoordinatorResponseV5 := findCoordinatorResponseV4
297+
findCoordinatorResponseV6 := findCoordinatorResponseV5
298+
299+
return []Schema{findCoordinatorResponseV0, findCoordinatorResponseV1, findCoordinatorResponseV2, findCoordinatorResponseV3, findCoordinatorResponseV4, findCoordinatorResponseV5, findCoordinatorResponseV6}
297300
}
298301

299302
func modifyMetadataResponse(decodedStruct *Struct, fn config.NetAddressMappingFunc) error {

0 commit comments

Comments
 (0)