mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
Merge pull request #43271 from liggitt/affinity-namespace
Automatic merge from submit-queue (batch tested with PRs 43313, 43257, 43271, 43307) Remove 'all namespaces' meaning of empty list in PodAffinityTerm Removes the distinction between `null` and `[]` for the PodAffinityTerm#namespaces field (option 4 discussed in https://github.com/kubernetes/kubernetes/issues/43203#issuecomment-287237992), since we can't distinguish between them in protobuf (and it's a less than ideal API) Leaves the door open to reintroducing "all namespaces" function via a dedicated field or a dedicated token in the list of namespaces Wanted to get a PR open and tests green in case we went with this option. Not sure what doc/release-note is needed if the "all namespaces" function is not present in 1.6
This commit is contained in:
commit
eb43cd5eb3
@ -39818,16 +39818,13 @@
|
|||||||
},
|
},
|
||||||
"io.k8s.kubernetes.pkg.api.v1.PodAffinityTerm": {
|
"io.k8s.kubernetes.pkg.api.v1.PodAffinityTerm": {
|
||||||
"description": "Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e tches that of any node on which a pod of the set of pods is running",
|
"description": "Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e tches that of any node on which a pod of the set of pods is running",
|
||||||
"required": [
|
|
||||||
"namespaces"
|
|
||||||
],
|
|
||||||
"properties": {
|
"properties": {
|
||||||
"labelSelector": {
|
"labelSelector": {
|
||||||
"description": "A label query over a set of resources, in this case pods.",
|
"description": "A label query over a set of resources, in this case pods.",
|
||||||
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector"
|
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector"
|
||||||
},
|
},
|
||||||
"namespaces": {
|
"namespaces": {
|
||||||
"description": "namespaces specifies which namespaces the labelSelector applies to (matches against); nil list means \"this pod's namespace,\" empty list means \"all namespaces\" The json tag here is not \"omitempty\" since we need to distinguish nil and empty. See https://golang.org/pkg/encoding/json/#Marshal for more details.",
|
"description": "namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"",
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
@ -4259,9 +4259,6 @@
|
|||||||
"v1.PodAffinityTerm": {
|
"v1.PodAffinityTerm": {
|
||||||
"id": "v1.PodAffinityTerm",
|
"id": "v1.PodAffinityTerm",
|
||||||
"description": "Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e tches that of any node on which a pod of the set of pods is running",
|
"description": "Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e tches that of any node on which a pod of the set of pods is running",
|
||||||
"required": [
|
|
||||||
"namespaces"
|
|
||||||
],
|
|
||||||
"properties": {
|
"properties": {
|
||||||
"labelSelector": {
|
"labelSelector": {
|
||||||
"$ref": "v1.LabelSelector",
|
"$ref": "v1.LabelSelector",
|
||||||
@ -4272,7 +4269,7 @@
|
|||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"description": "namespaces specifies which namespaces the labelSelector applies to (matches against); nil list means \"this pod's namespace,\" empty list means \"all namespaces\" The json tag here is not \"omitempty\" since we need to distinguish nil and empty. See https://golang.org/pkg/encoding/json/#Marshal for more details."
|
"description": "namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\""
|
||||||
},
|
},
|
||||||
"topologyKey": {
|
"topologyKey": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
@ -3042,9 +3042,6 @@
|
|||||||
"v1.PodAffinityTerm": {
|
"v1.PodAffinityTerm": {
|
||||||
"id": "v1.PodAffinityTerm",
|
"id": "v1.PodAffinityTerm",
|
||||||
"description": "Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e tches that of any node on which a pod of the set of pods is running",
|
"description": "Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e tches that of any node on which a pod of the set of pods is running",
|
||||||
"required": [
|
|
||||||
"namespaces"
|
|
||||||
],
|
|
||||||
"properties": {
|
"properties": {
|
||||||
"labelSelector": {
|
"labelSelector": {
|
||||||
"$ref": "v1.LabelSelector",
|
"$ref": "v1.LabelSelector",
|
||||||
@ -3055,7 +3052,7 @@
|
|||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"description": "namespaces specifies which namespaces the labelSelector applies to (matches against); nil list means \"this pod's namespace,\" empty list means \"all namespaces\" The json tag here is not \"omitempty\" since we need to distinguish nil and empty. See https://golang.org/pkg/encoding/json/#Marshal for more details."
|
"description": "namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\""
|
||||||
},
|
},
|
||||||
"topologyKey": {
|
"topologyKey": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
@ -8506,9 +8506,6 @@
|
|||||||
"v1.PodAffinityTerm": {
|
"v1.PodAffinityTerm": {
|
||||||
"id": "v1.PodAffinityTerm",
|
"id": "v1.PodAffinityTerm",
|
||||||
"description": "Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e tches that of any node on which a pod of the set of pods is running",
|
"description": "Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e tches that of any node on which a pod of the set of pods is running",
|
||||||
"required": [
|
|
||||||
"namespaces"
|
|
||||||
],
|
|
||||||
"properties": {
|
"properties": {
|
||||||
"labelSelector": {
|
"labelSelector": {
|
||||||
"$ref": "v1.LabelSelector",
|
"$ref": "v1.LabelSelector",
|
||||||
@ -8519,7 +8516,7 @@
|
|||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"description": "namespaces specifies which namespaces the labelSelector applies to (matches against); nil list means \"this pod's namespace,\" empty list means \"all namespaces\" The json tag here is not \"omitempty\" since we need to distinguish nil and empty. See https://golang.org/pkg/encoding/json/#Marshal for more details."
|
"description": "namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\""
|
||||||
},
|
},
|
||||||
"topologyKey": {
|
"topologyKey": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
@ -19857,9 +19857,6 @@
|
|||||||
"v1.PodAffinityTerm": {
|
"v1.PodAffinityTerm": {
|
||||||
"id": "v1.PodAffinityTerm",
|
"id": "v1.PodAffinityTerm",
|
||||||
"description": "Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e tches that of any node on which a pod of the set of pods is running",
|
"description": "Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e tches that of any node on which a pod of the set of pods is running",
|
||||||
"required": [
|
|
||||||
"namespaces"
|
|
||||||
],
|
|
||||||
"properties": {
|
"properties": {
|
||||||
"labelSelector": {
|
"labelSelector": {
|
||||||
"$ref": "v1.LabelSelector",
|
"$ref": "v1.LabelSelector",
|
||||||
@ -19870,7 +19867,7 @@
|
|||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"description": "namespaces specifies which namespaces the labelSelector applies to (matches against); nil list means \"this pod's namespace,\" empty list means \"all namespaces\" The json tag here is not \"omitempty\" since we need to distinguish nil and empty. See https://golang.org/pkg/encoding/json/#Marshal for more details."
|
"description": "namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\""
|
||||||
},
|
},
|
||||||
"topologyKey": {
|
"topologyKey": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
@ -1984,8 +1984,8 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">namespaces</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">namespaces</p></td>
|
||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">namespaces specifies which namespaces the labelSelector applies to (matches against); nil list means "this pod’s namespace," empty list means "all namespaces" The json tag here is not "omitempty" since we need to distinguish nil and empty. See <a href="https://golang.org/pkg/encoding/json/#Marshal">https://golang.org/pkg/encoding/json/#Marshal</a> for more details.</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means "this pod’s namespace"</p></td>
|
||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
||||||
<td class="tableblock halign-left valign-top"></td>
|
<td class="tableblock halign-left valign-top"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -2818,8 +2818,8 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">namespaces</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">namespaces</p></td>
|
||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">namespaces specifies which namespaces the labelSelector applies to (matches against); nil list means "this pod’s namespace," empty list means "all namespaces" The json tag here is not "omitempty" since we need to distinguish nil and empty. See <a href="https://golang.org/pkg/encoding/json/#Marshal">https://golang.org/pkg/encoding/json/#Marshal</a> for more details.</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means "this pod’s namespace"</p></td>
|
||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
||||||
<td class="tableblock halign-left valign-top"></td>
|
<td class="tableblock halign-left valign-top"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -2604,8 +2604,8 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">namespaces</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">namespaces</p></td>
|
||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">namespaces specifies which namespaces the labelSelector applies to (matches against); nil list means "this pod’s namespace," empty list means "all namespaces" The json tag here is not "omitempty" since we need to distinguish nil and empty. See <a href="https://golang.org/pkg/encoding/json/#Marshal">https://golang.org/pkg/encoding/json/#Marshal</a> for more details.</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means "this pod’s namespace"</p></td>
|
||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
||||||
<td class="tableblock halign-left valign-top"></td>
|
<td class="tableblock halign-left valign-top"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -2737,8 +2737,8 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">namespaces</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">namespaces</p></td>
|
||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">namespaces specifies which namespaces the labelSelector applies to (matches against); nil list means "this pod’s namespace," empty list means "all namespaces" The json tag here is not "omitempty" since we need to distinguish nil and empty. See <a href="https://golang.org/pkg/encoding/json/#Marshal">https://golang.org/pkg/encoding/json/#Marshal</a> for more details.</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means "this pod’s namespace"</p></td>
|
||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
||||||
<td class="tableblock halign-left valign-top"></td>
|
<td class="tableblock halign-left valign-top"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -10586,16 +10586,13 @@
|
|||||||
},
|
},
|
||||||
"io.k8s.kubernetes.pkg.api.v1.PodAffinityTerm": {
|
"io.k8s.kubernetes.pkg.api.v1.PodAffinityTerm": {
|
||||||
"description": "Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e tches that of any node on which a pod of the set of pods is running",
|
"description": "Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e tches that of any node on which a pod of the set of pods is running",
|
||||||
"required": [
|
|
||||||
"namespaces"
|
|
||||||
],
|
|
||||||
"properties": {
|
"properties": {
|
||||||
"labelSelector": {
|
"labelSelector": {
|
||||||
"description": "A label query over a set of resources, in this case pods.",
|
"description": "A label query over a set of resources, in this case pods.",
|
||||||
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector"
|
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector"
|
||||||
},
|
},
|
||||||
"namespaces": {
|
"namespaces": {
|
||||||
"description": "namespaces specifies which namespaces the labelSelector applies to (matches against); nil list means \"this pod's namespace,\" empty list means \"all namespaces\" The json tag here is not \"omitempty\" since we need to distinguish nil and empty. See https://golang.org/pkg/encoding/json/#Marshal for more details.",
|
"description": "namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"",
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
@ -1886,9 +1886,7 @@ type PodAffinityTerm struct {
|
|||||||
// +optional
|
// +optional
|
||||||
LabelSelector *metav1.LabelSelector
|
LabelSelector *metav1.LabelSelector
|
||||||
// namespaces specifies which namespaces the labelSelector applies to (matches against);
|
// namespaces specifies which namespaces the labelSelector applies to (matches against);
|
||||||
// nil list means "this pod's namespace," empty list means "all namespaces"
|
// null or empty list means "this pod's namespace"
|
||||||
// The json tag here is not "omitempty" since we need to distinguish nil and empty.
|
|
||||||
// See https://golang.org/pkg/encoding/json/#Marshal for more details.
|
|
||||||
Namespaces []string
|
Namespaces []string
|
||||||
// This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching
|
// This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching
|
||||||
// the labelSelector in the specified namespaces, where co-located is defined as running on a node
|
// the labelSelector in the specified namespaces, where co-located is defined as running on a node
|
||||||
|
@ -2279,9 +2279,7 @@ message PodAffinityTerm {
|
|||||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector labelSelector = 1;
|
optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector labelSelector = 1;
|
||||||
|
|
||||||
// namespaces specifies which namespaces the labelSelector applies to (matches against);
|
// namespaces specifies which namespaces the labelSelector applies to (matches against);
|
||||||
// nil list means "this pod's namespace," empty list means "all namespaces"
|
// null or empty list means "this pod's namespace"
|
||||||
// The json tag here is not "omitempty" since we need to distinguish nil and empty.
|
|
||||||
// See https://golang.org/pkg/encoding/json/#Marshal for more details.
|
|
||||||
repeated string namespaces = 2;
|
repeated string namespaces = 2;
|
||||||
|
|
||||||
// This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching
|
// This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching
|
||||||
|
@ -32190,12 +32190,13 @@ func (x *PodAffinityTerm) CodecEncodeSelf(e *codec1978.Encoder) {
|
|||||||
_, _, _ = yysep2, yyq2, yy2arr2
|
_, _, _ = yysep2, yyq2, yy2arr2
|
||||||
const yyr2 bool = false
|
const yyr2 bool = false
|
||||||
yyq2[0] = x.LabelSelector != nil
|
yyq2[0] = x.LabelSelector != nil
|
||||||
|
yyq2[1] = len(x.Namespaces) != 0
|
||||||
yyq2[2] = x.TopologyKey != ""
|
yyq2[2] = x.TopologyKey != ""
|
||||||
var yynn2 int
|
var yynn2 int
|
||||||
if yyr2 || yy2arr2 {
|
if yyr2 || yy2arr2 {
|
||||||
r.EncodeArrayStart(3)
|
r.EncodeArrayStart(3)
|
||||||
} else {
|
} else {
|
||||||
yynn2 = 1
|
yynn2 = 0
|
||||||
for _, b := range yyq2 {
|
for _, b := range yyq2 {
|
||||||
if b {
|
if b {
|
||||||
yynn2++
|
yynn2++
|
||||||
@ -32241,6 +32242,7 @@ func (x *PodAffinityTerm) CodecEncodeSelf(e *codec1978.Encoder) {
|
|||||||
}
|
}
|
||||||
if yyr2 || yy2arr2 {
|
if yyr2 || yy2arr2 {
|
||||||
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
|
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
|
||||||
|
if yyq2[1] {
|
||||||
if x.Namespaces == nil {
|
if x.Namespaces == nil {
|
||||||
r.EncodeNil()
|
r.EncodeNil()
|
||||||
} else {
|
} else {
|
||||||
@ -32252,6 +32254,10 @@ func (x *PodAffinityTerm) CodecEncodeSelf(e *codec1978.Encoder) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
r.EncodeNil()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if yyq2[1] {
|
||||||
z.EncSendContainerState(codecSelfer_containerMapKey1234)
|
z.EncSendContainerState(codecSelfer_containerMapKey1234)
|
||||||
r.EncodeString(codecSelferC_UTF81234, string("namespaces"))
|
r.EncodeString(codecSelferC_UTF81234, string("namespaces"))
|
||||||
z.EncSendContainerState(codecSelfer_containerMapValue1234)
|
z.EncSendContainerState(codecSelfer_containerMapValue1234)
|
||||||
@ -32266,6 +32272,7 @@ func (x *PodAffinityTerm) CodecEncodeSelf(e *codec1978.Encoder) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if yyr2 || yy2arr2 {
|
if yyr2 || yy2arr2 {
|
||||||
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
|
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
|
||||||
if yyq2[2] {
|
if yyq2[2] {
|
||||||
|
@ -2102,10 +2102,8 @@ type PodAffinityTerm struct {
|
|||||||
// +optional
|
// +optional
|
||||||
LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty" protobuf:"bytes,1,opt,name=labelSelector"`
|
LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty" protobuf:"bytes,1,opt,name=labelSelector"`
|
||||||
// namespaces specifies which namespaces the labelSelector applies to (matches against);
|
// namespaces specifies which namespaces the labelSelector applies to (matches against);
|
||||||
// nil list means "this pod's namespace," empty list means "all namespaces"
|
// null or empty list means "this pod's namespace"
|
||||||
// The json tag here is not "omitempty" since we need to distinguish nil and empty.
|
Namespaces []string `json:"namespaces,omitempty" protobuf:"bytes,2,rep,name=namespaces"`
|
||||||
// See https://golang.org/pkg/encoding/json/#Marshal for more details.
|
|
||||||
Namespaces []string `json:"namespaces" protobuf:"bytes,2,rep,name=namespaces"`
|
|
||||||
// This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching
|
// This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching
|
||||||
// the labelSelector in the specified namespaces, where co-located is defined as running on a node
|
// the labelSelector in the specified namespaces, where co-located is defined as running on a node
|
||||||
// whose value of the label with key topologyKey matches that of any node on which any of the
|
// whose value of the label with key topologyKey matches that of any node on which any of the
|
||||||
|
@ -1189,7 +1189,7 @@ func (PodAffinity) SwaggerDoc() map[string]string {
|
|||||||
var map_PodAffinityTerm = map[string]string{
|
var map_PodAffinityTerm = map[string]string{
|
||||||
"": "Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key <topologyKey> tches that of any node on which a pod of the set of pods is running",
|
"": "Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key <topologyKey> tches that of any node on which a pod of the set of pods is running",
|
||||||
"labelSelector": "A label query over a set of resources, in this case pods.",
|
"labelSelector": "A label query over a set of resources, in this case pods.",
|
||||||
"namespaces": "namespaces specifies which namespaces the labelSelector applies to (matches against); nil list means \"this pod's namespace,\" empty list means \"all namespaces\" The json tag here is not \"omitempty\" since we need to distinguish nil and empty. See https://golang.org/pkg/encoding/json/#Marshal for more details.",
|
"namespaces": "namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"",
|
||||||
"topologyKey": "This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. For PreferredDuringScheduling pod anti-affinity, empty topologyKey is interpreted as \"all topologies\" (\"all topologies\" here means all the topologyKeys indicated by scheduler command-line argument --failure-domains); for affinity and for RequiredDuringScheduling pod anti-affinity, empty topologyKey is not allowed.",
|
"topologyKey": "This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. For PreferredDuringScheduling pod anti-affinity, empty topologyKey is interpreted as \"all topologies\" (\"all topologies\" here means all the topologyKeys indicated by scheduler command-line argument --failure-domains); for affinity and for RequiredDuringScheduling pod anti-affinity, empty topologyKey is not allowed.",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5925,7 +5925,7 @@ func GetOpenAPIDefinitions(ref openapi.ReferenceCallback) map[string]openapi.Ope
|
|||||||
},
|
},
|
||||||
"namespaces": {
|
"namespaces": {
|
||||||
SchemaProps: spec.SchemaProps{
|
SchemaProps: spec.SchemaProps{
|
||||||
Description: "namespaces specifies which namespaces the labelSelector applies to (matches against); nil list means \"this pod's namespace,\" empty list means \"all namespaces\" The json tag here is not \"omitempty\" since we need to distinguish nil and empty. See https://golang.org/pkg/encoding/json/#Marshal for more details.",
|
Description: "namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"",
|
||||||
Type: []string{"array"},
|
Type: []string{"array"},
|
||||||
Items: &spec.SchemaOrArray{
|
Items: &spec.SchemaOrArray{
|
||||||
Schema: &spec.Schema{
|
Schema: &spec.Schema{
|
||||||
@ -5945,7 +5945,6 @@ func GetOpenAPIDefinitions(ref openapi.ReferenceCallback) map[string]openapi.Ope
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Required: []string{"namespaces"},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Dependencies: []string{
|
Dependencies: []string{
|
||||||
|
@ -26,13 +26,12 @@ import (
|
|||||||
|
|
||||||
// GetNamespacesFromPodAffinityTerm returns a set of names
|
// GetNamespacesFromPodAffinityTerm returns a set of names
|
||||||
// according to the namespaces indicated in podAffinityTerm.
|
// according to the namespaces indicated in podAffinityTerm.
|
||||||
// 1. If the namespaces is nil considers the given pod's namespace
|
// If namespaces is empty it considers the given pod's namespace.
|
||||||
// 2. If the namespaces is empty list then considers all the namespaces
|
|
||||||
func GetNamespacesFromPodAffinityTerm(pod *v1.Pod, podAffinityTerm *v1.PodAffinityTerm) sets.String {
|
func GetNamespacesFromPodAffinityTerm(pod *v1.Pod, podAffinityTerm *v1.PodAffinityTerm) sets.String {
|
||||||
names := sets.String{}
|
names := sets.String{}
|
||||||
if podAffinityTerm.Namespaces == nil {
|
if len(podAffinityTerm.Namespaces) == 0 {
|
||||||
names.Insert(pod.Namespace)
|
names.Insert(pod.Namespace)
|
||||||
} else if len(podAffinityTerm.Namespaces) != 0 {
|
} else {
|
||||||
names.Insert(podAffinityTerm.Namespaces...)
|
names.Insert(podAffinityTerm.Namespaces...)
|
||||||
}
|
}
|
||||||
return names
|
return names
|
||||||
@ -41,7 +40,7 @@ func GetNamespacesFromPodAffinityTerm(pod *v1.Pod, podAffinityTerm *v1.PodAffini
|
|||||||
// PodMatchesTermsNamespaceAndSelector returns true if the given <pod>
|
// PodMatchesTermsNamespaceAndSelector returns true if the given <pod>
|
||||||
// matches the namespace and selector defined by <affinityPod>`s <term>.
|
// matches the namespace and selector defined by <affinityPod>`s <term>.
|
||||||
func PodMatchesTermsNamespaceAndSelector(pod *v1.Pod, namespaces sets.String, selector labels.Selector) bool {
|
func PodMatchesTermsNamespaceAndSelector(pod *v1.Pod, namespaces sets.String, selector labels.Selector) bool {
|
||||||
if len(namespaces) != 0 && !namespaces.Has(pod.Namespace) {
|
if !namespaces.Has(pod.Namespace) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1886,9 +1886,7 @@ type PodAffinityTerm struct {
|
|||||||
// +optional
|
// +optional
|
||||||
LabelSelector *metav1.LabelSelector
|
LabelSelector *metav1.LabelSelector
|
||||||
// namespaces specifies which namespaces the labelSelector applies to (matches against);
|
// namespaces specifies which namespaces the labelSelector applies to (matches against);
|
||||||
// nil list means "this pod's namespace," empty list means "all namespaces"
|
// null or empty list means "this pod's namespace"
|
||||||
// The json tag here is not "omitempty" since we need to distinguish nil and empty.
|
|
||||||
// See https://golang.org/pkg/encoding/json/#Marshal for more details.
|
|
||||||
Namespaces []string
|
Namespaces []string
|
||||||
// This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching
|
// This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching
|
||||||
// the labelSelector in the specified namespaces, where co-located is defined as running on a node
|
// the labelSelector in the specified namespaces, where co-located is defined as running on a node
|
||||||
|
@ -2279,9 +2279,7 @@ message PodAffinityTerm {
|
|||||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector labelSelector = 1;
|
optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector labelSelector = 1;
|
||||||
|
|
||||||
// namespaces specifies which namespaces the labelSelector applies to (matches against);
|
// namespaces specifies which namespaces the labelSelector applies to (matches against);
|
||||||
// nil list means "this pod's namespace," empty list means "all namespaces"
|
// null or empty list means "this pod's namespace"
|
||||||
// The json tag here is not "omitempty" since we need to distinguish nil and empty.
|
|
||||||
// See https://golang.org/pkg/encoding/json/#Marshal for more details.
|
|
||||||
repeated string namespaces = 2;
|
repeated string namespaces = 2;
|
||||||
|
|
||||||
// This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching
|
// This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching
|
||||||
|
@ -32190,12 +32190,13 @@ func (x *PodAffinityTerm) CodecEncodeSelf(e *codec1978.Encoder) {
|
|||||||
_, _, _ = yysep2, yyq2, yy2arr2
|
_, _, _ = yysep2, yyq2, yy2arr2
|
||||||
const yyr2 bool = false
|
const yyr2 bool = false
|
||||||
yyq2[0] = x.LabelSelector != nil
|
yyq2[0] = x.LabelSelector != nil
|
||||||
|
yyq2[1] = len(x.Namespaces) != 0
|
||||||
yyq2[2] = x.TopologyKey != ""
|
yyq2[2] = x.TopologyKey != ""
|
||||||
var yynn2 int
|
var yynn2 int
|
||||||
if yyr2 || yy2arr2 {
|
if yyr2 || yy2arr2 {
|
||||||
r.EncodeArrayStart(3)
|
r.EncodeArrayStart(3)
|
||||||
} else {
|
} else {
|
||||||
yynn2 = 1
|
yynn2 = 0
|
||||||
for _, b := range yyq2 {
|
for _, b := range yyq2 {
|
||||||
if b {
|
if b {
|
||||||
yynn2++
|
yynn2++
|
||||||
@ -32241,6 +32242,7 @@ func (x *PodAffinityTerm) CodecEncodeSelf(e *codec1978.Encoder) {
|
|||||||
}
|
}
|
||||||
if yyr2 || yy2arr2 {
|
if yyr2 || yy2arr2 {
|
||||||
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
|
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
|
||||||
|
if yyq2[1] {
|
||||||
if x.Namespaces == nil {
|
if x.Namespaces == nil {
|
||||||
r.EncodeNil()
|
r.EncodeNil()
|
||||||
} else {
|
} else {
|
||||||
@ -32252,6 +32254,10 @@ func (x *PodAffinityTerm) CodecEncodeSelf(e *codec1978.Encoder) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
r.EncodeNil()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if yyq2[1] {
|
||||||
z.EncSendContainerState(codecSelfer_containerMapKey1234)
|
z.EncSendContainerState(codecSelfer_containerMapKey1234)
|
||||||
r.EncodeString(codecSelferC_UTF81234, string("namespaces"))
|
r.EncodeString(codecSelferC_UTF81234, string("namespaces"))
|
||||||
z.EncSendContainerState(codecSelfer_containerMapValue1234)
|
z.EncSendContainerState(codecSelfer_containerMapValue1234)
|
||||||
@ -32266,6 +32272,7 @@ func (x *PodAffinityTerm) CodecEncodeSelf(e *codec1978.Encoder) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if yyr2 || yy2arr2 {
|
if yyr2 || yy2arr2 {
|
||||||
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
|
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
|
||||||
if yyq2[2] {
|
if yyq2[2] {
|
||||||
|
@ -2102,10 +2102,8 @@ type PodAffinityTerm struct {
|
|||||||
// +optional
|
// +optional
|
||||||
LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty" protobuf:"bytes,1,opt,name=labelSelector"`
|
LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty" protobuf:"bytes,1,opt,name=labelSelector"`
|
||||||
// namespaces specifies which namespaces the labelSelector applies to (matches against);
|
// namespaces specifies which namespaces the labelSelector applies to (matches against);
|
||||||
// nil list means "this pod's namespace," empty list means "all namespaces"
|
// null or empty list means "this pod's namespace"
|
||||||
// The json tag here is not "omitempty" since we need to distinguish nil and empty.
|
Namespaces []string `json:"namespaces,omitempty" protobuf:"bytes,2,rep,name=namespaces"`
|
||||||
// See https://golang.org/pkg/encoding/json/#Marshal for more details.
|
|
||||||
Namespaces []string `json:"namespaces" protobuf:"bytes,2,rep,name=namespaces"`
|
|
||||||
// This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching
|
// This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching
|
||||||
// the labelSelector in the specified namespaces, where co-located is defined as running on a node
|
// the labelSelector in the specified namespaces, where co-located is defined as running on a node
|
||||||
// whose value of the label with key topologyKey matches that of any node on which any of the
|
// whose value of the label with key topologyKey matches that of any node on which any of the
|
||||||
|
@ -1189,7 +1189,7 @@ func (PodAffinity) SwaggerDoc() map[string]string {
|
|||||||
var map_PodAffinityTerm = map[string]string{
|
var map_PodAffinityTerm = map[string]string{
|
||||||
"": "Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key <topologyKey> tches that of any node on which a pod of the set of pods is running",
|
"": "Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key <topologyKey> tches that of any node on which a pod of the set of pods is running",
|
||||||
"labelSelector": "A label query over a set of resources, in this case pods.",
|
"labelSelector": "A label query over a set of resources, in this case pods.",
|
||||||
"namespaces": "namespaces specifies which namespaces the labelSelector applies to (matches against); nil list means \"this pod's namespace,\" empty list means \"all namespaces\" The json tag here is not \"omitempty\" since we need to distinguish nil and empty. See https://golang.org/pkg/encoding/json/#Marshal for more details.",
|
"namespaces": "namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"",
|
||||||
"topologyKey": "This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. For PreferredDuringScheduling pod anti-affinity, empty topologyKey is interpreted as \"all topologies\" (\"all topologies\" here means all the topologyKeys indicated by scheduler command-line argument --failure-domains); for affinity and for RequiredDuringScheduling pod anti-affinity, empty topologyKey is not allowed.",
|
"topologyKey": "This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. For PreferredDuringScheduling pod anti-affinity, empty topologyKey is interpreted as \"all topologies\" (\"all topologies\" here means all the topologyKeys indicated by scheduler command-line argument --failure-domains); for affinity and for RequiredDuringScheduling pod anti-affinity, empty topologyKey is not allowed.",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user