-
Notifications
You must be signed in to change notification settings - Fork 272
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
feat(operator): plain kafkasql support #5375
Conversation
import lombok.*; | ||
|
||
@JsonInclude(Include.NON_NULL) | ||
@JsonPropertyOrder({ "env", "host" }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a leftover
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@JsonPropertyDescription(""" | ||
Configure KafkaSQL storage.""") | ||
@JsonSetter(nulls = Nulls.SKIP) | ||
private ApicurioRegistry3SpecKafkaSql kafkasql = new ApicurioRegistry3SpecKafkaSql(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, being able to identify the presence of the field checking for null at the kafkasql
object level seems useful to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. So the rule is: default value for collections, null
for objects? If so we need to update ApicurioRegistry3Spec
.
} | ||
|
||
private static void applyStrimziResources(boolean delete) { | ||
String text = load("/k8s/examples/kafkasql/strimzi-cluster-operator-0.43.0.yaml"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The strimzi-cluster-operator
is huge, I think that, in this specific case, we can use the upstream installation mechanism: https://strimzi.io/install/latest
.
We can keep an eye on it and, if it starts failing too often, we can revert to dumping resources.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. However, I would prefer downloading a specific version, since we're using Strimzi Java model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're using Strimzi Java model
that's something we should aim to avoid. No need from our perspective to bind to Strimzi.
|
||
@AfterAll | ||
public static void afterAll() throws Exception { | ||
applyStrimziResources(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two comments here:
- do we need to explicitly delete resources? something is getting stuck on finalizers?
- deletion of resources in a namespace should remove detected resources, e.g. we should get from the namespace and remove. The source of truth is the cluster and not the previously applied
yaml
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
@@ -54,7 +54,7 @@ public enum OperatorDeployment { | |||
private static Operator operator; | |||
|
|||
@BeforeAll | |||
public static void before() throws Exception { | |||
public static void beforeAll() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: the operator codebase is still early and I don't mind those changes, going forward let's try to minimize those unrelated changes, and, maybe pack them in a "chore" separate PR.
Two reasons:
- git history -> is easier to follow the history of changes when they are done in isolation
- review -> it keeps things better scoped
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted. I consider this fine, since it is often easier to fix a small thing immediately if you notice it, rather than trying to remember and create micro PRs. Do you consider it a good practice to track things like these in issues? If so I'll create an issue for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to process for this, just open a PR changing just this bit and we fast-track it.
@@ -0,0 +1,36 @@ | |||
apiVersion: kafka.strimzi.io/v1beta2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should those examples
resources stay in the test
scope?
Do we need them at runtime in the Operator?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessarily in runtime, but my thinking is that we can use those examples in documentation for example, while making sure they are tested. If you have a suggestion on how to better organize this, let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider the test/resources
folder, so that they are not going to be bundled with the final JARs
operator/controller/src/main/java/io/apicurio/registry/operator/feat/KafkaSql.java
Show resolved
Hide resolved
client.resource(kafka).create(); | ||
|
||
await().ignoreExceptions().until(() -> { | ||
var status = client.resources(Kafka.class).inNamespace(namespace).withName("my-cluster").get() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a check that is not dependent on the Strimzi CR?
E.g. something that should work without code changes also for plain Kafka and RedPanda.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would welcome a specific suggestion/code from you. I added the dependency because:
- I need to read the status in the test. The alternative is using raw
JsonNode
s, or assuming what thebootstrapServers
value will be, and I don't like either of those much. - Our customers are very likely to use Strimzi/AMQ streams, so using it in our tests gives greater confidence it'll work, and provides examples for users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can get the status of the ReplicaSet
of the Kafka pods, all the checks are, anyhow happening with retries and it should be more than enough to have a stable situation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strimzi does not use ReplicaSet
btw.
operator/controller/pom.xml
Outdated
@@ -89,6 +89,12 @@ | |||
<artifactId>lombok</artifactId> | |||
<scope>provided</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>io.strimzi</groupId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we should be able to not tight the setup to Strimzi but keep it more generic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR looks in great shape now, thanks!
The last bit is to remove the dependency on Strimzi, I can help doing it if required, just let me know 👍
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to go, nice job!
final var clusterNAme = "my-cluster"; | ||
|
||
await().ignoreExceptions().untilAsserted(() -> | ||
// Strimzi uses StrimziPodSet instead of ReplicaSet, so we have to check pods |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
cbc4ab5
to
1c46f7c
Compare
No description provided.