Skip to content

Commit

Permalink
fix: Misc fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
iocanel committed Mar 15, 2019
1 parent c2fc644 commit ab8ddcf
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public T create(T... resources) throws KubernetesClientException {
if (resources.length > 1) {
throw new IllegalArgumentException("Too many items to create.");
} else if (resources.length == 1) {
return handleCreate(resources[0]);
return withItem(resources[0]).create();
} else if (getItem() == null) {
throw new IllegalArgumentException("Nothing to create.");
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package io.fabric8.kubernetes.client.dsl.base;

import io.fabric8.kubernetes.api.model.HasMetadata;
import io.fabric8.kubernetes.client.Config;
import io.fabric8.kubernetes.client.utils.ApiVersionUtil;
import io.fabric8.kubernetes.client.utils.Utils;
Expand Down Expand Up @@ -68,7 +67,7 @@ public OperationContext(OkHttpClient client, Config config, String plural, Strin
this.reloadingFromServer = reloadingFromServer;
this.gracePeriodSeconds = gracePeriodSeconds;
this.item = item;
this.apiGroupName = Utils.isNullOrEmpty(apiGroupName) ? ApiVersionUtil.apiGroup(item, apiGroupName) : apiGroupName;
this.apiGroupName = ApiVersionUtil.apiGroup(item, apiGroupName);
this.apiGroupVersion = ApiVersionUtil.apiVersion(item, apiGroupVersion);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,6 @@ public CustomResourceOperationContext withGracePeriodSeconds(long gracePeriodSec
return new CustomResourceOperationContext(client, config, plural, namespace, name, apiGroupName, apiGroupVersion, cascading,item, labels, labelsNot, labelsIn, labelsNotIn, fields, resourceVersion, reloadingFromServer, gracePeriodSeconds, crd, type, listType, doneableType);
}

public CustomResourceOperationContext withRolling(boolean rolling) {
return new CustomResourceOperationContext(client, config, plural, namespace, name, apiGroupName, apiGroupVersion, cascading,item, labels, labelsNot, labelsIn, labelsNotIn, fields, resourceVersion, reloadingFromServer, gracePeriodSeconds, crd, type, listType, doneableType);
}

public CustomResourceOperationContext withRollingTimeout(long rollingTimeout) {
return new CustomResourceOperationContext(client, config, plural, namespace, name, apiGroupName, apiGroupVersion, cascading,item, labels, labelsNot, labelsIn, labelsNotIn, fields, resourceVersion, reloadingFromServer, gracePeriodSeconds, crd, type, listType, doneableType);
}

public CustomResourceOperationContext withRollingTimeUnit(TimeUnit rollingTimeUnit) {
return new CustomResourceOperationContext(client, config, plural, namespace, name, apiGroupName, apiGroupVersion, cascading,item, labels, labelsNot, labelsIn, labelsNotIn, fields, resourceVersion, reloadingFromServer, gracePeriodSeconds, crd, type, listType, doneableType);
}

public CustomResourceOperationContext withCrd(Object crd) {
return new CustomResourceOperationContext(client, config, plural, namespace, name, apiGroupName, apiGroupVersion, cascading,item, labels, labelsNot, labelsIn, labelsNotIn, fields, resourceVersion, reloadingFromServer, gracePeriodSeconds, crd, type, listType, doneableType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.fabric8.kubernetes.client.dsl.base.HasMetadataOperation;
import io.fabric8.kubernetes.client.dsl.base.OperationContext;
import io.fabric8.kubernetes.client.utils.URLUtils;
import io.fabric8.kubernetes.client.utils.Utils;
import io.fabric8.openshift.client.DefaultOpenShiftClient;
import io.fabric8.openshift.client.OpenShiftClient;
import io.fabric8.openshift.client.OpenShiftConfig;
Expand All @@ -42,12 +43,13 @@ public static OperationContext wrap(OperationContext context) {
OpenShiftConfig config = OpenShiftConfig.wrap(context.getConfig());
String oapiVersion = config.getOapiVersion();
OpenShiftClient oc = new DefaultOpenShiftClient(context.getClient(), config);
if (config.isOpenShiftAPIGroups(oc)) {
if (Utils.isNotNullOrEmpty(context.getApiGroupName()) && config.isOpenShiftAPIGroups(oc)) {
String apiGroupUrl = URLUtils.join(config.getMasterUrl(), "apis", context.getApiGroupName(), oapiVersion);
String apiGroupVersion = URLUtils.join(context.getApiGroupName(), oapiVersion);
return context.withConfig(new OpenShiftConfig(config, apiGroupUrl)).withApiGroupName(context.getApiGroupName()).withApiGroupVersion(apiGroupVersion);
} else {
return context.withApiGroupVersion(oapiVersion);
String apiGroupUrl = URLUtils.join(config.getMasterUrl(), "oapi", oapiVersion);
return context.withConfig(new OpenShiftConfig(config, apiGroupUrl)).withApiGroupName(context.getApiGroupName()).withApiGroupVersion(oapiVersion);
}
}

Expand Down

0 comments on commit ab8ddcf

Please sign in to comment.