Improve plugin args JSON tags

This commit is contained in:
Rafal Wicha 2020-03-02 15:20:44 +00:00
parent 39ed64ec4c
commit 09598d48f6
3 changed files with 5 additions and 5 deletions

View File

@ -131,9 +131,9 @@ type LabelPreference struct {
// RequestedToCapacityRatioArguments holds arguments specific to RequestedToCapacityRatio priority function.
type RequestedToCapacityRatioArguments struct {
// Array of point defining priority function shape
Shape []UtilizationShapePoint
Resources []ResourceSpec
// Array of point defining priority function shape.
Shape []UtilizationShapePoint `json:"shape"`
Resources []ResourceSpec `json:"resources,omitempty"`
}
// UtilizationShapePoint represents single point of priority function shape

View File

@ -128,7 +128,7 @@ func TestCreateFromConfig(t *testing.T) {
wantArgs := `{"Name":"NodeLabel","Args":{"presentLabels":["zone"],"absentLabels":["foo"],"presentLabelsPreference":["l1"],"absentLabelsPreference":["l2"]}}`
verifyPluginConvertion(t, nodelabel.Name, []string{"FilterPlugin", "ScorePlugin"}, prof, &factory.profiles[0], 6, wantArgs)
// Verify that service affinity custom predicate/priority is converted to framework plugin.
wantArgs = `{"Name":"ServiceAffinity","Args":{"labels":["zone","foo"],"antiAffinityLabelsPreference":["rack","zone"]}}`
wantArgs = `{"Name":"ServiceAffinity","Args":{"affinityLabels":["zone","foo"],"antiAffinityLabelsPreference":["rack","zone"]}}`
verifyPluginConvertion(t, serviceaffinity.Name, []string{"FilterPlugin", "ScorePlugin"}, prof, &factory.profiles[0], 6, wantArgs)
// TODO(#87703): Verify all plugin configs.
}

View File

@ -46,7 +46,7 @@ type Args struct {
// Labels are homogeneous for pods that are scheduled to a node.
// (i.e. it returns true IFF this pod can be added to this node such that all other pods in
// the same service are running on nodes with the exact same values for Labels).
AffinityLabels []string `json:"labels,omitempty"`
AffinityLabels []string `json:"affinityLabels,omitempty"`
// AntiAffinityLabelsPreference are the labels to consider for service anti affinity scoring.
AntiAffinityLabelsPreference []string `json:"antiAffinityLabelsPreference,omitempty"`
}