Skip to content

Commit 650d66c

Browse files
committed
v1 API implementation and conversion tool
Signed-off-by: Jakub Scholz <www@scholzj.com>
1 parent bc4a4dc commit 650d66c

220 files changed

Lines changed: 83036 additions & 2004 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.azure/scripts/push-to-central.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ export GPG_TTY=$(tty)
1414
echo $GPG_SIGNING_KEY | base64 -d > signing.gpg
1515
gpg --batch --import signing.gpg
1616

17-
GPG_EXECUTABLE=gpg mvn $MVN_ARGS -DskipTests -s ./.azure/scripts/settings.xml -pl ./,crd-annotations,crd-generator,test,api -P central deploy
17+
GPG_EXECUTABLE=gpg mvn $MVN_ARGS -DskipTests -s ./.azure/scripts/settings.xml -pl ./,crd-annotations,crd-generator,test,api,v1-api-conversion -P central deploy
1818

1919
cleanup

.checkstyle/import-control.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,24 @@ We also control imports only in production classes and not in tests. This is con
101101
<allow class="io.strimzi.operator.common.ReconciliationLogger" />
102102
<allow class="io.strimzi.operator.common.Util" />
103103
</subpackage>
104+
105+
<subpackage name="kafka.api.conversion.v1" strategyOnMismatch="disallowed">
106+
<!-- This enforces the layering between the Strimzi Model and Operator classes in the User Operator. The Model classes are not allowed
107+
to import from Operator classes. They should only use the API classes -->
108+
109+
<!-- Common libraries and Java classes -->
110+
<allow pkg="java" />
111+
<allow pkg="javax.naming" />
112+
<allow pkg="org.apache.kafka.common" />
113+
<allow pkg="io.fabric8.kubernetes" />
114+
<allow pkg="com.fasterxml.jackson" />
115+
<allow pkg="org.yaml.snakeyaml" />
116+
<allow pkg="picocli" />
117+
<allow pkg="org.apache.logging.log4j" />
118+
<allow pkg="edu.umd.cs.findbugs.annotations" />
119+
120+
<!-- Strimzi Operators classes -->
121+
<allow pkg="io.strimzi.api" />
122+
<allow pkg="io.strimzi.kafka.api.conversion" />
123+
</subpackage>
104124
</import-control>

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* Add support for Kafka 4.0.1
66
* Set `blockOwnerDeletion` to `true` in the owner references in Strimzi managed resources.
77
Deleting the Strimzi custom resources will now by default wait for the deletion of all the owned Kubernetes resources.
8+
* Introduce the `v1` API to Strimzi CRDs and move User and Topic Operators to use it.
9+
The `v1` APi Conversion Tool can be used to convert the resources in files or in your Kubernetes cluter from the `v1beta2` API to the `v1` API.
810
* Make `.spec` sections required in the `v1` version of all Strimzi custom resources.
911
* Make `.spec.replicas` properties required in the `v1` of the `KafkaBridge`, `KafkaConnect`, and `KafkaMirrorMaker2` custom resources.
1012
* New fields `.spec.groupId`, `.spec.configStorageTopic`, `.spec.offsetStorageTopic`, and `.spec.statusStorageTopic` in the `KafkaConnect` custom resource for configuring Connect's group ID and internal topics.
@@ -14,6 +16,9 @@
1416

1517
### Major changes, deprecations, and removals
1618

19+
* **This version introduces a new API version to our CRDs.**
20+
**Before upgrading to Strimzi 0.49 or newer, make sure that you update your `KafkaUser` resources to use the `.spec.authorization.acls[]operations` field instead of the deprecated `.spec.authorization.acls[]operation`.**
21+
**Especially when using Helm, make sure that the CRDs are updated when you upgrade the operator.**
1722
* The `.status.kafkaMetadataState` field in the `Kafka` custom resource is deprecated and not used anymore.
1823
* The `type: oauth` authentication in Kafka brokers and Kafka clients (Kafka Connect, MirrorMaker 2, and Strimzi HTTP Bridge) has been deprecated.
1924
Please use the `type: custom` authentication instead.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ifneq ($(RELEASE_VERSION),latest)
1414
GITHUB_VERSION = $(RELEASE_VERSION)
1515
endif
1616

17-
SUBDIRS=kafka-agent tracing-agent crd-annotations test crd-generator api mockkube certificate-manager operator-common config-model config-model-generator cluster-operator topic-operator user-operator kafka-init systemtest docker-images/artifacts packaging/helm-charts/helm3 packaging/install packaging/examples
17+
SUBDIRS=kafka-agent tracing-agent crd-annotations test crd-generator api v1-api-conversion mockkube certificate-manager operator-common config-model config-model-generator cluster-operator topic-operator user-operator kafka-init systemtest docker-images/artifacts packaging/helm-charts/helm3 packaging/install packaging/examples
1818
DOCKERDIRS=docker-images/base docker-images/operator docker-images/kafka-based docker-images/maven-builder docker-images/kaniko-executor docker-images/buildah
1919
DOCKER_TARGETS=docker_build docker_push docker_tag docker_load docker_save docker_amend_manifest docker_push_manifest docker_sign_manifest docker_delete_manifest docker_delete_archive docker_sbom docker_push_sbom docker_e2e docker_gha_sign_manifest docker_gha_sbom docker_gha_push_sbom
2020
JAVA_TARGETS=java_build java_install java_clean

api/pom.xml

Lines changed: 125 additions & 5 deletions
Large diffs are not rendered by default.

api/src/main/java/io/strimzi/api/kafka/model/bridge/KafkaBridge.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
group = KafkaBridge.RESOURCE_GROUP,
4040
scope = KafkaBridge.SCOPE,
4141
versions = {
42-
@Crd.Spec.Version(name = Constants.V1BETA2, served = true, storage = true)
42+
@Crd.Spec.Version(name = Constants.V1, served = true, storage = false),
43+
@Crd.Spec.Version(name = Constants.V1BETA2, served = true, storage = true, deprecated = true, deprecationWarning = "Version v1beta2 of the KafkaBridge API is deprecated. Please use the v1 version instead.")
4344
},
4445
subresources = @Crd.Spec.Subresources(
4546
status = @Crd.Spec.Subresources.Status(),
@@ -84,7 +85,7 @@ public class KafkaBridge extends CustomResource<KafkaBridgeSpec, KafkaBridgeStat
8485
private static final long serialVersionUID = 1L;
8586

8687
public static final String SCOPE = Constants.SCOPE_NAMESPACED;
87-
public static final List<String> VERSIONS = List.of(Constants.V1BETA2);
88+
public static final List<String> VERSIONS = List.of(Constants.V1, Constants.V1BETA2);
8889
public static final String RESOURCE_KIND = "KafkaBridge";
8990
public static final String RESOURCE_LIST_KIND = RESOURCE_KIND + "List";
9091
public static final String RESOURCE_GROUP = Constants.RESOURCE_GROUP_NAME;

api/src/main/java/io/strimzi/api/kafka/model/connect/KafkaConnect.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
group = KafkaConnect.RESOURCE_GROUP,
4040
scope = KafkaConnect.SCOPE,
4141
versions = {
42-
@Crd.Spec.Version(name = Constants.V1BETA2, served = true, storage = true)
42+
@Crd.Spec.Version(name = Constants.V1, served = true, storage = false),
43+
@Crd.Spec.Version(name = Constants.V1BETA2, served = true, storage = true, deprecated = true, deprecationWarning = "Version v1beta2 of the KafkaConnect API is deprecated. Please use the v1 version instead.")
4344
},
4445
subresources = @Crd.Spec.Subresources(
4546
status = @Crd.Spec.Subresources.Status(),
@@ -78,7 +79,7 @@ public class KafkaConnect extends CustomResource<KafkaConnectSpec, KafkaConnectS
7879
private static final long serialVersionUID = 1L;
7980

8081
public static final String SCOPE = Constants.SCOPE_NAMESPACED;
81-
public static final List<String> VERSIONS = List.of(Constants.V1BETA2);
82+
public static final List<String> VERSIONS = List.of(Constants.V1, Constants.V1BETA2);
8283
public static final String RESOURCE_KIND = "KafkaConnect";
8384
public static final String RESOURCE_LIST_KIND = RESOURCE_KIND + "List";
8485
public static final String RESOURCE_GROUP = Constants.RESOURCE_GROUP_NAME;

api/src/main/java/io/strimzi/api/kafka/model/connector/KafkaConnector.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
group = KafkaConnector.RESOURCE_GROUP,
3838
scope = KafkaConnector.SCOPE,
3939
versions = {
40-
@Crd.Spec.Version(name = Constants.V1BETA2, served = true, storage = true)
40+
@Crd.Spec.Version(name = Constants.V1, served = true, storage = false),
41+
@Crd.Spec.Version(name = Constants.V1BETA2, served = true, storage = true, deprecated = true, deprecationWarning = "Version v1beta2 of the KafkaConnector API is deprecated. Please use the v1 version instead.")
4142
},
4243
subresources = @Crd.Spec.Subresources(
4344
status = @Crd.Spec.Subresources.Status(),
@@ -84,7 +85,7 @@
8485
public class KafkaConnector extends CustomResource<KafkaConnectorSpec, KafkaConnectorStatus> implements Namespaced, UnknownPropertyPreserving {
8586
private static final long serialVersionUID = 1L;
8687

87-
public static final List<String> VERSIONS = List.of(Constants.V1BETA2);
88+
public static final List<String> VERSIONS = List.of(Constants.V1, Constants.V1BETA2);
8889
public static final String SCOPE = Constants.SCOPE_NAMESPACED;
8990
public static final String RESOURCE_PLURAL = "kafkaconnectors";
9091
public static final String RESOURCE_SINGULAR = "kafkaconnector";

api/src/main/java/io/strimzi/api/kafka/model/kafka/Kafka.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
group = Kafka.RESOURCE_GROUP,
4040
scope = Kafka.SCOPE,
4141
versions = {
42-
@Crd.Spec.Version(name = Constants.V1BETA2, served = true, storage = true)
42+
@Crd.Spec.Version(name = Constants.V1, served = true, storage = false),
43+
@Crd.Spec.Version(name = Constants.V1BETA2, served = true, storage = true, deprecated = true, deprecationWarning = "Version v1beta2 of the Kafka API is deprecated. Please use the v1 version instead.")
4344
},
4445
subresources = @Crd.Spec.Subresources(
4546
status = @Crd.Spec.Subresources.Status()
@@ -78,7 +79,7 @@ public class Kafka extends CustomResource<KafkaSpec, KafkaStatus> implements Nam
7879
private static final long serialVersionUID = 1L;
7980

8081
public static final String SCOPE = Constants.SCOPE_NAMESPACED;
81-
public static final List<String> VERSIONS = List.of(Constants.V1BETA2);
82+
public static final List<String> VERSIONS = List.of(Constants.V1, Constants.V1BETA2);
8283
public static final String RESOURCE_KIND = "Kafka";
8384
public static final String RESOURCE_LIST_KIND = RESOURCE_KIND + "List";
8485
public static final String RESOURCE_GROUP = Constants.RESOURCE_GROUP_NAME;

api/src/main/java/io/strimzi/api/kafka/model/mirrormaker2/KafkaMirrorMaker2.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
group = KafkaMirrorMaker2.RESOURCE_GROUP,
4040
scope = KafkaMirrorMaker2.SCOPE,
4141
versions = {
42-
@Crd.Spec.Version(name = Constants.V1BETA2, served = true, storage = true)
42+
@Crd.Spec.Version(name = Constants.V1, served = true, storage = false),
43+
@Crd.Spec.Version(name = Constants.V1BETA2, served = true, storage = true, deprecated = true, deprecationWarning = "Version v1beta2 of the KafkaMirrorMaker2 API is deprecated. Please use the v1 version instead.")
4344
},
4445
subresources = @Crd.Spec.Subresources(
4546
status = @Crd.Spec.Subresources.Status(),
@@ -78,7 +79,7 @@ public class KafkaMirrorMaker2 extends CustomResource<KafkaMirrorMaker2Spec, Kaf
7879
private static final long serialVersionUID = 1L;
7980

8081
public static final String SCOPE = Constants.SCOPE_NAMESPACED;
81-
public static final List<String> VERSIONS = List.of(Constants.V1BETA2);
82+
public static final List<String> VERSIONS = List.of(Constants.V1, Constants.V1BETA2);
8283
public static final String RESOURCE_KIND = "KafkaMirrorMaker2";
8384
public static final String RESOURCE_LIST_KIND = RESOURCE_KIND + "List";
8485
public static final String RESOURCE_GROUP = Constants.RESOURCE_GROUP_NAME;

0 commit comments

Comments
 (0)