Skip to content

Commit

Permalink
fix #3875 moving static state to non-static
Browse files Browse the repository at this point in the history
- converting openshift clients to extension api
- removing extension adapters as extension client adapters can act as
their own factories
- correcting namespaced/plural for several openshift resources to remove
their operations
  • Loading branch information
shawkins committed Mar 22, 2022
1 parent eaf7a15 commit e09f4b4
Show file tree
Hide file tree
Showing 289 changed files with 2,452 additions and 5,833 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#### New Features
* Fix #3407: Added Itemable.withItem to directly associate a resource with the DSL. It can be used as an alternative to Loadable.load when you already have the item. There is also client.resourceList(...).getResources() - that will provide the resource list as Resources. This allows you to implement composite operations easily with lambda: client.resourceList(...).getResources().forEach(r -> r.delete());
* Fix #3922: added Client.supports and Client.hasApiGroup methods
* KubernetesMockServer has new methods - unsupported and reset - to control what apis are unsupported and to reset its state.

#### _**Note**_: Breaking changes in the API
Please see the [migration guide](doc/MIGRATION-v6.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package io.fabric8.camelk.client;

import io.fabric8.camelk.client.dsl.V1APIGroupDSL;
import io.fabric8.camelk.client.dsl.V1alpha1APIGroupDSL;
import io.fabric8.kubernetes.client.Client;
import io.fabric8.kubernetes.client.extension.ExtensionAdapter;

Expand All @@ -30,4 +32,10 @@ public CamelKClient adapt(Client client) {
return new DefaultCamelKClient(client);
}

@Override
public void registerClients(ClientFactory factory) {
factory.register(V1APIGroupDSL.class, new V1APIGroupClient());
factory.register(V1alpha1APIGroupDSL.class, new V1alpha1APIGroupClient());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@
import io.fabric8.kubernetes.client.RequestConfig;
import io.fabric8.kubernetes.client.WithRequestCallable;
import io.fabric8.kubernetes.client.dsl.FunctionCallable;
import io.fabric8.kubernetes.client.extension.ClientAdapter;
import io.fabric8.kubernetes.client.extension.ExtensionRootClientAdapter;
import io.fabric8.kubernetes.client.extension.SupportTestingClient;

public class DefaultCamelKClient extends ClientAdapter<DefaultCamelKClient>
public class DefaultCamelKClient extends ExtensionRootClientAdapter<DefaultCamelKClient>
implements NamespacedCamelKClient, SupportTestingClient {

public DefaultCamelKClient() {
super();
}

public DefaultCamelKClient(Config configuration) {
super(configuration);
public DefaultCamelKClient(Config config) {
super(config);
}

public DefaultCamelKClient(Client client) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,15 @@
import io.fabric8.camelk.v1.IntegrationList;
import io.fabric8.camelk.v1.IntegrationPlatform;
import io.fabric8.camelk.v1.IntegrationPlatformList;
import io.fabric8.kubernetes.client.Client;
import io.fabric8.kubernetes.client.dsl.MixedOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.kubernetes.client.extension.ClientAdapter;

public class V1APIGroupClient extends ClientAdapter<V1APIGroupClient> implements V1APIGroupDSL {

public V1APIGroupClient() {
super();
}

public V1APIGroupClient(Client client) {
super(client);
}

@Override
public V1APIGroupClient newInstance(Client client) {
return new V1APIGroupClient(client);
public V1APIGroupClient newInstance() {
return new V1APIGroupClient();
}

@Override
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,15 @@
import io.fabric8.camelk.client.dsl.V1alpha1APIGroupDSL;
import io.fabric8.camelk.v1alpha1.Kamelet;
import io.fabric8.camelk.v1alpha1.KameletList;
import io.fabric8.kubernetes.client.Client;
import io.fabric8.kubernetes.client.dsl.MixedOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.kubernetes.client.extension.ClientAdapter;

public class V1alpha1APIGroupClient extends ClientAdapter<V1alpha1APIGroupClient> implements V1alpha1APIGroupDSL {

public V1alpha1APIGroupClient() {
super();
}

public V1alpha1APIGroupClient(Client client) {
super(client);
}

@Override
public V1alpha1APIGroupClient newInstance(Client client) {
return new V1alpha1APIGroupClient(client);
public V1alpha1APIGroupClient newInstance() {
return new V1alpha1APIGroupClient();
}

@Override
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@
# limitations under the License.
#
io.fabric8.camelk.client.CamelKExtensionAdapter
io.fabric8.camelk.client.V1APIGroupExtensionAdapter
io.fabric8.camelk.client.V1alpha1APIGroupExtensionAdapter
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
*/
package io.fabric8.certmanager.client;

import io.fabric8.certmanager.client.dsl.V1APIGroupDSL;
import io.fabric8.certmanager.client.dsl.V1alpha2APIGroupDSL;
import io.fabric8.certmanager.client.dsl.V1alpha3APIGroupDSL;
import io.fabric8.certmanager.client.dsl.V1beta1APIGroupDSL;
import io.fabric8.kubernetes.client.Client;
import io.fabric8.kubernetes.client.extension.ExtensionAdapter;

Expand All @@ -30,4 +34,12 @@ public CertManagerClient adapt(Client client) {
return new DefaultCertManagerClient(client);
}

@Override
public void registerClients(ClientFactory factory) {
factory.register(V1alpha2APIGroupDSL.class, new V1alpha2APIGroupClient());
factory.register(V1alpha3APIGroupDSL.class, new V1alpha3APIGroupClient());
factory.register(V1beta1APIGroupDSL.class, new V1beta1APIGroupClient());
factory.register(V1APIGroupDSL.class, new V1APIGroupClient());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,25 @@
import io.fabric8.kubernetes.client.RequestConfig;
import io.fabric8.kubernetes.client.WithRequestCallable;
import io.fabric8.kubernetes.client.dsl.FunctionCallable;
import io.fabric8.kubernetes.client.extension.ClientAdapter;
import io.fabric8.kubernetes.client.extension.ExtensionRootClientAdapter;

public class DefaultCertManagerClient extends ClientAdapter<NamespacedCertManagerClient> implements NamespacedCertManagerClient {
public class DefaultCertManagerClient extends ExtensionRootClientAdapter<DefaultCertManagerClient>
implements NamespacedCertManagerClient {

public DefaultCertManagerClient() {
super();
}

public DefaultCertManagerClient(Config configuration) {
super(configuration);
public DefaultCertManagerClient(Config config) {
super(config);
}

public DefaultCertManagerClient(Client client) {
super(client);
}

@Override
protected NamespacedCertManagerClient newInstance(Client client) {
protected DefaultCertManagerClient newInstance(Client client) {
return new DefaultCertManagerClient(client);
}

Expand All @@ -51,7 +52,9 @@ public FunctionCallable<NamespacedCertManagerClient> withRequestConfig(RequestCo
}

@Override
public V1APIGroupDSL v1() { return adapt(V1APIGroupClient.class); }
public V1APIGroupDSL v1() {
return adapt(V1APIGroupClient.class);
}

@Override
public V1alpha2APIGroupDSL v1alpha2() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,16 @@
import io.fabric8.certmanager.api.model.v1.Issuer;
import io.fabric8.certmanager.api.model.v1.IssuerList;
import io.fabric8.certmanager.client.dsl.V1APIGroupDSL;
import io.fabric8.kubernetes.client.Client;
import io.fabric8.kubernetes.client.dsl.MixedOperation;
import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.kubernetes.client.extension.ClientAdapter;

public class V1APIGroupClient extends ClientAdapter<V1APIGroupDSL> implements V1APIGroupDSL {
public V1APIGroupClient() {super();}

public V1APIGroupClient(Client client) {
super(client);
}
public class V1APIGroupClient extends ClientAdapter<V1APIGroupClient> implements V1APIGroupDSL {

@Override
protected V1APIGroupDSL newInstance(Client client) {
return new V1APIGroupClient(client);
public V1APIGroupClient newInstance() {
return new V1APIGroupClient();
}

@Override
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,16 @@
import io.fabric8.certmanager.api.model.v1alpha2.Issuer;
import io.fabric8.certmanager.api.model.v1alpha2.IssuerList;
import io.fabric8.certmanager.client.dsl.V1alpha2APIGroupDSL;
import io.fabric8.kubernetes.client.Client;
import io.fabric8.kubernetes.client.dsl.MixedOperation;
import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.kubernetes.client.extension.ClientAdapter;

public class V1alpha2APIGroupClient extends ClientAdapter<V1alpha2APIGroupDSL> implements V1alpha2APIGroupDSL {
public V1alpha2APIGroupClient() {
super();
}

public V1alpha2APIGroupClient(Client client) {
super(client);
}
public class V1alpha2APIGroupClient extends ClientAdapter<V1alpha2APIGroupClient> implements V1alpha2APIGroupDSL {

@Override
protected V1alpha2APIGroupDSL newInstance(Client client) {
return new V1alpha2APIGroupClient(client);
public V1alpha2APIGroupClient newInstance() {
return new V1alpha2APIGroupClient();
}

@Override
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,16 @@
import io.fabric8.certmanager.api.model.v1alpha3.Issuer;
import io.fabric8.certmanager.api.model.v1alpha3.IssuerList;
import io.fabric8.certmanager.client.dsl.V1alpha3APIGroupDSL;
import io.fabric8.kubernetes.client.Client;
import io.fabric8.kubernetes.client.dsl.MixedOperation;
import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.kubernetes.client.extension.ClientAdapter;

public class V1alpha3APIGroupClient extends ClientAdapter<V1alpha3APIGroupDSL> implements V1alpha3APIGroupDSL {
public V1alpha3APIGroupClient() {
super();
}

public V1alpha3APIGroupClient(Client client) {
super(client);
}
public class V1alpha3APIGroupClient extends ClientAdapter<V1alpha3APIGroupClient> implements V1alpha3APIGroupDSL {

@Override
protected V1alpha3APIGroupDSL newInstance(Client client) {
return new V1alpha3APIGroupClient(client);
public V1alpha3APIGroupClient newInstance() {
return new V1alpha3APIGroupClient();
}

@Override
Expand Down
Loading

0 comments on commit e09f4b4

Please sign in to comment.