Skip to content

Instantly share code, notes, and snippets.

@jayunit100
Created April 12, 2017 13:36
Show Gist options
  • Select an option

  • Save jayunit100/21c78d1ef07ddd92bd6bd22f034a66e3 to your computer and use it in GitHub Desktop.

Select an option

Save jayunit100/21c78d1ef07ddd92bd6bd22f034a66e3 to your computer and use it in GitHub Desktop.
struct describing predicates
type PredPriConfiguration struct {
NodeAffinity struct {
Enabled bool // the % of nodes and pods that should match. If not enabled, node affinity is disabled.
MatchProbability float64 // the % of nodes and pods that should match. Higher # -> smaller performance deficit at scale.
NumLabels int // the number of labels needed to match. Higher # -> larger performance deficit at scale.
}
... // others
}
func ReadInPredPriConfiguration() *PredPrioConfiguration {
return &PredPrioConfiguration{
NodeAffinity:{
true,
.5,
5,
},
}
}
func (*PredPrioConfiguration) mutate() (func(*api.Pod) *api.Pod, func(*api.Node) *api.Node) {
ppc := ReadInPredPriConfiguration()
defaultMutatorPod := func(p *api.Pod) api.Pod {
return p;
}
defaultMutatorNode := func(n *api.Node) api.Node {
return n;
}
// Affinity mutation:
affinityMutatorPod := defaultMutator
affinityMutatorNode := defaultMutator
if ppc.NodeAffinity.Enabled {
affinityMutator := func(p *api.Pod) api.Pod {
// generate a default affinity struct that
}
affinityMutator := func(p *api.Pod) api.Pod {
// generate a default affinity struct that
}
}
return func(p *api.Pod) *api.Pod{
affinityMutator(p)
},func(n *api.Node) *api.Node{
affinityMutatorNode(n)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment