confluentinc / cp-ansible

Ansible playbooks for the Confluent Platform
Apache License 2.0
33 stars 406 forks source link

Should manage the Java that components run with #1241

Open erikgb opened 1 year ago

erikgb commented 1 year ago

Describe the issue We have several clusters provisioned with cp-ansible, and all clusters are currently running with Java 11. With the release of Confluent Platform 7.3, we notice that Java 17 is supported and recommended, so we want to upgrade to Java 17.

This turns out to be more difficult than expected, since it seems like cp-ansible only support first time install of Java. As cp-ansible runs all components with the default Java installed on the system, we have to add additional logic to modify the default Java, which we prefer to avoid.

IMO it would be a lot better if cp-ansible did not rely on the default Java version installed, but instead included a more specific path in the component service wrappers.

To Reproduce

  1. Provision a system with Java 11, by overriding the current default package name(s) installing Java 17.
  2. Attempt an upgrade to Java 17 by setting the package name(s) to Java 17.
  3. Observe all components still run with Java 11, even if Java 17 is installed by the updated play.

Expected behaviour

All components are updated/restarted, and runs with the Java version specified in the inventory.

Inventory File

Maybe not that relevant, but we have attempted to adjust the following variables: redhat_java_package_name, custom_java_path and install_java without being able to achieve the desired outcome.

Logs

N/A

Environment (please complete the following information):

Additional context Add any other context about the problem here.

erikgb commented 1 year ago

We managed to work around this issue by overriding a few things in our inventory:

redhat_java_package_name: java-17-openjdk
# This is (part of) a workaround for https://github.com/confluentinc/cp-ansible/issues/1241
redhat_java_home_path: /usr/lib/jvm/jre-17
kafka_broker_service_environment_overrides:
  JAVA_HOME: "{{ redhat_java_home_path }}"
zookeeper_service_environment_overrides:
  JAVA_HOME: "{{ redhat_java_home_path }}"

We only provision brokers and zookeepers (on RHEL) with cp-ansible. This can definitely be improved!

Fobhep commented 1 month ago

This seem still an issue - I can imagine with a lot of people now moving finally away from Java 8, due to deprecation - managing an automated Java Upgrade would really be an useful QoL improvement.