Skip to content

Commit

Permalink
Upgrade quarkus from 1.2.1.Final to the latest 1.9.0.Final in order t…
Browse files Browse the repository at this point in the history
…o include kubernetes-client of at least 4.11.x (4.12.x is included in 1.9.0.Final).

This is necessary for us to be able to leverage the v1 API for CustomResourceDefinition as v1beta1 is deprecated and will soon be removed.
  • Loading branch information
dlbock committed Dec 4, 2020
1 parent b860e32 commit d07f72b
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 15 deletions.
7 changes: 4 additions & 3 deletions olm/operator-resources/instana-agent-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ rules:
- 'events'
verbs:
- 'create'
# -------------------------------------------------------------------------
# For the custom resource, the operator needs list, watch, get, update.
# -------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# For the custom resource, the operator needs list, watch, get, update, create.
# -----------------------------------------------------------------------------
- apiGroups:
- 'instana.io'
resources:
Expand All @@ -79,6 +79,7 @@ rules:
- 'update'
- 'list'
- 'watch'
- 'create'
# -------------------------------------------------------------------------
# Below are the permissions are for the agent.
# The operator needs these permissions to create the agent's cluster role.
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<properties>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<surefire-plugin.version>2.22.0</surefire-plugin.version>
<quarkus.version>1.2.1.Final</quarkus.version>
<quarkus.version>1.9.0.Final</quarkus.version>
<bouncycastle.version>1.62</bouncycastle.version>
<maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/instana/operator/AgentDeployer.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import io.fabric8.kubernetes.api.model.VolumeBuilder;
import io.fabric8.kubernetes.api.model.VolumeMount;
import io.fabric8.kubernetes.api.model.VolumeMountBuilder;
import io.fabric8.kubernetes.api.model.apiextensions.CustomResourceDefinition;
import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition;
import io.fabric8.kubernetes.api.model.apps.DaemonSet;
import io.fabric8.kubernetes.api.model.apps.DaemonSetList;
import io.fabric8.kubernetes.api.model.apps.DoneableDaemonSet;
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/com/instana/operator/CustomResourceWatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@
import com.instana.operator.customresource.DoneableInstanaAgent;
import com.instana.operator.customresource.InstanaAgent;
import com.instana.operator.customresource.InstanaAgentList;
import com.instana.operator.env.NamespaceProducer;
import com.instana.operator.events.CustomResourceAdded;
import com.instana.operator.events.CustomResourceDeleted;
import com.instana.operator.events.CustomResourceModified;
import com.instana.operator.events.CustomResourceOtherInstanceAdded;
import com.instana.operator.events.OperatorLeaderElected;
import io.fabric8.kubernetes.client.Watch;
import io.fabric8.kubernetes.client.Watcher;
import io.fabric8.kubernetes.client.dsl.FilterWatchListMultiDeletable;
import io.fabric8.kubernetes.client.dsl.MixedOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
Expand Down Expand Up @@ -61,7 +59,7 @@ public class CustomResourceWatcher {
private final AtomicReference<InstanaAgent> current = new AtomicReference<>();

public void onElectedLeader(@ObservesAsync OperatorLeaderElected _ev) {
List<FilterWatchListMultiDeletable<InstanaAgent, InstanaAgentList, Boolean, Watch, Watcher<InstanaAgent>>> ops = new ArrayList<>();
List<FilterWatchListMultiDeletable<InstanaAgent, InstanaAgentList, Boolean, Watch>> ops = new ArrayList<>();
if (targetNamespaces.isEmpty()) {
LOGGER.info("Watching for " + KubernetesClientProducer.CRD_NAME + " resources in any namespace.");
ops.add(client.inAnyNamespace());
Expand All @@ -72,7 +70,7 @@ public void onElectedLeader(@ObservesAsync OperatorLeaderElected _ev) {
}
}
Cache<InstanaAgent, InstanaAgentList> cache = cacheService.newCache(InstanaAgent.class, InstanaAgentList.class);
for (FilterWatchListMultiDeletable<InstanaAgent, InstanaAgentList, Boolean, Watch, Watcher<InstanaAgent>> op : ops) {
for (FilterWatchListMultiDeletable<InstanaAgent, InstanaAgentList, Boolean, Watch> op : ops) {
cache.listThenWatch(op).subscribe(event -> handleCacheEvent(cache.get(event.getUid())));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/instana/operator/cache/Cache.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public Optional<T> get(String uid) {
return map.get(uid);
}

public Observable<CacheEvent> listThenWatch(FilterWatchListDeletable<T, L, Boolean, Watch, Watcher<T>> op) {
public Observable<CacheEvent> listThenWatch(FilterWatchListDeletable<T, L, Boolean, Watch> op) {
return listThenWatch(new ListerWatcher<>(op));
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/instana/operator/cache/ListerWatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
*/
public class ListerWatcher<T extends HasMetadata, L extends KubernetesResourceList<T>> {

private final FilterWatchListDeletable<T, L, Boolean, Watch, Watcher<T>> op;
private final FilterWatchListDeletable<T, L, Boolean, Watch> op;

ListerWatcher(FilterWatchListDeletable<T, L, Boolean, Watch, Watcher<T>> op) {
ListerWatcher(FilterWatchListDeletable<T, L, Boolean, Watch> op) {
this.op = op;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.instana.operator.customresource.DoneableInstanaAgent;
import com.instana.operator.customresource.InstanaAgent;
import com.instana.operator.customresource.InstanaAgentList;
import io.fabric8.kubernetes.api.model.apiextensions.CustomResourceDefinition;
import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition;
import io.fabric8.kubernetes.client.Config;
import io.fabric8.kubernetes.client.DefaultKubernetesClient;
import io.fabric8.kubernetes.client.dsl.MixedOperation;
Expand Down Expand Up @@ -34,7 +34,6 @@
import javax.net.ssl.X509TrustManager;
import java.net.Proxy;
import java.util.Arrays;
import java.util.Optional;
import java.util.concurrent.TimeUnit;

import static com.instana.operator.env.Environment.OPERATOR_NAMESPACE;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/instana/operator/AgentDeployerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import io.fabric8.kubernetes.api.model.Container;
import io.fabric8.kubernetes.api.model.EnvVar;
import io.fabric8.kubernetes.api.model.apiextensions.CustomResourceDefinitionBuilder;
import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionBuilder;
import io.fabric8.kubernetes.api.model.apps.DaemonSet;
import io.fabric8.kubernetes.client.DefaultKubernetesClient;
import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer;
Expand Down

0 comments on commit d07f72b

Please sign in to comment.