Commit 944e7f77 authored by Marcin Wielgus's avatar Marcin Wielgus Committed by Marcin

Internal types for FederatedReplicaSetPreferences

parent 1784e99a
......@@ -108,3 +108,32 @@ type ClusterList struct {
// List of Cluster objects.
Items []Cluster `json:"items"`
}
// Temporary/alpha stuctures to support custom replica assignments within FederatedReplicaSet.
// A set of preferences that can be added to federated version of ReplicaSet as a json-serialized annotation.
// The preferences allow the user to express in which culsters he wants to put his replicas within the
// mentiond FederatedReplicaSet.
type FederatedReplicaSetPreferences struct {
// If set to true then already scheduled and running replicas may be moved to other clusters to
// in order to bring cluster replicasets towards a desired state. Otherwise, if set to false,
// up and running replicas will not be moved.
Rebalance bool `json:"rebalance,omitempty"`
// A mapping between cluser names and preferences regarding local replicasets in these clusters.
// "*" (if provided) applies to all clusters if an explicit mapping is not provided. If there is no
// "*" that clusters without explicit preferences should not have any replicas scheduled.
Clusters map[string]ClusterReplicaSetPreferences `json:"clusters,omitempty"`
}
// Preferences regarding number of replicas assigned to a cluster replicaset within a federated replicaset.
type ClusterReplicaSetPreferences struct {
// Minimum number of replicas that should be assigned to this Local ReplicaSet. 0 by default.
MinReplicas int64 `json:"maxReplicas,omitempty"`
// Maximum number of replicas that should be assigned to this Local ReplicaSet. Unbounded if no value provided (default).
MaxReplicas *int64 `json:"maxReplicas,omitempty"`
// A number expressing the preference to put an additional replica to this LocalReplicaSet. 0 by default.
Weight int64
}
......@@ -31,8 +31,10 @@ func init() {
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_federation_Cluster, InType: reflect.TypeOf(func() *Cluster { var x *Cluster; return x }())},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_federation_ClusterCondition, InType: reflect.TypeOf(func() *ClusterCondition { var x *ClusterCondition; return x }())},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_federation_ClusterList, InType: reflect.TypeOf(func() *ClusterList { var x *ClusterList; return x }())},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_federation_ClusterReplicaSetPreferences, InType: reflect.TypeOf(func() *ClusterReplicaSetPreferences { var x *ClusterReplicaSetPreferences; return x }())},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_federation_ClusterSpec, InType: reflect.TypeOf(func() *ClusterSpec { var x *ClusterSpec; return x }())},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_federation_ClusterStatus, InType: reflect.TypeOf(func() *ClusterStatus { var x *ClusterStatus; return x }())},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_federation_FederatedReplicaSetPreferences, InType: reflect.TypeOf(func() *FederatedReplicaSetPreferences { var x *FederatedReplicaSetPreferences; return x }())},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_federation_ServerAddressByClientCIDR, InType: reflect.TypeOf(func() *ServerAddressByClientCIDR { var x *ServerAddressByClientCIDR; return x }())},
); err != nil {
// if one of the deep copy functions is malformed, detect it immediately.
......@@ -93,6 +95,23 @@ func DeepCopy_federation_ClusterList(in interface{}, out interface{}, c *convers
}
}
func DeepCopy_federation_ClusterReplicaSetPreferences(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*ClusterReplicaSetPreferences)
out := out.(*ClusterReplicaSetPreferences)
out.MinReplicas = in.MinReplicas
if in.MaxReplicas != nil {
in, out := &in.MaxReplicas, &out.MaxReplicas
*out = new(int64)
**out = **in
} else {
out.MaxReplicas = nil
}
out.Weight = in.Weight
return nil
}
}
func DeepCopy_federation_ClusterSpec(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*ClusterSpec)
......@@ -144,6 +163,28 @@ func DeepCopy_federation_ClusterStatus(in interface{}, out interface{}, c *conve
}
}
func DeepCopy_federation_FederatedReplicaSetPreferences(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*FederatedReplicaSetPreferences)
out := out.(*FederatedReplicaSetPreferences)
out.Rebalance = in.Rebalance
if in.Clusters != nil {
in, out := &in.Clusters, &out.Clusters
*out = make(map[string]ClusterReplicaSetPreferences)
for key, val := range *in {
newVal := new(ClusterReplicaSetPreferences)
if err := DeepCopy_federation_ClusterReplicaSetPreferences(&val, newVal, c); err != nil {
return err
}
(*out)[key] = *newVal
}
} else {
out.Clusters = nil
}
return nil
}
}
func DeepCopy_federation_ServerAddressByClientCIDR(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*ServerAddressByClientCIDR)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment