Skip to content

Commit

Permalink
Merge branch 'master' into 4491
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins committed Oct 18, 2022
2 parents 53c78a5 + 366ede8 commit c5b5c95
Show file tree
Hide file tree
Showing 246 changed files with 2,146 additions and 4,864 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Expand Up @@ -3,16 +3,20 @@
### 6.2-SNAPSHOT

#### Bugs
* Fix #4312: fix timestamp can't be deserialized for IstioCondition
* Fix #4369: Informers will retry with a backoff on list/watch failure as they did in 5.12 and prior.
* Fix #4350: SchemaSwap annotation is now repeatable and is applied multiple times if classes are used more than once in the class hierarchy.
* Fix #3733: The authentication command from the .kube/config won't be discarded if no arguments are specified
* Fix #4460: removing split packages. Converting Default clients into adapters rather than real instances.
* Fix #4441: corrected patch base handling for the patch methods available from a Resource - resource(item).patch() will be evaluated as resource(latest).patch(item). Also undeprecated patch(item), which is consistent with leaving patch(context, item) undeprecated as well. For consistency with the other operations (such as edit), patch(item) will use the context item as the base when available, or the server side item when not. This means that patch(item) is only the same as resource(item).patch() when the patch(item) is called when the context item is missing or is the same as the latest.
* Fix #4442: TokenRefreshInterceptor doesn't overwrite existing OAuth token with empty string
* Fix #4459: Fixed OSGi startup exceptions while using KubernetesClient/OpenShiftClient
* Fix #4482: Fixing blocking behavior of okhttp log watch
* Fix #4473: Fix regression in backoff interval introduced in #4365
* Fix #4426: [java-generator] Encode an `AnyType` instead of an Object if `x-kubernetes-preserve-unknown-fields` is present and the type is null.

#### Improvements
* Fix #4471: Adding KubernetesClientBuilder.withHttpClientBuilderConsumer to further customize the HttpClient for any implementation.
* Fix #4348: Introduce specific annotations for the generators
* Refactor #4441: refactoring `TokenRefreshInterceptor`
* Fix #4491: added a more explicit shutdown exception for okhttp
Expand All @@ -34,8 +38,9 @@
#### _**Note**_: Breaking changes in the API
* Fix #4350: SchemaSwap's fieldName parameter now expects a field name only, not a method or a constructor.
* Module `io.fabric8:tekton-model-triggers` which contained Tekton triggers v1alpha1 model has been removed. We have introduced separate modules `io.fabric8:tekton-model-v1alpha1` and `io.fabric8:tekton-model-v1beta1` for Tekton triggers v1alpha1 and v1beta1 apigroups respectively. Users who are using `io.fabric8:tekton-client` dependency directly should be unaffected by this change.
* Fix #4384: javax.validation.* annotations are no longer added by the Java generator.
* Fix #3864: Now it's compulsory to provide `etc/io.fabric8.openshift.client.cfg` file in order to load ManagedOpenShiftClient in OSGi environment.
* Fix #3924: Extension Mock modules have been removed
* Fix #4384: javax.validation.* annotations are no longer added by the Java generator.

### 5.12.4 (2022-09-30)

Expand Down
Expand Up @@ -92,6 +92,7 @@ public abstract class AbstractJsonSchema<T, B> {
public static final String ANNOTATION_SCHEMA_SWAPS = "io.fabric8.crd.generator.annotation.SchemaSwaps";

public static final String JSON_NODE_TYPE = "com.fasterxml.jackson.databind.JsonNode";
public static final String ANY_TYPE = "io.fabric8.kubernetes.api.model.AnyType";

static {
COMMON_MAPPINGS.put(STRING_REF, STRING_MARKER);
Expand Down Expand Up @@ -239,14 +240,18 @@ private void extractSchemaSwap(ClassRef definitionType, Object annotation, Inter
}

private T internalFromImpl(TypeDef definition, Set<String> visited, InternalSchemaSwaps schemaSwaps, String... ignore) {
final B builder = newBuilder();
Set<String> ignores = ignore.length > 0 ? new LinkedHashSet<>(Arrays.asList(ignore))
: Collections
.emptySet();
List<String> required = new ArrayList<>();

boolean preserveUnknownFields = (definition.getFullyQualifiedName() != null &&
definition.getFullyQualifiedName().equals(JSON_NODE_TYPE));
final boolean isJsonNode = (definition.getFullyQualifiedName() != null &&
(definition.getFullyQualifiedName().equals(JSON_NODE_TYPE)
|| definition.getFullyQualifiedName().equals(ANY_TYPE)));

final B builder = (isJsonNode) ? newBuilder(null) : newBuilder();

boolean preserveUnknownFields = isJsonNode;

definition.getAnnotations().forEach(annotation -> extractSchemaSwaps(definition.toReference(), annotation, schemaSwaps));

Expand Down Expand Up @@ -579,6 +584,14 @@ private String extractUpdatedNameFromJacksonPropertyIfPresent(Property property)
*/
public abstract B newBuilder();

/**
* Creates a new specific builder object.
*
* @param type the type to be used
* @return a new builder object specific to the CRD generation version
*/
public abstract B newBuilder(String type);

/**
* Adds the specified property to the specified builder, calling {@link #internalFrom(String, TypeRef)}
* to create the property schema.
Expand Down
Expand Up @@ -49,8 +49,13 @@ public static JSONSchemaProps from(TypeDef definition, String... ignore) {

@Override
public JSONSchemaPropsBuilder newBuilder() {
return newBuilder("object");
}

@Override
public JSONSchemaPropsBuilder newBuilder(String type) {
final JSONSchemaPropsBuilder builder = new JSONSchemaPropsBuilder();
builder.withType("object");
builder.withType(type);
return builder;
}

Expand Down
Expand Up @@ -50,8 +50,13 @@ public static JSONSchemaProps from(

@Override
public JSONSchemaPropsBuilder newBuilder() {
return newBuilder("object");
}

@Override
public JSONSchemaPropsBuilder newBuilder(String type) {
final JSONSchemaPropsBuilder builder = new JSONSchemaPropsBuilder();
builder.withType("object");
builder.withType(type);
return builder;
}

Expand Down
Expand Up @@ -152,16 +152,19 @@ void shouldProduceKubernetesPreserveFields() {
assertTrue(spec.containsKey("free"));
JSONSchemaProps freeField = spec.get("free");

assertNull(freeField.getType());
assertTrue(freeField.getXKubernetesPreserveUnknownFields());

assertTrue(spec.containsKey("field"));
JSONSchemaProps field = spec.get("field");

assertEquals("integer", field.getType());
assertNull(field.getXKubernetesPreserveUnknownFields());

assertTrue(spec.containsKey("foo"));
JSONSchemaProps fooField = spec.get("foo");

assertEquals("object", fooField.getType());
assertTrue(fooField.getXKubernetesPreserveUnknownFields());
}

Expand Down
49 changes: 0 additions & 49 deletions extensions/camel-k/mock/pom.xml

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit c5b5c95

Please sign in to comment.