Skip to content

Commit

Permalink
Merge pull request #50 from jutley/support-disconnect
Browse files Browse the repository at this point in the history
Support Kafka client disconnect
  • Loading branch information
marshmallory authored Jan 27, 2023
2 parents 33fd4c4 + 2ad8994 commit 98d9a10
Show file tree
Hide file tree
Showing 19 changed files with 574 additions and 681 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ KIND_NODE_IMAGE_TAG ?= v1.19.11
# Setup Go

# TODO(jastang): update Go version to be in-line with the build submodule.
GO_REQUIRED_VERSION = 1.17
GO_REQUIRED_VERSION = 1.19

# Set a sane default so that the nprocs calculation below is less noisy on the initial
# loading of this file
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ parameters [here](https://github.com/bitnami/charts/tree/master/bitnami/kafka/#i
helm repo add bitnami https://charts.bitnami.com/bitnami
kubectl create ns kafka-cluster
helm upgrade --install kafka-dev -n kafka-cluster bitnami/kafka \
--version 15.0.1 \
--version 20.0.5 \
--set auth.clientProtocol=sasl \
--set deleteTopicEnable=true \
--set authorizerClassName="kafka.security.authorizer.AclAuthorizer" \
Expand Down Expand Up @@ -88,10 +88,16 @@ parameters [here](https://github.com/bitnami/charts/tree/master/bitnami/kafka/#i
sudo kubefwd svc -n kafka-cluster
```

5. (optional) Install the [kafka cli](https://github.com/twmb/kcl).
5. To run tests, export the KAFKA_PASSWORD environment variable using the password from step 2

```
export KAFKA_PASSWORD="<password-you-obtained-in-step-2>"
```

6. (optional) Install the [kafka cli](https://github.com/twmb/kcl).


6. (optional) Configure the kafka cli to talk against local Kafka installation:
7. (optional) Configure the kafka cli to talk against local Kafka installation:

1. Create a config file for the client with the following content at `~/.kcl/config.toml`:

Expand Down
10 changes: 10 additions & 0 deletions apis/acl/v1alpha1/zz_generated.managed.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apis/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ limitations under the License.
//go:generate rm -rf ../package/crds

// Generate deepcopy methodsets and CRD manifests
//go:generate go run -tags generate sigs.k8s.io/controller-tools/cmd/controller-gen object:headerFile=../hack/boilerplate.go.txt paths=./... crd:trivialVersions=true,crdVersions=v1 output:artifacts:config=../package/crds
//go:generate go run -tags generate sigs.k8s.io/controller-tools/cmd/controller-gen object:headerFile=../hack/boilerplate.go.txt paths=./... crd:crdVersions=v1 output:artifacts:config=../package/crds

// Generate crossplane-runtime methodsets (resource.Claim, etc)
//go:generate go run -tags generate github.com/crossplane/crossplane-tools/cmd/angryjet generate-methodsets --header-file=../hack/boilerplate.go.txt ./...
Expand Down
10 changes: 10 additions & 0 deletions apis/topic/v1alpha1/zz_generated.managed.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apis/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build
4 changes: 1 addition & 3 deletions cmd/provider/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/log/zap"

"github.com/crossplane/crossplane-runtime/pkg/logging"
"github.com/crossplane/crossplane-runtime/pkg/ratelimiter"

"github.com/crossplane-contrib/provider-kafka/apis"
"github.com/crossplane-contrib/provider-kafka/internal/controller"
Expand Down Expand Up @@ -61,8 +60,7 @@ func main() {
})
kingpin.FatalIfError(err, "Cannot create controller manager")

rl := ratelimiter.NewDefaultProviderRateLimiter(ratelimiter.DefaultProviderRPS)
kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add Kafka APIs to scheme")
kingpin.FatalIfError(controller.Setup(mgr, log, rl), "Cannot setup Kafka controllers")
kingpin.FatalIfError(controller.Setup(mgr, log), "Cannot setup Kafka controllers")
kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager")
}
114 changes: 60 additions & 54 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,87 +1,93 @@
module github.com/crossplane-contrib/provider-kafka

go 1.17
go 1.19

require (
github.com/aws/aws-sdk-go v1.44.96
github.com/crossplane/crossplane-runtime v0.15.0
github.com/crossplane/crossplane-tools v0.0.0-20210320162312-1baca298c527
github.com/google/go-cmp v0.5.8
github.com/crossplane/crossplane-runtime v0.19.0
github.com/crossplane/crossplane-tools v0.0.0-20220901191540-806c0b01097b
github.com/google/go-cmp v0.5.9
github.com/pkg/errors v0.9.1
github.com/twmb/franz-go v1.2.3
github.com/twmb/franz-go/pkg/kadm v0.0.0-20211102021212-9a7f9860bbb6
github.com/twmb/franz-go/pkg/kmsg v0.0.0-20211104051938-70808186d5f7
gopkg.in/alecthomas/kingpin.v2 v2.2.6
k8s.io/api v0.21.3
k8s.io/apimachinery v0.21.3
k8s.io/client-go v0.21.3
sigs.k8s.io/controller-runtime v0.9.6
sigs.k8s.io/controller-tools v0.6.2
k8s.io/api v0.26.1
k8s.io/apimachinery v0.26.1
sigs.k8s.io/controller-runtime v0.14.1
sigs.k8s.io/controller-tools v0.11.1
)

require (
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect
github.com/alecthomas/units v0.0.0-20210912230133-d1bdfacee922 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/dave/jennifer v1.3.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/dave/jennifer v1.4.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/evanphx/json-patch v4.11.0+incompatible // indirect
github.com/fatih/color v1.12.0 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-logr/logr v0.4.0 // indirect
github.com/go-logr/zapr v0.4.0 // indirect
github.com/gobuffalo/flect v0.2.3 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/zapr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/gobuffalo/flect v0.3.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/uuid v1.1.2 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/json-iterator/go v1.1.11 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.13.6 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-colorable v0.1.9 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pierrec/lz4/v4 v4.1.8 // indirect
github.com/prometheus/client_golang v1.11.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.26.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cobra v1.2.1 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/spf13/afero v1.8.0 // indirect
github.com/spf13/cobra v1.6.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/twmb/go-rbtree v1.0.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.18.1 // indirect
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
golang.org/x/mod v0.4.2 // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602 // indirect
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
golang.org/x/tools v0.1.5 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/crypto v0.1.0 // indirect
golang.org/x/mod v0.7.0 // indirect
golang.org/x/net v0.4.0 // indirect
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/term v0.3.0 // indirect
golang.org/x/text v0.5.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.4.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.26.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/apiextensions-apiserver v0.21.3 // indirect
k8s.io/component-base v0.21.3 // indirect
k8s.io/klog/v2 v2.8.0 // indirect
k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7 // indirect
k8s.io/utils v0.0.0-20210722164352-7f3ee0f31471 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.26.1 // indirect
k8s.io/client-go v0.26.1 // indirect
k8s.io/component-base v0.26.1 // indirect
k8s.io/klog/v2 v2.80.1 // indirect
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect
k8s.io/utils v0.0.0-20221128185143-99ec85e7a448 // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
Loading

0 comments on commit 98d9a10

Please sign in to comment.