Skip to content

Commit

Permalink
Merge pull request #2356 from Vlatombe/csi-volume-snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
fusesource-ci authored Aug 20, 2020
2 parents 3a6587f + 3bce837 commit 559f594
Show file tree
Hide file tree
Showing 51 changed files with 3,024 additions and 142 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Fix #2292: Update createOrReplace to do replace when create fails with conflict

#### New Features
* CSI Volume Snapshot extension
* Fix #2311: Add Support for creating bootstrap project template
* Fix #2287: Add support for V1 and V1Beta1 CustomResourceDefinition
* Fix #2319: Create Config without using auto-configure functionality or setting env variables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@
*/
package io.fabric8.knative.client;

import io.fabric8.kubernetes.client.ExtensionAdapterSupport;
import io.fabric8.kubernetes.client.Client;
import io.fabric8.kubernetes.api.model.RootPaths;
import io.fabric8.kubernetes.client.ExtensionAdapter;
import okhttp3.OkHttpClient;

import java.net.URL;
import java.util.List;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

public class KnativeExtensionAdapter implements ExtensionAdapter<KnativeClient> {
public class KnativeExtensionAdapter extends ExtensionAdapterSupport implements ExtensionAdapter<KnativeClient> {

static final ConcurrentMap<URL, Boolean> IS_TEKTON = new ConcurrentHashMap<>();
static final ConcurrentMap<URL, Boolean> USES_TEKTON_APIGROUPS = new ConcurrentHashMap<>();
Expand All @@ -37,35 +36,11 @@ public Class<KnativeClient> getExtensionType() {

@Override
public Boolean isAdaptable(Client client) {
return isKnativeAvailable(client);
return isAdaptable(client, IS_TEKTON, USES_TEKTON_APIGROUPS, "knative.dev");
}

@Override
public KnativeClient adapt(Client client) {
return new DefaultKnativeClient(client.adapt(OkHttpClient.class), client.getConfiguration());
}

private boolean isKnativeAvailable(Client client) {
URL masterUrl = client.getMasterUrl();
if (IS_TEKTON.containsKey(masterUrl)) {
return IS_TEKTON.get(masterUrl);
} else {
RootPaths rootPaths = client.rootPaths();
if (rootPaths != null) {
List<String> paths = rootPaths.getPaths();
if (paths != null) {
for (String path : paths) {
// lets detect the new API Groups APIs for OpenShift
if (path.endsWith("knative.dev") || path.contains("knative.dev/")) {
USES_TEKTON_APIGROUPS.putIfAbsent(masterUrl, true);
IS_TEKTON.putIfAbsent(masterUrl, true);
return true;
}
}
}
}
}
IS_TEKTON.putIfAbsent(masterUrl, false);
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@
*/
package io.fabric8.knative.client.serving.v1;

import io.fabric8.kubernetes.client.ExtensionAdapterSupport;
import io.fabric8.kubernetes.client.Client;
import io.fabric8.kubernetes.api.model.RootPaths;
import io.fabric8.kubernetes.client.ExtensionAdapter;
import okhttp3.OkHttpClient;

import java.net.URL;
import java.util.List;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

public class ServingV1ExtensionAdapter implements ExtensionAdapter<ServingV1Client> {
public class ServingV1ExtensionAdapter extends ExtensionAdapterSupport implements ExtensionAdapter<ServingV1Client> {

static final ConcurrentMap<URL, Boolean> IS_KNATIVE = new ConcurrentHashMap<>();
static final ConcurrentMap<URL, Boolean> USES_KNATIVE_APIGROUPS = new ConcurrentHashMap<>();
Expand All @@ -37,35 +36,11 @@ public Class<ServingV1Client> getExtensionType() {

@Override
public Boolean isAdaptable(Client client) {
return isServingV1Available(client);
return isAdaptable(client, IS_KNATIVE, USES_KNATIVE_APIGROUPS, "knative.dev");
}

@Override
public ServingV1Client adapt(Client client) {
return new DefaultServingV1Client(client.adapt(OkHttpClient.class), client.getConfiguration());
}

private boolean isServingV1Available(Client client) {
URL masterUrl = client.getMasterUrl();
if (IS_KNATIVE.containsKey(masterUrl)) {
return IS_KNATIVE.get(masterUrl);
} else {
RootPaths rootPaths = client.rootPaths();
if (rootPaths != null) {
List<String> paths = rootPaths.getPaths();
if (paths != null) {
for (String path : paths) {
// lets detect the new API Groups APIs for OpenShift
if (path.endsWith("knative.dev") || path.contains("knative.dev/")) {
USES_KNATIVE_APIGROUPS.putIfAbsent(masterUrl, true);
IS_KNATIVE.putIfAbsent(masterUrl, true);
return true;
}
}
}
}
}
IS_KNATIVE.putIfAbsent(masterUrl, false);
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@
*/
package io.fabric8.knative.client.serving.v1beta1;

import io.fabric8.kubernetes.client.ExtensionAdapterSupport;
import io.fabric8.kubernetes.client.Client;
import io.fabric8.kubernetes.api.model.RootPaths;
import io.fabric8.kubernetes.client.ExtensionAdapter;
import okhttp3.OkHttpClient;

import java.net.URL;
import java.util.List;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentHashMap;

public class ServingV1Beta1ExtensionAdapter implements ExtensionAdapter<ServingV1Beta1Client> {
public class ServingV1Beta1ExtensionAdapter extends ExtensionAdapterSupport implements ExtensionAdapter<ServingV1Beta1Client> {

static final ConcurrentMap<URL, Boolean> IS_KNATIVE = new ConcurrentHashMap<>();
static final ConcurrentMap<URL, Boolean> USES_KNATIVE_APIGROUPS = new ConcurrentHashMap<>();
Expand All @@ -37,35 +36,11 @@ public Class<ServingV1Beta1Client> getExtensionType() {

@Override
public Boolean isAdaptable(Client client) {
return isServingV1Beta1Available(client);
return isAdaptable(client, IS_KNATIVE, USES_KNATIVE_APIGROUPS, "knative.dev");
}

@Override
public ServingV1Beta1Client adapt(Client client) {
return new DefaultServingV1Beta1Client(client.adapt(OkHttpClient.class), client.getConfiguration());
}

private boolean isServingV1Beta1Available(Client client) {
URL masterUrl = client.getMasterUrl();
if (IS_KNATIVE.containsKey(masterUrl)) {
return IS_KNATIVE.get(masterUrl);
} else {
RootPaths rootPaths = client.rootPaths();
if (rootPaths != null) {
List<String> paths = rootPaths.getPaths();
if (paths != null) {
for (String path : paths) {
// lets detect the new API Groups APIs for OpenShift
if (path.endsWith("knative.dev") || path.contains("knative.dev/")) {
USES_KNATIVE_APIGROUPS.putIfAbsent(masterUrl, true);
IS_KNATIVE.putIfAbsent(masterUrl, true);
return true;
}
}
}
}
}
IS_KNATIVE.putIfAbsent(masterUrl, false);
return false;
}
}
1 change: 1 addition & 0 deletions extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<module>knative</module>
<module>tekton</module>
<module>service-catalog</module>
<module>volumesnapshot</module>
</modules>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@
*/
package io.fabric8.servicecatalog.client;

import io.fabric8.kubernetes.api.model.RootPaths;
import io.fabric8.kubernetes.client.ExtensionAdapterSupport;
import io.fabric8.kubernetes.client.Client;
import io.fabric8.kubernetes.client.ExtensionAdapter;
import okhttp3.OkHttpClient;

import java.net.URL;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

public class ServiceCatalogExtensionAdapter implements ExtensionAdapter<ServiceCatalogClient> {
public class ServiceCatalogExtensionAdapter extends ExtensionAdapterSupport implements ExtensionAdapter<ServiceCatalogClient> {

static final ConcurrentMap<URL, Boolean> IS_SERVICE_CATALOG = new ConcurrentHashMap<>();
static final ConcurrentMap<URL, Boolean> USES_SERVICE_CATALOG_APIGROUPS = new ConcurrentHashMap<>();
Expand All @@ -37,35 +36,11 @@ public Class<ServiceCatalogClient> getExtensionType() {

@Override
public Boolean isAdaptable(Client client) {
return isServiceCatalogAvailable(client);
return isAdaptable(client, IS_SERVICE_CATALOG, USES_SERVICE_CATALOG_APIGROUPS, "servicecatalog.k8s.io");
}

@Override
public ServiceCatalogClient adapt(Client client) {
return new DefaultServiceCatalogClient(client.adapt(OkHttpClient.class), client.getConfiguration());
}

private boolean isServiceCatalogAvailable(Client client) {
URL masterUrl = client.getMasterUrl();
if (IS_SERVICE_CATALOG.containsKey(masterUrl)) {
return IS_SERVICE_CATALOG.get(masterUrl);
} else {
RootPaths rootPaths = client.rootPaths();
if (rootPaths != null) {
List<String> paths = rootPaths.getPaths();
if (paths != null) {
for (String path : paths) {
// lets detect the new API Groups APIs for OpenShift
if (path.endsWith("servicecatalog.k8s.io") || path.contains("servicecatalog.k8s.io/")) {
USES_SERVICE_CATALOG_APIGROUPS.putIfAbsent(masterUrl, true);
IS_SERVICE_CATALOG.putIfAbsent(masterUrl, true);
return true;
}
}
}
}
}
IS_SERVICE_CATALOG.putIfAbsent(masterUrl, false);
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@
*/
package io.fabric8.tekton.client;

import io.fabric8.kubernetes.client.ExtensionAdapterSupport;
import io.fabric8.kubernetes.client.Client;
import io.fabric8.kubernetes.api.model.RootPaths;
import io.fabric8.kubernetes.client.ExtensionAdapter;
import okhttp3.OkHttpClient;

import java.net.URL;
import java.util.List;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentHashMap;

public class TektonExtensionAdapter implements ExtensionAdapter<TektonClient> {
public class TektonExtensionAdapter extends ExtensionAdapterSupport implements ExtensionAdapter<TektonClient> {

static final ConcurrentMap<URL, Boolean> IS_TEKTON = new ConcurrentHashMap<>();
static final ConcurrentMap<URL, Boolean> USES_TEKTON_APIGROUPS = new ConcurrentHashMap<>();
Expand All @@ -37,35 +36,11 @@ public Class<TektonClient> getExtensionType() {

@Override
public Boolean isAdaptable(Client client) {
return isTektonAvailable(client);
return isAdaptable(client, IS_TEKTON, USES_TEKTON_APIGROUPS, "tekton.dev");
}

@Override
public TektonClient adapt(Client client) {
return new DefaultTektonClient(client.adapt(OkHttpClient.class), client.getConfiguration());
}

private boolean isTektonAvailable(Client client) {
URL masterUrl = client.getMasterUrl();
if (IS_TEKTON.containsKey(masterUrl)) {
return IS_TEKTON.get(masterUrl);
} else {
RootPaths rootPaths = client.rootPaths();
if (rootPaths != null) {
List<String> paths = rootPaths.getPaths();
if (paths != null) {
for (String path : paths) {
// lets detect the new API Groups APIs for OpenShift
if (path.endsWith("tekton.dev") || path.contains("tekton.dev/")) {
USES_TEKTON_APIGROUPS.putIfAbsent(masterUrl, true);
IS_TEKTON.putIfAbsent(masterUrl, true);
return true;
}
}
}
}
}
IS_TEKTON.putIfAbsent(masterUrl, false);
return false;
}
}
Loading

0 comments on commit 559f594

Please sign in to comment.