Skip to content

Commit

Permalink
fix #4662: adding a changelog and additional deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins authored and manusa committed May 23, 2023
1 parent 3633ea6 commit 14833da
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 28 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ Fix #5145: [java-generator] handle `additionalProperties: true` emitting a field
* Fix #4911: Config/RequestConfig.scaleTimeout has been deprecated along with Scalable.scale(count, wait) and DeployableScalableResource.deployLatest(wait). withTimeout may be called before the operation to control the timeout.
* Fix #4911: Config/RequestConfig.websocketTimeout has been removed. Config/RequestConfig.requestTimeout will be used for websocket connection timeouts.
* Fix #4911: HttpClient api/building changes - writeTimeout has been removed, readTimeout has moved to the HttpRequest
* Fix #4662: removed deprecated classes/methods: ReflectUtils, ReplaceValueStream, ParameterNamespaceListVisitFromServerGetDeleteRecreateWaitApplicable, ResourceCompare, and Serialization methods taking parameters
* Fix #4662: deprecated serialization static logic: several IOHelpers methods, Serialization methods, such as access to the static jsonMapper. Please use KubernetesSerialization methods instead.
* Fix #4662: deprecated Helper.getAnnotationValue, use HasMetadata methods instead.

### 6.6.2 (2023-05-15)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

import io.fabric8.kubernetes.api.model.HasMetadata;
import io.fabric8.kubernetes.api.model.ObjectMeta;
import io.fabric8.kubernetes.client.utils.ReflectUtils;
import io.fabric8.kubernetes.client.utils.Utils;

import java.util.Collections;
import java.util.List;
import java.util.Optional;

/**
* It basically saves and indexes all the entries.
Expand All @@ -41,27 +41,16 @@ public interface Cache<T> extends Indexer<T> {
* @param obj specific object
* @return the key
*/
public static String metaNamespaceKeyFunc(Object obj) {
try {
if (obj == null) {
return "";
}
ObjectMeta metadata;
if (obj instanceof String) {
return (String) obj;
} else if (obj instanceof ObjectMeta) {
metadata = (ObjectMeta) obj;
} else {
metadata = ReflectUtils.objectMetadata(obj);
if (metadata == null) {
throw new RuntimeException("Object is bad :" + obj);
}
}

return namespaceKeyFunc(metadata.getNamespace(), metadata.getName());
} catch (ReflectiveOperationException e) {
throw new RuntimeException(e);
public static String metaNamespaceKeyFunc(HasMetadata obj) {
if (obj == null) {
return "";
}
ObjectMeta metadata = obj.getMetadata();
if (metadata == null) {
throw new RuntimeException("Object is bad :" + obj);
}

return namespaceKeyFunc(metadata.getNamespace(), metadata.getName());
}

public static String metaUidKeyFunc(HasMetadata obj) {
Expand Down Expand Up @@ -90,12 +79,8 @@ public static String namespaceKeyFunc(String objectNamespace, String objectName)
* @param obj the specific object
* @return the indexed value
*/
public static List<String> metaNamespaceIndexFunc(Object obj) {
try {
ObjectMeta metadata = ReflectUtils.objectMetadata(obj);
return metadata == null ? Collections.emptyList() : Collections.singletonList(metadata.getNamespace());
} catch (ReflectiveOperationException e) {
throw new RuntimeException(e);
}
public static List<String> metaNamespaceIndexFunc(HasMetadata obj) {
return Optional.ofNullable(obj).map(HasMetadata::getMetadata)
.map(metadata -> Collections.singletonList(metadata.getNamespace())).orElse(Collections.emptyList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
import java.lang.reflect.Method;
import java.util.List;

/**
* @deprecated use {@link HasMetadata} methods instead
*/
@Deprecated
public class ReflectUtils {
private ReflectUtils() {
throw new IllegalStateException("Utility class");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
/**
* Replaces template parameter values in the stream to avoid
* parsing issues of templates with numeric expressions
*
* @deprecated to be removed in future versions
*/
@Deprecated
public class ReplaceValueStream {
private final Map<String, String> valuesMap;

Expand Down

0 comments on commit 14833da

Please sign in to comment.