Skip to content

Commit

Permalink
Merge pull request #1433 from iocanel/reflection
Browse files Browse the repository at this point in the history
refactor: Introduce OperationContext, to limit the use of reflection.
  • Loading branch information
iocanel authored Mar 15, 2019
2 parents afe07fd + d08f4bd commit 2ffefdd
Show file tree
Hide file tree
Showing 90 changed files with 2,315 additions and 980 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,21 @@ public AppsAPIGroupClient(OkHttpClient httpClient, final Config config) throws K

@Override
public MixedOperation<DaemonSet, DaemonSetList, DoneableDaemonSet, Resource<DaemonSet, DoneableDaemonSet>> daemonSets() {
return new DaemonSetOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new DaemonSetOperationsImpl(httpClient, getConfiguration());
}

@Override
public MixedOperation<Deployment, DeploymentList, DoneableDeployment, RollableScalableResource<Deployment, DoneableDeployment>> deployments() {
return new DeploymentOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new DeploymentOperationsImpl(httpClient, getConfiguration());
}

@Override
public MixedOperation<ReplicaSet, ReplicaSetList, DoneableReplicaSet, RollableScalableResource<ReplicaSet, DoneableReplicaSet>> replicaSets() {
return new ReplicaSetOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new ReplicaSetOperationsImpl(httpClient, getConfiguration());
}

@Override
public MixedOperation<StatefulSet, StatefulSetList, DoneableStatefulSet, RollableScalableResource<StatefulSet, DoneableStatefulSet>> statefulSets() {
return new StatefulSetOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new StatefulSetOperationsImpl(httpClient, getConfiguration());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ public AutoscalingAPIGroupClient(OkHttpClient httpClient, final Config config) t
}

public MixedOperation<HorizontalPodAutoscaler, HorizontalPodAutoscalerList, DoneableHorizontalPodAutoscaler, Resource<HorizontalPodAutoscaler, DoneableHorizontalPodAutoscaler>> horizontalPodAutoscalers() {
return new HorizontalPodAutoscalerOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new HorizontalPodAutoscalerOperationsImpl(httpClient, getConfiguration());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.fabric8.kubernetes.client;

import io.fabric8.kubernetes.client.dsl.base.OperationContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -136,7 +137,7 @@ public <C> C adapt(Class<C> type) {

@Override
public RootPaths rootPaths() {
return new BaseOperation(httpClient, configuration, null, null, "", null, null, false, null, null, false, RootPaths.class, null, null) {
return new BaseOperation(new OperationContext().withOkhttpClient(httpClient).withConfig(configuration)) {
}.getRootPaths();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ public BatchAPIGroupClient(OkHttpClient httpClient, final Config config) throws

@Override
public MixedOperation<Job, JobList, DoneableJob, ScalableResource<Job, DoneableJob>> jobs() {
return new JobOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new JobOperationsImpl(httpClient, getConfiguration());
}

@Override
public MixedOperation<CronJob, CronJobList, DoneableCronJob, Resource<CronJob, DoneableCronJob>> cronjobs() {
return new CronJobOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new CronJobOperationsImpl(httpClient, getConfiguration());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public static DefaultKubernetesClient fromConfig(InputStream is) {

@Override
public MixedOperation<ComponentStatus, ComponentStatusList, DoneableComponentStatus, Resource<ComponentStatus, DoneableComponentStatus>> componentstatuses() {
return new ComponentStatusOperationsImpl(httpClient, getConfiguration(), null);
return new ComponentStatusOperationsImpl(httpClient, getConfiguration());
}

@Override
Expand Down Expand Up @@ -152,12 +152,12 @@ public NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicable<HasMetadata,

@Override
public MixedOperation<Endpoints, EndpointsList, DoneableEndpoints, Resource<Endpoints, DoneableEndpoints>> endpoints() {
return new EndpointsOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new EndpointsOperationsImpl(httpClient, getConfiguration());
}

@Override
public MixedOperation<Event, EventList, DoneableEvent, Resource<Event, DoneableEvent>> events() {
return new EventOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new EventOperationsImpl(httpClient, getConfiguration());
}

@Override
Expand All @@ -177,22 +177,22 @@ public NonNamespaceOperation<PersistentVolume, PersistentVolumeList, DoneablePer

@Override
public MixedOperation<PersistentVolumeClaim, PersistentVolumeClaimList, DoneablePersistentVolumeClaim, Resource<PersistentVolumeClaim, DoneablePersistentVolumeClaim>> persistentVolumeClaims() {
return new PersistentVolumeClaimOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new PersistentVolumeClaimOperationsImpl(httpClient, getConfiguration());
}

@Override
public MixedOperation<Pod, PodList, DoneablePod, PodResource<Pod, DoneablePod>> pods() {
return new PodOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new PodOperationsImpl(httpClient, getConfiguration());
}

@Override
public MixedOperation<ReplicationController, ReplicationControllerList, DoneableReplicationController, RollableScalableResource<ReplicationController, DoneableReplicationController>> replicationControllers() {
return new ReplicationControllerOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new ReplicationControllerOperationsImpl(httpClient, getConfiguration());
}

@Override
public MixedOperation<ResourceQuota, ResourceQuotaList, DoneableResourceQuota, Resource<ResourceQuota, DoneableResourceQuota>> resourceQuotas() {
return new ResourceQuotaOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new ResourceQuotaOperationsImpl(httpClient, getConfiguration());
}

@Override
Expand All @@ -202,17 +202,17 @@ public SchedulingAPIGroupDSL scheduling() {

@Override
public MixedOperation<Secret, SecretList, DoneableSecret, Resource<Secret, DoneableSecret>> secrets() {
return new SecretOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new SecretOperationsImpl(httpClient, getConfiguration());
}

@Override
public MixedOperation<Service, ServiceList, DoneableService, ServiceResource<Service, DoneableService>> services() {
return new ServiceOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new ServiceOperationsImpl(httpClient, getConfiguration());
}

@Override
public MixedOperation<ServiceAccount, ServiceAccountList, DoneableServiceAccount, Resource<ServiceAccount, DoneableServiceAccount>> serviceAccounts() {
return new ServiceAccountOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new ServiceAccountOperationsImpl(httpClient, getConfiguration());
}

@Override
Expand All @@ -222,12 +222,12 @@ public KubernetesListMixedOperation lists() {

@Override
public MixedOperation<ConfigMap, ConfigMapList, DoneableConfigMap, Resource<ConfigMap, DoneableConfigMap>> configMaps() {
return new ConfigMapOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new ConfigMapOperationsImpl(httpClient, getConfiguration());
}

@Override
public MixedOperation<LimitRange, LimitRangeList, DoneableLimitRange, Resource<LimitRange, DoneableLimitRange>> limitRanges() {
return new LimitRangeOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new LimitRangeOperationsImpl(httpClient, getConfiguration());
}

@Override
Expand All @@ -237,7 +237,11 @@ public NonNamespaceOperation<CustomResourceDefinition, CustomResourceDefinitionL

@Override
public <T extends HasMetadata, L extends KubernetesResourceList, D extends Doneable<T>> MixedOperation<T, L, D, Resource<T, D>> customResources(CustomResourceDefinition crd, Class<T> resourceType, Class<L> listClass, Class<D> doneClass) {
return new CustomResourceOperationsImpl<T,L,D>(httpClient, getConfiguration(), crd, resourceType, listClass, doneClass);
return new CustomResourceOperationsImpl<T,L,D>(new CustomResourceOperationContext().withOkhttpClient(httpClient).withConfig(getConfiguration())
.withCrd(crd)
.withType(resourceType)
.withListType(listClass)
.withDoneableType(doneClass));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ public ExtensionsAPIGroupClient(OkHttpClient httpClient, final Config config) th
@Override
@Deprecated
public MixedOperation<DaemonSet, DaemonSetList, DoneableDaemonSet, Resource<DaemonSet, DoneableDaemonSet>> daemonSets() {
return new DaemonSetOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new DaemonSetOperationsImpl(httpClient, getConfiguration());
}

@Override
@Deprecated
public MixedOperation<Deployment, DeploymentList, DoneableDeployment, RollableScalableResource<Deployment, DoneableDeployment>> deployments() {
return new DeploymentOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new DeploymentOperationsImpl(httpClient, getConfiguration());
}

@Override
Expand All @@ -80,30 +80,30 @@ public MixedOperation<Ingress, IngressList, DoneableIngress, Resource<Ingress, D

@Override
public MixedOperation<Ingress, IngressList, DoneableIngress, Resource<Ingress, DoneableIngress>> ingresses() {
return new IngressOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new IngressOperationsImpl(httpClient, getConfiguration());
}

@Override
@Deprecated
public MixedOperation<Job, JobList, DoneableJob, ScalableResource<Job, DoneableJob>> jobs() {
return new JobOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new JobOperationsImpl(httpClient, getConfiguration());
}

@Override
@Deprecated
public MixedOperation<NetworkPolicy, NetworkPolicyList, DoneableNetworkPolicy, Resource<NetworkPolicy, DoneableNetworkPolicy>> networkPolicies() {
return new NetworkPolicyOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new NetworkPolicyOperationsImpl(httpClient, getConfiguration());
}

@Override
public MixedOperation<PodSecurityPolicy, PodSecurityPolicyList, DoneablePodSecurityPolicy, Resource<PodSecurityPolicy, DoneablePodSecurityPolicy>> podSecurityPolicies() {
return new PodSecurityPolicyOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new PodSecurityPolicyOperationsImpl(httpClient, getConfiguration());
}

@Override
@Deprecated
public MixedOperation<ReplicaSet, ReplicaSetList, DoneableReplicaSet, RollableScalableResource<ReplicaSet, DoneableReplicaSet>> replicaSets() {
return new ReplicaSetOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new ReplicaSetOperationsImpl(httpClient, getConfiguration());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ public NetworkAPIGroupClient(OkHttpClient httpClient, final Config config) throw

@Override
public MixedOperation<NetworkPolicy, NetworkPolicyList, DoneableNetworkPolicy, Resource<NetworkPolicy, DoneableNetworkPolicy>> networkPolicies() {
return new NetworkPolicyOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new NetworkPolicyOperationsImpl(httpClient, getConfiguration());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ public PolicyAPIGroupClient(OkHttpClient httpClient, final Config config) throws

@Override
public MixedOperation<PodDisruptionBudget, PodDisruptionBudgetList, DoneablePodDisruptionBudget, Resource<PodDisruptionBudget, DoneablePodDisruptionBudget>> podDisruptionBudget() {
return new PodDisruptionBudgetOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new PodDisruptionBudgetOperationsImpl(httpClient, getConfiguration());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ public RbacAPIGroupClient(OkHttpClient httpClient, final Config config) throws K

@Override
public MixedOperation<Role, RoleList, DoneableRole, Resource<Role, DoneableRole>> roles() {
return new RoleOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new RoleOperationsImpl(httpClient, getConfiguration());
}

@Override
public MixedOperation<RoleBinding, RoleBindingList, DoneableRoleBinding, Resource<RoleBinding, DoneableRoleBinding>> roleBindings() {
return new RoleBindingOperationsImpl(httpClient, getConfiguration(), getNamespace());
return new RoleBindingOperationsImpl(httpClient, getConfiguration());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ public SchedulingAPIGroupClient(OkHttpClient httpClient, final Config config) th

@Override
public MixedOperation<PriorityClass, PriorityClassList, DoneablePriorityClass, Resource<PriorityClass, DoneablePriorityClass>> priorityClass() {
return new PriorityClassOperationsImpl(httpClient, getConfiguration(), null);
return new PriorityClassOperationsImpl(httpClient, getConfiguration());
}
}
Loading

0 comments on commit 2ffefdd

Please sign in to comment.