Skip to content

Commit 9791142

Browse files
author
Daniel Vaseekaran
committed
Merge branch 'master' into merge-kraft-2
2 parents bad9200 + 1f0d47f commit 9791142

38 files changed

+10701
-112
lines changed

.github/workflows/build-push-kafka-docker.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,21 @@ jobs:
2424
echo ::set-output name=version::${VERSION}
2525
echo ::set-output name=tags::${TAGS}
2626
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
27+
- name: Set up QEMU
28+
uses: docker/setup-qemu-action@v3
2729
- name: Set up Docker Buildx
28-
uses: docker/setup-buildx-action@v1
30+
uses: docker/setup-buildx-action@v3
2931
- name: Login to DockerHub
3032
if: startsWith(github.ref, 'refs/tags/')
3133
uses: docker/login-action@v1
3234
with:
3335
username: ${{ secrets.DOCKER_USERNAME }}
3436
password: ${{ secrets.DOCKER_PASSWORD }}
3537
- name: Build and push
36-
uses: docker/build-push-action@v2
38+
uses: docker/build-push-action@v5
3739
with:
3840
context: docker/kafka
41+
platforms: linux/amd64,linux/arm64
3942
push: ${{ startsWith(github.ref, 'refs/tags/') }}
4043
tags: ${{ steps.prep.outputs.tags }}
4144
labels: |

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343

4444
# Initializes the CodeQL tools for scanning.
4545
- name: Initialize CodeQL
46-
uses: github/codeql-action/init@v1
46+
uses: github/codeql-action/init@v2
4747
with:
4848
languages: ${{ matrix.language }}
4949
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -54,7 +54,7 @@ jobs:
5454
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5555
# If this step fails, then you should remove it and run the build manually (see below)
5656
- name: Autobuild
57-
uses: github/codeql-action/autobuild@v1
57+
uses: github/codeql-action/autobuild@v2
5858

5959
# ℹ️ Command-line programs to run using the OS shell.
6060
# 📚 https://git.io/JvXDl
@@ -68,4 +68,4 @@ jobs:
6868
# make release
6969

7070
- name: Perform CodeQL Analysis
71-
uses: github/codeql-action/analyze@v1
71+
uses: github/codeql-action/analyze@v2

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,20 @@ docker-build: ## Build the operator docker image.
156156
docker-push: ## Push the operator docker image.
157157
docker push ${IMG}
158158

159+
# PLATFORMS defines the target platforms for the manager image be built to provide support to multiple
160+
# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
161+
# - be able to use docker buildx. More info: https://docs.docker.com/build/buildx/
162+
# - have enabled BuildKit. More info: https://docs.docker.com/develop/develop-images/build_enhancements/
163+
# - be able to push the image to your registry (i.e. if you do not set a valid value via IMG=<myregistry/image:<tag>> then the export will fail)
164+
# To adequately provide solutions that are compatible with multiple platforms, you should consider using this option.
165+
PLATFORMS ?= linux/arm64,linux/amd64
166+
.PHONY: docker-buildx
167+
docker-buildx: ## Build and push docker image for the manager for cross-platform support
168+
- docker buildx create --name koperator-builder
169+
docker buildx use koperator-builder
170+
docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile .
171+
- docker buildx rm koperator-builder
172+
159173
bin/controller-gen: bin/controller-gen-$(CONTROLLER_GEN_VERSION) ## Symlink controller-gen-<version> into versionless controller-gen.
160174
@ln -sf controller-gen-$(CONTROLLER_GEN_VERSION) bin/controller-gen
161175

api/go.mod

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require (
77
emperror.dev/errors v0.8.1
88
github.com/banzaicloud/istio-client-go v0.0.17
99
github.com/cert-manager/cert-manager v1.13.2
10-
github.com/stretchr/testify v1.8.4
10+
// github.com/stretchr/testify v1.8.4
1111
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
1212
gotest.tools v2.2.0+incompatible
1313
k8s.io/api v0.28.4
@@ -16,7 +16,7 @@ require (
1616
)
1717

1818
require (
19-
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
19+
// github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
2020
github.com/go-logr/logr v1.3.0 // indirect
2121
github.com/gogo/protobuf v1.3.2 // indirect
2222
github.com/google/go-cmp v0.5.9 // indirect
@@ -25,15 +25,18 @@ require (
2525
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
2626
github.com/modern-go/reflect2 v1.0.2 // indirect
2727
github.com/pkg/errors v0.9.1 // indirect
28-
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
28+
// github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
2929
go.uber.org/multierr v1.11.0 // indirect
3030
golang.org/x/net v0.18.0 // indirect
3131
golang.org/x/text v0.14.0 // indirect
3232
gopkg.in/inf.v0 v0.9.1 // indirect
3333
gopkg.in/yaml.v2 v2.4.0 // indirect
34-
gopkg.in/yaml.v3 v3.0.1 // indirect
34+
// gopkg.in/yaml.v3 v3.0.1 // indirect
3535
k8s.io/klog/v2 v2.110.1 // indirect
3636
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
3737
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
3838
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
3939
)
40+
41+
// remove once https://github.com/cert-manager/cert-manager/issues/5953 is fixed
42+
replace github.com/Venafi/vcert/v4 => github.com/jetstack/vcert/v4 v4.9.6-0.20230127103832-3aa3dfd6613d

api/v1beta1/kafkacluster_types.go

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ type KafkaClusterSpec struct {
178178
RollingUpgradeConfig RollingUpgradeConfig `json:"rollingUpgradeConfig"`
179179
// Selector for broker pods that need to be recycled/reconciled
180180
TaintedBrokersSelector *metav1.LabelSelector `json:"taintedBrokersSelector,omitempty"`
181-
// +kubebuilder:validation:Enum=envoy;istioingress
181+
// +kubebuilder:validation:Enum=envoy;contour;istioingress
182182
// IngressController specifies the type of the ingress controller to be used for external listeners. The `istioingress` ingress controller type requires the `spec.istioControlPlane` field to be populated as well.
183183
IngressController string `json:"ingressController,omitempty"`
184184
// IstioControlPlane is a reference to the IstioControlPlane resource for envoy configuration. It must be specified if istio ingress is used.
@@ -190,13 +190,14 @@ type KafkaClusterSpec struct {
190190
// when false, they will be kept so the Kafka cluster remains available for those Kafka clients which are still using the previous ingress setting.
191191
// +kubebuilder:default=false
192192
// +optional
193-
RemoveUnusedIngressResources bool `json:"removeUnusedIngressResources,omitempty"`
194-
PropagateLabels bool `json:"propagateLabels,omitempty"`
195-
CruiseControlConfig CruiseControlConfig `json:"cruiseControlConfig"`
196-
EnvoyConfig EnvoyConfig `json:"envoyConfig,omitempty"`
197-
MonitoringConfig MonitoringConfig `json:"monitoringConfig,omitempty"`
198-
AlertManagerConfig *AlertManagerConfig `json:"alertManagerConfig,omitempty"`
199-
IstioIngressConfig IstioIngressConfig `json:"istioIngressConfig,omitempty"`
193+
RemoveUnusedIngressResources bool `json:"removeUnusedIngressResources,omitempty"`
194+
PropagateLabels bool `json:"propagateLabels,omitempty"`
195+
CruiseControlConfig CruiseControlConfig `json:"cruiseControlConfig"`
196+
EnvoyConfig EnvoyConfig `json:"envoyConfig,omitempty"`
197+
ContourIngressConfig ContourIngressConfig `json:"contourIngressConfig,omitempty"`
198+
MonitoringConfig MonitoringConfig `json:"monitoringConfig,omitempty"`
199+
AlertManagerConfig *AlertManagerConfig `json:"alertManagerConfig,omitempty"`
200+
IstioIngressConfig IstioIngressConfig `json:"istioIngressConfig,omitempty"`
200201
// Envs defines environment variables for Kafka broker Pods.
201202
// Adding the "+" prefix to the name prepends the value to that environment variable instead of overwriting it.
202203
// Add the "+" suffix to append.
@@ -624,6 +625,10 @@ func (c IngressServiceSettings) GetServiceType() corev1.ServiceType {
624625
return c.ServiceType
625626
}
626627

628+
func (c ContourIngressConfig) GetBrokerFqdn(brokerId int32) string {
629+
return strings.Replace(c.BrokerFQDNTemplate, "%id", strconv.Itoa(int(brokerId)), 1)
630+
}
631+
627632
// Replace %id in brokerHostnameTemplate with actual broker id
628633
func (c EnvoyConfig) GetBrokerHostname(brokerId int32) string {
629634
return strings.Replace(c.BrokerHostnameTemplate, "%id", strconv.Itoa(int(brokerId)), 1)
@@ -704,7 +709,7 @@ type ExternalListenerConfig struct {
704709
// IngressControllerTargetPort defines the container port that the ingress controller uses for handling external traffic.
705710
// If not defined, 29092 will be used as the default IngressControllerTargetPort value.
706711
IngressControllerTargetPort *int32 `json:"ingressControllerTargetPort,omitempty"`
707-
// +kubebuilder:validation:Enum=LoadBalancer;NodePort
712+
// +kubebuilder:validation:Enum=LoadBalancer;NodePort;ClusterIP
708713
// accessMethod defines the method which the external listener is exposed through.
709714
// Two types are supported LoadBalancer and NodePort.
710715
// The recommended and default is the LoadBalancer.
@@ -727,8 +732,16 @@ type Config struct {
727732

728733
type IngressConfig struct {
729734
IngressServiceSettings `json:",inline"`
730-
IstioIngressConfig *IstioIngressConfig `json:"istioIngressConfig,omitempty"`
731-
EnvoyConfig *EnvoyConfig `json:"envoyConfig,omitempty"`
735+
IstioIngressConfig *IstioIngressConfig `json:"istioIngressConfig,omitempty"`
736+
EnvoyConfig *EnvoyConfig `json:"envoyConfig,omitempty"`
737+
ContourIngressConfig *ContourIngressConfig `json:"contourIngressConfig,omitempty"`
738+
}
739+
740+
type ContourIngressConfig struct {
741+
// TLS secret used for Contour IngressRoute resource
742+
TLSSecretName string `json:"tlsSecretName"`
743+
// Broker hostname template for Contour IngressRoute resource to generate broker hostnames.
744+
BrokerFQDNTemplate string `json:"brokerFQDNTemplate"`
732745
}
733746

734747
// InternalListenerConfig defines the internal listener config for Kafka
@@ -766,6 +779,9 @@ type CommonListenerSpec struct {
766779
// At least one of the listeners should have this flag enabled
767780
// +optional
768781
UsedForInnerBrokerCommunication bool `json:"usedForInnerBrokerCommunication"`
782+
// UsedForKafkaAdminCommunication allows for a different port to be returned when the koperator is checking for the port to use to check if kafka is operating.
783+
// +optional
784+
UsedForKafkaAdminCommunication bool `json:"usedForKafkaAdminCommunication,omitempty"`
769785
}
770786

771787
func (c *CommonListenerSpec) GetServerSSLCertSecretName() string {

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/kafka-operator/crds/kafkaclusters.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12919,6 +12919,19 @@ spec:
1291912919
type: string
1292012920
clusterWideConfig:
1292112921
type: string
12922+
contourIngressConfig:
12923+
properties:
12924+
brokerFQDNTemplate:
12925+
description: Broker hostname template for Contour IngressRoute
12926+
resource to generate broker hostnames.
12927+
type: string
12928+
tlsSecretName:
12929+
description: TLS secret used for Contour IngressRoute resource
12930+
type: string
12931+
required:
12932+
- brokerFQDNTemplate
12933+
- tlsSecretName
12934+
type: object
1292212935
cruiseControlConfig:
1292312936
description: CruiseControlConfig defines the config for Cruise Control
1292412937
properties:
@@ -18837,6 +18850,7 @@ spec:
1883718850
as well.
1883818851
enum:
1883918852
- envoy
18853+
- contour
1884018854
- istioingress
1884118855
type: string
1884218856
istioControlPlane:
@@ -19197,6 +19211,7 @@ spec:
1919719211
enum:
1919819212
- LoadBalancer
1919919213
- NodePort
19214+
- ClusterIP
1920019215
type: string
1920119216
anyCastPort:
1920219217
description: configuring AnyCastPort allows kafka cluster
@@ -19216,6 +19231,21 @@ spec:
1921619231
ingressConfig:
1921719232
additionalProperties:
1921819233
properties:
19234+
contourIngressConfig:
19235+
properties:
19236+
brokerFQDNTemplate:
19237+
description: Broker hostname template for
19238+
Contour IngressRoute resource to generate
19239+
broker hostnames.
19240+
type: string
19241+
tlsSecretName:
19242+
description: TLS secret used for Contour IngressRoute
19243+
resource
19244+
type: string
19245+
required:
19246+
- brokerFQDNTemplate
19247+
- tlsSecretName
19248+
type: object
1921919249
envoyConfig:
1922019250
description: EnvoyConfig defines the config for
1922119251
Envoy
@@ -21673,6 +21703,11 @@ spec:
2167321703
description: At least one of the listeners should have this
2167421704
flag enabled
2167521705
type: boolean
21706+
usedForKafkaAdminCommunication:
21707+
description: UsedForKafkaAdminCommunication allows for a
21708+
different port to be returned when the koperator is checking
21709+
for the port to use to check if kafka is operating.
21710+
type: boolean
2167621711
required:
2167721712
- containerPort
2167821713
- externalStartingPort
@@ -21749,6 +21784,11 @@ spec:
2174921784
description: At least one of the listeners should have this
2175021785
flag enabled
2175121786
type: boolean
21787+
usedForKafkaAdminCommunication:
21788+
description: UsedForKafkaAdminCommunication allows for a
21789+
different port to be returned when the koperator is checking
21790+
for the port to use to check if kafka is operating.
21791+
type: boolean
2175221792
required:
2175321793
- containerPort
2175421794
- name

config/base/crds/kafka.banzaicloud.io_kafkaclusters.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12919,6 +12919,19 @@ spec:
1291912919
type: string
1292012920
clusterWideConfig:
1292112921
type: string
12922+
contourIngressConfig:
12923+
properties:
12924+
brokerFQDNTemplate:
12925+
description: Broker hostname template for Contour IngressRoute
12926+
resource to generate broker hostnames.
12927+
type: string
12928+
tlsSecretName:
12929+
description: TLS secret used for Contour IngressRoute resource
12930+
type: string
12931+
required:
12932+
- brokerFQDNTemplate
12933+
- tlsSecretName
12934+
type: object
1292212935
cruiseControlConfig:
1292312936
description: CruiseControlConfig defines the config for Cruise Control
1292412937
properties:
@@ -18837,6 +18850,7 @@ spec:
1883718850
as well.
1883818851
enum:
1883918852
- envoy
18853+
- contour
1884018854
- istioingress
1884118855
type: string
1884218856
istioControlPlane:
@@ -19197,6 +19211,7 @@ spec:
1919719211
enum:
1919819212
- LoadBalancer
1919919213
- NodePort
19214+
- ClusterIP
1920019215
type: string
1920119216
anyCastPort:
1920219217
description: configuring AnyCastPort allows kafka cluster
@@ -19216,6 +19231,21 @@ spec:
1921619231
ingressConfig:
1921719232
additionalProperties:
1921819233
properties:
19234+
contourIngressConfig:
19235+
properties:
19236+
brokerFQDNTemplate:
19237+
description: Broker hostname template for
19238+
Contour IngressRoute resource to generate
19239+
broker hostnames.
19240+
type: string
19241+
tlsSecretName:
19242+
description: TLS secret used for Contour IngressRoute
19243+
resource
19244+
type: string
19245+
required:
19246+
- brokerFQDNTemplate
19247+
- tlsSecretName
19248+
type: object
1921919249
envoyConfig:
1922019250
description: EnvoyConfig defines the config for
1922119251
Envoy
@@ -21673,6 +21703,11 @@ spec:
2167321703
description: At least one of the listeners should have this
2167421704
flag enabled
2167521705
type: boolean
21706+
usedForKafkaAdminCommunication:
21707+
description: UsedForKafkaAdminCommunication allows for a
21708+
different port to be returned when the koperator is checking
21709+
for the port to use to check if kafka is operating.
21710+
type: boolean
2167621711
required:
2167721712
- containerPort
2167821713
- externalStartingPort
@@ -21749,6 +21784,11 @@ spec:
2174921784
description: At least one of the listeners should have this
2175021785
flag enabled
2175121786
type: boolean
21787+
usedForKafkaAdminCommunication:
21788+
description: UsedForKafkaAdminCommunication allows for a
21789+
different port to be returned when the koperator is checking
21790+
for the port to use to check if kafka is operating.
21791+
type: boolean
2175221792
required:
2175321793
- containerPort
2175421794
- name

0 commit comments

Comments
 (0)