Skip to content

Commit

Permalink
Merge pull request #3 from adobe/master
Browse files Browse the repository at this point in the history
updatePR
  • Loading branch information
cawright-rh authored Aug 29, 2024
2 parents b37a977 + 1f0d47f commit f3593ae
Show file tree
Hide file tree
Showing 27 changed files with 9,765 additions and 72 deletions.
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,20 @@ docker-build: ## Build the operator docker image.
docker-push: ## Push the operator docker image.
docker push ${IMG}

# PLATFORMS defines the target platforms for the manager image be built to provide support to multiple
# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
# - be able to use docker buildx. More info: https://docs.docker.com/build/buildx/
# - have enabled BuildKit. More info: https://docs.docker.com/develop/develop-images/build_enhancements/
# - 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)
# To adequately provide solutions that are compatible with multiple platforms, you should consider using this option.
PLATFORMS ?= linux/arm64,linux/amd64
.PHONY: docker-buildx
docker-buildx: ## Build and push docker image for the manager for cross-platform support
- docker buildx create --name koperator-builder
docker buildx use koperator-builder
docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile .
- docker buildx rm koperator-builder

bin/controller-gen: bin/controller-gen-$(CONTROLLER_GEN_VERSION) ## Symlink controller-gen-<version> into versionless controller-gen.
@ln -sf controller-gen-$(CONTROLLER_GEN_VERSION) bin/controller-gen

Expand Down
38 changes: 27 additions & 11 deletions api/v1beta1/kafkacluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ type KafkaClusterSpec struct {
RollingUpgradeConfig RollingUpgradeConfig `json:"rollingUpgradeConfig"`
// Selector for broker pods that need to be recycled/reconciled
TaintedBrokersSelector *metav1.LabelSelector `json:"taintedBrokersSelector,omitempty"`
// +kubebuilder:validation:Enum=envoy;istioingress
// +kubebuilder:validation:Enum=envoy;contour;istioingress
// 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.
IngressController string `json:"ingressController,omitempty"`
// IstioControlPlane is a reference to the IstioControlPlane resource for envoy configuration. It must be specified if istio ingress is used.
Expand All @@ -167,13 +167,14 @@ type KafkaClusterSpec struct {
// when false, they will be kept so the Kafka cluster remains available for those Kafka clients which are still using the previous ingress setting.
// +kubebuilder:default=false
// +optional
RemoveUnusedIngressResources bool `json:"removeUnusedIngressResources,omitempty"`
PropagateLabels bool `json:"propagateLabels,omitempty"`
CruiseControlConfig CruiseControlConfig `json:"cruiseControlConfig"`
EnvoyConfig EnvoyConfig `json:"envoyConfig,omitempty"`
MonitoringConfig MonitoringConfig `json:"monitoringConfig,omitempty"`
AlertManagerConfig *AlertManagerConfig `json:"alertManagerConfig,omitempty"`
IstioIngressConfig IstioIngressConfig `json:"istioIngressConfig,omitempty"`
RemoveUnusedIngressResources bool `json:"removeUnusedIngressResources,omitempty"`
PropagateLabels bool `json:"propagateLabels,omitempty"`
CruiseControlConfig CruiseControlConfig `json:"cruiseControlConfig"`
EnvoyConfig EnvoyConfig `json:"envoyConfig,omitempty"`
ContourIngressConfig ContourIngressConfig `json:"contourIngressConfig,omitempty"`
MonitoringConfig MonitoringConfig `json:"monitoringConfig,omitempty"`
AlertManagerConfig *AlertManagerConfig `json:"alertManagerConfig,omitempty"`
IstioIngressConfig IstioIngressConfig `json:"istioIngressConfig,omitempty"`
// Envs defines environment variables for Kafka broker Pods.
// Adding the "+" prefix to the name prepends the value to that environment variable instead of overwriting it.
// Add the "+" suffix to append.
Expand Down Expand Up @@ -593,6 +594,10 @@ func (c IngressServiceSettings) GetServiceType() corev1.ServiceType {
return c.ServiceType
}

func (c ContourIngressConfig) GetBrokerFqdn(brokerId int32) string {
return strings.Replace(c.BrokerFQDNTemplate, "%id", strconv.Itoa(int(brokerId)), 1)
}

// Replace %id in brokerHostnameTemplate with actual broker id
func (c EnvoyConfig) GetBrokerHostname(brokerId int32) string {
return strings.Replace(c.BrokerHostnameTemplate, "%id", strconv.Itoa(int(brokerId)), 1)
Expand Down Expand Up @@ -673,7 +678,7 @@ type ExternalListenerConfig struct {
// IngressControllerTargetPort defines the container port that the ingress controller uses for handling external traffic.
// If not defined, 29092 will be used as the default IngressControllerTargetPort value.
IngressControllerTargetPort *int32 `json:"ingressControllerTargetPort,omitempty"`
// +kubebuilder:validation:Enum=LoadBalancer;NodePort
// +kubebuilder:validation:Enum=LoadBalancer;NodePort;ClusterIP
// accessMethod defines the method which the external listener is exposed through.
// Two types are supported LoadBalancer and NodePort.
// The recommended and default is the LoadBalancer.
Expand All @@ -696,8 +701,16 @@ type Config struct {

type IngressConfig struct {
IngressServiceSettings `json:",inline"`
IstioIngressConfig *IstioIngressConfig `json:"istioIngressConfig,omitempty"`
EnvoyConfig *EnvoyConfig `json:"envoyConfig,omitempty"`
IstioIngressConfig *IstioIngressConfig `json:"istioIngressConfig,omitempty"`
EnvoyConfig *EnvoyConfig `json:"envoyConfig,omitempty"`
ContourIngressConfig *ContourIngressConfig `json:"contourIngressConfig,omitempty"`
}

type ContourIngressConfig struct {
// TLS secret used for Contour IngressRoute resource
TLSSecretName string `json:"tlsSecretName"`
// Broker hostname template for Contour IngressRoute resource to generate broker hostnames.
BrokerFQDNTemplate string `json:"brokerFQDNTemplate"`
}

// InternalListenerConfig defines the internal listener config for Kafka
Expand Down Expand Up @@ -735,6 +748,9 @@ type CommonListenerSpec struct {
// At least one of the listeners should have this flag enabled
// +optional
UsedForInnerBrokerCommunication bool `json:"usedForInnerBrokerCommunication"`
// 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.
// +optional
UsedForKafkaAdminCommunication bool `json:"usedForKafkaAdminCommunication,omitempty"`
}

func (c *CommonListenerSpec) GetServerSSLCertSecretName() string {
Expand Down
21 changes: 21 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

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

40 changes: 40 additions & 0 deletions charts/kafka-operator/crds/kafkaclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12899,6 +12899,19 @@ spec:
type: string
clusterWideConfig:
type: string
contourIngressConfig:
properties:
brokerFQDNTemplate:
description: Broker hostname template for Contour IngressRoute
resource to generate broker hostnames.
type: string
tlsSecretName:
description: TLS secret used for Contour IngressRoute resource
type: string
required:
- brokerFQDNTemplate
- tlsSecretName
type: object
cruiseControlConfig:
description: CruiseControlConfig defines the config for Cruise Control
properties:
Expand Down Expand Up @@ -18817,6 +18830,7 @@ spec:
as well.
enum:
- envoy
- contour
- istioingress
type: string
istioControlPlane:
Expand Down Expand Up @@ -19171,6 +19185,7 @@ spec:
enum:
- LoadBalancer
- NodePort
- ClusterIP
type: string
anyCastPort:
description: configuring AnyCastPort allows kafka cluster
Expand All @@ -19190,6 +19205,21 @@ spec:
ingressConfig:
additionalProperties:
properties:
contourIngressConfig:
properties:
brokerFQDNTemplate:
description: Broker hostname template for
Contour IngressRoute resource to generate
broker hostnames.
type: string
tlsSecretName:
description: TLS secret used for Contour IngressRoute
resource
type: string
required:
- brokerFQDNTemplate
- tlsSecretName
type: object
envoyConfig:
description: EnvoyConfig defines the config for
Envoy
Expand Down Expand Up @@ -21647,6 +21677,11 @@ spec:
description: At least one of the listeners should have this
flag enabled
type: boolean
usedForKafkaAdminCommunication:
description: 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.
type: boolean
required:
- containerPort
- externalStartingPort
Expand Down Expand Up @@ -21723,6 +21758,11 @@ spec:
description: At least one of the listeners should have this
flag enabled
type: boolean
usedForKafkaAdminCommunication:
description: 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.
type: boolean
required:
- containerPort
- name
Expand Down
40 changes: 40 additions & 0 deletions config/base/crds/kafka.banzaicloud.io_kafkaclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12899,6 +12899,19 @@ spec:
type: string
clusterWideConfig:
type: string
contourIngressConfig:
properties:
brokerFQDNTemplate:
description: Broker hostname template for Contour IngressRoute
resource to generate broker hostnames.
type: string
tlsSecretName:
description: TLS secret used for Contour IngressRoute resource
type: string
required:
- brokerFQDNTemplate
- tlsSecretName
type: object
cruiseControlConfig:
description: CruiseControlConfig defines the config for Cruise Control
properties:
Expand Down Expand Up @@ -18817,6 +18830,7 @@ spec:
as well.
enum:
- envoy
- contour
- istioingress
type: string
istioControlPlane:
Expand Down Expand Up @@ -19171,6 +19185,7 @@ spec:
enum:
- LoadBalancer
- NodePort
- ClusterIP
type: string
anyCastPort:
description: configuring AnyCastPort allows kafka cluster
Expand All @@ -19190,6 +19205,21 @@ spec:
ingressConfig:
additionalProperties:
properties:
contourIngressConfig:
properties:
brokerFQDNTemplate:
description: Broker hostname template for
Contour IngressRoute resource to generate
broker hostnames.
type: string
tlsSecretName:
description: TLS secret used for Contour IngressRoute
resource
type: string
required:
- brokerFQDNTemplate
- tlsSecretName
type: object
envoyConfig:
description: EnvoyConfig defines the config for
Envoy
Expand Down Expand Up @@ -21647,6 +21677,11 @@ spec:
description: At least one of the listeners should have this
flag enabled
type: boolean
usedForKafkaAdminCommunication:
description: 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.
type: boolean
required:
- containerPort
- externalStartingPort
Expand Down Expand Up @@ -21723,6 +21758,11 @@ spec:
description: At least one of the listeners should have this
flag enabled
type: boolean
usedForKafkaAdminCommunication:
description: 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.
type: boolean
required:
- containerPort
- name
Expand Down
Loading

0 comments on commit f3593ae

Please sign in to comment.