strimzi-kafka-operator: [Bug]: TopicOperator's use of SSL and auth for Cruise Control cannot be disabled anymore

Bug Description

Starting with #9483 (which holds awesome work otherwise šŸ˜…), we found the TopicOperator will necessarily speak SSL with Cruise Control. This seems to be a regression, because in some setups, it is not easy to use SSL on Cruise Control backends, especially when using a CC front-end UI (as mentioned in this blog post’s prerequisites).

When changing a topic replication factor, the TopicOperator will throw the following error:

ReplicasChangeHandler:299 - Replicas change failed, javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake

Indeed, there is no SSL on Cruise Control side, so the Topic Operator’s attempt to negociate SSL is in vain.

We tried to change the TopicOperator’s SSL behaviour with the following configuration, but it turned out to be impossible, because the STRIMZI_CRUISE_CONTROL_SSL_ENABLED environment variable is hard-coded to true here. In the case of the following scenario, this error is thrown: User defined container template environment variable STRIMZI_CRUISE_CONTROL_SSL_ENABLED is already in use and will be ignored.

apiVersion: kafka.strimzi.io/v1beta2
kind: Kafka
metadata:
  name: test-kafka
  namespace: strimzi-test
spec:
  cruiseControl:
    config:
      webserver.security.enable: false  <-- ask Cruise Control backend to use no auth
      webserver.ssl.enable: false       <-- nor any SSL
  entityOperator:
    template:
      topicOperatorContainer:
        env:
        - name: STRIMZI_CRUISE_CONTROL_SSL_ENABLED
          value: "false"    <-- ask topicOperator not to speak SSL to Cruise Control

Thank you for your help ā¤ļø

I guess it will be necessary to modify or enrich the way the addContainerEnvsToExistingEnvs function works (for instance by making it possible to add the ā€œtrueā€ value as a default value) or is called (for instance by calling the method only after the template vars are already loaded in the configuration).

PS. Beyond auth and SSL, other parameters are also affected by this issue.

Steps to reproduce

Deploy the following resource:

apiVersion: kafka.strimzi.io/v1beta2
kind: Kafka
metadata:
  name: test-kafka
  namespace: strimzi-bug-cruise-control-no-ssl
spec:
  cruiseControl:
    config:
      webserver.security.enable: false
      webserver.ssl.enable: false
  entityOperator:
    template:
      topicOperatorContainer:
        env:
        - name: STRIMZI_CRUISE_CONTROL_SSL_ENABLED
          value: "false"
  kafka:
    replicas: 3
    resources:
      limits:
        memory: 2Gi
      requests:
        cpu: 250m
        memory: 2Gi
---
apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaTopic
metadata:
  labels:
    app: test-kafka
    strimzi.io/cluster: test-kafka
  name: test-topic
  namespace: strimzi-bug-cruise-control-no-ssl
spec:
  partitions: 12
  replicas: 1

Once the cluster is created, kubectl edit kt/test-topic to change the replication factor to 2.

Monitor the logs of the TopicOperator, especially to see the configuration printed at startup.

Expected behavior

As the default value of STRIMZI_CRUISE_CONTROL_SSL_ENABLED is false, one expects this variable not to be true. But when printed at startup, it appears to be true. Digging through, I saw the cluster operator actually adds the environment variable as a result from a hard-coded setting.

If the environment variable is manually added in the Kafka spec (see first code sample above), the cluster operator ignores it.

Strimzi version

0.41

Kubernetes version

v1.28.9-gke.1289000

Installation method

Helm Chart

Infrastructure

GKE

Configuration files and logs

No response

Additional context

The security issue with Cruise Control is addressed using native Kubernetes filtering.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (13 by maintainers)

Most upvoted comments

This is also listed in the docs: https://strimzi.io/docs/operators/latest/full/configuring.html#type-ContainerTemplate-reference

If you set a custom environment variable that is already in use by Strimzi, it is ignored and a warning is recorded in the log.

TBH, I’m not aware of any guidance for how to use Cruise Control UI in Strimzi. I’m not aware of it being covered in the documentation or anything like that. As far as I know, there was just one blog post a long time ago. I also don’t understand why would the Cruise Control UI not support TLS. If it indeed doesn’t, that is maybe something what should be contributed to Cruise Control in the first place?

But keep in mind that from the beginning, the Cruise Control integration in Strimzi was designed around the operator pattern and around the KafkaRebalance resources. Using it differently might cause problems and conflicts with the operator.