-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First draft, mostly duplicated code from Connector, compiling
- Loading branch information
1 parent
9562514
commit aff0732
Showing
17 changed files
with
1,213 additions
and
7 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
52 changes: 52 additions & 0 deletions
52
cos-fleetshard-api/model/src/main/java/org/bf2/cos/fleetshard/api/Processor.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 @@ | ||
package org.bf2.cos.fleetshard.api; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
|
||
import io.fabric8.kubernetes.api.model.Namespaced; | ||
import io.fabric8.kubernetes.client.CustomResource; | ||
import io.fabric8.kubernetes.model.annotation.Group; | ||
import io.fabric8.kubernetes.model.annotation.ShortNames; | ||
import io.fabric8.kubernetes.model.annotation.Version; | ||
import io.sundr.builder.annotations.Buildable; | ||
import io.sundr.builder.annotations.BuildableReference; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.ToString; | ||
|
||
@ToString(callSuper = true) | ||
@EqualsAndHashCode(callSuper = true) | ||
@Buildable(builderPackage = "io.fabric8.kubernetes.api.builder", refs = @BuildableReference(CustomResource.class), | ||
editableEnabled = false) | ||
@Version(Processor.VERSION) | ||
@Group(Processor.GROUP) | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@ShortNames("prc") | ||
public class Processor | ||
extends CustomResource<ProcessorSpec, ProcessorStatus> | ||
implements Namespaced { | ||
|
||
public static final String VERSION = "v1alpha1"; | ||
public static final String GROUP = "cos.bf2.org"; | ||
public static final String API_VERSION = GROUP + "/" + VERSION; | ||
|
||
public static final String DESIRED_STATE_READY = "ready"; | ||
public static final String DESIRED_STATE_DELETED = "deleted"; | ||
public static final String DESIRED_STATE_UNASSIGNED = "unassigned"; | ||
public static final String DESIRED_STATE_STOPPED = "stopped"; | ||
|
||
public static final String STATE_PROVISIONING = "provisioning"; | ||
public static final String STATE_DE_PROVISIONING = "deprovisioning"; | ||
public static final String STATE_DELETED = "deleted"; | ||
public static final String STATE_STOPPED = "stopped"; | ||
public static final String STATE_FAILED = "failed"; | ||
public static final String STATE_READY = "ready"; | ||
|
||
@Override | ||
protected ProcessorSpec initSpec() { | ||
return new ProcessorSpec(); | ||
} | ||
|
||
@Override | ||
protected ProcessorStatus initStatus() { | ||
return new ProcessorStatus(); | ||
} | ||
} |
173 changes: 173 additions & 0 deletions
173
...leetshard-api/model/src/main/java/org/bf2/cos/fleetshard/api/ProcessorDeploymentSpec.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,173 @@ | ||
package org.bf2.cos.fleetshard.api; | ||
|
||
import java.util.Objects; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonPropertyOrder; | ||
|
||
import io.fabric8.kubernetes.model.annotation.PrinterColumn; | ||
import io.sundr.builder.annotations.Buildable; | ||
|
||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@Buildable(builderPackage = "io.fabric8.kubernetes.api.builder") | ||
@JsonPropertyOrder({ | ||
"processorTypeId", | ||
"connectorResourceVersion", | ||
"deploymentResourceVersion", | ||
"desiredState", | ||
"secret", | ||
"configMapChecksum", | ||
"unitOfWork" | ||
}) | ||
public class ProcessorDeploymentSpec { | ||
|
||
@PrinterColumn(name = "PROCESSOR_TYPE_ID") | ||
private String processorTypeId; | ||
private Long processorResourceVersion; | ||
private Long deploymentResourceVersion; | ||
private KafkaSpec kafka; | ||
private SchemaRegistrySpec schemaRegistry; | ||
private String desiredState; | ||
private String secret; | ||
private String configMapChecksum; | ||
private String unitOfWork; | ||
|
||
@JsonProperty | ||
public String getProcessorTypeId() { | ||
return processorTypeId; | ||
} | ||
|
||
@JsonProperty | ||
public void setProcessorTypeId(String connectorTypeId) { | ||
this.processorTypeId = connectorTypeId; | ||
} | ||
|
||
@JsonProperty | ||
public Long getProcessorResourceVersion() { | ||
return processorResourceVersion; | ||
} | ||
|
||
@JsonProperty | ||
public void setProcessorResourceVersion(Long processorResourceVersion) { | ||
this.processorResourceVersion = processorResourceVersion; | ||
} | ||
|
||
@JsonProperty | ||
public Long getDeploymentResourceVersion() { | ||
return deploymentResourceVersion; | ||
} | ||
|
||
@JsonProperty | ||
public void setDeploymentResourceVersion(Long deploymentResourceVersion) { | ||
this.deploymentResourceVersion = deploymentResourceVersion; | ||
} | ||
|
||
@JsonProperty | ||
public KafkaSpec getKafka() { | ||
return kafka; | ||
} | ||
|
||
@JsonProperty | ||
public void setKafka(KafkaSpec kafka) { | ||
this.kafka = kafka; | ||
} | ||
|
||
@JsonProperty | ||
public SchemaRegistrySpec getSchemaRegistry() { | ||
return schemaRegistry; | ||
} | ||
|
||
@JsonProperty | ||
public void setSchemaRegistry(SchemaRegistrySpec schemaRegistry) { | ||
this.schemaRegistry = schemaRegistry; | ||
} | ||
|
||
@JsonProperty | ||
public String getDesiredState() { | ||
return desiredState; | ||
} | ||
|
||
@JsonProperty | ||
public void setDesiredState(String desiredState) { | ||
this.desiredState = desiredState; | ||
} | ||
|
||
@JsonProperty | ||
public String getSecret() { | ||
return secret; | ||
} | ||
|
||
@JsonProperty | ||
public void setSecret(String secret) { | ||
this.secret = secret; | ||
} | ||
|
||
@JsonProperty | ||
public String getConfigMapChecksum() { | ||
return configMapChecksum; | ||
} | ||
|
||
@JsonProperty | ||
public void setConfigMapChecksum(String configMapChecksum) { | ||
this.configMapChecksum = configMapChecksum; | ||
} | ||
|
||
@JsonProperty | ||
public String getUnitOfWork() { | ||
return unitOfWork; | ||
} | ||
|
||
@JsonProperty | ||
public void setUnitOfWork(String unitOfWork) { | ||
this.unitOfWork = unitOfWork; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
ProcessorDeploymentSpec that = (ProcessorDeploymentSpec) o; | ||
return Objects.equals(processorTypeId, that.processorTypeId) | ||
&& Objects.equals(processorResourceVersion, that.processorResourceVersion) | ||
&& Objects.equals(deploymentResourceVersion, that.deploymentResourceVersion) | ||
&& Objects.equals(kafka, that.kafka) | ||
&& Objects.equals(schemaRegistry, that.schemaRegistry) | ||
&& Objects.equals(desiredState, that.desiredState) | ||
&& Objects.equals(secret, that.secret) | ||
&& Objects.equals(configMapChecksum, that.configMapChecksum) | ||
&& Objects.equals(unitOfWork, that.unitOfWork); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(processorTypeId, | ||
processorResourceVersion, | ||
deploymentResourceVersion, | ||
kafka, | ||
schemaRegistry, | ||
desiredState, | ||
secret, | ||
configMapChecksum, | ||
unitOfWork); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "DeploymentSpec{" + | ||
"processorTypeId='" + processorTypeId + '\'' + | ||
", processorResourceVersion=" + processorResourceVersion + | ||
", deploymentResourceVersion=" + deploymentResourceVersion + | ||
", kafka=" + kafka + | ||
", schemaRegistry=" + schemaRegistry + | ||
", desiredState='" + desiredState + '\'' + | ||
", secret='" + secret + '\'' + | ||
", configMapChecksum='" + configMapChecksum + '\'' + | ||
", unitOfWork='" + unitOfWork + '\'' + | ||
'}'; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...hard-api/model/src/main/java/org/bf2/cos/fleetshard/api/ProcessorDeploymentSpecAware.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,7 @@ | ||
package org.bf2.cos.fleetshard.api; | ||
|
||
public interface ProcessorDeploymentSpecAware { | ||
ProcessorDeploymentSpec getDeployment(); | ||
|
||
void setDeployment(ProcessorDeploymentSpec deployment); | ||
} |
89 changes: 89 additions & 0 deletions
89
cos-fleetshard-api/model/src/main/java/org/bf2/cos/fleetshard/api/ProcessorSpec.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,89 @@ | ||
package org.bf2.cos.fleetshard.api; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonPropertyOrder; | ||
|
||
import io.fabric8.kubernetes.model.annotation.PrinterColumn; | ||
import io.sundr.builder.annotations.Buildable; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.ToString; | ||
|
||
@ToString | ||
@EqualsAndHashCode | ||
@Buildable(builderPackage = "io.fabric8.kubernetes.api.builder") | ||
@JsonPropertyOrder({ | ||
"id", | ||
"clusterId", | ||
"processorId", | ||
"deploymentId", | ||
"deployment", | ||
"operatorSelector" | ||
}) | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class ProcessorSpec implements ProcessorDeploymentSpecAware { | ||
@PrinterColumn(name = "CLUSTER_ID") | ||
private String clusterId; | ||
|
||
@PrinterColumn(name = "PROCESSOR_ID") | ||
private String processorId; | ||
|
||
@PrinterColumn(name = "DEPLOYMENT_ID") | ||
private String deploymentId; | ||
|
||
private ProcessorDeploymentSpec deployment = new ProcessorDeploymentSpec(); | ||
|
||
private OperatorSelector operatorSelector = new OperatorSelector(); | ||
|
||
@JsonProperty | ||
public String getClusterId() { | ||
return clusterId; | ||
} | ||
|
||
@JsonProperty | ||
public void setClusterId(String clusterId) { | ||
this.clusterId = clusterId; | ||
} | ||
|
||
@JsonProperty | ||
public String getProcessorId() { | ||
return processorId; | ||
} | ||
|
||
@JsonProperty | ||
public void setProcessorId(String processorId) { | ||
this.processorId = processorId; | ||
} | ||
|
||
@JsonProperty | ||
public String getDeploymentId() { | ||
return deploymentId; | ||
} | ||
|
||
@JsonProperty | ||
public void setDeploymentId(String deploymentId) { | ||
this.deploymentId = deploymentId; | ||
} | ||
|
||
@Override | ||
@JsonProperty | ||
public ProcessorDeploymentSpec getDeployment() { | ||
return deployment; | ||
} | ||
|
||
@Override | ||
@JsonProperty | ||
public void setDeployment(ProcessorDeploymentSpec deployment) { | ||
this.deployment = deployment; | ||
} | ||
|
||
@JsonProperty | ||
public OperatorSelector getOperatorSelector() { | ||
return operatorSelector; | ||
} | ||
|
||
@JsonProperty | ||
public void setOperatorSelector(OperatorSelector operatorSelector) { | ||
this.operatorSelector = operatorSelector; | ||
} | ||
} |
Oops, something went wrong.