Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle upgrade kafka from zookeeper to kraft #1284

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

ldpliu
Copy link
Contributor

@ldpliu ldpliu commented Dec 17, 2024

Summary

Related issue(s)

Fixes #
https://issues.redhat.com/browse/ACM-16108

Tests

  • Unit/function tests have been added and incorporated into make unit-tests.
  • Integration tests have been added and incorporated into make integration-test.
  • E2E tests have been added and incorporated into make e2e-test-all.
  • List other manual tests you have done.

@ldpliu ldpliu force-pushed the kafka-upgrade branch 5 times, most recently from e6b8013 to 09f9a2d Compare December 18, 2024 06:23
@@ -1,7 +1,7 @@
apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaNodePool
metadata:
name: kafka
name: kraft
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why change the name to Kraft? It seems wired to name a resource to kraft.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why change the name to Kraft? It seems wired to name a resource to kraft.

If we do not change the name, the pvc will conflict in upgrade env.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kraft is an algorithm. Maybe we can just name it kafka-node-pool or kafka-cluster to distinguish it from the original one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kraft is an algorithm. Maybe we can just name it kafka-node-pool or kafka-cluster to distinguish it from the original one.

Sure, we could change it, @clyang82 what's your suggestion?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about use name: "global-hub" as kafkanodepool name

Copy link
Member

@yanmxa yanmxa Dec 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are several options for now:

  • global-hub
  • global-hub-kafka
  • multicluster-global-hub-kafka
  • kafka-cluster
  • kafka-node-pool

I suggest using the name multicluster-global-hub-kafka for the built-in Kafka, which aligns with the built-in Postgres(multicluster-global-hub-postgresql)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: you can define the nodepool instance with multicluster-global-hub, and all the broker instances will automatically have the suffix -kafka, if I recall correctly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to use kraft as a name, and then the kafka pod name can be kafka-kraft-0. it is easy to understand the kafka is use kraft mode.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, it looks like we have the final decision. Let's go with the name kraft

@@ -22,6 +22,7 @@ List all annotations are used by multicluster global hub.
|global-hub.open-cluster-management.io/import-cluster-in-hosted=true\|false | This annotation is used to identify if managedhub cluster should be imported in hosted mode |
| global-hub.open-cluster-management.io/with-inventory | This annotation is used to identify the common inventory is deployed. |
| global-hub.open-cluster-management.io/with-stackrox-integration | This annotation enables the experimental integration with [Stackrox](https://github.com/stackrox).|
| global-hub.open-cluster-management.io/resync-kafka-client-secret | This annotation is used to identify if the kafka client secret is resynced in agent.|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this annotation to indicate the agent should resign the client certificates?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this annotation to indicate the agent should resign the client certificates?

it means the secrete re-synced.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe use resign-kafka-client-secret or regenerate-kafka-client-secret

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you add the annotation, will it be removed by addon framework?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you add the annotation, will it be removed by addon framework?

No

@yanmxa
Copy link
Member

yanmxa commented Dec 19, 2024

Thanks @ldpliu!

It looks good to me, just the naming issue that needs to be consistent. Leave it to @clyang82~

@@ -1,7 +1,7 @@
apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaNodePool
metadata:
name: kafka
name: kraft
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to use kraft as a name, and then the kafka pod name can be kafka-kraft-0. it is easy to understand the kafka is use kraft mode.

@@ -448,7 +492,7 @@ func (k *strimziTransporter) GetConnCredential(clusterName string) (*transport.K
// topics
credential.StatusTopic = config.GetStatusTopic(clusterName)
credential.SpecTopic = config.GetSpecTopic()

credential.IsNewKafkaCluster = k.isNewKafkaCluster
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it may have a case that the value is set as true firstly and the the operator is restarted, the value is set as false.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it may have a case that the value is set as true firstly and the the operator is restarted, the value is set as false.

I think it's fine, we only use it once. after agent resynced secret, it is useless

@@ -22,6 +22,7 @@ List all annotations are used by multicluster global hub.
|global-hub.open-cluster-management.io/import-cluster-in-hosted=true\|false | This annotation is used to identify if managedhub cluster should be imported in hosted mode |
| global-hub.open-cluster-management.io/with-inventory | This annotation is used to identify the common inventory is deployed. |
| global-hub.open-cluster-management.io/with-stackrox-integration | This annotation enables the experimental integration with [Stackrox](https://github.com/stackrox).|
| global-hub.open-cluster-management.io/resync-kafka-client-secret | This annotation is used to identify if the kafka client secret is resynced in agent.|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe use resign-kafka-client-secret or regenerate-kafka-client-secret

@@ -22,6 +22,7 @@ List all annotations are used by multicluster global hub.
|global-hub.open-cluster-management.io/import-cluster-in-hosted=true\|false | This annotation is used to identify if managedhub cluster should be imported in hosted mode |
| global-hub.open-cluster-management.io/with-inventory | This annotation is used to identify the common inventory is deployed. |
| global-hub.open-cluster-management.io/with-stackrox-integration | This annotation enables the experimental integration with [Stackrox](https://github.com/stackrox).|
| global-hub.open-cluster-management.io/resync-kafka-client-secret | This annotation is used to identify if the kafka client secret is resynced in agent.|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you add the annotation, will it be removed by addon framework?

}
signedSecret := &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: kafkaConn.ClientSecretName,
Copy link
Member

@yanmxa yanmxa Dec 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the BYO case, the ClientSecretName might be empty in the kafkaConn. So, you need to assert it is not empty before retrieving the secret.

}
log.Infof("update transport config secret")

transportSecret.Annotations[constants.ResyncKafkaClientSecretAnnotation] = "true"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to confirm whether the annotation is overwritten by AppliedManifestWork or not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirmed. it will merge

Copy link
Contributor

@clyang82 clyang82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

openshift-ci bot commented Dec 19, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: clyang82, ldpliu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit dc440a5 into stolostron:main Dec 19, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants