Skip to content

Commit

Permalink
test(crd-generator): ensure Collection properties work like List in C…
Browse files Browse the repository at this point in the history
…RD generation

- Updated `ServiceSpec` to use `Collection` instead of `List` for `loadBalancerSourceRanges`.
- Modified getter and setter methods for `loadBalancerSourceRanges` to use `Collection`.
- Confirmed that CRD generation produces a field of type array when using `Collection`, ensuring compatibility and correct schema output.

Signed-off-by: Sun Seng David TAN <[email protected]>
  • Loading branch information
sunix committed May 21, 2024
1 parent c470c55 commit ef0e71c
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.fabric8.kubernetes.api.model.KubernetesResource;

import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -88,7 +89,7 @@ public class ServiceSpec implements KubernetesResource {
private String loadBalancerIP;
@JsonProperty("loadBalancerSourceRanges")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<String> loadBalancerSourceRanges = new ArrayList<>();
private Collection<String> loadBalancerSourceRanges = new ArrayList<>();
@JsonProperty("publishNotReadyAddresses")
private Boolean publishNotReadyAddresses;
@JsonProperty("selector")
Expand Down Expand Up @@ -225,12 +226,12 @@ public void setLoadBalancerIP(String loadBalancerIP) {
}

@JsonProperty("loadBalancerSourceRanges")
public List<String> getLoadBalancerSourceRanges() {
public Collection<String> getLoadBalancerSourceRanges() {
return loadBalancerSourceRanges;
}

@JsonProperty("loadBalancerSourceRanges")
public void setLoadBalancerSourceRanges(List<String> loadBalancerSourceRanges) {
public void setLoadBalancerSourceRanges(Collection<String> loadBalancerSourceRanges) {
this.loadBalancerSourceRanges = loadBalancerSourceRanges;
}

Expand Down

0 comments on commit ef0e71c

Please sign in to comment.