-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ResourceCluster Part1] ResourceClustersManager actor + contracts #175
Conversation
|
||
@Builder | ||
@Value | ||
public class ListResourceClusterRequest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move these within the actor class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these contracts in a single file are going to make it a huge one though? Also, there are composite referenced classes that are already huge by themselves.
@calvin681 @codyrioux @hmit @sundargates: I would love to get some review/feedback, especially regarding the interface of IResourceClusterProvider and the provisioning part in the ResourceClustersManagerActor. |
@sundargates I've renamed the classes here to avoid naming conflicts. Let me know if you have any other concerns. |
...rc/main/java/io/mantisrx/control/plane/resource/cluster/proto/MantisResourceClusterSpec.java
Outdated
Show resolved
Hide resolved
int desireSize; | ||
|
||
@JsonCreator | ||
public SkuCapacity( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of adding an explicit constructor with @Json*
annotations here, having @Value
is enough since it does -- final @ToString @EqualsAndHashCode @AllArgsConstructor @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) @Getter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a workaround (when I tested the original clean version (@value + builder only) in nfmantis the shaded classes and Jackson doesn't play well with each other and other internal SDKs and it can only work when I have both annotation + upgrade shaded Jackson for all combinations).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me add some notes here about this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some tests to make sure you codify the expected behaviors? In this case, I'm guessing you want the classes to be Jackson serializable (which they already are because of our lombok.config checked in at the root level).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tricky part is that these work just fine without any of the extra annotations in OSS repo but started to run into trouble imported in the internal wrapper mixing with other non-shaded Jackson. I will have more tests covering in the nfmantis side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For OSS I will have some extra coverage on thee too in the follow up PR.
...ontrol/plane/resource/cluster/resourceprovider/SimpleFileResourceClusterStorageProvider.java
Show resolved
Hide resolved
...ontrol/plane/resource/cluster/resourceprovider/SimpleFileResourceClusterStorageProvider.java
Outdated
Show resolved
Hide resolved
...ontrol/plane/resource/cluster/resourceprovider/SimpleFileResourceClusterStorageProvider.java
Show resolved
Hide resolved
flink : "1.14.2", | ||
hadoop : "2.7.7", | ||
junit4 : "4.11", | ||
junit5 : "5.4.+", | ||
mockito : "2.0.+", | ||
mockito3: "3.+", | ||
slf4j : "1.7.0", | ||
vavr : "0.9.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe we should try to not align the colons given that this is constantly going to change based on the longest module name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think editor config might help streamline these. I will take a look.
* This interface provides the API to connect resource cluster management actor to actual | ||
* implementations of different resource cluster clients e.g. k8s. | ||
*/ | ||
public interface IResourceClusterProvider { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: let's rename this to ResourceClusterProvider. We want a consistent naming style for interfaces, and it's already mixed between I.* and regular interface names.
@JsonCreator | ||
public MantisResourceClusterSpec( | ||
@JsonProperty("name") final String name, | ||
@JsonProperty("id") final String id, | ||
@JsonProperty("ownerName") final String ownerName, | ||
@JsonProperty("ownerEmail") final String ownerEmail, | ||
@JsonProperty("envType") final MantisResourceClusterEnvType envType, | ||
@JsonProperty("skuSpecs") final Set<SkuTypeSpec> skuSpecs, | ||
@JsonProperty("clusterMetadataFields") final Map<String, String> clusterMetadataFields) { | ||
this.name = name; | ||
this.id = id; | ||
this.ownerName = ownerName; | ||
this.ownerEmail = ownerEmail; | ||
this.envType = envType; | ||
this.skuSpecs = skuSpecs; | ||
this.clusterMetadataFields = clusterMetadataFields; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you should need both @value and @JsonCreator in the same class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the other conversation thread regarding the workaround for Jackson.
@JsonCreator | ||
public SkuTypeSpec( | ||
@JsonProperty("skuId") final String skuId, | ||
@JsonProperty("capacity") final SkuCapacity capacity, | ||
@JsonProperty("imageId") final String imageId, | ||
@JsonProperty("cpuCoreCount") final int cpuCoreCount, | ||
@JsonProperty("memorySizeInBytes") final int memorySizeInBytes, | ||
@JsonProperty("networkMbps") final int networkMbps, | ||
@JsonProperty("diskSizeInBytes") final int diskSizeInBytes, | ||
@JsonProperty("skuMetadataFields") final Map<String, String> skuMetadataFields) { | ||
this.skuId = skuId; | ||
this.capacity = capacity; | ||
this.imageId = imageId; | ||
this.cpuCoreCount = cpuCoreCount; | ||
this.memorySizeInBytes = memorySizeInBytes; | ||
this.networkMbps = networkMbps; | ||
this.diskSizeInBytes = diskSizeInBytes; | ||
this.skuMetadataFields = skuMetadataFields; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here.
int desireSize; | ||
|
||
@JsonCreator | ||
public SkuCapacity( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some tests to make sure you codify the expected behaviors? In this case, I'm guessing you want the classes to be Jackson serializable (which they already are because of our lombok.config checked in at the root level).
@JsonCreator | ||
public SkuCapacity( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Don't think you need this.
@Builder | ||
public class MantisResourceClusterSpec { | ||
|
||
@NonNull |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String ownerEmail; | ||
|
||
@NonNull | ||
MantisResourceClusterEnvType envType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need this? can this not be obtained from the env the mantis-control-plane is being run from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer not to have an assumption about env var at this layer but leave it at the entry-point/wrapper to decide how to obtain it.
|
||
@Builder | ||
@Value | ||
public static class SkuCapacity { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: document.
Context
This PR adds the new ResourceClustersManagerActor and its dependent classes and contract classes as part of the effort to support non-Mesos cluster type for Mantis.
This new actor will be handling both API requests and requests from other actors related to any resource-cluster-related operations.
To support different cluster types (e.g. Kubernetes/Spinnaker), this new ResourceClustersManager actor and its corresponding contracts will provide abstraction only and not be tied to any framework-specific dependencies.
Checklist
./gradlew build
compiles code correctly./gradlew test
passes all testsCONTRIBUTING.md