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

refactor: remove some deprecated code #601

Merged
merged 1 commit into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ private void registerAssociatedClassesForReflection(BuildProducer<ReflectiveClas
BuildProducer<ForceNonWeakReflectiveClassBuildItem> forcedReflectionClasses,
Set<String> classNamesToRegister) {
classNamesToRegister.forEach(cn -> {
reflectionClasses.produce(new ReflectiveClassBuildItem(true, true, cn));
reflectionClasses.produce(ReflectiveClassBuildItem.builder(cn).methods().fields().build());
forcedReflectionClasses.produce(
new ForceNonWeakReflectiveClassBuildItem(cn));
log.infov("Registered ''{0}'' for reflection", cn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import java.io.IOException;
import java.nio.file.Files;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import org.junit.jupiter.api.Assertions;
Expand Down Expand Up @@ -60,7 +59,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<HasMetadata>) Serialization.unmarshal(kubeIS, Collections.emptyMap());
final var kubeResources = (List<HasMetadata>) Serialization.unmarshal(kubeIS);

// check cluster role for TestReconciler
final var testReconcilerRoleName = AddClusterRolesDecorator.getClusterRoleName(TestReconciler.NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@ private static void apply(KubernetesClient client, String v, Object crd) {
switch (v) {
case "v1":
client.apiextensions().v1().customResourceDefinitions()
.resource((CustomResourceDefinition) crd).createOrReplace();
.resource((CustomResourceDefinition) crd)
.serverSideApply();
break;
case "v1beta1":
client.apiextensions().v1beta1().customResourceDefinitions()
.resource((io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition) crd)
.createOrReplace();
.serverSideApply();
break;
default:
throw new IllegalArgumentException("Unknown CRD version: " + v);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import io.quarkus.jackson.ObjectMapperCustomizer;
import io.quarkus.runtime.LaunchMode;
import io.quarkus.runtime.annotations.Recorder;
import io.quarkus.runtime.configuration.ProfileManager;
import io.quarkus.runtime.configuration.ConfigUtils;

@Recorder
public class ConfigurationServiceRecorder {
Expand Down Expand Up @@ -78,11 +78,13 @@ public Supplier<QuarkusConfigurationService> configurationServiceSupplier(Versio

// deactivate leader election in dev mode
LeaderElectionConfiguration leaderElectionConfiguration = null;
final var profile = ProfileManager.getActiveProfile(); // todo: use ConfigUtils instead
if (buildTimeConfiguration.activateLeaderElectionForProfiles.contains(profile)) {
final var profiles = ConfigUtils.getProfiles();
if (profiles.stream().anyMatch(buildTimeConfiguration.activateLeaderElectionForProfiles::contains)) {
leaderElectionConfiguration = container.instance(LeaderElectionConfiguration.class).get();
} else {
log.info("Leader election deactivated for " + profile + " profile");
log.info("Leader election deactivated because it is only activated for "
+ buildTimeConfiguration.activateLeaderElectionForProfiles
+ " profiles. Currently active profiles: " + profiles);
}

return new QuarkusConfigurationService(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class MicrometerMetricsProvider implements MeterBinder {

@Override
public void bindTo(MeterRegistry registry) {
metrics = new MicrometerMetrics(registry);
metrics = MicrometerMetrics.newPerResourceCollectingMicrometerMetricsBuilder(registry).build();
}

@Produces
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public String getQuarkusVersion() {
}

public static Version loadFromProperties() {
final var sdkVersion = Utils.loadFromProperties();
final var sdkVersion = Utils.VERSION;
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("extension-version.properties");
Properties properties = new Properties();
if (is != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void test() {
testSchema.getSpec().setEncoding("utf8");

log.infof("Creating test MySQLSchema object: %s", testSchema);
client.resource(testSchema).createOrReplace();
client.resource(testSchema).serverSideApply();

log.info("Waiting 10 seconds for expected resources to be created and updated");
await().atMost(10, SECONDS).untilAsserted(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void canReconcile() {

// assert ping reconciler
await().ignoreException(NullPointerException.class).atMost(5, MINUTES).untilAsserted(() -> {
Ping updatedRequest = client.resource(testRequest).fromServer().get();
Ping updatedRequest = client.resource(testRequest).get();
assertThat(updatedRequest.getStatus(), is(notNullValue()));
assertThat(updatedRequest.getStatus().getState(), is(Status.State.PROCESSED));
});
Expand Down