diff --git a/annotations/src/main/java/io/quarkiverse/operatorsdk/annotations/RBACCRoleRef.java b/annotations/src/main/java/io/quarkiverse/operatorsdk/annotations/RBACCRoleRef.java index 60e2f3190..35327373e 100644 --- a/annotations/src/main/java/io/quarkiverse/operatorsdk/annotations/RBACCRoleRef.java +++ b/annotations/src/main/java/io/quarkiverse/operatorsdk/annotations/RBACCRoleRef.java @@ -19,7 +19,7 @@ enum RoleKind { ClusterRole, - Role; + Role } } diff --git a/bundle-generator/deployment/src/main/java/io/quarkiverse/operatorsdk/bundle/deployment/BundleGenerator.java b/bundle-generator/deployment/src/main/java/io/quarkiverse/operatorsdk/bundle/deployment/BundleGenerator.java index e5b3bace1..ce41bbd04 100644 --- a/bundle-generator/deployment/src/main/java/io/quarkiverse/operatorsdk/bundle/deployment/BundleGenerator.java +++ b/bundle-generator/deployment/src/main/java/io/quarkiverse/operatorsdk/bundle/deployment/BundleGenerator.java @@ -101,7 +101,7 @@ private static HashSet addCRDManifestBuilder(Map crds, private static SortedMap generateBundleLabels(CSVMetadataHolder csvMetadata, BundleGenerationConfiguration bundleConfiguration, Version version) { - var packageName = bundleConfiguration.packageName().orElse(csvMetadata.bundleName); + var packageName = csvMetadata.bundleName; SortedMap values = new TreeMap<>(); values.put(join(BUNDLE_PREFIX, CHANNEL, DEFAULT, ANNOTATIONS_VERSION), diff --git a/bundle-generator/deployment/src/main/java/io/quarkiverse/operatorsdk/bundle/deployment/BundleProcessor.java b/bundle-generator/deployment/src/main/java/io/quarkiverse/operatorsdk/bundle/deployment/BundleProcessor.java index e33c9236c..dfce87c9e 100644 --- a/bundle-generator/deployment/src/main/java/io/quarkiverse/operatorsdk/bundle/deployment/BundleProcessor.java +++ b/bundle-generator/deployment/src/main/java/io/quarkiverse/operatorsdk/bundle/deployment/BundleProcessor.java @@ -116,8 +116,7 @@ CSVMetadataBuildItem gatherCSVMetadata(KubernetesConfig kubernetesConfig, CombinedIndexBuildItem combinedIndexBuildItem, JarBuildItem jarBuildItem) { final var index = combinedIndexBuildItem.getIndex(); - final var defaultName = bundleConfiguration.packageName() - .orElse(ResourceNameUtil.getResourceName(kubernetesConfig, appConfiguration)); + final var defaultName = ResourceNameUtil.getResourceName(kubernetesConfig, appConfiguration); // note that version, replaces, etc. should probably be settable at the reconciler level // use version specified in bundle configuration, if not use the one extracted from the project, if available diff --git a/bundle-generator/deployment/src/main/java/io/quarkiverse/operatorsdk/bundle/deployment/builders/CsvManifestsBuilder.java b/bundle-generator/deployment/src/main/java/io/quarkiverse/operatorsdk/bundle/deployment/builders/CsvManifestsBuilder.java index 625eee693..cbfac7d19 100644 --- a/bundle-generator/deployment/src/main/java/io/quarkiverse/operatorsdk/bundle/deployment/builders/CsvManifestsBuilder.java +++ b/bundle-generator/deployment/src/main/java/io/quarkiverse/operatorsdk/bundle/deployment/builders/CsvManifestsBuilder.java @@ -485,6 +485,6 @@ private void appendRulesInPermission(StrategyDeploymentPermissionsFluent permiss } private static String defaultIfEmpty(String possiblyNullOrEmpty, String defaultValue) { - return Optional.ofNullable(possiblyNullOrEmpty).filter(s -> !s.isBlank() && !s.isEmpty()).orElse(defaultValue); + return Optional.ofNullable(possiblyNullOrEmpty).filter(s -> !s.isBlank()).orElse(defaultValue); } } diff --git a/bundle-generator/deployment/src/main/java/io/quarkiverse/operatorsdk/bundle/deployment/builders/ManifestsBuilder.java b/bundle-generator/deployment/src/main/java/io/quarkiverse/operatorsdk/bundle/deployment/builders/ManifestsBuilder.java index fc9940fa8..f15e2172e 100644 --- a/bundle-generator/deployment/src/main/java/io/quarkiverse/operatorsdk/bundle/deployment/builders/ManifestsBuilder.java +++ b/bundle-generator/deployment/src/main/java/io/quarkiverse/operatorsdk/bundle/deployment/builders/ManifestsBuilder.java @@ -4,6 +4,7 @@ import java.nio.file.Path; import java.util.List; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; @@ -26,8 +27,9 @@ public abstract class ManifestsBuilder { .enable(YAMLGenerator.Feature.ALWAYS_QUOTE_NUMBERS_AS_STRINGS) .disable(YAMLGenerator.Feature.WRITE_DOC_START_MARKER)); YAML_MAPPER.configure(SerializationFeature.INDENT_OUTPUT, true); - YAML_MAPPER.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false); - YAML_MAPPER.configure(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS, false); + YAML_MAPPER.setDefaultPropertyInclusion( + JsonInclude.Value.construct(JsonInclude.Include.ALWAYS, JsonInclude.Include.NON_NULL)); + YAML_MAPPER.setSerializationInclusion(JsonInclude.Include.NON_EMPTY); } protected final CSVMetadataHolder metadata; diff --git a/bundle-generator/deployment/src/test/java/io/quarkiverse/operatorsdk/bundle/ExternalCRDsTest.java b/bundle-generator/deployment/src/test/java/io/quarkiverse/operatorsdk/bundle/ExternalCRDsTest.java index 753508b61..0d1108aca 100644 --- a/bundle-generator/deployment/src/test/java/io/quarkiverse/operatorsdk/bundle/ExternalCRDsTest.java +++ b/bundle-generator/deployment/src/test/java/io/quarkiverse/operatorsdk/bundle/ExternalCRDsTest.java @@ -1,7 +1,6 @@ package io.quarkiverse.operatorsdk.bundle; import static io.quarkiverse.operatorsdk.bundle.Utils.*; -import static io.quarkiverse.operatorsdk.bundle.Utils.getCRDNameFor; import static org.junit.jupiter.api.Assertions.*; import java.io.IOException; diff --git a/bundle-generator/deployment/src/test/java/io/quarkiverse/operatorsdk/bundle/MultipleOperatorsBundleTest.java b/bundle-generator/deployment/src/test/java/io/quarkiverse/operatorsdk/bundle/MultipleOperatorsBundleTest.java index 49910b885..addebce2d 100644 --- a/bundle-generator/deployment/src/test/java/io/quarkiverse/operatorsdk/bundle/MultipleOperatorsBundleTest.java +++ b/bundle-generator/deployment/src/test/java/io/quarkiverse/operatorsdk/bundle/MultipleOperatorsBundleTest.java @@ -23,7 +23,6 @@ public class MultipleOperatorsBundleTest { private static final String VERSION = "test-version"; - private static final String BUNDLE_PACKAGE = "olm-package"; private static final String OVERRIDEN_REPO_ANNOTATION = "overridden-repo-annotation"; private static final String DEFAULT_ANNOTATION_NAME = "default-annotation-name"; private static final String DEFAULT_ANNOTATION_VALUE = "default-annotation-value"; @@ -41,7 +40,6 @@ public class MultipleOperatorsBundleTest { ExternalDependentResource.class, PodDependentResource.class)) .overrideConfigKey("quarkus.operator-sdk.crd.generate-all", "true") .overrideConfigKey("quarkus.operator-sdk.bundle.replaces", FirstReconciler.REPLACES) - .overrideConfigKey("quarkus.operator-sdk.bundle.package-name", BUNDLE_PACKAGE) .overrideConfigKey("quarkus.operator-sdk.bundle.bundles." + ThirdReconciler.BUNDLE_NAME + ".annotations." + BundleConfiguration.REPOSITORY_ANNOTATION, OVERRIDEN_REPO_ANNOTATION) .overrideConfigKey( @@ -71,7 +69,7 @@ public void shouldWriteBundleForTheOperators() throws IOException { assertEquals(FirstReconciler.VERSION, csv.getSpec().getVersion()); assertEquals(FirstReconciler.REPLACES, csv.getSpec().getReplaces()); var bundleMeta = getAnnotationsFor(bundle, "first-operator"); - assertEquals(BUNDLE_PACKAGE, bundleMeta.getAnnotations().get("operators.operatorframework.io.bundle.package.v1")); + assertEquals("first-operator", bundleMeta.getAnnotations().get("operators.operatorframework.io.bundle.package.v1")); checkBundleFor(bundle, "second-operator", Second.class); csv = getCSVFor(bundle, "second-operator"); diff --git a/bundle-generator/runtime/src/main/java/io/quarkiverse/operatorsdk/bundle/runtime/BundleGenerationConfiguration.java b/bundle-generator/runtime/src/main/java/io/quarkiverse/operatorsdk/bundle/runtime/BundleGenerationConfiguration.java index f7334b682..3575ecf32 100644 --- a/bundle-generator/runtime/src/main/java/io/quarkiverse/operatorsdk/bundle/runtime/BundleGenerationConfiguration.java +++ b/bundle-generator/runtime/src/main/java/io/quarkiverse/operatorsdk/bundle/runtime/BundleGenerationConfiguration.java @@ -4,7 +4,6 @@ import java.util.Map; import java.util.Optional; -import io.quarkiverse.operatorsdk.annotations.CSVMetadata; import io.quarkus.runtime.annotations.ConfigRoot; import io.smallrye.config.ConfigMapping; import io.smallrye.config.WithDefault; @@ -31,14 +30,6 @@ public interface BundleGenerationConfiguration { */ Optional defaultChannel(); - /** - * The name of the package that bundle belongs to. - * - * @deprecated Use {@link CSVMetadata#bundleName()} instead - */ - @Deprecated(forRemoval = true) - Optional packageName(); - /** * The replaces value that should be used in the generated CSV. */ diff --git a/bundle-generator/runtime/src/main/java/io/quarkiverse/operatorsdk/bundle/runtime/CSVMetadata.java b/bundle-generator/runtime/src/main/java/io/quarkiverse/operatorsdk/bundle/runtime/CSVMetadata.java deleted file mode 100644 index b3fcaa98e..000000000 --- a/bundle-generator/runtime/src/main/java/io/quarkiverse/operatorsdk/bundle/runtime/CSVMetadata.java +++ /dev/null @@ -1,125 +0,0 @@ -package io.quarkiverse.operatorsdk.bundle.runtime; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target({ ElementType.TYPE }) -@SuppressWarnings("unused") -@Deprecated(since = "6.3.1", forRemoval = true) -/** - * @deprecated Use {@link io.quarkiverse.operatorsdk.annotations.CSVMetadata} instead - */ -public @interface CSVMetadata { - String name() default ""; - - Annotations annotations() default @Annotations; - - String description() default ""; - - String displayName() default ""; - - Icon[] icon() default {}; - - String[] keywords() default ""; - - String maturity() default ""; - - String version() default ""; - - String replaces() default ""; - - Maintainer[] maintainers() default {}; - - Provider provider() default @Provider; - - InstallMode[] installModes() default {}; - - PermissionRule[] permissionRules() default {}; - - RequiredCRD[] requiredCRDs() default {}; - - String minKubeVersion() default ""; - - Link[] links() default {}; - - @interface Annotations { - String containerImage() default ""; - - String repository() default ""; - - String capabilities() default ""; - - String categories() default ""; - - boolean certified() default false; - - String almExamples() default ""; - - String skipRange() default ""; - - Annotation[] others() default {}; - - @interface Annotation { - String name(); - - String value(); - } - } - - @interface Icon { - String DEFAULT_MEDIA_TYPE = "image/svg+xml"; - - String fileName(); - - String mediatype() default DEFAULT_MEDIA_TYPE; - } - - @interface Maintainer { - String email() default ""; - - String name() default ""; - } - - @interface Provider { - String name() default ""; - - String url() default ""; - } - - @interface InstallMode { - String type(); - - boolean supported() default true; - } - - @interface PermissionRule { - String[] apiGroups(); - - String[] resources(); - - String[] verbs() default { "get", "list", "watch", "create", "delete", "patch", "update" }; - - /** - * @return the service account name for the permission rule. If not provided, it will use the default service account - * name. - */ - String serviceAccountName() default ""; - } - - @interface RequiredCRD { - String kind(); - - String name(); - - String version(); - } - - @interface Link { - String url(); - - String name(); - } -} diff --git a/bundle-generator/runtime/src/main/java/io/quarkiverse/operatorsdk/bundle/runtime/CSVMetadataHolder.java b/bundle-generator/runtime/src/main/java/io/quarkiverse/operatorsdk/bundle/runtime/CSVMetadataHolder.java index 6635280de..89d4229ae 100644 --- a/bundle-generator/runtime/src/main/java/io/quarkiverse/operatorsdk/bundle/runtime/CSVMetadataHolder.java +++ b/bundle-generator/runtime/src/main/java/io/quarkiverse/operatorsdk/bundle/runtime/CSVMetadataHolder.java @@ -1,7 +1,6 @@ package io.quarkiverse.operatorsdk.bundle.runtime; import static io.quarkiverse.operatorsdk.bundle.runtime.BundleConfiguration.*; -import static io.quarkiverse.operatorsdk.bundle.runtime.BundleConfiguration.CONTAINER_IMAGE_ANNOTATION; import java.util.Collections; import java.util.HashMap; diff --git a/bundle-generator/runtime/src/main/java/io/quarkiverse/operatorsdk/bundle/runtime/SharedCSVMetadata.java b/bundle-generator/runtime/src/main/java/io/quarkiverse/operatorsdk/bundle/runtime/SharedCSVMetadata.java deleted file mode 100644 index 2a8c4b1e9..000000000 --- a/bundle-generator/runtime/src/main/java/io/quarkiverse/operatorsdk/bundle/runtime/SharedCSVMetadata.java +++ /dev/null @@ -1,9 +0,0 @@ -package io.quarkiverse.operatorsdk.bundle.runtime; - -@SuppressWarnings("unused") -@Deprecated(since = "6.3.1", forRemoval = true) -/** - * @deprecated Use {@link io.quarkiverse.operatorsdk.annotations.CSVMetadata} instead - */ -public interface SharedCSVMetadata { -} diff --git a/cli/pom.xml b/cli/pom.xml index 78383d4ad..94d9dc127 100644 --- a/cli/pom.xml +++ b/cli/pom.xml @@ -13,7 +13,8 @@ true - uber-jar + true + uber-jar diff --git a/common/src/main/java/io/quarkiverse/operatorsdk/common/Files.java b/common/src/main/java/io/quarkiverse/operatorsdk/common/Files.java index d7179a8d7..56510f898 100644 --- a/common/src/main/java/io/quarkiverse/operatorsdk/common/Files.java +++ b/common/src/main/java/io/quarkiverse/operatorsdk/common/Files.java @@ -24,7 +24,7 @@ private Files() { public interface MessageWriter { default void write(String message) { write(message, null, false); - }; + } default void error(String message) { error(message, null); diff --git a/core/deployment/src/main/java/io/quarkiverse/operatorsdk/deployment/OperatorSDKProcessor.java b/core/deployment/src/main/java/io/quarkiverse/operatorsdk/deployment/OperatorSDKProcessor.java index ad5f1e545..474919cd2 100644 --- a/core/deployment/src/main/java/io/quarkiverse/operatorsdk/deployment/OperatorSDKProcessor.java +++ b/core/deployment/src/main/java/io/quarkiverse/operatorsdk/deployment/OperatorSDKProcessor.java @@ -28,7 +28,6 @@ import io.quarkiverse.operatorsdk.runtime.BuildTimeOperatorConfiguration; import io.quarkiverse.operatorsdk.runtime.ConfigurationServiceRecorder; import io.quarkiverse.operatorsdk.runtime.KubernetesClientObjectMapperCustomizer; -import io.quarkiverse.operatorsdk.runtime.KubernetesClientSerializationCustomizer; import io.quarkiverse.operatorsdk.runtime.NoOpMetricsProvider; import io.quarkiverse.operatorsdk.runtime.OperatorHealthCheck; import io.quarkiverse.operatorsdk.runtime.OperatorProducer; @@ -90,9 +89,6 @@ void setup(BuildProducer indexDependency, // register our Kubernetes client mapper customizer additionalBeans.produce(AdditionalBeanBuildItem.unremovableOf(KubernetesClientObjectMapperCustomizer.class)); - // register CDI qualifier for customization of the fabric8 ObjectMapper - additionalBeans.produce(AdditionalBeanBuildItem.unremovableOf(KubernetesClientSerializationCustomizer.class)); - // register CDI Operator producer additionalBeans.produce(AdditionalBeanBuildItem.unremovableOf(OperatorProducer.class)); diff --git a/core/deployment/src/main/java/io/quarkiverse/operatorsdk/deployment/VersionAlignmentCheckingStep.java b/core/deployment/src/main/java/io/quarkiverse/operatorsdk/deployment/VersionAlignmentCheckingStep.java index 49c81c8b6..d947893d2 100644 --- a/core/deployment/src/main/java/io/quarkiverse/operatorsdk/deployment/VersionAlignmentCheckingStep.java +++ b/core/deployment/src/main/java/io/quarkiverse/operatorsdk/deployment/VersionAlignmentCheckingStep.java @@ -72,7 +72,7 @@ private void checkVersionCompatibility(BuildTimeOperatorConfiguration buildTimeC private static Optional getSemverFrom(String version) { try { - return Optional.of(Semver.coerce(version)); + return Optional.ofNullable(Semver.coerce(version)); } catch (Exception e) { log.warn("Couldn't convert version " + version); } diff --git a/core/deployment/src/test/java/io/quarkiverse/operatorsdk/test/KubernetesClientSerializationCustomizerTest.java b/core/deployment/src/test/java/io/quarkiverse/operatorsdk/test/KubernetesClientSerializationCustomizerTest.java index 996b70a36..f4a7452f9 100644 --- a/core/deployment/src/test/java/io/quarkiverse/operatorsdk/test/KubernetesClientSerializationCustomizerTest.java +++ b/core/deployment/src/test/java/io/quarkiverse/operatorsdk/test/KubernetesClientSerializationCustomizerTest.java @@ -12,12 +12,10 @@ import com.fasterxml.jackson.databind.ObjectMapper; import io.fabric8.kubernetes.client.KubernetesClient; -import io.quarkiverse.operatorsdk.runtime.KubernetesClientSerializationCustomizer; import io.quarkiverse.operatorsdk.runtime.QuarkusConfigurationService; import io.quarkiverse.operatorsdk.test.sources.SimpleCR; import io.quarkiverse.operatorsdk.test.sources.SimpleSpec; import io.quarkiverse.operatorsdk.test.sources.SimpleStatus; -import io.quarkus.jackson.ObjectMapperCustomizer; import io.quarkus.kubernetes.client.KubernetesClientObjectMapperCustomizer; import io.quarkus.test.QuarkusUnitTest; @@ -33,38 +31,27 @@ public void kubernetesClientUsesCustomizedObjectMapper() { assertEquals(service.getKubernetesClient(), kubernetesClient); var serialization = kubernetesClient.getKubernetesSerialization(); var result = serialization - .unmarshal("{\"spec\": {\"mixin\": \"fromMixin\"},\"status\":{\"mixin\": \"fromMixin\"}}", SimpleCR.class); - assertEquals("fromMixin", result.getSpec().value); + .unmarshal("{\"status\":{\"mixin\": \"fromMixin\"}}", SimpleCR.class); assertEquals("fromMixin", result.getStatus().value); serialization = service.getKubernetesClient().getKubernetesSerialization(); result = serialization - .unmarshal("{\"spec\": {\"mixin\": \"fromMixin\"},\"status\":{\"mixin\": \"fromMixin\"}}", SimpleCR.class); - assertEquals("fromMixin", result.getSpec().value); + .unmarshal("{\"status\":{\"mixin\": \"fromMixin\"}}", SimpleCR.class); assertEquals("fromMixin", result.getStatus().value); } @RegisterExtension static QuarkusUnitTest runner = new QuarkusUnitTest() - .withApplicationRoot(jar -> jar.addClasses(Customizer.class, Customizer2.class, ValueMixIn.class, SimpleCR.class, + .withApplicationRoot(jar -> jar.addClasses(Customizer.class, ValueMixIn.class, SimpleCR.class, SimpleSpec.class, SimpleStatus.class)); - @Singleton - @KubernetesClientSerializationCustomizer - public static class Customizer implements ObjectMapperCustomizer { - @Override - public void customize(ObjectMapper objectMapper) { - objectMapper.addMixIn(SimpleSpec.class, ValueMixIn.class); - } - } - private static final class ValueMixIn { @JsonProperty("mixin") String value; } @Singleton - public static class Customizer2 implements KubernetesClientObjectMapperCustomizer { + public static class Customizer implements KubernetesClientObjectMapperCustomizer { public void customize(ObjectMapper objectMapper) { objectMapper.addMixIn(SimpleStatus.class, ValueMixIn.class); } diff --git a/core/deployment/src/test/java/io/quarkiverse/operatorsdk/test/WatchAllNamespacesTest.java b/core/deployment/src/test/java/io/quarkiverse/operatorsdk/test/WatchAllNamespacesTest.java index 7cf146028..6bca899a2 100644 --- a/core/deployment/src/test/java/io/quarkiverse/operatorsdk/test/WatchAllNamespacesTest.java +++ b/core/deployment/src/test/java/io/quarkiverse/operatorsdk/test/WatchAllNamespacesTest.java @@ -18,7 +18,7 @@ import io.fabric8.kubernetes.api.model.HasMetadata; import io.fabric8.kubernetes.api.model.rbac.ClusterRole; import io.fabric8.kubernetes.api.model.rbac.ClusterRoleBinding; -import io.fabric8.kubernetes.client.utils.Serialization; +import io.fabric8.kubernetes.client.utils.KubernetesSerialization; import io.quarkiverse.operatorsdk.deployment.AddClusterRolesDecorator; import io.quarkiverse.operatorsdk.deployment.AddRoleBindingsDecorator; import io.quarkiverse.operatorsdk.test.sources.WatchAllReconciler; @@ -36,6 +36,7 @@ public class WatchAllNamespacesTest { @ProdBuildResults private ProdModeTestResults prodModeTestResults; + private static final KubernetesSerialization serialization = new KubernetesSerialization(); @Test public void shouldCreateRolesAndRoleBindings() throws IOException { @@ -45,7 +46,7 @@ public void shouldCreateRolesAndRoleBindings() throws IOException { final var kubeIS = new FileInputStream(kubeManifest.toFile()); // use unmarshall version with parameters map to ensure code goes through the proper processing wrt multiple documents @SuppressWarnings("unchecked") - final var kubeResources = (List) Serialization.unmarshal(kubeIS); + final var kubeResources = (List) serialization.unmarshal(kubeIS); // check cluster role final var clusterRoleName = AddClusterRolesDecorator.getClusterRoleName(WatchAllReconciler.NAME); diff --git a/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/KubernetesClientObjectMapperCustomizer.java b/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/KubernetesClientObjectMapperCustomizer.java index 8927f600b..90206c22d 100644 --- a/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/KubernetesClientObjectMapperCustomizer.java +++ b/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/KubernetesClientObjectMapperCustomizer.java @@ -5,9 +5,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; -import io.quarkus.arc.Arc; -import io.quarkus.jackson.ObjectMapperCustomizer; - @Singleton public class KubernetesClientObjectMapperCustomizer implements io.quarkus.kubernetes.client.KubernetesClientObjectMapperCustomizer { @@ -16,12 +13,5 @@ public class KubernetesClientObjectMapperCustomizer implements public void customize(ObjectMapper mapper) { // disable failure on empty beans mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); - - // apply now deprecated user-defined customizations - Arc.container() - .select(ObjectMapperCustomizer.class, KubernetesClientSerializationCustomizer.Literal.INSTANCE) - .stream() - .sorted() - .forEach(c -> c.customize(mapper)); } } diff --git a/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/KubernetesClientSerializationCustomizer.java b/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/KubernetesClientSerializationCustomizer.java deleted file mode 100644 index da71abcc4..000000000 --- a/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/KubernetesClientSerializationCustomizer.java +++ /dev/null @@ -1,31 +0,0 @@ -package io.quarkiverse.operatorsdk.runtime; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import jakarta.enterprise.util.AnnotationLiteral; -import jakarta.inject.Qualifier; - -/** - * @deprecated Use {@link io.quarkus.kubernetes.client.KubernetesClientObjectMapperCustomizer} instead - */ -@Qualifier -@Documented -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -@Deprecated(since = "6.2.0", forRemoval = true) -public @interface KubernetesClientSerializationCustomizer { - - final class Literal extends AnnotationLiteral - implements KubernetesClientSerializationCustomizer { - - public static final Literal INSTANCE = new Literal(); - private static final long serialVersionUID = 1L; - - private Literal() { - } - } -} diff --git a/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/QuarkusConfigurationService.java b/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/QuarkusConfigurationService.java index 0cff52856..d0801ac85 100644 --- a/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/QuarkusConfigurationService.java +++ b/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/QuarkusConfigurationService.java @@ -32,7 +32,6 @@ public class QuarkusConfigurationService extends AbstractConfigurationService implements DependentResourceFactory, DependentResourceSpecMetadata>, ManagedWorkflowFactory> { - public static final QuarkusConfigurationService RESOURCE_CLASS_RESOLVER_ONLY = new QuarkusConfigurationService(); public static final int UNSET_TERMINATION_TIMEOUT_SECONDS = -1; private static final Logger log = LoggerFactory.getLogger(QuarkusConfigurationService.class); private final CRDGenerationInfo crdInfo; @@ -90,12 +89,6 @@ public QuarkusConfigurationService( this.defensiveCloning = defensiveCloning; } - private QuarkusConfigurationService() { - this(Version.UNKNOWN, Collections.emptyList(), null, null, DEFAULT_RECONCILIATION_THREADS_NUMBER, - DEFAULT_WORKFLOW_EXECUTOR_THREAD_NUMBER, UNSET_TERMINATION_TIMEOUT_SECONDS, null, null, false, null, null, - false, false, false, false); - } - private static Reconciler unwrap(Reconciler reconciler) { return ClientProxy.unwrap(reconciler); } @@ -165,11 +158,6 @@ public Metrics getMetrics() { return metrics; } - @Override - public KubernetesClient getKubernetesClient() { - return super.getKubernetesClient(); - } - boolean shouldStartOperator() { return startOperator; } diff --git a/docs/modules/ROOT/pages/upgrade.adoc b/docs/modules/ROOT/pages/upgrade.adoc new file mode 100644 index 000000000..97911d3a5 --- /dev/null +++ b/docs/modules/ROOT/pages/upgrade.adoc @@ -0,0 +1,8 @@ +== Upgrading from 6.x to 7.0 + +=== Removed deprecated code + +- `KubernetesClientSerializationCustomer` has been removed, use `io.quarkus.kubernetes.client.KubernetesClientObjectMapperCustomizer` from Quarkus instead +- `BundleGenerationConfiguration.packageName` and associated property (`quarkus.operator-sdk.bundle.package-name`) have been removed, use `CSVMetadata.bundleName` instead +- `SharedCSVMetadata` and `CSVMetadata` from `quarkus-operator-sdk-bundle-generator` annotations that got moved to `quarkus-operator-sdk-annotations` module for better reuse + diff --git a/integration-tests/src/test/java/io/quarkiverse/operatorsdk/it/OperatorSDKResourceTest.java b/integration-tests/src/test/java/io/quarkiverse/operatorsdk/it/OperatorSDKResourceTest.java index 2aa85676b..617479987 100644 --- a/integration-tests/src/test/java/io/quarkiverse/operatorsdk/it/OperatorSDKResourceTest.java +++ b/integration-tests/src/test/java/io/quarkiverse/operatorsdk/it/OperatorSDKResourceTest.java @@ -6,7 +6,6 @@ import java.time.Duration; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import io.javaoperatorsdk.operator.ReconcilerUtils; @@ -31,11 +30,6 @@ @QuarkusTest @WithTestResource(CustomKubernetesServerTestResource.class) class OperatorSDKResourceTest { - - @BeforeAll - static void setup() { - } - @Test void shouldNotValidateCRs() { given().when().get("/operator/config").then().statusCode(200).body( diff --git a/samples/exposedapp/src/test/java/io/halkyon/HelmDeploymentE2ETest.java b/samples/exposedapp/src/test/java/io/halkyon/HelmDeploymentE2ETest.java index 7330007b4..c80099d38 100644 --- a/samples/exposedapp/src/test/java/io/halkyon/HelmDeploymentE2ETest.java +++ b/samples/exposedapp/src/test/java/io/halkyon/HelmDeploymentE2ETest.java @@ -153,13 +153,13 @@ private void createNamespace(String namespace) { private void deployWithHelm(String... values) { File kubeConfigFile = KubeUtils.generateConfigFromClient(client); - var command = "helm install exposedapp target/helm"; - command += " --kubeconfig " + kubeConfigFile.getPath(); + StringBuilder command = new StringBuilder("helm install exposedapp target/helm"); + command.append(" --kubeconfig ").append(kubeConfigFile.getPath()); for (int i = 0; i < values.length; i = i + 2) { - command += " --set " + values[i] + "=" + values[i + 1]; + command.append(" --set ").append(values[i]).append("=").append(values[i + 1]); } - execHelmCommand(command); + execHelmCommand(command.toString()); client.apps().deployments().inNamespace(DEFAULT_NAMESPACE).withName(DEPLOYMENT_NAME) .waitUntilReady(30, TimeUnit.SECONDS); } diff --git a/samples/exposedapp/src/test/java/io/halkyon/KubeUtils.java b/samples/exposedapp/src/test/java/io/halkyon/KubeUtils.java index df400a940..f0622da18 100644 --- a/samples/exposedapp/src/test/java/io/halkyon/KubeUtils.java +++ b/samples/exposedapp/src/test/java/io/halkyon/KubeUtils.java @@ -2,12 +2,16 @@ import java.io.File; import java.io.IOException; -import java.nio.charset.StandardCharsets; +import java.nio.file.Files; import java.util.List; -import org.testcontainers.shaded.com.google.common.io.Files; - -import io.fabric8.kubernetes.api.model.*; +import io.fabric8.kubernetes.api.model.AuthInfo; +import io.fabric8.kubernetes.api.model.Cluster; +import io.fabric8.kubernetes.api.model.Config; +import io.fabric8.kubernetes.api.model.Context; +import io.fabric8.kubernetes.api.model.NamedAuthInfo; +import io.fabric8.kubernetes.api.model.NamedCluster; +import io.fabric8.kubernetes.api.model.NamedContext; import io.fabric8.kubernetes.client.KubernetesClient; public class KubeUtils { @@ -28,7 +32,7 @@ public static File generateConfigFromClient(KubernetesClient client) { File targetFile = new File("target", "devservice-kubeconfig.yaml"); String yaml = client.getKubernetesSerialization().asYaml(res); - Files.write(yaml, targetFile, StandardCharsets.UTF_8); + Files.writeString(targetFile.toPath(), yaml); return targetFile; } catch (IOException e) { throw new RuntimeException(e); diff --git a/samples/joke/src/test/java/io/quarkiverse/operatorsdk/samples/joke/JokeRequestReconcilerTest.java b/samples/joke/src/test/java/io/quarkiverse/operatorsdk/samples/joke/JokeRequestReconcilerTest.java index 3cb53fcb0..fbcbc13ca 100644 --- a/samples/joke/src/test/java/io/quarkiverse/operatorsdk/samples/joke/JokeRequestReconcilerTest.java +++ b/samples/joke/src/test/java/io/quarkiverse/operatorsdk/samples/joke/JokeRequestReconcilerTest.java @@ -25,8 +25,8 @@ import io.javaoperatorsdk.operator.Operator; import io.quarkiverse.operatorsdk.samples.joke.JokeRequestSpec.Category; import io.quarkiverse.operatorsdk.samples.joke.JokeRequestStatus.State; +import io.quarkus.test.InjectMock; import io.quarkus.test.junit.QuarkusTest; -import io.quarkus.test.junit.mockito.InjectMock; @QuarkusTest class JokeRequestReconcilerTest { diff --git a/samples/mysql-schema/src/main/java/io/quarkiverse/operatorsdk/samples/mysqlschema/dependent/SecretDependentResource.java b/samples/mysql-schema/src/main/java/io/quarkiverse/operatorsdk/samples/mysqlschema/dependent/SecretDependentResource.java index 82c51b118..60ead1e9d 100644 --- a/samples/mysql-schema/src/main/java/io/quarkiverse/operatorsdk/samples/mysqlschema/dependent/SecretDependentResource.java +++ b/samples/mysql-schema/src/main/java/io/quarkiverse/operatorsdk/samples/mysqlschema/dependent/SecretDependentResource.java @@ -34,8 +34,7 @@ private static String encode(String value) { @Override protected Secret desired(MySQLSchema schema, Context context) { - final var password = RandomStringUtils - .randomAlphanumeric(16); // NOSONAR: we don't need cryptographically-strong randomness here + final var password = RandomStringUtils.insecure().nextAlphanumeric(16); // NOSONAR: we don't need cryptographically-strong randomness here final var name = schema.getMetadata().getName(); final var secretName = getSecretName(name); final var userName = String.format(USERNAME_FORMAT, name);