Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.fabric8.kubernetes.api.model.CSIVolumeSource;
import io.fabric8.kubernetes.api.model.ConfigMapVolumeSource;
import io.fabric8.kubernetes.api.model.EmptyDirVolumeSource;
import io.fabric8.kubernetes.api.model.ImageVolumeSource;
import io.fabric8.kubernetes.api.model.PersistentVolumeClaimVolumeSource;
import io.fabric8.kubernetes.api.model.SecretVolumeSource;
Expand Down Expand Up @@ -46,7 +45,7 @@ public class AdditionalVolume implements UnknownPropertyPreserving {
private String name;
private SecretVolumeSource secret;
private ConfigMapVolumeSource configMap;
private EmptyDirVolumeSource emptyDir;
private EmptyDirVolume emptyDir;
private PersistentVolumeClaimVolumeSource persistentVolumeClaim;
private CSIVolumeSource csi;
private ImageVolumeSource image;
Expand Down Expand Up @@ -85,13 +84,12 @@ public void setConfigMap(ConfigMapVolumeSource configMap) {
}

@Description("`EmptyDir` to use to populate the volume.")
@KubeLink(group = "core", version = "v1", kind = "emptydirvolumesource")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public EmptyDirVolumeSource getEmptyDir() {
public EmptyDirVolume getEmptyDir() {
return emptyDir;
}

public void setEmptyDir(EmptyDirVolumeSource emptyDir) {
public void setEmptyDir(EmptyDirVolume emptyDir) {
this.emptyDir = emptyDir;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright Strimzi authors.
* License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
*/
package io.strimzi.api.kafka.model.common.template;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

import java.util.Locale;

public enum EmptyDirMedium {
MEMORY;

@JsonCreator
public static EmptyDirMedium forValue(String value) {
switch (value.toLowerCase(Locale.ENGLISH)) {
case "memory":
return MEMORY;
default:
return null;
}
}

@JsonValue
public String toValue() {
switch (this) {
case MEMORY:
return "Memory";
default:
return null;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Copyright Strimzi authors.
* License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
*/
package io.strimzi.api.kafka.model.common.template;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.strimzi.api.kafka.model.common.Constants;
import io.strimzi.api.kafka.model.common.UnknownPropertyPreserving;
import io.strimzi.crdgenerator.annotations.Description;
import io.strimzi.crdgenerator.annotations.Pattern;
import io.sundr.builder.annotations.Buildable;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.util.HashMap;
import java.util.Map;

/**
* Representation for EmptyDir volume in additional volumes. This is used because the Fabric8 EmptyDirVolumeSource does
* not serialize nicely into the Strimzi CRDs.
*/
@Buildable(
editableEnabled = false,
builderPackage = Constants.FABRIC8_KUBERNETES_API
)
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
@JsonPropertyOrder({"medium", "sizeLimit"})
@EqualsAndHashCode
@ToString
public class EmptyDirVolume implements UnknownPropertyPreserving {
private EmptyDirMedium medium;
private String sizeLimit;
private Map<String, Object> additionalProperties;

@Description("Medium represents the type of storage medium should back this volume. " +
"Valid values are unset or `Memory`.")
public EmptyDirMedium getMedium() {
return medium;
}

public void setMedium(EmptyDirMedium medium) {
this.medium = medium;
}

@Pattern(Constants.MEMORY_REGEX)
@Description("The total amount of local storage required for this EmptyDir volume (for example 1Gi).")
public String getSizeLimit() {
return sizeLimit;
}

public void setSizeLimit(String sizeLimit) {
this.sizeLimit = sizeLimit;
}

@Override
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties != null ? this.additionalProperties : Map.of();
}

@Override
public void setAdditionalProperty(String name, Object value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap<>(2);
}
this.additionalProperties.put(name, value);
}
}
48 changes: 24 additions & 24 deletions api/src/test/resources/crds/v1/040-Crd-kafka.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1171,13 +1171,13 @@ spec:
properties:
medium:
type: string
enum:
- Memory
description: Medium represents the type of storage medium should back this volume. Valid values are unset or `Memory`.
sizeLimit:
type: object
properties:
amount:
type: string
format:
type: string
type: string
pattern: "^([0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$"
description: The total amount of local storage required for this EmptyDir volume (for example 1Gi).
description: '`EmptyDir` to use to populate the volume.'
persistentVolumeClaim:
type: object
Expand Down Expand Up @@ -2843,13 +2843,13 @@ spec:
properties:
medium:
type: string
enum:
- Memory
description: Medium represents the type of storage medium should back this volume. Valid values are unset or `Memory`.
sizeLimit:
type: object
properties:
amount:
type: string
format:
type: string
type: string
pattern: "^([0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$"
description: The total amount of local storage required for this EmptyDir volume (for example 1Gi).
description: '`EmptyDir` to use to populate the volume.'
persistentVolumeClaim:
type: object
Expand Down Expand Up @@ -4091,13 +4091,13 @@ spec:
properties:
medium:
type: string
enum:
- Memory
description: Medium represents the type of storage medium should back this volume. Valid values are unset or `Memory`.
sizeLimit:
type: object
properties:
amount:
type: string
format:
type: string
type: string
pattern: "^([0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$"
description: The total amount of local storage required for this EmptyDir volume (for example 1Gi).
description: '`EmptyDir` to use to populate the volume.'
persistentVolumeClaim:
type: object
Expand Down Expand Up @@ -5217,13 +5217,13 @@ spec:
properties:
medium:
type: string
enum:
- Memory
description: Medium represents the type of storage medium should back this volume. Valid values are unset or `Memory`.
sizeLimit:
type: object
properties:
amount:
type: string
format:
type: string
type: string
pattern: "^([0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$"
description: The total amount of local storage required for this EmptyDir volume (for example 1Gi).
description: '`EmptyDir` to use to populate the volume.'
persistentVolumeClaim:
type: object
Expand Down
24 changes: 12 additions & 12 deletions api/src/test/resources/crds/v1/041-Crd-kafkaconnect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -996,13 +996,13 @@ spec:
properties:
medium:
type: string
enum:
- Memory
description: Medium represents the type of storage medium should back this volume. Valid values are unset or `Memory`.
sizeLimit:
type: object
properties:
amount:
type: string
format:
type: string
type: string
pattern: "^([0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$"
description: The total amount of local storage required for this EmptyDir volume (for example 1Gi).
description: '`EmptyDir` to use to populate the volume.'
persistentVolumeClaim:
type: object
Expand Down Expand Up @@ -2051,13 +2051,13 @@ spec:
properties:
medium:
type: string
enum:
- Memory
description: Medium represents the type of storage medium should back this volume. Valid values are unset or `Memory`.
sizeLimit:
type: object
properties:
amount:
type: string
format:
type: string
type: string
pattern: "^([0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$"
description: The total amount of local storage required for this EmptyDir volume (for example 1Gi).
description: '`EmptyDir` to use to populate the volume.'
persistentVolumeClaim:
type: object
Expand Down
12 changes: 6 additions & 6 deletions api/src/test/resources/crds/v1/045-Crd-kafkanodepool.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -824,13 +824,13 @@ spec:
properties:
medium:
type: string
enum:
- Memory
description: Medium represents the type of storage medium should back this volume. Valid values are unset or `Memory`.
sizeLimit:
type: object
properties:
amount:
type: string
format:
type: string
type: string
pattern: "^([0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$"
description: The total amount of local storage required for this EmptyDir volume (for example 1Gi).
description: '`EmptyDir` to use to populate the volume.'
persistentVolumeClaim:
type: object
Expand Down
12 changes: 6 additions & 6 deletions api/src/test/resources/crds/v1/046-Crd-kafkabridge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1021,13 +1021,13 @@ spec:
properties:
medium:
type: string
enum:
- Memory
description: Medium represents the type of storage medium should back this volume. Valid values are unset or `Memory`.
sizeLimit:
type: object
properties:
amount:
type: string
format:
type: string
type: string
pattern: "^([0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$"
description: The total amount of local storage required for this EmptyDir volume (for example 1Gi).
description: '`EmptyDir` to use to populate the volume.'
persistentVolumeClaim:
type: object
Expand Down
24 changes: 12 additions & 12 deletions api/src/test/resources/crds/v1/048-Crd-kafkamirrormaker2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1246,13 +1246,13 @@ spec:
properties:
medium:
type: string
enum:
- Memory
description: Medium represents the type of storage medium should back this volume. Valid values are unset or `Memory`.
sizeLimit:
type: object
properties:
amount:
type: string
format:
type: string
type: string
pattern: "^([0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$"
description: The total amount of local storage required for this EmptyDir volume (for example 1Gi).
description: '`EmptyDir` to use to populate the volume.'
persistentVolumeClaim:
type: object
Expand Down Expand Up @@ -2301,13 +2301,13 @@ spec:
properties:
medium:
type: string
enum:
- Memory
description: Medium represents the type of storage medium should back this volume. Valid values are unset or `Memory`.
sizeLimit:
type: object
properties:
amount:
type: string
format:
type: string
type: string
pattern: "^([0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$"
description: The total amount of local storage required for this EmptyDir volume (for example 1Gi).
description: '`EmptyDir` to use to populate the volume.'
persistentVolumeClaim:
type: object
Expand Down
Loading