Skip to content

Commit

Permalink
fix fabric8io#3625: removing default objectmeta
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins committed May 25, 2022
1 parent 2d73f03 commit c33d21b
Show file tree
Hide file tree
Showing 286 changed files with 671 additions and 1,009 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ And Store.getKey can be used rather than directly referencing static Cache funct
* Fix #4142: Added patch() and patch(PatchContext) methods for use with resource and load
* Fix #4146: ManagedKubernetesClient and ManagedOpenShiftClient as delayed OSGi services
* Fix #4093: adding a possibility to get a log as an `InputStream` from the `Loggable` resources
* Fix #3625: adds default maps to mostly prevent the need for null checks on things like annotations and labels.

#### Dependency Upgrade
* Fix #3788: Point CamelK Extension model to latest released version v1.8.0
Expand Down
19 changes: 13 additions & 6 deletions doc/MIGRATION-v6.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Migration from 5.x to 6.x

## Contents:
- [ObjectMetadata](#objectmetadata)
- [Default Maps](#default-maps)
- [Backwards Compatibility Interceptor](#backwards-compatibility-interceptor)
- [Namespace Changes](#namespace-changes)
- [API/Impl split](#api-impl-split)
Expand All @@ -20,14 +20,21 @@
- [Delete Behavior](#delete-behavior)
- [Stream Changes](#stream-changes)

## ObjectMetadata
## Default Maps

ObjectMetadata will default to a non-null value. All Maps in the generated object models, including ObjectMetadata.annotations and labels will also be non-null by default. A small behavioral difference is that the default value will be omitted from serialization, previously if you did something like
All Maps in the generated object models, including ObjectMetadata.annotations and labels will also be non-null by default. A small behavioral difference is that the default value will be omitted from serialization, previously if you did something like:

```
Pod p = new PodBuilder().withNewMetadata().withLabels(new HashMap()).endMetadata().build();
```
Pod p = new Pod();
p.setMetadata(new ObjectMetadata());
p would serialize with

```
p would serialize with "metadata: {}" - that will now be omitted.
metadata:
labels: {}
```

That empty map will now be omitted - which is the same as the existing behavior for arrays.

## Backwards Compatibility Interceptor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
public abstract class CustomResource<S, T> implements HasMetadata {
private static final Logger LOG = LoggerFactory.getLogger(CustomResource.class);

@JsonInclude(value = Include.CUSTOM, valueFilter = ObjectMeta.class)
private ObjectMeta metadata = new ObjectMeta();

@JsonProperty("spec")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ public class KubeSchema {
@JsonProperty("MutatingWebhookConfigurationList")
private io.fabric8.kubernetes.api.model.admissionregistration.v1beta1.MutatingWebhookConfigurationList mutatingWebhookConfigurationList;
@JsonProperty("ObjectMeta")
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = io.fabric8.kubernetes.api.model.ObjectMeta.class)
private io.fabric8.kubernetes.api.model.ObjectMeta objectMeta = new io.fabric8.kubernetes.api.model.ObjectMeta();
private io.fabric8.kubernetes.api.model.ObjectMeta objectMeta;
@JsonProperty("Patch")
private Patch patch;
@JsonProperty("PatchOptions")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ public class MutatingWebhookConfiguration implements HasMetadata
@JsonProperty("kind")
private String kind = "MutatingWebhookConfiguration";
@JsonProperty("metadata")
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = io.fabric8.kubernetes.api.model.ObjectMeta.class)
private io.fabric8.kubernetes.api.model.ObjectMeta metadata = new io.fabric8.kubernetes.api.model.ObjectMeta();
private io.fabric8.kubernetes.api.model.ObjectMeta metadata;
@JsonProperty("webhooks")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<MutatingWebhook> webhooks = new ArrayList<MutatingWebhook>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ public class ValidatingWebhookConfiguration implements HasMetadata
@JsonProperty("kind")
private String kind = "ValidatingWebhookConfiguration";
@JsonProperty("metadata")
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = io.fabric8.kubernetes.api.model.ObjectMeta.class)
private io.fabric8.kubernetes.api.model.ObjectMeta metadata = new io.fabric8.kubernetes.api.model.ObjectMeta();
private io.fabric8.kubernetes.api.model.ObjectMeta metadata;
@JsonProperty("webhooks")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<ValidatingWebhook> webhooks = new ArrayList<ValidatingWebhook>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ public class MutatingWebhookConfiguration implements HasMetadata
@JsonProperty("kind")
private String kind = "MutatingWebhookConfiguration";
@JsonProperty("metadata")
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = io.fabric8.kubernetes.api.model.ObjectMeta.class)
private io.fabric8.kubernetes.api.model.ObjectMeta metadata = new io.fabric8.kubernetes.api.model.ObjectMeta();
private io.fabric8.kubernetes.api.model.ObjectMeta metadata;
@JsonProperty("webhooks")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<MutatingWebhook> webhooks = new ArrayList<MutatingWebhook>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ public class ValidatingWebhookConfiguration implements HasMetadata
@JsonProperty("kind")
private String kind = "ValidatingWebhookConfiguration";
@JsonProperty("metadata")
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = io.fabric8.kubernetes.api.model.ObjectMeta.class)
private io.fabric8.kubernetes.api.model.ObjectMeta metadata = new io.fabric8.kubernetes.api.model.ObjectMeta();
private io.fabric8.kubernetes.api.model.ObjectMeta metadata;
@JsonProperty("webhooks")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<ValidatingWebhook> webhooks = new ArrayList<ValidatingWebhook>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ public class TokenReview implements HasMetadata
@JsonProperty("kind")
private String kind = "TokenReview";
@JsonProperty("metadata")
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = io.fabric8.kubernetes.api.model.ObjectMeta.class)
private io.fabric8.kubernetes.api.model.ObjectMeta metadata = new io.fabric8.kubernetes.api.model.ObjectMeta();
private io.fabric8.kubernetes.api.model.ObjectMeta metadata;
@JsonProperty("spec")
private TokenReviewSpec spec;
@JsonProperty("status")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ public class LocalSubjectAccessReview implements HasMetadata, Namespaced
@JsonProperty("kind")
private String kind = "LocalSubjectAccessReview";
@JsonProperty("metadata")
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = io.fabric8.kubernetes.api.model.ObjectMeta.class)
private io.fabric8.kubernetes.api.model.ObjectMeta metadata = new io.fabric8.kubernetes.api.model.ObjectMeta();
private io.fabric8.kubernetes.api.model.ObjectMeta metadata;
@JsonProperty("spec")
private SubjectAccessReviewSpec spec;
@JsonProperty("status")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ public class SelfSubjectAccessReview implements HasMetadata
@JsonProperty("kind")
private String kind = "SelfSubjectAccessReview";
@JsonProperty("metadata")
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = io.fabric8.kubernetes.api.model.ObjectMeta.class)
private io.fabric8.kubernetes.api.model.ObjectMeta metadata = new io.fabric8.kubernetes.api.model.ObjectMeta();
private io.fabric8.kubernetes.api.model.ObjectMeta metadata;
@JsonProperty("spec")
private SelfSubjectAccessReviewSpec spec;
@JsonProperty("status")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ public class SelfSubjectRulesReview implements HasMetadata
@JsonProperty("kind")
private String kind = "SelfSubjectRulesReview";
@JsonProperty("metadata")
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = io.fabric8.kubernetes.api.model.ObjectMeta.class)
private io.fabric8.kubernetes.api.model.ObjectMeta metadata = new io.fabric8.kubernetes.api.model.ObjectMeta();
private io.fabric8.kubernetes.api.model.ObjectMeta metadata;
@JsonProperty("spec")
private SelfSubjectRulesReviewSpec spec;
@JsonProperty("status")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ public class SubjectAccessReview implements HasMetadata
@JsonProperty("kind")
private String kind = "SubjectAccessReview";
@JsonProperty("metadata")
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = io.fabric8.kubernetes.api.model.ObjectMeta.class)
private io.fabric8.kubernetes.api.model.ObjectMeta metadata = new io.fabric8.kubernetes.api.model.ObjectMeta();
private io.fabric8.kubernetes.api.model.ObjectMeta metadata;
@JsonProperty("spec")
private SubjectAccessReviewSpec spec;
@JsonProperty("status")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ public class LocalSubjectAccessReview implements HasMetadata, Namespaced
@JsonProperty("kind")
private String kind = "LocalSubjectAccessReview";
@JsonProperty("metadata")
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = io.fabric8.kubernetes.api.model.ObjectMeta.class)
private io.fabric8.kubernetes.api.model.ObjectMeta metadata = new io.fabric8.kubernetes.api.model.ObjectMeta();
private io.fabric8.kubernetes.api.model.ObjectMeta metadata;
@JsonProperty("spec")
private SubjectAccessReviewSpec spec;
@JsonProperty("status")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ public class SelfSubjectAccessReview implements HasMetadata
@JsonProperty("kind")
private String kind = "SelfSubjectAccessReview";
@JsonProperty("metadata")
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = io.fabric8.kubernetes.api.model.ObjectMeta.class)
private io.fabric8.kubernetes.api.model.ObjectMeta metadata = new io.fabric8.kubernetes.api.model.ObjectMeta();
private io.fabric8.kubernetes.api.model.ObjectMeta metadata;
@JsonProperty("spec")
private SelfSubjectAccessReviewSpec spec;
@JsonProperty("status")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ public class SelfSubjectRulesReview implements HasMetadata
@JsonProperty("kind")
private String kind = "SelfSubjectRulesReview";
@JsonProperty("metadata")
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = io.fabric8.kubernetes.api.model.ObjectMeta.class)
private io.fabric8.kubernetes.api.model.ObjectMeta metadata = new io.fabric8.kubernetes.api.model.ObjectMeta();
private io.fabric8.kubernetes.api.model.ObjectMeta metadata;
@JsonProperty("spec")
private SelfSubjectRulesReviewSpec spec;
@JsonProperty("status")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ public class SubjectAccessReview implements HasMetadata
@JsonProperty("kind")
private String kind = "SubjectAccessReview";
@JsonProperty("metadata")
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = io.fabric8.kubernetes.api.model.ObjectMeta.class)
private io.fabric8.kubernetes.api.model.ObjectMeta metadata = new io.fabric8.kubernetes.api.model.ObjectMeta();
private io.fabric8.kubernetes.api.model.ObjectMeta metadata;
@JsonProperty("spec")
private SubjectAccessReviewSpec spec;
@JsonProperty("status")
Expand Down
Loading

0 comments on commit c33d21b

Please sign in to comment.