-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial implementation for tiered storage support (#9727)
Signed-off-by: Lixin Yao <lixin_yao@apple.com> Signed-off-by: Jakub Scholz <www@scholzj.com> Co-authored-by: Lixin Yao <lixin_yao@apple.com> Co-authored-by: Jakub Scholz <www@scholzj.com>
- Loading branch information
1 parent
eaf8950
commit 4ca2bc6
Showing
12 changed files
with
412 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
api/src/main/java/io/strimzi/api/kafka/model/kafka/tieredstorage/RemoteStorageManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* 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.kafka.tieredstorage; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import io.strimzi.api.kafka.model.common.Constants; | ||
import io.strimzi.api.kafka.model.common.UnknownPropertyPreserving; | ||
import io.strimzi.crdgenerator.annotations.Description; | ||
import io.sundr.builder.annotations.Buildable; | ||
import lombok.EqualsAndHashCode; | ||
|
||
import java.io.Serializable; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* Configures a RemoteStorageManager in the tiered storage setup. | ||
*/ | ||
@Buildable( | ||
editableEnabled = false, | ||
builderPackage = Constants.FABRIC8_KUBERNETES_API | ||
) | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@EqualsAndHashCode | ||
public class RemoteStorageManager implements UnknownPropertyPreserving, Serializable { | ||
private static final long serialVersionUID = 1L; | ||
protected Map<String, Object> additionalProperties; | ||
private String className; | ||
private String classPath; | ||
private Map<String, String> config; | ||
|
||
@Override | ||
public Map<String, Object> getAdditionalProperties() { | ||
return this.additionalProperties; | ||
} | ||
|
||
@Override | ||
public void setAdditionalProperty(String name, Object value) { | ||
if (this.additionalProperties == null) { | ||
this.additionalProperties = new HashMap<>(1); | ||
} | ||
this.additionalProperties.put(name, value); | ||
} | ||
|
||
@Description("The class name for the 'RemoteStorageManager' implementation.") | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public String getClassName() { | ||
return className; | ||
} | ||
|
||
public void setClassName(String className) { | ||
this.className = className; | ||
} | ||
|
||
@Description("The class path for the 'RemoteStorageManager' implementation.") | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public String getClassPath() { | ||
return classPath; | ||
} | ||
|
||
public void setClassPath(String classPath) { | ||
this.classPath = classPath; | ||
} | ||
|
||
@Description("The additional configuration map for the 'RemoteStorageManager' implementation. " + | ||
"Keys will be automatically prefixed with `rsm.config.`, and added to Kafka broker configuration.") | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public Map<String, String> getConfig() { | ||
return this.config; | ||
} | ||
|
||
public void setConfig(Map<String, String> config) { | ||
this.config = config; | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
api/src/main/java/io/strimzi/api/kafka/model/kafka/tieredstorage/TieredStorage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* 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.kafka.tieredstorage; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonSubTypes; | ||
import com.fasterxml.jackson.annotation.JsonTypeInfo; | ||
import io.strimzi.api.kafka.model.common.UnknownPropertyPreserving; | ||
import io.strimzi.crdgenerator.annotations.Description; | ||
import lombok.EqualsAndHashCode; | ||
|
||
import java.io.Serializable; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* Abstract baseclass for different representations of tieredStorage, discriminated by {@link #getType() type}. | ||
*/ | ||
@JsonTypeInfo( | ||
use = JsonTypeInfo.Id.NAME, | ||
include = JsonTypeInfo.As.EXISTING_PROPERTY, | ||
property = "type" | ||
) | ||
@JsonSubTypes({ | ||
@JsonSubTypes.Type(value = TieredStorageCustom.class, name = TieredStorage.TYPE_CUSTOM)} | ||
) | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@EqualsAndHashCode | ||
public abstract class TieredStorage implements UnknownPropertyPreserving, Serializable { | ||
|
||
private static final long serialVersionUID = 1L; | ||
public static final String TYPE_CUSTOM = "custom"; | ||
|
||
private final Map<String, Object> additionalProperties = new HashMap<>(0); | ||
|
||
@Description("Storage type, only 'custom' is supported at the moment.") | ||
public abstract String getType(); | ||
|
||
@Override | ||
public Map<String, Object> getAdditionalProperties() { | ||
return this.additionalProperties; | ||
} | ||
|
||
@Override | ||
public void setAdditionalProperty(String name, Object value) { | ||
this.additionalProperties.put(name, value); | ||
} | ||
} | ||
|
46 changes: 46 additions & 0 deletions
46
api/src/main/java/io/strimzi/api/kafka/model/kafka/tieredstorage/TieredStorageCustom.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* 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.kafka.tieredstorage; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import io.strimzi.api.kafka.model.common.Constants; | ||
import io.strimzi.crdgenerator.annotations.Description; | ||
import io.strimzi.crdgenerator.annotations.DescriptionFile; | ||
import io.sundr.builder.annotations.Buildable; | ||
import lombok.EqualsAndHashCode; | ||
|
||
/** | ||
* Configures a tieredStorage to use custom type. | ||
*/ | ||
@DescriptionFile | ||
@Buildable( | ||
editableEnabled = false, | ||
builderPackage = Constants.FABRIC8_KUBERNETES_API | ||
) | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@EqualsAndHashCode | ||
public class TieredStorageCustom extends TieredStorage { | ||
private static final long serialVersionUID = 1L; | ||
|
||
private RemoteStorageManager remoteStorageManager; | ||
|
||
@Description("Must be `" + TYPE_CUSTOM + "`") | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@Override | ||
public String getType() { | ||
return TYPE_CUSTOM; | ||
} | ||
|
||
@Description("Configuration for the Remote Storage Manager.") | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public RemoteStorageManager getRemoteStorageManager() { | ||
return remoteStorageManager; | ||
} | ||
|
||
public void setRemoteStorageManager(RemoteStorageManager remoteStorageManager) { | ||
this.remoteStorageManager = remoteStorageManager; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.