-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DBZ-6962 Ability to configure various aspects of DebeziumServer's pod…
… via PodTemplate
- Loading branch information
Showing
9 changed files
with
631 additions
and
35 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,28 @@ | ||
/* | ||
* Copyright Debezium Authors. | ||
* | ||
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
*/ | ||
package io.debezium.operator.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonPropertyDescription; | ||
|
||
import io.debezium.operator.model.templates.PodTemplate; | ||
|
||
public class Templates { | ||
|
||
@JsonPropertyDescription("Pod template.") | ||
private PodTemplate pod; | ||
|
||
public Templates() { | ||
this.pod = new PodTemplate(); | ||
} | ||
|
||
public PodTemplate getPod() { | ||
return pod; | ||
} | ||
|
||
public void setPod(PodTemplate pod) { | ||
this.pod = pod; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/io/debezium/operator/model/templates/HasMetadataTemplate.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,26 @@ | ||
/* | ||
* Copyright Debezium Authors. | ||
* | ||
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
*/ | ||
package io.debezium.operator.model.templates; | ||
|
||
/** | ||
* Interface for kubernetes objects witch metadata | ||
*/ | ||
public interface HasMetadataTemplate { | ||
|
||
/** | ||
* Gets template metadata | ||
* | ||
* @return Metadata template | ||
*/ | ||
MetadataTemplate getMetadata(); | ||
|
||
/** | ||
* Sets template metadata | ||
* | ||
* @param metadata Metadata template | ||
*/ | ||
void setMetadata(MetadataTemplate metadata); | ||
} |
53 changes: 53 additions & 0 deletions
53
src/main/java/io/debezium/operator/model/templates/MetadataTemplate.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,53 @@ | ||
/* | ||
* Copyright Debezium Authors. | ||
* | ||
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
*/ | ||
package io.debezium.operator.model.templates; | ||
|
||
import java.io.Serializable; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.Objects; | ||
|
||
import com.fasterxml.jackson.annotation.JsonPropertyOrder; | ||
|
||
@JsonPropertyOrder({ "labels", "annotations" }) | ||
public class MetadataTemplate implements Serializable { | ||
public static final long serialVersionUID = 1L; | ||
|
||
private Map<String, String> labels = new HashMap<>(0); | ||
private Map<String, String> annotations = new HashMap<>(0); | ||
|
||
public Map<String, String> getLabels() { | ||
return labels; | ||
} | ||
|
||
public void setLabels(Map<String, String> labels) { | ||
this.labels = labels; | ||
} | ||
|
||
public Map<String, String> getAnnotations() { | ||
return annotations; | ||
} | ||
|
||
public void setAnnotations(Map<String, String> annotations) { | ||
this.annotations = annotations; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (!(o instanceof MetadataTemplate that)) { | ||
return false; | ||
} | ||
return Objects.equals(labels, that.labels) && Objects.equals(annotations, that.annotations); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(labels, annotations); | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
src/main/java/io/debezium/operator/model/templates/PodTemplate.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,70 @@ | ||
/* | ||
* Copyright Debezium Authors. | ||
* | ||
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
*/ | ||
package io.debezium.operator.model.templates; | ||
|
||
import java.util.List; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonPropertyDescription; | ||
import com.fasterxml.jackson.annotation.JsonPropertyOrder; | ||
|
||
import io.fabric8.kubernetes.api.model.Affinity; | ||
import io.fabric8.kubernetes.api.model.LocalObjectReference; | ||
import io.fabric8.kubernetes.api.model.PodSecurityContext; | ||
|
||
@JsonPropertyOrder({ "metadata", "imagePullSecrets", "affinity" }) | ||
@JsonInclude(JsonInclude.Include.NON_DEFAULT) | ||
public class PodTemplate implements HasMetadataTemplate { | ||
|
||
@JsonPropertyDescription("Metadata applied to the resource.") | ||
private MetadataTemplate metadata = new MetadataTemplate(); | ||
|
||
@JsonPropertyDescription("List of local references to secrets used for pulling any of the images used by this Pod.") | ||
@JsonInclude(JsonInclude.Include.NON_EMPTY) | ||
private List<LocalObjectReference> imagePullSecrets = List.of(); | ||
|
||
@JsonPropertyDescription("Pod affinity rules") | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
private Affinity affinity; | ||
|
||
@JsonPropertyDescription("Pod-level security attributes and container settings") | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
private PodSecurityContext securityContext; | ||
|
||
@Override | ||
public MetadataTemplate getMetadata() { | ||
return metadata; | ||
} | ||
|
||
@Override | ||
public void setMetadata(MetadataTemplate metadata) { | ||
this.metadata = metadata; | ||
} | ||
|
||
public List<LocalObjectReference> getImagePullSecrets() { | ||
return imagePullSecrets; | ||
} | ||
|
||
public void setImagePullSecrets(List<LocalObjectReference> imagePullSecrets) { | ||
this.imagePullSecrets = imagePullSecrets; | ||
} | ||
|
||
public Affinity getAffinity() { | ||
return affinity; | ||
} | ||
|
||
public void setAffinity(Affinity affinity) { | ||
this.affinity = affinity; | ||
} | ||
|
||
public PodSecurityContext getSecurityContext() { | ||
return securityContext; | ||
} | ||
|
||
public void setSecurityContext(PodSecurityContext securityContext) { | ||
this.securityContext = securityContext; | ||
} | ||
} |