Skip to content

Commit

Permalink
Small documentation fixes and introduce inticontainer image for CC
Browse files Browse the repository at this point in the history
  • Loading branch information
baluchicken committed Sep 27, 2019
1 parent 94a1a82 commit 79387ab
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 7 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ volumeBindingMode: WaitForFirstConsumer
```bash
# Add your zookeeper svc name to the configuration
kubectl create -n kafka -f config/samples/simplekafkacluster.yaml
# If prometheus operator installed create the ServiceMonitors
kubectl create -n kafka -f config/sample/kafkacluster-prometheus.yaml
```

> In this case you have to install Prometheus with proper configuration if you want the Kafka-Operator to react to alerts. Again, if you need Prometheus and would like to have a fully automated and managed experience of Apache Kafka on Kubernetes please try it with [Pipeline](https://github.com/banzaicloud/pipeline).
Expand All @@ -210,6 +212,8 @@ helm repo add banzaicloud-stable https://kubernetes-charts.banzaicloud.com/
helm install --name=kafka-operator --namespace=kafka banzaicloud-stable/kafka-operator -f config/samples/example-prometheus-alerts.yaml
# Add your zookeeper svc name to the configuration
kubectl create -n kafka -f config/samples/simplekafkacluster.yaml
# If prometheus operator installed create the ServiceMonitors
kubectl create -n kafka -f config/sample/kafkacluster-prometheus.yaml
```

> In this case Prometheus will be installed and configured properly for the Kafka-Operator.
Expand Down
9 changes: 9 additions & 0 deletions api/v1beta1/kafkacluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ type CruiseControlConfig struct {
CapacityConfig string `json:"capacityConfig,omitempty"`
ClusterConfig string `json:"clusterConfig,omitempty"`
Image string `json:"image,omitempty"`
InitContainerImage string `json:"initContainerImage,omitempty"`
}

// EnvoyConfig defines the config for Envoy
Expand Down Expand Up @@ -184,6 +185,14 @@ func init() {
SchemeBuilder.Register(&KafkaCluster{}, &KafkaClusterList{})
}

//GetInitContainerImage returns the Init container image to use for CruiseControl
func (cConfig *CruiseControlConfig) GetInitContainerImage() string {
if cConfig.InitContainerImage != "" {
return cConfig.InitContainerImage
}
return "wurstmeister/kafka:2.12-2.1.0"
}

//GetLoadBalancerSourceRanges returns LoadBalancerSourceRanges to use for Envoy generated LoadBalancer
func (eConfig *EnvoyConfig) GetLoadBalancerSourceRanges() []string {
return eConfig.LoadBalancerSourceRanges
Expand Down
2 changes: 2 additions & 0 deletions charts/kafka-operator/templates/operator-kafka-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,8 @@ spec:
type: string
type: object
type: array
initContainerImage:
type: string
nodeSelector:
additionalProperties:
type: string
Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/kafka.banzaicloud.io_kafkaclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,8 @@ spec:
type: string
type: object
type: array
initContainerImage:
type: string
nodeSelector:
additionalProperties:
type: string
Expand Down
3 changes: 2 additions & 1 deletion config/samples/kafkacluster_with_ssl_groups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ spec:
clusterImage: "wurstmeister/kafka:2.12-2.1.0"
readOnlyConfig: |
auto.create.topics.enable=false
authorizer.class.name=kafka.security.auth.SimpleAclAuthorizer
allow.everyone.if.no.acl.found=false
brokerConfigGroups:
default:
storageConfigs:
Expand All @@ -34,7 +36,6 @@ spec:
brokerConfigGroup: "default"
- id: 2
brokerConfigGroup: "default"
brokeConfig:
rollingUpgradeConfig:
failureThreshold: 1
listenersConfig:
Expand Down
7 changes: 1 addition & 6 deletions pkg/resources/cruisecontrol/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,10 @@ func (r *Reconciler) deployment(log logr.Logger) runtime.Object {
volumeMount := []corev1.VolumeMount{}
initContainers := []corev1.Container{}

brokerConfig, err := util.GetBrokerConfig(r.KafkaCluster.Spec.Brokers[0], r.KafkaCluster.Spec)
if err != nil {
log.Error(err, "could not merge broker config properly")
}

if r.KafkaCluster.Spec.ListenersConfig.SSLSecrets != nil && util.IsSSLEnabledForInternalCommunication(r.KafkaCluster.Spec.ListenersConfig.InternalListeners) {
volume = append(volume, generateVolumesForSSL(r.KafkaCluster.Spec.ListenersConfig.SSLSecrets.TLSSecretName)...)
volumeMount = append(volumeMount, generateVolumeMountForSSL()...)
initContainers = append(initContainers, generateInitContainerForSSL(r.KafkaCluster.Spec.ListenersConfig.SSLSecrets.JKSPasswordName, util.GetBrokerImage(brokerConfig, r.KafkaCluster.Spec.ClusterImage), r.KafkaCluster.Name))
initContainers = append(initContainers, generateInitContainerForSSL(r.KafkaCluster.Spec.ListenersConfig.SSLSecrets.JKSPasswordName, r.KafkaCluster.Spec.CruiseControlConfig.GetInitContainerImage(), r.KafkaCluster.Name))
} else {
volumeMount = append(volumeMount, []corev1.VolumeMount{
{
Expand Down

0 comments on commit 79387ab

Please sign in to comment.