Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore #3906: deprecating CustomResourceList #4232

Merged
merged 1 commit into from
Jul 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions doc/MIGRATION-v6.md
Expand Up @@ -244,10 +244,11 @@ We've removed setter methods `setIntVal`, `setKind`, `setStrVal` from the class.

- DSL methods available off of a resource context involving a resource - `client.configMaps().withName("name").create(configMap)` - should instead use a no-argument method - `client.configMaps().resource(configMap).create()` or `client.resource(configMap).create()`.

- DSL methods available off of a collection context involving a resource - `client.configMaps().create(configMap)` - should instead use a no-argument method - `client.configMaps().resource(configMap).create()` or `client.resource(configMap).create()`.

- DSL methods available off of a collection context involving a resource - `client.configMaps().create(configMap)` - should instead use a no-argument method - `client.configMaps().resource(configMap).create()` or `client.resource(configMap).create()`.
The only exception to the above is `patch(PatchContext, item)` - it is valid to be called after withName.

- CustomResourceList was deprecated - use DefaultKubernetesResourceList instead.

## Object Sorting

`KubernetesList` and `Template` will no longer automatically sort their objects by default. You may use the `HasMetadataComparator` yourself to sort the items as needed.
Expand Down
Expand Up @@ -18,5 +18,9 @@
import io.fabric8.kubernetes.api.model.DefaultKubernetesResourceList;
import io.fabric8.kubernetes.api.model.HasMetadata;

/**
* @deprecated use DefaultKubernetesResourceList instead
*/
@Deprecated
public class CustomResourceList<T extends HasMetadata> extends DefaultKubernetesResourceList<T> {
}
Expand Up @@ -21,7 +21,6 @@
import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinitionList;
import io.fabric8.kubernetes.api.model.apiextensions.v1.JSONSchemaPropsBuilder;
import io.fabric8.kubernetes.client.CustomResource;
import io.fabric8.kubernetes.client.CustomResourceList;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClientBuilder;
import io.fabric8.kubernetes.client.KubernetesClientException;
Expand Down Expand Up @@ -111,23 +110,23 @@ public static void main(String[] args) {
System.out.println("Found CRD: " + dummyCRD.getMetadata().getSelfLink());
} else {
dummyCRD = CustomResourceDefinitionContext.v1CRDFromCustomResourceType(Dummy.class)
.editSpec()
.editVersion(0)
.withNewSchema()
.withNewOpenAPIV3Schema()
.withTitle("dummy")
.withType("object")
.addToRequired("spec")
.addToProperties("spec", new JSONSchemaPropsBuilder()
.editSpec()
.editVersion(0)
.withNewSchema()
.withNewOpenAPIV3Schema()
.withTitle("dummy")
.withType("object")
.addToProperties("foo", new JSONSchemaPropsBuilder().withType("string").build())
.addToProperties("bar", new JSONSchemaPropsBuilder().withType("string").build())
.build())
.endOpenAPIV3Schema()
.endSchema()
.endVersion()
.endSpec()
.build();
.addToRequired("spec")
.addToProperties("spec", new JSONSchemaPropsBuilder()
.withType("object")
.addToProperties("foo", new JSONSchemaPropsBuilder().withType("string").build())
.addToProperties("bar", new JSONSchemaPropsBuilder().withType("string").build())
.build())
.endOpenAPIV3Schema()
.endSchema()
.endVersion()
.endSpec()
.build();

client.apiextensions().v1().customResourceDefinitions().create(dummyCRD);
System.out.println("Created CRD " + dummyCRD.getMetadata().getName());
Expand All @@ -141,7 +140,7 @@ public static void main(String[] args) {
if (resourceNamespaced) {
dummyClient = ((MixedOperation<Dummy, DummyList, Resource<Dummy>>) dummyClient).inNamespace(namespace);
}
CustomResourceList<Dummy> dummyList = dummyClient.list();
DummyList dummyList = dummyClient.list();
List<Dummy> items = dummyList.getItems();
System.out.println(" found " + items.size() + " dummies");
for (Dummy item : items) {
Expand Down
Expand Up @@ -15,12 +15,12 @@
*/
package io.fabric8.kubernetes.examples;

import io.fabric8.kubernetes.api.model.DefaultKubernetesResourceList;
import io.fabric8.kubernetes.api.model.Namespaced;
import io.fabric8.kubernetes.api.model.ObjectMetaBuilder;
import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinition;
import io.fabric8.kubernetes.api.model.apiextensions.v1.JSONSchemaPropsBuilder;
import io.fabric8.kubernetes.client.CustomResource;
import io.fabric8.kubernetes.client.CustomResourceList;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClientBuilder;
import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation;
Expand Down Expand Up @@ -82,7 +82,7 @@ public Show(String metaName, ShowSpec spec) {
}
}

public static final class ShowList extends CustomResourceList<Show> {
public static final class ShowList extends DefaultKubernetesResourceList<Show> {
}

@SuppressWarnings("unused")
Expand Down
Expand Up @@ -15,7 +15,7 @@
*/
package io.fabric8.kubernetes.examples.crds;

import io.fabric8.kubernetes.client.CustomResourceList;
import io.fabric8.kubernetes.api.model.DefaultKubernetesResourceList;

public class DummyList extends CustomResourceList<Dummy> {
public class DummyList extends DefaultKubernetesResourceList<Dummy> {
}