Use topology labels instead of old beta names (#96033)
* Rename const for topology.../zone * Rename const for topology.../region * Rename const for failure-domain.../zone * Rename const for failure-domain.../region * Restore old names for compat
This commit is contained in:
parent
cccd77bd3a
commit
819ff9b087
@ -197,10 +197,10 @@ func TestMonitorNodeHealthEvictPods(t *testing.T) {
|
||||
fakeNow := metav1.Date(2015, 1, 1, 12, 0, 0, 0, time.UTC)
|
||||
evictionTimeout := 10 * time.Minute
|
||||
labels := map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
}
|
||||
|
||||
// Because of the logic that prevents NC from evicting anything when all Nodes are NotReady
|
||||
@ -236,10 +236,10 @@ func TestMonitorNodeHealthEvictPods(t *testing.T) {
|
||||
Name: "node0",
|
||||
CreationTimestamp: fakeNow,
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -248,10 +248,10 @@ func TestMonitorNodeHealthEvictPods(t *testing.T) {
|
||||
Name: "node1",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -320,10 +320,10 @@ func TestMonitorNodeHealthEvictPods(t *testing.T) {
|
||||
Name: "node0",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -342,10 +342,10 @@ func TestMonitorNodeHealthEvictPods(t *testing.T) {
|
||||
Name: "node1",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -388,10 +388,10 @@ func TestMonitorNodeHealthEvictPods(t *testing.T) {
|
||||
Name: "node0",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -410,10 +410,10 @@ func TestMonitorNodeHealthEvictPods(t *testing.T) {
|
||||
Name: "node1",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -483,10 +483,10 @@ func TestMonitorNodeHealthEvictPods(t *testing.T) {
|
||||
Name: "node0",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -505,10 +505,10 @@ func TestMonitorNodeHealthEvictPods(t *testing.T) {
|
||||
Name: "node1",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -551,10 +551,10 @@ func TestMonitorNodeHealthEvictPods(t *testing.T) {
|
||||
Name: "node0",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -573,10 +573,10 @@ func TestMonitorNodeHealthEvictPods(t *testing.T) {
|
||||
Name: "node1",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -619,10 +619,10 @@ func TestMonitorNodeHealthEvictPods(t *testing.T) {
|
||||
Name: "node0",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -641,10 +641,10 @@ func TestMonitorNodeHealthEvictPods(t *testing.T) {
|
||||
Name: "node1",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -788,10 +788,10 @@ func TestPodStatusChange(t *testing.T) {
|
||||
Name: "node0",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -810,8 +810,8 @@ func TestPodStatusChange(t *testing.T) {
|
||||
Name: "node1",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -958,10 +958,10 @@ func TestMonitorNodeHealthEvictPodsWithDisruption(t *testing.T) {
|
||||
Name: "node0",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -980,10 +980,10 @@ func TestMonitorNodeHealthEvictPodsWithDisruption(t *testing.T) {
|
||||
Name: "node1",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -1017,10 +1017,10 @@ func TestMonitorNodeHealthEvictPodsWithDisruption(t *testing.T) {
|
||||
Name: "node0",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -1039,10 +1039,10 @@ func TestMonitorNodeHealthEvictPodsWithDisruption(t *testing.T) {
|
||||
Name: "node1",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region2",
|
||||
v1.LabelZoneFailureDomainStable: "zone2",
|
||||
v1.LabelZoneRegion: "region2",
|
||||
v1.LabelZoneFailureDomain: "zone2",
|
||||
v1.LabelTopologyRegion: "region2",
|
||||
v1.LabelTopologyZone: "zone2",
|
||||
v1.LabelFailureDomainBetaRegion: "region2",
|
||||
v1.LabelFailureDomainBetaZone: "zone2",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -1083,10 +1083,10 @@ func TestMonitorNodeHealthEvictPodsWithDisruption(t *testing.T) {
|
||||
Name: "node0",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -1105,10 +1105,10 @@ func TestMonitorNodeHealthEvictPodsWithDisruption(t *testing.T) {
|
||||
Name: "node1",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone2",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone2",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone2",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone2",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -1148,10 +1148,10 @@ func TestMonitorNodeHealthEvictPodsWithDisruption(t *testing.T) {
|
||||
Name: "node0",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -1170,10 +1170,10 @@ func TestMonitorNodeHealthEvictPodsWithDisruption(t *testing.T) {
|
||||
Name: "node-master",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -1211,10 +1211,10 @@ func TestMonitorNodeHealthEvictPodsWithDisruption(t *testing.T) {
|
||||
Name: "node0",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -1233,10 +1233,10 @@ func TestMonitorNodeHealthEvictPodsWithDisruption(t *testing.T) {
|
||||
Name: "node1",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone2",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone2",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone2",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone2",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -1277,10 +1277,10 @@ func TestMonitorNodeHealthEvictPodsWithDisruption(t *testing.T) {
|
||||
Name: "node0",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -1299,10 +1299,10 @@ func TestMonitorNodeHealthEvictPodsWithDisruption(t *testing.T) {
|
||||
Name: "node1",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -1321,10 +1321,10 @@ func TestMonitorNodeHealthEvictPodsWithDisruption(t *testing.T) {
|
||||
Name: "node2",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -1343,10 +1343,10 @@ func TestMonitorNodeHealthEvictPodsWithDisruption(t *testing.T) {
|
||||
Name: "node3",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -1365,10 +1365,10 @@ func TestMonitorNodeHealthEvictPodsWithDisruption(t *testing.T) {
|
||||
Name: "node4",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -2640,10 +2640,10 @@ func TestApplyNoExecuteTaints(t *testing.T) {
|
||||
Name: "node0",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -2664,10 +2664,10 @@ func TestApplyNoExecuteTaints(t *testing.T) {
|
||||
Name: "node1",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -2687,10 +2687,10 @@ func TestApplyNoExecuteTaints(t *testing.T) {
|
||||
Name: "node2",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -2793,10 +2793,10 @@ func TestSwapUnreachableNotReadyTaints(t *testing.T) {
|
||||
Name: "node0",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -2818,10 +2818,10 @@ func TestSwapUnreachableNotReadyTaints(t *testing.T) {
|
||||
Name: "node1",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -2946,10 +2946,10 @@ func TestTaintsNodeByCondition(t *testing.T) {
|
||||
Name: "node0",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -3007,10 +3007,10 @@ func TestTaintsNodeByCondition(t *testing.T) {
|
||||
Name: "node0",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -3039,10 +3039,10 @@ func TestTaintsNodeByCondition(t *testing.T) {
|
||||
Name: "node0",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -3071,10 +3071,10 @@ func TestTaintsNodeByCondition(t *testing.T) {
|
||||
Name: "node0",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -3097,10 +3097,10 @@ func TestTaintsNodeByCondition(t *testing.T) {
|
||||
Name: "node0",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -3221,10 +3221,10 @@ func TestReconcileNodeLabels(t *testing.T) {
|
||||
Name: "node0",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
@ -3279,12 +3279,12 @@ func TestReconcileNodeLabels(t *testing.T) {
|
||||
Name: "node0",
|
||||
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
},
|
||||
},
|
||||
},
|
||||
ExpectedLabels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -115,7 +115,7 @@ var (
|
||||
nodeLabelValue = "node1"
|
||||
|
||||
// node topology for CSI migration
|
||||
zone1Labels = map[string]string{v1.LabelZoneFailureDomain: "us-east-1", v1.LabelZoneRegion: "us-east-1a"}
|
||||
zone1Labels = map[string]string{v1.LabelFailureDomainBetaZone: "us-east-1", v1.LabelFailureDomainBetaRegion: "us-east-1a"}
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -19,7 +19,7 @@ package apis
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
)
|
||||
|
||||
@ -34,10 +34,10 @@ const (
|
||||
|
||||
var kubeletLabels = sets.NewString(
|
||||
v1.LabelHostname,
|
||||
v1.LabelZoneFailureDomainStable,
|
||||
v1.LabelZoneRegionStable,
|
||||
v1.LabelZoneFailureDomain,
|
||||
v1.LabelZoneRegion,
|
||||
v1.LabelTopologyZone,
|
||||
v1.LabelTopologyRegion,
|
||||
v1.LabelFailureDomainBetaZone,
|
||||
v1.LabelFailureDomainBetaRegion,
|
||||
v1.LabelInstanceType,
|
||||
v1.LabelInstanceTypeStable,
|
||||
v1.LabelOSStable,
|
||||
|
@ -192,10 +192,10 @@ func (kl *Kubelet) reconcileExtendedResource(initialNode, node *v1.Node) bool {
|
||||
func (kl *Kubelet) updateDefaultLabels(initialNode, existingNode *v1.Node) bool {
|
||||
defaultLabels := []string{
|
||||
v1.LabelHostname,
|
||||
v1.LabelZoneFailureDomainStable,
|
||||
v1.LabelZoneRegionStable,
|
||||
v1.LabelZoneFailureDomain,
|
||||
v1.LabelZoneRegion,
|
||||
v1.LabelTopologyZone,
|
||||
v1.LabelTopologyRegion,
|
||||
v1.LabelFailureDomainBetaZone,
|
||||
v1.LabelFailureDomainBetaRegion,
|
||||
v1.LabelInstanceTypeStable,
|
||||
v1.LabelInstanceType,
|
||||
v1.LabelOSStable,
|
||||
@ -392,16 +392,16 @@ func (kl *Kubelet) initialNode(ctx context.Context) (*v1.Node, error) {
|
||||
return nil, fmt.Errorf("failed to get zone from cloud provider: %v", err)
|
||||
}
|
||||
if zone.FailureDomain != "" {
|
||||
klog.Infof("Adding node label from cloud provider: %s=%s", v1.LabelZoneFailureDomain, zone.FailureDomain)
|
||||
node.ObjectMeta.Labels[v1.LabelZoneFailureDomain] = zone.FailureDomain
|
||||
klog.Infof("Adding node label from cloud provider: %s=%s", v1.LabelZoneFailureDomainStable, zone.FailureDomain)
|
||||
node.ObjectMeta.Labels[v1.LabelZoneFailureDomainStable] = zone.FailureDomain
|
||||
klog.Infof("Adding node label from cloud provider: %s=%s", v1.LabelFailureDomainBetaZone, zone.FailureDomain)
|
||||
node.ObjectMeta.Labels[v1.LabelFailureDomainBetaZone] = zone.FailureDomain
|
||||
klog.Infof("Adding node label from cloud provider: %s=%s", v1.LabelTopologyZone, zone.FailureDomain)
|
||||
node.ObjectMeta.Labels[v1.LabelTopologyZone] = zone.FailureDomain
|
||||
}
|
||||
if zone.Region != "" {
|
||||
klog.Infof("Adding node label from cloud provider: %s=%s", v1.LabelZoneRegion, zone.Region)
|
||||
node.ObjectMeta.Labels[v1.LabelZoneRegion] = zone.Region
|
||||
klog.Infof("Adding node label from cloud provider: %s=%s", v1.LabelZoneRegionStable, zone.Region)
|
||||
node.ObjectMeta.Labels[v1.LabelZoneRegionStable] = zone.Region
|
||||
klog.Infof("Adding node label from cloud provider: %s=%s", v1.LabelFailureDomainBetaRegion, zone.Region)
|
||||
node.ObjectMeta.Labels[v1.LabelFailureDomainBetaRegion] = zone.Region
|
||||
klog.Infof("Adding node label from cloud provider: %s=%s", v1.LabelTopologyRegion, zone.Region)
|
||||
node.ObjectMeta.Labels[v1.LabelTopologyRegion] = zone.Region
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1412,10 +1412,10 @@ func TestUpdateDefaultLabels(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
v1.LabelHostname: "new-hostname",
|
||||
v1.LabelZoneFailureDomainStable: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegionStable: "new-zone-region",
|
||||
v1.LabelZoneFailureDomain: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegion: "new-zone-region",
|
||||
v1.LabelTopologyZone: "new-zone-failure-domain",
|
||||
v1.LabelTopologyRegion: "new-zone-region",
|
||||
v1.LabelFailureDomainBetaZone: "new-zone-failure-domain",
|
||||
v1.LabelFailureDomainBetaRegion: "new-zone-region",
|
||||
v1.LabelInstanceTypeStable: "new-instance-type",
|
||||
v1.LabelInstanceType: "new-instance-type",
|
||||
v1.LabelOSStable: "new-os",
|
||||
@ -1431,10 +1431,10 @@ func TestUpdateDefaultLabels(t *testing.T) {
|
||||
needsUpdate: true,
|
||||
finalLabels: map[string]string{
|
||||
v1.LabelHostname: "new-hostname",
|
||||
v1.LabelZoneFailureDomainStable: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegionStable: "new-zone-region",
|
||||
v1.LabelZoneFailureDomain: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegion: "new-zone-region",
|
||||
v1.LabelTopologyZone: "new-zone-failure-domain",
|
||||
v1.LabelTopologyRegion: "new-zone-region",
|
||||
v1.LabelFailureDomainBetaZone: "new-zone-failure-domain",
|
||||
v1.LabelFailureDomainBetaRegion: "new-zone-region",
|
||||
v1.LabelInstanceTypeStable: "new-instance-type",
|
||||
v1.LabelInstanceType: "new-instance-type",
|
||||
v1.LabelOSStable: "new-os",
|
||||
@ -1447,10 +1447,10 @@ func TestUpdateDefaultLabels(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
v1.LabelHostname: "new-hostname",
|
||||
v1.LabelZoneFailureDomainStable: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegionStable: "new-zone-region",
|
||||
v1.LabelZoneFailureDomain: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegion: "new-zone-region",
|
||||
v1.LabelTopologyZone: "new-zone-failure-domain",
|
||||
v1.LabelTopologyRegion: "new-zone-region",
|
||||
v1.LabelFailureDomainBetaZone: "new-zone-failure-domain",
|
||||
v1.LabelFailureDomainBetaRegion: "new-zone-region",
|
||||
v1.LabelInstanceTypeStable: "new-instance-type",
|
||||
v1.LabelInstanceType: "new-instance-type",
|
||||
v1.LabelOSStable: "new-os",
|
||||
@ -1462,10 +1462,10 @@ func TestUpdateDefaultLabels(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
v1.LabelHostname: "old-hostname",
|
||||
v1.LabelZoneFailureDomainStable: "old-zone-failure-domain",
|
||||
v1.LabelZoneRegionStable: "old-zone-region",
|
||||
v1.LabelZoneFailureDomain: "old-zone-failure-domain",
|
||||
v1.LabelZoneRegion: "old-zone-region",
|
||||
v1.LabelTopologyZone: "old-zone-failure-domain",
|
||||
v1.LabelTopologyRegion: "old-zone-region",
|
||||
v1.LabelFailureDomainBetaZone: "old-zone-failure-domain",
|
||||
v1.LabelFailureDomainBetaRegion: "old-zone-region",
|
||||
v1.LabelInstanceTypeStable: "old-instance-type",
|
||||
v1.LabelInstanceType: "old-instance-type",
|
||||
v1.LabelOSStable: "old-os",
|
||||
@ -1476,10 +1476,10 @@ func TestUpdateDefaultLabels(t *testing.T) {
|
||||
needsUpdate: true,
|
||||
finalLabels: map[string]string{
|
||||
v1.LabelHostname: "new-hostname",
|
||||
v1.LabelZoneFailureDomainStable: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegionStable: "new-zone-region",
|
||||
v1.LabelZoneFailureDomain: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegion: "new-zone-region",
|
||||
v1.LabelTopologyZone: "new-zone-failure-domain",
|
||||
v1.LabelTopologyRegion: "new-zone-region",
|
||||
v1.LabelFailureDomainBetaZone: "new-zone-failure-domain",
|
||||
v1.LabelFailureDomainBetaRegion: "new-zone-region",
|
||||
v1.LabelInstanceTypeStable: "new-instance-type",
|
||||
v1.LabelInstanceType: "new-instance-type",
|
||||
v1.LabelOSStable: "new-os",
|
||||
@ -1492,10 +1492,10 @@ func TestUpdateDefaultLabels(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
v1.LabelHostname: "new-hostname",
|
||||
v1.LabelZoneFailureDomainStable: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegionStable: "new-zone-region",
|
||||
v1.LabelZoneFailureDomain: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegion: "new-zone-region",
|
||||
v1.LabelTopologyZone: "new-zone-failure-domain",
|
||||
v1.LabelTopologyRegion: "new-zone-region",
|
||||
v1.LabelFailureDomainBetaZone: "new-zone-failure-domain",
|
||||
v1.LabelFailureDomainBetaRegion: "new-zone-region",
|
||||
v1.LabelInstanceTypeStable: "new-instance-type",
|
||||
v1.LabelInstanceType: "new-instance-type",
|
||||
v1.LabelOSStable: "new-os",
|
||||
@ -1507,10 +1507,10 @@ func TestUpdateDefaultLabels(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
v1.LabelHostname: "new-hostname",
|
||||
v1.LabelZoneFailureDomainStable: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegionStable: "new-zone-region",
|
||||
v1.LabelZoneFailureDomain: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegion: "new-zone-region",
|
||||
v1.LabelTopologyZone: "new-zone-failure-domain",
|
||||
v1.LabelTopologyRegion: "new-zone-region",
|
||||
v1.LabelFailureDomainBetaZone: "new-zone-failure-domain",
|
||||
v1.LabelFailureDomainBetaRegion: "new-zone-region",
|
||||
v1.LabelInstanceTypeStable: "new-instance-type",
|
||||
v1.LabelInstanceType: "new-instance-type",
|
||||
v1.LabelOSStable: "new-os",
|
||||
@ -1522,10 +1522,10 @@ func TestUpdateDefaultLabels(t *testing.T) {
|
||||
needsUpdate: false,
|
||||
finalLabels: map[string]string{
|
||||
v1.LabelHostname: "new-hostname",
|
||||
v1.LabelZoneFailureDomainStable: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegionStable: "new-zone-region",
|
||||
v1.LabelZoneFailureDomain: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegion: "new-zone-region",
|
||||
v1.LabelTopologyZone: "new-zone-failure-domain",
|
||||
v1.LabelTopologyRegion: "new-zone-region",
|
||||
v1.LabelFailureDomainBetaZone: "new-zone-failure-domain",
|
||||
v1.LabelFailureDomainBetaRegion: "new-zone-region",
|
||||
v1.LabelInstanceTypeStable: "new-instance-type",
|
||||
v1.LabelInstanceType: "new-instance-type",
|
||||
v1.LabelOSStable: "new-os",
|
||||
@ -1544,10 +1544,10 @@ func TestUpdateDefaultLabels(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
v1.LabelHostname: "new-hostname",
|
||||
v1.LabelZoneFailureDomainStable: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegionStable: "new-zone-region",
|
||||
v1.LabelZoneFailureDomain: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegion: "new-zone-region",
|
||||
v1.LabelTopologyZone: "new-zone-failure-domain",
|
||||
v1.LabelTopologyRegion: "new-zone-region",
|
||||
v1.LabelFailureDomainBetaZone: "new-zone-failure-domain",
|
||||
v1.LabelFailureDomainBetaRegion: "new-zone-region",
|
||||
v1.LabelInstanceTypeStable: "new-instance-type",
|
||||
v1.LabelInstanceType: "new-instance-type",
|
||||
v1.LabelOSStable: "new-os",
|
||||
@ -1559,10 +1559,10 @@ func TestUpdateDefaultLabels(t *testing.T) {
|
||||
needsUpdate: false,
|
||||
finalLabels: map[string]string{
|
||||
v1.LabelHostname: "new-hostname",
|
||||
v1.LabelZoneFailureDomainStable: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegionStable: "new-zone-region",
|
||||
v1.LabelZoneFailureDomain: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegion: "new-zone-region",
|
||||
v1.LabelTopologyZone: "new-zone-failure-domain",
|
||||
v1.LabelTopologyRegion: "new-zone-region",
|
||||
v1.LabelFailureDomainBetaZone: "new-zone-failure-domain",
|
||||
v1.LabelFailureDomainBetaRegion: "new-zone-region",
|
||||
v1.LabelInstanceTypeStable: "new-instance-type",
|
||||
v1.LabelInstanceType: "new-instance-type",
|
||||
v1.LabelOSStable: "new-os",
|
||||
@ -1576,10 +1576,10 @@ func TestUpdateDefaultLabels(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
v1.LabelHostname: "new-hostname",
|
||||
v1.LabelZoneFailureDomainStable: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegionStable: "new-zone-region",
|
||||
v1.LabelZoneFailureDomain: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegion: "new-zone-region",
|
||||
v1.LabelTopologyZone: "new-zone-failure-domain",
|
||||
v1.LabelTopologyRegion: "new-zone-region",
|
||||
v1.LabelFailureDomainBetaZone: "new-zone-failure-domain",
|
||||
v1.LabelFailureDomainBetaRegion: "new-zone-region",
|
||||
v1.LabelInstanceTypeStable: "new-instance-type",
|
||||
v1.LabelInstanceType: "new-instance-type",
|
||||
v1.LabelOSStable: "new-os",
|
||||
@ -1591,10 +1591,10 @@ func TestUpdateDefaultLabels(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
v1.LabelHostname: "new-hostname",
|
||||
v1.LabelZoneFailureDomainStable: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegionStable: "new-zone-region",
|
||||
v1.LabelZoneFailureDomain: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegion: "new-zone-region",
|
||||
v1.LabelTopologyZone: "new-zone-failure-domain",
|
||||
v1.LabelTopologyRegion: "new-zone-region",
|
||||
v1.LabelFailureDomainBetaZone: "new-zone-failure-domain",
|
||||
v1.LabelFailureDomainBetaRegion: "new-zone-region",
|
||||
v1.LabelInstanceTypeStable: "new-instance-type",
|
||||
v1.LabelInstanceType: "new-instance-type",
|
||||
v1.LabelOSStable: "new-os",
|
||||
@ -1605,10 +1605,10 @@ func TestUpdateDefaultLabels(t *testing.T) {
|
||||
needsUpdate: false,
|
||||
finalLabels: map[string]string{
|
||||
v1.LabelHostname: "new-hostname",
|
||||
v1.LabelZoneFailureDomainStable: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegionStable: "new-zone-region",
|
||||
v1.LabelZoneFailureDomain: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegion: "new-zone-region",
|
||||
v1.LabelTopologyZone: "new-zone-failure-domain",
|
||||
v1.LabelTopologyRegion: "new-zone-region",
|
||||
v1.LabelFailureDomainBetaZone: "new-zone-failure-domain",
|
||||
v1.LabelFailureDomainBetaRegion: "new-zone-region",
|
||||
v1.LabelInstanceTypeStable: "new-instance-type",
|
||||
v1.LabelInstanceType: "new-instance-type",
|
||||
v1.LabelOSStable: "new-os",
|
||||
@ -1621,10 +1621,10 @@ func TestUpdateDefaultLabels(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
v1.LabelHostname: "new-hostname",
|
||||
v1.LabelZoneFailureDomainStable: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegionStable: "new-zone-region",
|
||||
v1.LabelZoneFailureDomain: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegion: "new-zone-region",
|
||||
v1.LabelTopologyZone: "new-zone-failure-domain",
|
||||
v1.LabelTopologyRegion: "new-zone-region",
|
||||
v1.LabelFailureDomainBetaZone: "new-zone-failure-domain",
|
||||
v1.LabelFailureDomainBetaRegion: "new-zone-region",
|
||||
v1.LabelInstanceTypeStable: "new-instance-type",
|
||||
v1.LabelInstanceType: "new-instance-type",
|
||||
v1.LabelOSStable: "new-os",
|
||||
@ -1638,10 +1638,10 @@ func TestUpdateDefaultLabels(t *testing.T) {
|
||||
needsUpdate: true,
|
||||
finalLabels: map[string]string{
|
||||
v1.LabelHostname: "new-hostname",
|
||||
v1.LabelZoneFailureDomainStable: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegionStable: "new-zone-region",
|
||||
v1.LabelZoneFailureDomain: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegion: "new-zone-region",
|
||||
v1.LabelTopologyZone: "new-zone-failure-domain",
|
||||
v1.LabelTopologyRegion: "new-zone-region",
|
||||
v1.LabelFailureDomainBetaZone: "new-zone-failure-domain",
|
||||
v1.LabelFailureDomainBetaRegion: "new-zone-region",
|
||||
v1.LabelInstanceTypeStable: "new-instance-type",
|
||||
v1.LabelInstanceType: "new-instance-type",
|
||||
v1.LabelOSStable: "new-os",
|
||||
@ -1654,10 +1654,10 @@ func TestUpdateDefaultLabels(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
v1.LabelHostname: "new-hostname",
|
||||
v1.LabelZoneFailureDomainStable: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegionStable: "new-zone-region",
|
||||
v1.LabelZoneFailureDomain: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegion: "new-zone-region",
|
||||
v1.LabelTopologyZone: "new-zone-failure-domain",
|
||||
v1.LabelTopologyRegion: "new-zone-region",
|
||||
v1.LabelFailureDomainBetaZone: "new-zone-failure-domain",
|
||||
v1.LabelFailureDomainBetaRegion: "new-zone-region",
|
||||
v1.LabelInstanceTypeStable: "new-instance-type",
|
||||
v1.LabelInstanceType: "new-instance-type",
|
||||
v1.LabelOSStable: "new-os",
|
||||
@ -1668,20 +1668,20 @@ func TestUpdateDefaultLabels(t *testing.T) {
|
||||
existingNode: &v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
v1.LabelHostname: "new-hostname",
|
||||
v1.LabelZoneFailureDomain: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegion: "new-zone-region",
|
||||
v1.LabelInstanceType: "new-instance-type",
|
||||
v1.LabelHostname: "new-hostname",
|
||||
v1.LabelFailureDomainBetaZone: "new-zone-failure-domain",
|
||||
v1.LabelFailureDomainBetaRegion: "new-zone-region",
|
||||
v1.LabelInstanceType: "new-instance-type",
|
||||
},
|
||||
},
|
||||
},
|
||||
needsUpdate: true,
|
||||
finalLabels: map[string]string{
|
||||
v1.LabelHostname: "new-hostname",
|
||||
v1.LabelZoneFailureDomainStable: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegionStable: "new-zone-region",
|
||||
v1.LabelZoneFailureDomain: "new-zone-failure-domain",
|
||||
v1.LabelZoneRegion: "new-zone-region",
|
||||
v1.LabelTopologyZone: "new-zone-failure-domain",
|
||||
v1.LabelTopologyRegion: "new-zone-region",
|
||||
v1.LabelFailureDomainBetaZone: "new-zone-failure-domain",
|
||||
v1.LabelFailureDomainBetaRegion: "new-zone-region",
|
||||
v1.LabelInstanceTypeStable: "new-instance-type",
|
||||
v1.LabelInstanceType: "new-instance-type",
|
||||
v1.LabelOSStable: "new-os",
|
||||
|
@ -1076,7 +1076,7 @@ func BenchmarkFilter(b *testing.B) {
|
||||
{
|
||||
name: "1000nodes/single-constraint-zone",
|
||||
pod: st.MakePod().Name("p").Label("foo", "").
|
||||
SpreadConstraint(1, v1.LabelZoneFailureDomainStable, v1.DoNotSchedule, st.MakeLabelSelector().Exists("foo").Obj()).
|
||||
SpreadConstraint(1, v1.LabelTopologyZone, v1.DoNotSchedule, st.MakeLabelSelector().Exists("foo").Obj()).
|
||||
Obj(),
|
||||
existingPodsNum: 10000,
|
||||
allNodesNum: 1000,
|
||||
@ -1094,7 +1094,7 @@ func BenchmarkFilter(b *testing.B) {
|
||||
{
|
||||
name: "1000nodes/two-Constraints-zone-node",
|
||||
pod: st.MakePod().Name("p").Label("foo", "").Label("bar", "").
|
||||
SpreadConstraint(1, v1.LabelZoneFailureDomainStable, v1.DoNotSchedule, st.MakeLabelSelector().Exists("foo").Obj()).
|
||||
SpreadConstraint(1, v1.LabelTopologyZone, v1.DoNotSchedule, st.MakeLabelSelector().Exists("foo").Obj()).
|
||||
SpreadConstraint(1, v1.LabelHostname, v1.DoNotSchedule, st.MakeLabelSelector().Exists("bar").Obj()).
|
||||
Obj(),
|
||||
existingPodsNum: 10000,
|
||||
|
@ -43,7 +43,7 @@ var systemDefaultConstraints = []v1.TopologySpreadConstraint{
|
||||
MaxSkew: 3,
|
||||
},
|
||||
{
|
||||
TopologyKey: v1.LabelZoneFailureDomainStable,
|
||||
TopologyKey: v1.LabelTopologyZone,
|
||||
WhenUnsatisfiable: v1.ScheduleAnyway,
|
||||
MaxSkew: 5,
|
||||
},
|
||||
|
@ -121,7 +121,7 @@ func TestPreScoreStateEmptyNodes(t *testing.T) {
|
||||
DefaultingType: config.SystemDefaulting,
|
||||
},
|
||||
nodes: []*v1.Node{
|
||||
st.MakeNode().Name("node-a").Label(v1.LabelHostname, "node-a").Label(v1.LabelZoneFailureDomainStable, "mars").Obj(),
|
||||
st.MakeNode().Name("node-a").Label(v1.LabelHostname, "node-a").Label(v1.LabelTopologyZone, "mars").Obj(),
|
||||
},
|
||||
objs: []runtime.Object{
|
||||
&appsv1.ReplicaSet{Spec: appsv1.ReplicaSetSpec{Selector: st.MakeLabelSelector().Exists("foo").Obj()}},
|
||||
@ -135,13 +135,13 @@ func TestPreScoreStateEmptyNodes(t *testing.T) {
|
||||
},
|
||||
{
|
||||
MaxSkew: 5,
|
||||
TopologyKey: v1.LabelZoneFailureDomainStable,
|
||||
TopologyKey: v1.LabelTopologyZone,
|
||||
Selector: mustConvertLabelSelectorAsSelector(t, st.MakeLabelSelector().Exists("foo").Obj()),
|
||||
},
|
||||
},
|
||||
IgnoredNodes: sets.NewString(),
|
||||
TopologyPairToPodCounts: map[topologyPair]*int64{
|
||||
{key: v1.LabelZoneFailureDomainStable, value: "mars"}: pointer.Int64Ptr(0),
|
||||
{key: v1.LabelTopologyZone, value: "mars"}: pointer.Int64Ptr(0),
|
||||
},
|
||||
TopologyNormalizingWeight: []float64{topologyNormalizingWeight(1), topologyNormalizingWeight(1)},
|
||||
},
|
||||
@ -727,7 +727,7 @@ func BenchmarkTestPodTopologySpreadScore(b *testing.B) {
|
||||
{
|
||||
name: "1000nodes/single-constraint-zone",
|
||||
pod: st.MakePod().Name("p").Label("foo", "").
|
||||
SpreadConstraint(1, v1.LabelZoneFailureDomain, v1.ScheduleAnyway, st.MakeLabelSelector().Exists("foo").Obj()).
|
||||
SpreadConstraint(1, v1.LabelFailureDomainBetaZone, v1.ScheduleAnyway, st.MakeLabelSelector().Exists("foo").Obj()).
|
||||
Obj(),
|
||||
existingPodsNum: 10000,
|
||||
allNodesNum: 1000,
|
||||
@ -745,7 +745,7 @@ func BenchmarkTestPodTopologySpreadScore(b *testing.B) {
|
||||
{
|
||||
name: "1000nodes/two-Constraints-zone-node",
|
||||
pod: st.MakePod().Name("p").Label("foo", "").Label("bar", "").
|
||||
SpreadConstraint(1, v1.LabelZoneFailureDomain, v1.ScheduleAnyway, st.MakeLabelSelector().Exists("foo").Obj()).
|
||||
SpreadConstraint(1, v1.LabelFailureDomainBetaZone, v1.ScheduleAnyway, st.MakeLabelSelector().Exists("foo").Obj()).
|
||||
SpreadConstraint(1, v1.LabelHostname, v1.ScheduleAnyway, st.MakeLabelSelector().Exists("bar").Obj()).
|
||||
Obj(),
|
||||
existingPodsNum: 10000,
|
||||
|
@ -441,7 +441,7 @@ func TestZoneSelectorSpreadPriority(t *testing.T) {
|
||||
|
||||
buildNodeLabels := func(failureDomain string) map[string]string {
|
||||
labels := map[string]string{
|
||||
v1.LabelZoneFailureDomain: failureDomain,
|
||||
v1.LabelFailureDomainBetaZone: failureDomain,
|
||||
}
|
||||
return labels
|
||||
}
|
||||
|
@ -50,10 +50,10 @@ const (
|
||||
)
|
||||
|
||||
var volumeZoneLabels = sets.NewString(
|
||||
v1.LabelZoneFailureDomain,
|
||||
v1.LabelZoneRegion,
|
||||
v1.LabelZoneFailureDomainStable,
|
||||
v1.LabelZoneRegionStable,
|
||||
v1.LabelFailureDomainBetaZone,
|
||||
v1.LabelFailureDomainBetaRegion,
|
||||
v1.LabelTopologyZone,
|
||||
v1.LabelTopologyRegion,
|
||||
)
|
||||
|
||||
// Name returns name of the plugin. It is used in logs, etc.
|
||||
|
@ -49,19 +49,19 @@ func createPodWithVolume(pod, pv, pvc string) *v1.Pod {
|
||||
func TestSingleZone(t *testing.T) {
|
||||
pvLister := fakeframework.PersistentVolumeLister{
|
||||
{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "Vol_1", Labels: map[string]string{v1.LabelZoneFailureDomain: "us-west1-a"}},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "Vol_1", Labels: map[string]string{v1.LabelFailureDomainBetaZone: "us-west1-a"}},
|
||||
},
|
||||
{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "Vol_2", Labels: map[string]string{v1.LabelZoneRegion: "us-west1", "uselessLabel": "none"}},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "Vol_2", Labels: map[string]string{v1.LabelFailureDomainBetaRegion: "us-west1", "uselessLabel": "none"}},
|
||||
},
|
||||
{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "Vol_3", Labels: map[string]string{v1.LabelZoneRegion: "us-west1"}},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "Vol_3", Labels: map[string]string{v1.LabelFailureDomainBetaRegion: "us-west1"}},
|
||||
},
|
||||
{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "Vol_Stable_1", Labels: map[string]string{v1.LabelZoneFailureDomainStable: "us-west1-a"}},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "Vol_Stable_1", Labels: map[string]string{v1.LabelTopologyZone: "us-west1-a"}},
|
||||
},
|
||||
{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "Vol_Stable_2", Labels: map[string]string{v1.LabelZoneRegionStable: "us-west1", "uselessLabel": "none"}},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "Vol_Stable_2", Labels: map[string]string{v1.LabelTopologyRegion: "us-west1", "uselessLabel": "none"}},
|
||||
},
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ func TestSingleZone(t *testing.T) {
|
||||
Node: &v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "host1",
|
||||
Labels: map[string]string{v1.LabelZoneFailureDomain: "us-west1-a"},
|
||||
Labels: map[string]string{v1.LabelFailureDomainBetaZone: "us-west1-a"},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -125,7 +125,7 @@ func TestSingleZone(t *testing.T) {
|
||||
Node: &v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "host1",
|
||||
Labels: map[string]string{v1.LabelZoneFailureDomain: "us-west1-a", "uselessLabel": "none"},
|
||||
Labels: map[string]string{v1.LabelFailureDomainBetaZone: "us-west1-a", "uselessLabel": "none"},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -135,7 +135,7 @@ func TestSingleZone(t *testing.T) {
|
||||
Node: &v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "host1",
|
||||
Labels: map[string]string{v1.LabelZoneRegion: "us-west1", "uselessLabel": "none"},
|
||||
Labels: map[string]string{v1.LabelFailureDomainBetaRegion: "us-west1", "uselessLabel": "none"},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -145,7 +145,7 @@ func TestSingleZone(t *testing.T) {
|
||||
Node: &v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "host1",
|
||||
Labels: map[string]string{v1.LabelZoneRegion: "no_us-west1", "uselessLabel": "none"},
|
||||
Labels: map[string]string{v1.LabelFailureDomainBetaRegion: "no_us-west1", "uselessLabel": "none"},
|
||||
},
|
||||
},
|
||||
wantStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, ErrReasonConflict),
|
||||
@ -156,7 +156,7 @@ func TestSingleZone(t *testing.T) {
|
||||
Node: &v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "host1",
|
||||
Labels: map[string]string{v1.LabelZoneFailureDomain: "no_us-west1-a", "uselessLabel": "none"},
|
||||
Labels: map[string]string{v1.LabelFailureDomainBetaZone: "no_us-west1-a", "uselessLabel": "none"},
|
||||
},
|
||||
},
|
||||
wantStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, ErrReasonConflict),
|
||||
@ -167,7 +167,7 @@ func TestSingleZone(t *testing.T) {
|
||||
Node: &v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "host1",
|
||||
Labels: map[string]string{v1.LabelZoneFailureDomainStable: "us-west1-a", "uselessLabel": "none"},
|
||||
Labels: map[string]string{v1.LabelTopologyZone: "us-west1-a", "uselessLabel": "none"},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -177,7 +177,7 @@ func TestSingleZone(t *testing.T) {
|
||||
Node: &v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "host1",
|
||||
Labels: map[string]string{v1.LabelZoneRegionStable: "us-west1", "uselessLabel": "none"},
|
||||
Labels: map[string]string{v1.LabelTopologyRegion: "us-west1", "uselessLabel": "none"},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -187,7 +187,7 @@ func TestSingleZone(t *testing.T) {
|
||||
Node: &v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "host1",
|
||||
Labels: map[string]string{v1.LabelZoneRegionStable: "no_us-west1", "uselessLabel": "none"},
|
||||
Labels: map[string]string{v1.LabelTopologyRegion: "no_us-west1", "uselessLabel": "none"},
|
||||
},
|
||||
},
|
||||
wantStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, ErrReasonConflict),
|
||||
@ -198,7 +198,7 @@ func TestSingleZone(t *testing.T) {
|
||||
Node: &v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "host1",
|
||||
Labels: map[string]string{v1.LabelZoneFailureDomainStable: "no_us-west1-a", "uselessLabel": "none"},
|
||||
Labels: map[string]string{v1.LabelTopologyZone: "no_us-west1-a", "uselessLabel": "none"},
|
||||
},
|
||||
},
|
||||
wantStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, ErrReasonConflict),
|
||||
@ -225,19 +225,19 @@ func TestSingleZone(t *testing.T) {
|
||||
func TestMultiZone(t *testing.T) {
|
||||
pvLister := fakeframework.PersistentVolumeLister{
|
||||
{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "Vol_1", Labels: map[string]string{v1.LabelZoneFailureDomain: "us-west1-a"}},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "Vol_1", Labels: map[string]string{v1.LabelFailureDomainBetaZone: "us-west1-a"}},
|
||||
},
|
||||
{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "Vol_2", Labels: map[string]string{v1.LabelZoneFailureDomain: "us-west1-b", "uselessLabel": "none"}},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "Vol_2", Labels: map[string]string{v1.LabelFailureDomainBetaZone: "us-west1-b", "uselessLabel": "none"}},
|
||||
},
|
||||
{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "Vol_3", Labels: map[string]string{v1.LabelZoneFailureDomain: "us-west1-c__us-west1-a"}},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "Vol_3", Labels: map[string]string{v1.LabelFailureDomainBetaZone: "us-west1-c__us-west1-a"}},
|
||||
},
|
||||
{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "Vol_Stable_1", Labels: map[string]string{v1.LabelZoneFailureDomainStable: "us-west1-a"}},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "Vol_Stable_1", Labels: map[string]string{v1.LabelTopologyZone: "us-west1-a"}},
|
||||
},
|
||||
{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "Vol_Stable_2", Labels: map[string]string{v1.LabelZoneFailureDomainStable: "us-west1-c__us-west1-a"}},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "Vol_Stable_2", Labels: map[string]string{v1.LabelTopologyZone: "us-west1-c__us-west1-a"}},
|
||||
},
|
||||
}
|
||||
|
||||
@ -289,7 +289,7 @@ func TestMultiZone(t *testing.T) {
|
||||
Node: &v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "host1",
|
||||
Labels: map[string]string{v1.LabelZoneFailureDomain: "us-west1-a", "uselessLabel": "none"},
|
||||
Labels: map[string]string{v1.LabelFailureDomainBetaZone: "us-west1-a", "uselessLabel": "none"},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -299,7 +299,7 @@ func TestMultiZone(t *testing.T) {
|
||||
Node: &v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "host1",
|
||||
Labels: map[string]string{v1.LabelZoneFailureDomain: "us-west1-b", "uselessLabel": "none"},
|
||||
Labels: map[string]string{v1.LabelFailureDomainBetaZone: "us-west1-b", "uselessLabel": "none"},
|
||||
},
|
||||
},
|
||||
wantStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, ErrReasonConflict),
|
||||
@ -310,7 +310,7 @@ func TestMultiZone(t *testing.T) {
|
||||
Node: &v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "host1",
|
||||
Labels: map[string]string{v1.LabelZoneFailureDomainStable: "us-west1-a", "uselessLabel": "none"},
|
||||
Labels: map[string]string{v1.LabelTopologyZone: "us-west1-a", "uselessLabel": "none"},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -320,7 +320,7 @@ func TestMultiZone(t *testing.T) {
|
||||
Node: &v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "host1",
|
||||
Labels: map[string]string{v1.LabelZoneFailureDomainStable: "us-west1-b", "uselessLabel": "none"},
|
||||
Labels: map[string]string{v1.LabelTopologyZone: "us-west1-b", "uselessLabel": "none"},
|
||||
},
|
||||
},
|
||||
wantStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, ErrReasonConflict),
|
||||
@ -365,7 +365,7 @@ func TestWithBinding(t *testing.T) {
|
||||
|
||||
pvLister := fakeframework.PersistentVolumeLister{
|
||||
{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "Vol_1", Labels: map[string]string{v1.LabelZoneFailureDomain: "us-west1-a"}},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "Vol_1", Labels: map[string]string{v1.LabelFailureDomainBetaZone: "us-west1-a"}},
|
||||
},
|
||||
}
|
||||
|
||||
@ -394,7 +394,7 @@ func TestWithBinding(t *testing.T) {
|
||||
testNode := &v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "host1",
|
||||
Labels: map[string]string{v1.LabelZoneFailureDomain: "us-west1-a", "uselessLabel": "none"},
|
||||
Labels: map[string]string{v1.LabelFailureDomainBetaZone: "us-west1-a", "uselessLabel": "none"},
|
||||
},
|
||||
}
|
||||
|
||||
|
4
pkg/scheduler/internal/cache/cache_test.go
vendored
4
pkg/scheduler/internal/cache/cache_test.go
vendored
@ -1572,8 +1572,8 @@ func TestSchedulerCache_updateNodeInfoSnapshotList(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: fmt.Sprintf("node-%d", i),
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegion: fmt.Sprintf("region-%d", zone),
|
||||
v1.LabelZoneFailureDomain: fmt.Sprintf("zone-%d", zone),
|
||||
v1.LabelFailureDomainBetaRegion: fmt.Sprintf("region-%d", zone),
|
||||
v1.LabelFailureDomainBetaZone: fmt.Sprintf("zone-%d", zone),
|
||||
},
|
||||
},
|
||||
})
|
||||
|
52
pkg/scheduler/internal/cache/node_tree_test.go
vendored
52
pkg/scheduler/internal/cache/node_tree_test.go
vendored
@ -36,7 +36,7 @@ var allNodes = []*v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "node-1",
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegion: "region-1",
|
||||
v1.LabelFailureDomainBetaRegion: "region-1",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -45,7 +45,7 @@ var allNodes = []*v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "node-2",
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneFailureDomain: "zone-2",
|
||||
v1.LabelFailureDomainBetaZone: "zone-2",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -54,8 +54,8 @@ var allNodes = []*v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "node-3",
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegion: "region-1",
|
||||
v1.LabelZoneFailureDomain: "zone-2",
|
||||
v1.LabelFailureDomainBetaRegion: "region-1",
|
||||
v1.LabelFailureDomainBetaZone: "zone-2",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -64,8 +64,8 @@ var allNodes = []*v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "node-4",
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegion: "region-1",
|
||||
v1.LabelZoneFailureDomain: "zone-2",
|
||||
v1.LabelFailureDomainBetaRegion: "region-1",
|
||||
v1.LabelFailureDomainBetaZone: "zone-2",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -74,8 +74,8 @@ var allNodes = []*v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "node-5",
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegion: "region-1",
|
||||
v1.LabelZoneFailureDomain: "zone-3",
|
||||
v1.LabelFailureDomainBetaRegion: "region-1",
|
||||
v1.LabelFailureDomainBetaZone: "zone-3",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -84,8 +84,8 @@ var allNodes = []*v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "node-6",
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegion: "region-2",
|
||||
v1.LabelZoneFailureDomain: "zone-2",
|
||||
v1.LabelFailureDomainBetaRegion: "region-2",
|
||||
v1.LabelFailureDomainBetaZone: "zone-2",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -94,8 +94,8 @@ var allNodes = []*v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "node-7",
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegion: "region-2",
|
||||
v1.LabelZoneFailureDomain: "zone-2",
|
||||
v1.LabelFailureDomainBetaRegion: "region-2",
|
||||
v1.LabelFailureDomainBetaZone: "zone-2",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -104,8 +104,8 @@ var allNodes = []*v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "node-8",
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegion: "region-2",
|
||||
v1.LabelZoneFailureDomain: "zone-2",
|
||||
v1.LabelFailureDomainBetaRegion: "region-2",
|
||||
v1.LabelFailureDomainBetaZone: "zone-2",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -114,10 +114,10 @@ var allNodes = []*v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "node-9",
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegionStable: "region-2",
|
||||
v1.LabelZoneFailureDomainStable: "zone-2",
|
||||
v1.LabelZoneRegion: "region-2",
|
||||
v1.LabelZoneFailureDomain: "zone-2",
|
||||
v1.LabelTopologyRegion: "region-2",
|
||||
v1.LabelTopologyZone: "zone-2",
|
||||
v1.LabelFailureDomainBetaRegion: "region-2",
|
||||
v1.LabelFailureDomainBetaZone: "zone-2",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -126,8 +126,8 @@ var allNodes = []*v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "node-10",
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegion: "region-2",
|
||||
v1.LabelZoneFailureDomain: "zone-3",
|
||||
v1.LabelFailureDomainBetaRegion: "region-2",
|
||||
v1.LabelFailureDomainBetaZone: "zone-3",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -282,8 +282,8 @@ func TestNodeTree_UpdateNode(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "node-0",
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegion: "region-1",
|
||||
v1.LabelZoneFailureDomain: "zone-2",
|
||||
v1.LabelFailureDomainBetaRegion: "region-1",
|
||||
v1.LabelFailureDomainBetaZone: "zone-2",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -302,8 +302,8 @@ func TestNodeTree_UpdateNode(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "node-0",
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegion: "region-1",
|
||||
v1.LabelZoneFailureDomain: "zone-2",
|
||||
v1.LabelFailureDomainBetaRegion: "region-1",
|
||||
v1.LabelFailureDomainBetaZone: "zone-2",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -318,8 +318,8 @@ func TestNodeTree_UpdateNode(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "node-new",
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneRegion: "region-1",
|
||||
v1.LabelZoneFailureDomain: "zone-2",
|
||||
v1.LabelFailureDomainBetaRegion: "region-1",
|
||||
v1.LabelFailureDomainBetaZone: "zone-2",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -19,7 +19,7 @@ package testing
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
type keyVal struct {
|
||||
@ -44,7 +44,7 @@ func MakeNodesAndPodsForEvenPodsSpread(labels map[string]string, existingPodsNum
|
||||
// build nodes
|
||||
for i := 0; i < allNodesNum; i++ {
|
||||
node := MakeNode().Name(fmt.Sprintf("node%d", i)).
|
||||
Label(v1.LabelZoneFailureDomainStable, fmt.Sprintf("zone%d", i%zones)).
|
||||
Label(v1.LabelTopologyZone, fmt.Sprintf("zone%d", i%zones)).
|
||||
Label(v1.LabelHostname, fmt.Sprintf("node%d", i)).Obj()
|
||||
allNodes = append(allNodes, node)
|
||||
}
|
||||
|
@ -188,15 +188,15 @@ func GetZoneKey(node *v1.Node) string {
|
||||
}
|
||||
|
||||
// TODO: prefer stable labels for zone in v1.18
|
||||
zone, ok := labels[v1.LabelZoneFailureDomain]
|
||||
zone, ok := labels[v1.LabelFailureDomainBetaZone]
|
||||
if !ok {
|
||||
zone, _ = labels[v1.LabelZoneFailureDomainStable]
|
||||
zone, _ = labels[v1.LabelTopologyZone]
|
||||
}
|
||||
|
||||
// TODO: prefer stable labels for region in v1.18
|
||||
region, ok := labels[v1.LabelZoneRegion]
|
||||
region, ok := labels[v1.LabelFailureDomainBetaRegion]
|
||||
if !ok {
|
||||
region, _ = labels[v1.LabelZoneRegionStable]
|
||||
region, _ = labels[v1.LabelTopologyRegion]
|
||||
}
|
||||
|
||||
if region == "" && zone == "" {
|
||||
|
@ -21,7 +21,7 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
||||
@ -287,8 +287,8 @@ func Test_GetZoneKey(t *testing.T) {
|
||||
node: &v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -299,8 +299,8 @@ func Test_GetZoneKey(t *testing.T) {
|
||||
node: &v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -311,10 +311,10 @@ func Test_GetZoneKey(t *testing.T) {
|
||||
node: &v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -325,10 +325,10 @@ func Test_GetZoneKey(t *testing.T) {
|
||||
node: &v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneFailureDomainStable: "zone1",
|
||||
v1.LabelZoneRegionStable: "region1",
|
||||
v1.LabelZoneFailureDomain: "zone2",
|
||||
v1.LabelZoneRegion: "region2",
|
||||
v1.LabelTopologyZone: "zone1",
|
||||
v1.LabelTopologyRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "zone2",
|
||||
v1.LabelFailureDomainBetaRegion: "region2",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -396,7 +396,7 @@ func TestGetCandidateZone(t *testing.T) {
|
||||
node: &v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneFailureDomain: testZone,
|
||||
v1.LabelFailureDomainBetaZone: testZone,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -368,12 +368,12 @@ func (p *azureDiskProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
|
||||
for i := 0; i < 3; i++ {
|
||||
requirements := []v1.NodeSelectorRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneRegion,
|
||||
Key: v1.LabelFailureDomainBetaRegion,
|
||||
Operator: v1.NodeSelectorOpIn,
|
||||
Values: []string{diskController.GetLocation()},
|
||||
},
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Operator: v1.NodeSelectorOpIn,
|
||||
Values: []string{strconv.Itoa(i)},
|
||||
},
|
||||
|
@ -123,7 +123,7 @@ func (fake *fakePDManager) DetachDisk(c *cinderVolumeUnmounter) error {
|
||||
|
||||
func (fake *fakePDManager) CreateVolume(c *cinderVolumeProvisioner, node *v1.Node, allowedTopologies []v1.TopologySelectorTerm) (volumeID string, volumeSizeGB int, labels map[string]string, fstype string, err error) {
|
||||
labels = make(map[string]string)
|
||||
labels[v1.LabelZoneFailureDomain] = "nova"
|
||||
labels[v1.LabelFailureDomainBetaZone] = "nova"
|
||||
return "test-volume-name", 1, labels, "", nil
|
||||
}
|
||||
|
||||
@ -241,7 +241,7 @@ func TestPlugin(t *testing.T) {
|
||||
|
||||
req := persistentSpec.Spec.NodeAffinity.Required.NodeSelectorTerms[0].MatchExpressions[0]
|
||||
|
||||
if req.Key != v1.LabelZoneFailureDomain {
|
||||
if req.Key != v1.LabelFailureDomainBetaZone {
|
||||
t.Errorf("Provision() returned unexpected requirement key in NodeAffinity %v", req.Key)
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ func getZonesFromNodes(kubeClient clientset.Interface) (sets.String, error) {
|
||||
return zones, err
|
||||
}
|
||||
for _, node := range nodes.Items {
|
||||
if zone, ok := node.Labels[v1.LabelZoneFailureDomain]; ok {
|
||||
if zone, ok := node.Labels[v1.LabelFailureDomainBetaZone]; ok {
|
||||
zones.Insert(zone)
|
||||
}
|
||||
}
|
||||
@ -229,10 +229,10 @@ func (util *DiskUtil) CreateVolume(c *cinderVolumeProvisioner, node *v1.Node, al
|
||||
volumeLabels = make(map[string]string)
|
||||
if IgnoreVolumeAZ == false {
|
||||
if volumeAZ != "" {
|
||||
volumeLabels[v1.LabelZoneFailureDomain] = volumeAZ
|
||||
volumeLabels[v1.LabelFailureDomainBetaZone] = volumeAZ
|
||||
}
|
||||
if volumeRegion != "" {
|
||||
volumeLabels[v1.LabelZoneRegion] = volumeRegion
|
||||
volumeLabels[v1.LabelFailureDomainBetaRegion] = volumeRegion
|
||||
}
|
||||
}
|
||||
return volumeID, volSizeGiB, volumeLabels, fstype, nil
|
||||
|
@ -458,7 +458,7 @@ func createPVSpec(name string, readOnly bool, zones []string) *volume.Spec {
|
||||
if zones != nil {
|
||||
zonesLabel := strings.Join(zones, cloudvolume.LabelMultiZoneDelimiter)
|
||||
spec.PersistentVolume.ObjectMeta.Labels = map[string]string{
|
||||
v1.LabelZoneFailureDomain: zonesLabel,
|
||||
v1.LabelFailureDomainBetaZone: zonesLabel,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -542,7 +542,7 @@ func (c *gcePersistentDiskProvisioner) Provision(selectedNode *v1.Node, allowedT
|
||||
for k, v := range labels {
|
||||
pv.Labels[k] = v
|
||||
var values []string
|
||||
if k == v1.LabelZoneFailureDomain {
|
||||
if k == v1.LabelFailureDomainBetaZone {
|
||||
values, err = volumehelpers.LabelZonesToList(v)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to convert label string for Zone: %s to a List: %v", v, err)
|
||||
|
@ -86,7 +86,7 @@ type fakePDManager struct {
|
||||
func (fake *fakePDManager) CreateVolume(c *gcePersistentDiskProvisioner, node *v1.Node, allowedTopologies []v1.TopologySelectorTerm) (volumeID string, volumeSizeGB int, labels map[string]string, fstype string, err error) {
|
||||
labels = make(map[string]string)
|
||||
labels["fakepdmanager"] = "yes"
|
||||
labels[v1.LabelZoneFailureDomain] = "zone1__zone2"
|
||||
labels[v1.LabelFailureDomainBetaZone] = "zone1__zone2"
|
||||
return "test-gce-volume-name", 100, labels, "", nil
|
||||
}
|
||||
|
||||
@ -200,8 +200,8 @@ func TestPlugin(t *testing.T) {
|
||||
t.Errorf("Provision() returned unexpected value for fakepdmanager: %v", persistentSpec.Labels["fakepdmanager"])
|
||||
}
|
||||
|
||||
if persistentSpec.Labels[v1.LabelZoneFailureDomain] != "zone1__zone2" {
|
||||
t.Errorf("Provision() returned unexpected value for %s: %v", v1.LabelZoneFailureDomain, persistentSpec.Labels[v1.LabelZoneFailureDomain])
|
||||
if persistentSpec.Labels[v1.LabelFailureDomainBetaZone] != "zone1__zone2" {
|
||||
t.Errorf("Provision() returned unexpected value for %s: %v", v1.LabelFailureDomainBetaZone, persistentSpec.Labels[v1.LabelFailureDomainBetaZone])
|
||||
}
|
||||
|
||||
if persistentSpec.Spec.NodeAffinity == nil {
|
||||
@ -219,9 +219,9 @@ func TestPlugin(t *testing.T) {
|
||||
t.Errorf("NodeSelectorRequirement fakepdmanager-in-yes not found in volume NodeAffinity")
|
||||
}
|
||||
zones, _ := volumehelpers.ZonesToSet("zone1,zone2")
|
||||
r, _ = getNodeSelectorRequirementWithKey(v1.LabelZoneFailureDomain, term)
|
||||
r, _ = getNodeSelectorRequirementWithKey(v1.LabelFailureDomainBetaZone, term)
|
||||
if r == nil {
|
||||
t.Errorf("NodeSelectorRequirement %s-in-%v not found in volume NodeAffinity", v1.LabelZoneFailureDomain, zones)
|
||||
t.Errorf("NodeSelectorRequirement %s-in-%v not found in volume NodeAffinity", v1.LabelFailureDomainBetaZone, zones)
|
||||
} else {
|
||||
sort.Strings(r.Values)
|
||||
if !reflect.DeepEqual(r.Values, zones.List()) {
|
||||
|
@ -356,7 +356,7 @@ func udevadmChangeToDrive(drivePath string) error {
|
||||
// Checks whether the given GCE PD volume spec is associated with a regional PD.
|
||||
func isRegionalPD(spec *volume.Spec) bool {
|
||||
if spec.PersistentVolume != nil {
|
||||
zonesLabel := spec.PersistentVolume.Labels[v1.LabelZoneFailureDomain]
|
||||
zonesLabel := spec.PersistentVolume.Labels[v1.LabelFailureDomainBetaZone]
|
||||
zones := strings.Split(zonesLabel, cloudvolume.LabelMultiZoneDelimiter)
|
||||
return len(zones) > 1
|
||||
}
|
||||
|
@ -433,7 +433,7 @@ func (v *vsphereVolumeProvisioner) Provision(selectedNode *v1.Node, allowedTopol
|
||||
for k, v := range labels {
|
||||
pv.Labels[k] = v
|
||||
var values []string
|
||||
if k == v1.LabelZoneFailureDomain {
|
||||
if k == v1.LabelFailureDomainBetaZone {
|
||||
values, err = volumehelpers.LabelZonesToList(v)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to convert label string for Zone: %s to a List: %v", v, err)
|
||||
|
@ -130,7 +130,7 @@ func (l *persistentVolumeLabel) Admit(ctx context.Context, a admission.Attribute
|
||||
|
||||
// Set NodeSelectorRequirements based on the labels
|
||||
var values []string
|
||||
if k == v1.LabelZoneFailureDomain {
|
||||
if k == v1.LabelFailureDomainBetaZone {
|
||||
zones, err := volumehelpers.LabelZonesToSet(v)
|
||||
if err != nil {
|
||||
return admission.NewForbidden(a, fmt.Errorf("failed to convert label string for Zone: %s to a Set", v))
|
||||
@ -172,14 +172,14 @@ func (l *persistentVolumeLabel) findVolumeLabels(volume *api.PersistentVolume) (
|
||||
existingLabels := volume.Labels
|
||||
|
||||
// All cloud providers set only these two labels.
|
||||
domain, domainOK := existingLabels[v1.LabelZoneFailureDomain]
|
||||
region, regionOK := existingLabels[v1.LabelZoneRegion]
|
||||
domain, domainOK := existingLabels[v1.LabelFailureDomainBetaZone]
|
||||
region, regionOK := existingLabels[v1.LabelFailureDomainBetaRegion]
|
||||
isDynamicallyProvisioned := metav1.HasAnnotation(volume.ObjectMeta, persistentvolume.AnnDynamicallyProvisioned)
|
||||
if isDynamicallyProvisioned && domainOK && regionOK {
|
||||
// PV already has all the labels and we can trust the dynamic provisioning that it provided correct values.
|
||||
return map[string]string{
|
||||
v1.LabelZoneFailureDomain: domain,
|
||||
v1.LabelZoneRegion: region,
|
||||
v1.LabelFailureDomainBetaZone: domain,
|
||||
v1.LabelFailureDomainBetaRegion: region,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
@ -66,9 +66,9 @@ func Test_PVLAdmission(t *testing.T) {
|
||||
name: "non-cloud PV ignored",
|
||||
handler: newPersistentVolumeLabel(),
|
||||
pvlabeler: mockVolumeLabels(map[string]string{
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelZoneFailureDomain: "1__2__3",
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelFailureDomainBetaZone: "1__2__3",
|
||||
}),
|
||||
preAdmissionPV: &api.PersistentVolume{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "noncloud", Namespace: "myns"},
|
||||
@ -174,9 +174,9 @@ func Test_PVLAdmission(t *testing.T) {
|
||||
name: "AWS EBS PV labeled correctly",
|
||||
handler: newPersistentVolumeLabel(),
|
||||
pvlabeler: mockVolumeLabels(map[string]string{
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelZoneFailureDomain: "1__2__3",
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelFailureDomainBetaZone: "1__2__3",
|
||||
}),
|
||||
preAdmissionPV: &api.PersistentVolume{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "awsebs", Namespace: "myns"},
|
||||
@ -193,9 +193,9 @@ func Test_PVLAdmission(t *testing.T) {
|
||||
Name: "awsebs",
|
||||
Namespace: "myns",
|
||||
Labels: map[string]string{
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelZoneFailureDomain: "1__2__3",
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelFailureDomainBetaZone: "1__2__3",
|
||||
},
|
||||
},
|
||||
Spec: api.PersistentVolumeSpec{
|
||||
@ -220,7 +220,7 @@ func Test_PVLAdmission(t *testing.T) {
|
||||
Values: []string{"2"},
|
||||
},
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Operator: api.NodeSelectorOpIn,
|
||||
Values: []string{"1", "2", "3"},
|
||||
},
|
||||
@ -237,15 +237,15 @@ func Test_PVLAdmission(t *testing.T) {
|
||||
name: "existing labels from dynamic provisioning are not changed",
|
||||
handler: newPersistentVolumeLabel(),
|
||||
pvlabeler: mockVolumeLabels(map[string]string{
|
||||
v1.LabelZoneFailureDomain: "domain1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "domain1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
}),
|
||||
preAdmissionPV: &api.PersistentVolume{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "awsebs", Namespace: "myns",
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneFailureDomain: "existingDomain",
|
||||
v1.LabelZoneRegion: "existingRegion",
|
||||
v1.LabelFailureDomainBetaZone: "existingDomain",
|
||||
v1.LabelFailureDomainBetaRegion: "existingRegion",
|
||||
},
|
||||
Annotations: map[string]string{
|
||||
persistentvolume.AnnDynamicallyProvisioned: "kubernetes.io/aws-ebs",
|
||||
@ -264,8 +264,8 @@ func Test_PVLAdmission(t *testing.T) {
|
||||
Name: "awsebs",
|
||||
Namespace: "myns",
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneFailureDomain: "existingDomain",
|
||||
v1.LabelZoneRegion: "existingRegion",
|
||||
v1.LabelFailureDomainBetaZone: "existingDomain",
|
||||
v1.LabelFailureDomainBetaRegion: "existingRegion",
|
||||
},
|
||||
Annotations: map[string]string{
|
||||
persistentvolume.AnnDynamicallyProvisioned: "kubernetes.io/aws-ebs",
|
||||
@ -283,12 +283,12 @@ func Test_PVLAdmission(t *testing.T) {
|
||||
{
|
||||
MatchExpressions: []api.NodeSelectorRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneRegion,
|
||||
Key: v1.LabelFailureDomainBetaRegion,
|
||||
Operator: api.NodeSelectorOpIn,
|
||||
Values: []string{"existingRegion"},
|
||||
},
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Operator: api.NodeSelectorOpIn,
|
||||
Values: []string{"existingDomain"},
|
||||
},
|
||||
@ -305,15 +305,15 @@ func Test_PVLAdmission(t *testing.T) {
|
||||
name: "existing labels from user are changed",
|
||||
handler: newPersistentVolumeLabel(),
|
||||
pvlabeler: mockVolumeLabels(map[string]string{
|
||||
v1.LabelZoneFailureDomain: "domain1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "domain1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
}),
|
||||
preAdmissionPV: &api.PersistentVolume{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "awsebs", Namespace: "myns",
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneFailureDomain: "existingDomain",
|
||||
v1.LabelZoneRegion: "existingRegion",
|
||||
v1.LabelFailureDomainBetaZone: "existingDomain",
|
||||
v1.LabelFailureDomainBetaRegion: "existingRegion",
|
||||
},
|
||||
},
|
||||
Spec: api.PersistentVolumeSpec{
|
||||
@ -329,8 +329,8 @@ func Test_PVLAdmission(t *testing.T) {
|
||||
Name: "awsebs",
|
||||
Namespace: "myns",
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneFailureDomain: "domain1",
|
||||
v1.LabelZoneRegion: "region1",
|
||||
v1.LabelFailureDomainBetaZone: "domain1",
|
||||
v1.LabelFailureDomainBetaRegion: "region1",
|
||||
},
|
||||
},
|
||||
Spec: api.PersistentVolumeSpec{
|
||||
@ -345,12 +345,12 @@ func Test_PVLAdmission(t *testing.T) {
|
||||
{
|
||||
MatchExpressions: []api.NodeSelectorRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneRegion,
|
||||
Key: v1.LabelFailureDomainBetaRegion,
|
||||
Operator: api.NodeSelectorOpIn,
|
||||
Values: []string{"region1"},
|
||||
},
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Operator: api.NodeSelectorOpIn,
|
||||
Values: []string{"domain1"},
|
||||
},
|
||||
@ -367,9 +367,9 @@ func Test_PVLAdmission(t *testing.T) {
|
||||
name: "GCE PD PV labeled correctly",
|
||||
handler: newPersistentVolumeLabel(),
|
||||
pvlabeler: mockVolumeLabels(map[string]string{
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelZoneFailureDomain: "1__2__3",
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelFailureDomainBetaZone: "1__2__3",
|
||||
}),
|
||||
preAdmissionPV: &api.PersistentVolume{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "gcepd", Namespace: "myns"},
|
||||
@ -386,9 +386,9 @@ func Test_PVLAdmission(t *testing.T) {
|
||||
Name: "gcepd",
|
||||
Namespace: "myns",
|
||||
Labels: map[string]string{
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelZoneFailureDomain: "1__2__3",
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelFailureDomainBetaZone: "1__2__3",
|
||||
},
|
||||
},
|
||||
Spec: api.PersistentVolumeSpec{
|
||||
@ -413,7 +413,7 @@ func Test_PVLAdmission(t *testing.T) {
|
||||
Values: []string{"2"},
|
||||
},
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Operator: api.NodeSelectorOpIn,
|
||||
Values: []string{"1", "2", "3"},
|
||||
},
|
||||
@ -430,9 +430,9 @@ func Test_PVLAdmission(t *testing.T) {
|
||||
name: "Azure Disk PV labeled correctly",
|
||||
handler: newPersistentVolumeLabel(),
|
||||
pvlabeler: mockVolumeLabels(map[string]string{
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelZoneFailureDomain: "1__2__3",
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelFailureDomainBetaZone: "1__2__3",
|
||||
}),
|
||||
preAdmissionPV: &api.PersistentVolume{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
@ -452,9 +452,9 @@ func Test_PVLAdmission(t *testing.T) {
|
||||
Name: "azurepd",
|
||||
Namespace: "myns",
|
||||
Labels: map[string]string{
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelZoneFailureDomain: "1__2__3",
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelFailureDomainBetaZone: "1__2__3",
|
||||
},
|
||||
},
|
||||
Spec: api.PersistentVolumeSpec{
|
||||
@ -479,7 +479,7 @@ func Test_PVLAdmission(t *testing.T) {
|
||||
Values: []string{"2"},
|
||||
},
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Operator: api.NodeSelectorOpIn,
|
||||
Values: []string{"1", "2", "3"},
|
||||
},
|
||||
@ -496,9 +496,9 @@ func Test_PVLAdmission(t *testing.T) {
|
||||
name: "Cinder Disk PV labeled correctly",
|
||||
handler: newPersistentVolumeLabel(),
|
||||
pvlabeler: mockVolumeLabels(map[string]string{
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelZoneFailureDomain: "1__2__3",
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelFailureDomainBetaZone: "1__2__3",
|
||||
}),
|
||||
preAdmissionPV: &api.PersistentVolume{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
@ -518,9 +518,9 @@ func Test_PVLAdmission(t *testing.T) {
|
||||
Name: "azurepd",
|
||||
Namespace: "myns",
|
||||
Labels: map[string]string{
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelZoneFailureDomain: "1__2__3",
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelFailureDomainBetaZone: "1__2__3",
|
||||
},
|
||||
},
|
||||
Spec: api.PersistentVolumeSpec{
|
||||
@ -545,7 +545,7 @@ func Test_PVLAdmission(t *testing.T) {
|
||||
Values: []string{"2"},
|
||||
},
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Operator: api.NodeSelectorOpIn,
|
||||
Values: []string{"1", "2", "3"},
|
||||
},
|
||||
@ -562,9 +562,9 @@ func Test_PVLAdmission(t *testing.T) {
|
||||
name: "AWS EBS PV overrides user applied labels",
|
||||
handler: newPersistentVolumeLabel(),
|
||||
pvlabeler: mockVolumeLabels(map[string]string{
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelZoneFailureDomain: "1__2__3",
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelFailureDomainBetaZone: "1__2__3",
|
||||
}),
|
||||
preAdmissionPV: &api.PersistentVolume{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
@ -587,9 +587,9 @@ func Test_PVLAdmission(t *testing.T) {
|
||||
Name: "awsebs",
|
||||
Namespace: "myns",
|
||||
Labels: map[string]string{
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelZoneFailureDomain: "1__2__3",
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelFailureDomainBetaZone: "1__2__3",
|
||||
},
|
||||
},
|
||||
Spec: api.PersistentVolumeSpec{
|
||||
@ -614,7 +614,7 @@ func Test_PVLAdmission(t *testing.T) {
|
||||
Values: []string{"2"},
|
||||
},
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Operator: api.NodeSelectorOpIn,
|
||||
Values: []string{"1", "2", "3"},
|
||||
},
|
||||
@ -819,9 +819,9 @@ func Test_PVLAdmission(t *testing.T) {
|
||||
name: "vSphere PV labeled correctly",
|
||||
handler: newPersistentVolumeLabel(),
|
||||
pvlabeler: mockVolumeLabels(map[string]string{
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelZoneFailureDomain: "1__2__3",
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelFailureDomainBetaZone: "1__2__3",
|
||||
}),
|
||||
preAdmissionPV: &api.PersistentVolume{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
@ -841,9 +841,9 @@ func Test_PVLAdmission(t *testing.T) {
|
||||
Name: "vSpherePV",
|
||||
Namespace: "myns",
|
||||
Labels: map[string]string{
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelZoneFailureDomain: "1__2__3",
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
v1.LabelFailureDomainBetaZone: "1__2__3",
|
||||
},
|
||||
},
|
||||
Spec: api.PersistentVolumeSpec{
|
||||
@ -868,7 +868,7 @@ func Test_PVLAdmission(t *testing.T) {
|
||||
Values: []string{"2"},
|
||||
},
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Operator: api.NodeSelectorOpIn,
|
||||
Values: []string{"1", "2", "3"},
|
||||
},
|
||||
|
@ -19,10 +19,16 @@ package v1
|
||||
const (
|
||||
LabelHostname = "kubernetes.io/hostname"
|
||||
|
||||
LabelZoneFailureDomain = "failure-domain.beta.kubernetes.io/zone"
|
||||
LabelZoneRegion = "failure-domain.beta.kubernetes.io/region"
|
||||
LabelZoneFailureDomainStable = "topology.kubernetes.io/zone"
|
||||
LabelZoneRegionStable = "topology.kubernetes.io/region"
|
||||
LabelFailureDomainBetaZone = "failure-domain.beta.kubernetes.io/zone"
|
||||
LabelFailureDomainBetaRegion = "failure-domain.beta.kubernetes.io/region"
|
||||
LabelTopologyZone = "topology.kubernetes.io/zone"
|
||||
LabelTopologyRegion = "topology.kubernetes.io/region"
|
||||
|
||||
// Legacy names for compat.
|
||||
LabelZoneFailureDomain = LabelFailureDomainBetaZone // deprecated, remove after 1.20
|
||||
LabelZoneRegion = LabelFailureDomainBetaRegion // deprecated, remove after 1.20
|
||||
LabelZoneFailureDomainStable = LabelTopologyZone
|
||||
LabelZoneRegionStable = LabelTopologyRegion
|
||||
|
||||
LabelInstanceType = "beta.kubernetes.io/instance-type"
|
||||
LabelInstanceTypeStable = "node.kubernetes.io/instance-type"
|
||||
|
@ -58,16 +58,16 @@ var labelReconcileInfo = []struct {
|
||||
// Reconcile the beta and the GA zone label using the beta label as
|
||||
// the source of truth
|
||||
// TODO: switch the primary key to GA labels in v1.21
|
||||
primaryKey: v1.LabelZoneFailureDomain,
|
||||
secondaryKey: v1.LabelZoneFailureDomainStable,
|
||||
primaryKey: v1.LabelFailureDomainBetaZone,
|
||||
secondaryKey: v1.LabelTopologyZone,
|
||||
ensureSecondaryExists: true,
|
||||
},
|
||||
{
|
||||
// Reconcile the beta and the stable region label using the beta label as
|
||||
// the source of truth
|
||||
// TODO: switch the primary key to GA labels in v1.21
|
||||
primaryKey: v1.LabelZoneRegion,
|
||||
secondaryKey: v1.LabelZoneRegionStable,
|
||||
primaryKey: v1.LabelFailureDomainBetaRegion,
|
||||
secondaryKey: v1.LabelTopologyRegion,
|
||||
ensureSecondaryExists: true,
|
||||
},
|
||||
{
|
||||
@ -501,25 +501,25 @@ func (cnc *CloudNodeController) getNodeModifiersFromCloudProvider(
|
||||
}
|
||||
|
||||
if instanceMeta.Zone != "" {
|
||||
klog.V(2).Infof("Adding node label from cloud provider: %s=%s", v1.LabelZoneFailureDomain, instanceMeta.Zone)
|
||||
klog.V(2).Infof("Adding node label from cloud provider: %s=%s", v1.LabelZoneFailureDomainStable, instanceMeta.Zone)
|
||||
klog.V(2).Infof("Adding node label from cloud provider: %s=%s", v1.LabelFailureDomainBetaZone, instanceMeta.Zone)
|
||||
klog.V(2).Infof("Adding node label from cloud provider: %s=%s", v1.LabelTopologyZone, instanceMeta.Zone)
|
||||
nodeModifiers = append(nodeModifiers, func(n *v1.Node) {
|
||||
if n.Labels == nil {
|
||||
n.Labels = map[string]string{}
|
||||
}
|
||||
n.Labels[v1.LabelZoneFailureDomain] = instanceMeta.Zone
|
||||
n.Labels[v1.LabelZoneFailureDomainStable] = instanceMeta.Zone
|
||||
n.Labels[v1.LabelFailureDomainBetaZone] = instanceMeta.Zone
|
||||
n.Labels[v1.LabelTopologyZone] = instanceMeta.Zone
|
||||
})
|
||||
}
|
||||
if instanceMeta.Region != "" {
|
||||
klog.V(2).Infof("Adding node label from cloud provider: %s=%s", v1.LabelZoneRegion, instanceMeta.Region)
|
||||
klog.V(2).Infof("Adding node label from cloud provider: %s=%s", v1.LabelZoneRegionStable, instanceMeta.Region)
|
||||
klog.V(2).Infof("Adding node label from cloud provider: %s=%s", v1.LabelFailureDomainBetaRegion, instanceMeta.Region)
|
||||
klog.V(2).Infof("Adding node label from cloud provider: %s=%s", v1.LabelTopologyRegion, instanceMeta.Region)
|
||||
nodeModifiers = append(nodeModifiers, func(n *v1.Node) {
|
||||
if n.Labels == nil {
|
||||
n.Labels = map[string]string{}
|
||||
}
|
||||
n.Labels[v1.LabelZoneRegion] = instanceMeta.Region
|
||||
n.Labels[v1.LabelZoneRegionStable] = instanceMeta.Region
|
||||
n.Labels[v1.LabelFailureDomainBetaRegion] = instanceMeta.Region
|
||||
n.Labels[v1.LabelTopologyRegion] = instanceMeta.Region
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1571,15 +1571,15 @@ func Test_reconcileNodeLabels(t *testing.T) {
|
||||
{
|
||||
name: "requires reconcile",
|
||||
labels: map[string]string{
|
||||
v1.LabelZoneFailureDomain: "foo",
|
||||
v1.LabelZoneRegion: "bar",
|
||||
v1.LabelInstanceType: "the-best-type",
|
||||
v1.LabelFailureDomainBetaZone: "foo",
|
||||
v1.LabelFailureDomainBetaRegion: "bar",
|
||||
v1.LabelInstanceType: "the-best-type",
|
||||
},
|
||||
expectedLabels: map[string]string{
|
||||
v1.LabelZoneFailureDomain: "foo",
|
||||
v1.LabelZoneRegion: "bar",
|
||||
v1.LabelZoneFailureDomainStable: "foo",
|
||||
v1.LabelZoneRegionStable: "bar",
|
||||
v1.LabelFailureDomainBetaZone: "foo",
|
||||
v1.LabelFailureDomainBetaRegion: "bar",
|
||||
v1.LabelTopologyZone: "foo",
|
||||
v1.LabelTopologyRegion: "bar",
|
||||
v1.LabelInstanceType: "the-best-type",
|
||||
v1.LabelInstanceTypeStable: "the-best-type",
|
||||
},
|
||||
@ -1588,18 +1588,18 @@ func Test_reconcileNodeLabels(t *testing.T) {
|
||||
{
|
||||
name: "doesn't require reconcile",
|
||||
labels: map[string]string{
|
||||
v1.LabelZoneFailureDomain: "foo",
|
||||
v1.LabelZoneRegion: "bar",
|
||||
v1.LabelZoneFailureDomainStable: "foo",
|
||||
v1.LabelZoneRegionStable: "bar",
|
||||
v1.LabelFailureDomainBetaZone: "foo",
|
||||
v1.LabelFailureDomainBetaRegion: "bar",
|
||||
v1.LabelTopologyZone: "foo",
|
||||
v1.LabelTopologyRegion: "bar",
|
||||
v1.LabelInstanceType: "the-best-type",
|
||||
v1.LabelInstanceTypeStable: "the-best-type",
|
||||
},
|
||||
expectedLabels: map[string]string{
|
||||
v1.LabelZoneFailureDomain: "foo",
|
||||
v1.LabelZoneRegion: "bar",
|
||||
v1.LabelZoneFailureDomainStable: "foo",
|
||||
v1.LabelZoneRegionStable: "bar",
|
||||
v1.LabelFailureDomainBetaZone: "foo",
|
||||
v1.LabelFailureDomainBetaRegion: "bar",
|
||||
v1.LabelTopologyZone: "foo",
|
||||
v1.LabelTopologyRegion: "bar",
|
||||
v1.LabelInstanceType: "the-best-type",
|
||||
v1.LabelInstanceTypeStable: "the-best-type",
|
||||
},
|
||||
@ -1608,18 +1608,18 @@ func Test_reconcileNodeLabels(t *testing.T) {
|
||||
{
|
||||
name: "require reconcile -- secondary labels are different from primary",
|
||||
labels: map[string]string{
|
||||
v1.LabelZoneFailureDomain: "foo",
|
||||
v1.LabelZoneRegion: "bar",
|
||||
v1.LabelZoneFailureDomainStable: "wrongfoo",
|
||||
v1.LabelZoneRegionStable: "wrongbar",
|
||||
v1.LabelFailureDomainBetaZone: "foo",
|
||||
v1.LabelFailureDomainBetaRegion: "bar",
|
||||
v1.LabelTopologyZone: "wrongfoo",
|
||||
v1.LabelTopologyRegion: "wrongbar",
|
||||
v1.LabelInstanceType: "the-best-type",
|
||||
v1.LabelInstanceTypeStable: "the-wrong-type",
|
||||
},
|
||||
expectedLabels: map[string]string{
|
||||
v1.LabelZoneFailureDomain: "foo",
|
||||
v1.LabelZoneRegion: "bar",
|
||||
v1.LabelZoneFailureDomainStable: "foo",
|
||||
v1.LabelZoneRegionStable: "bar",
|
||||
v1.LabelFailureDomainBetaZone: "foo",
|
||||
v1.LabelFailureDomainBetaRegion: "bar",
|
||||
v1.LabelTopologyZone: "foo",
|
||||
v1.LabelTopologyRegion: "bar",
|
||||
v1.LabelInstanceType: "the-best-type",
|
||||
v1.LabelInstanceTypeStable: "the-best-type",
|
||||
},
|
||||
|
@ -118,9 +118,9 @@ func SelectZonesForVolume(zoneParameterPresent, zonesParameterPresent bool, zone
|
||||
|
||||
// pick node's zone for one of the replicas
|
||||
var ok bool
|
||||
zoneFromNode, ok = node.ObjectMeta.Labels[v1.LabelZoneFailureDomain]
|
||||
zoneFromNode, ok = node.ObjectMeta.Labels[v1.LabelFailureDomainBetaZone]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("%s Label for node missing", v1.LabelZoneFailureDomain)
|
||||
return nil, fmt.Errorf("%s Label for node missing", v1.LabelFailureDomainBetaZone)
|
||||
}
|
||||
// if single replica volume and node with zone found, return immediately
|
||||
if numReplicas == 1 {
|
||||
@ -135,7 +135,7 @@ func SelectZonesForVolume(zoneParameterPresent, zonesParameterPresent bool, zone
|
||||
}
|
||||
|
||||
if (len(allowedTopologies) > 0) && (allowedZones.Len() == 0) {
|
||||
return nil, fmt.Errorf("no matchLabelExpressions with %s key found in allowedTopologies. Please specify matchLabelExpressions with %s key", v1.LabelZoneFailureDomain, v1.LabelZoneFailureDomain)
|
||||
return nil, fmt.Errorf("no matchLabelExpressions with %s key found in allowedTopologies. Please specify matchLabelExpressions with %s key", v1.LabelFailureDomainBetaZone, v1.LabelFailureDomainBetaZone)
|
||||
}
|
||||
|
||||
if allowedZones.Len() > 0 {
|
||||
@ -185,7 +185,7 @@ func ZonesFromAllowedTopologies(allowedTopologies []v1.TopologySelectorTerm) (se
|
||||
zones := make(sets.String)
|
||||
for _, term := range allowedTopologies {
|
||||
for _, exp := range term.MatchLabelExpressions {
|
||||
if exp.Key == v1.LabelZoneFailureDomain {
|
||||
if exp.Key == v1.LabelFailureDomainBetaZone {
|
||||
for _, value := range exp.Values {
|
||||
zones.Insert(value)
|
||||
}
|
||||
|
@ -417,7 +417,7 @@ func TestChooseZonesForVolume(t *testing.T) {
|
||||
func TestSelectZoneForVolume(t *testing.T) {
|
||||
|
||||
nodeWithZoneLabels := &v1.Node{}
|
||||
nodeWithZoneLabels.Labels = map[string]string{v1.LabelZoneFailureDomain: "zoneX"}
|
||||
nodeWithZoneLabels.Labels = map[string]string{v1.LabelFailureDomainBetaZone: "zoneX"}
|
||||
|
||||
nodeWithNoLabels := &v1.Node{}
|
||||
|
||||
@ -499,7 +499,7 @@ func TestSelectZoneForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneX"},
|
||||
},
|
||||
},
|
||||
@ -521,7 +521,7 @@ func TestSelectZoneForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneX"},
|
||||
},
|
||||
},
|
||||
@ -530,7 +530,7 @@ func TestSelectZoneForVolume(t *testing.T) {
|
||||
Reject: true,
|
||||
},
|
||||
|
||||
// Key specified in AllowedTopologies is not LabelZoneFailureDomain [Fail]
|
||||
// Key specified in AllowedTopologies is not LabelFailureDomainBetaZone [Fail]
|
||||
// [1] nil Node
|
||||
// [2] no Zone/Zones parameter
|
||||
// [3] AllowedTopologies with invalid key specified
|
||||
@ -545,7 +545,7 @@ func TestSelectZoneForVolume(t *testing.T) {
|
||||
Values: []string{"zoneX"},
|
||||
},
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneY"},
|
||||
},
|
||||
},
|
||||
@ -554,7 +554,7 @@ func TestSelectZoneForVolume(t *testing.T) {
|
||||
Reject: true,
|
||||
},
|
||||
|
||||
// AllowedTopologies without keys specifying LabelZoneFailureDomain [Fail]
|
||||
// AllowedTopologies without keys specifying LabelFailureDomainBetaZone [Fail]
|
||||
// [1] nil Node
|
||||
// [2] no Zone/Zones parameter
|
||||
// [3] Invalid AllowedTopologies
|
||||
@ -633,7 +633,7 @@ func TestSelectZoneForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneZ", "zoneY"},
|
||||
},
|
||||
},
|
||||
@ -655,7 +655,7 @@ func TestSelectZoneForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneX", "zoneY"},
|
||||
},
|
||||
},
|
||||
@ -676,7 +676,7 @@ func TestSelectZoneForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneX"},
|
||||
},
|
||||
},
|
||||
@ -684,7 +684,7 @@ func TestSelectZoneForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneY"},
|
||||
},
|
||||
},
|
||||
@ -706,7 +706,7 @@ func TestSelectZoneForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneX"},
|
||||
},
|
||||
},
|
||||
@ -771,7 +771,7 @@ func TestSelectZoneForVolume(t *testing.T) {
|
||||
func TestSelectZonesForVolume(t *testing.T) {
|
||||
|
||||
nodeWithZoneLabels := &v1.Node{}
|
||||
nodeWithZoneLabels.Labels = map[string]string{v1.LabelZoneFailureDomain: "zoneX"}
|
||||
nodeWithZoneLabels.Labels = map[string]string{v1.LabelFailureDomainBetaZone: "zoneX"}
|
||||
|
||||
nodeWithNoLabels := &v1.Node{}
|
||||
|
||||
@ -865,7 +865,7 @@ func TestSelectZonesForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneX"},
|
||||
},
|
||||
},
|
||||
@ -889,7 +889,7 @@ func TestSelectZonesForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneX"},
|
||||
},
|
||||
},
|
||||
@ -898,7 +898,7 @@ func TestSelectZonesForVolume(t *testing.T) {
|
||||
Reject: true,
|
||||
},
|
||||
|
||||
// Key specified in AllowedTopologies is not LabelZoneFailureDomain [Fail]
|
||||
// Key specified in AllowedTopologies is not LabelFailureDomainBetaZone [Fail]
|
||||
// [1] nil Node
|
||||
// [2] no Zone/Zones parameter
|
||||
// [3] AllowedTopologies with invalid key specified
|
||||
@ -915,7 +915,7 @@ func TestSelectZonesForVolume(t *testing.T) {
|
||||
Values: []string{"zoneX"},
|
||||
},
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneY"},
|
||||
},
|
||||
},
|
||||
@ -924,7 +924,7 @@ func TestSelectZonesForVolume(t *testing.T) {
|
||||
Reject: true,
|
||||
},
|
||||
|
||||
// AllowedTopologies without keys specifying LabelZoneFailureDomain [Fail]
|
||||
// AllowedTopologies without keys specifying LabelFailureDomainBetaZone [Fail]
|
||||
// [1] nil Node
|
||||
// [2] no Zone/Zones parameter
|
||||
// [3] Invalid AllowedTopologies
|
||||
@ -999,7 +999,7 @@ func TestSelectZonesForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneX"},
|
||||
},
|
||||
},
|
||||
@ -1123,7 +1123,7 @@ func TestSelectZonesForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneV", "zoneW", "zoneX", "zoneY", "zoneZ"},
|
||||
},
|
||||
},
|
||||
@ -1149,7 +1149,7 @@ func TestSelectZonesForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneX", "zoneY"},
|
||||
},
|
||||
},
|
||||
@ -1176,7 +1176,7 @@ func TestSelectZonesForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneX", "zoneY", "zoneZ"},
|
||||
},
|
||||
},
|
||||
@ -1200,7 +1200,7 @@ func TestSelectZonesForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneX", "zoneY"},
|
||||
},
|
||||
},
|
||||
@ -1228,7 +1228,7 @@ func TestSelectZonesForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneV"},
|
||||
},
|
||||
},
|
||||
@ -1236,7 +1236,7 @@ func TestSelectZonesForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneW"},
|
||||
},
|
||||
},
|
||||
@ -1244,7 +1244,7 @@ func TestSelectZonesForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneX"},
|
||||
},
|
||||
},
|
||||
@ -1252,7 +1252,7 @@ func TestSelectZonesForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneY"},
|
||||
},
|
||||
},
|
||||
@ -1260,7 +1260,7 @@ func TestSelectZonesForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneZ"},
|
||||
},
|
||||
},
|
||||
@ -1286,7 +1286,7 @@ func TestSelectZonesForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneX"},
|
||||
},
|
||||
},
|
||||
@ -1294,7 +1294,7 @@ func TestSelectZonesForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneY"},
|
||||
},
|
||||
},
|
||||
@ -1321,7 +1321,7 @@ func TestSelectZonesForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneX"},
|
||||
},
|
||||
},
|
||||
@ -1329,7 +1329,7 @@ func TestSelectZonesForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneY"},
|
||||
},
|
||||
},
|
||||
@ -1337,7 +1337,7 @@ func TestSelectZonesForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneZ"},
|
||||
},
|
||||
},
|
||||
@ -1361,7 +1361,7 @@ func TestSelectZonesForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneX"},
|
||||
},
|
||||
},
|
||||
@ -1369,7 +1369,7 @@ func TestSelectZonesForVolume(t *testing.T) {
|
||||
{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zoneY"},
|
||||
},
|
||||
},
|
||||
|
@ -269,7 +269,7 @@ func TestTranslateInTreeStorageClassToCSI(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "some translated topology",
|
||||
options: NewStorageClass(map[string]string{}, generateToplogySelectors(v1.LabelZoneFailureDomain, []string{"foo"})),
|
||||
options: NewStorageClass(map[string]string{}, generateToplogySelectors(v1.LabelFailureDomainBetaZone, []string{"foo"})),
|
||||
expOptions: NewStorageClass(map[string]string{}, generateToplogySelectors(AzureDiskTopologyKey, []string{"foo"})),
|
||||
},
|
||||
{
|
||||
|
@ -215,7 +215,7 @@ func (g *gcePersistentDiskCSITranslator) TranslateInTreePVToCSI(pv *v1.Persisten
|
||||
return nil, fmt.Errorf("pv is nil or GCE Persistent Disk source not defined on pv")
|
||||
}
|
||||
|
||||
zonesLabel := pv.Labels[v1.LabelZoneFailureDomain]
|
||||
zonesLabel := pv.Labels[v1.LabelFailureDomainBetaZone]
|
||||
zones := strings.Split(zonesLabel, labelMultiZoneDelimiter)
|
||||
if len(zones) == 1 && len(zones[0]) != 0 {
|
||||
// Zonal
|
||||
|
@ -73,7 +73,7 @@ func TestTranslatePDInTreeStorageClassToCSI(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "some translated topology",
|
||||
options: NewStorageClass(map[string]string{}, generateToplogySelectors(v1.LabelZoneFailureDomain, []string{"foo"})),
|
||||
options: NewStorageClass(map[string]string{}, generateToplogySelectors(v1.LabelFailureDomainBetaZone, []string{"foo"})),
|
||||
expOptions: NewStorageClass(map[string]string{}, generateToplogySelectors(GCEPDTopologyKey, []string{"foo"})),
|
||||
},
|
||||
{
|
||||
|
@ -150,12 +150,12 @@ func translateTopology(pv *v1.PersistentVolume, topologyKey string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
zones := getTopologyZones(pv, v1.LabelZoneFailureDomain)
|
||||
zones := getTopologyZones(pv, v1.LabelFailureDomainBetaZone)
|
||||
if len(zones) > 0 {
|
||||
return replaceTopology(pv, v1.LabelZoneFailureDomain, topologyKey)
|
||||
return replaceTopology(pv, v1.LabelFailureDomainBetaZone, topologyKey)
|
||||
}
|
||||
|
||||
if label, ok := pv.Labels[v1.LabelZoneFailureDomain]; ok {
|
||||
if label, ok := pv.Labels[v1.LabelFailureDomainBetaZone]; ok {
|
||||
zones = strings.Split(label, labelMultiZoneDelimiter)
|
||||
if len(zones) > 0 {
|
||||
return addTopology(pv, topologyKey, zones)
|
||||
@ -177,7 +177,7 @@ func translateAllowedTopologies(terms []v1.TopologySelectorTerm, key string) ([]
|
||||
newTerm := v1.TopologySelectorTerm{}
|
||||
for _, exp := range term.MatchLabelExpressions {
|
||||
var newExp v1.TopologySelectorLabelRequirement
|
||||
if exp.Key == v1.LabelZoneFailureDomain {
|
||||
if exp.Key == v1.LabelFailureDomainBetaZone {
|
||||
newExp = v1.TopologySelectorLabelRequirement{
|
||||
Key: key,
|
||||
Values: exp.Values,
|
||||
|
@ -30,11 +30,11 @@ func TestTranslatevSphereInTreeStorageClassToCSI(t *testing.T) {
|
||||
translator := NewvSphereCSITranslator()
|
||||
topologySelectorTerm := v1.TopologySelectorTerm{[]v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: []string{"zone-a"},
|
||||
},
|
||||
{
|
||||
Key: v1.LabelZoneRegion,
|
||||
Key: v1.LabelFailureDomainBetaRegion,
|
||||
Values: []string{"region-a"},
|
||||
},
|
||||
}}
|
||||
|
@ -29,11 +29,11 @@ import (
|
||||
|
||||
var (
|
||||
defaultZoneLabels = map[string]string{
|
||||
v1.LabelZoneFailureDomain: "us-east-1a",
|
||||
v1.LabelZoneRegion: "us-east-1",
|
||||
v1.LabelFailureDomainBetaZone: "us-east-1a",
|
||||
v1.LabelFailureDomainBetaRegion: "us-east-1",
|
||||
}
|
||||
regionalPDLabels = map[string]string{
|
||||
v1.LabelZoneFailureDomain: "europe-west1-b__europe-west1-c",
|
||||
v1.LabelFailureDomainBetaZone: "europe-west1-b__europe-west1-c",
|
||||
}
|
||||
)
|
||||
|
||||
@ -104,7 +104,7 @@ func TestTopologyTranslation(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "GCE PD with existing topology (beta keys)",
|
||||
pv: makeGCEPDPV(nil /*labels*/, makeTopology(v1.LabelZoneFailureDomain, "us-east-2a")),
|
||||
pv: makeGCEPDPV(nil /*labels*/, makeTopology(v1.LabelFailureDomainBetaZone, "us-east-2a")),
|
||||
expectedNodeAffinity: makeNodeAffinity(false /*multiTerms*/, plugins.GCEPDTopologyKey, "us-east-2a"),
|
||||
},
|
||||
{
|
||||
@ -114,7 +114,7 @@ func TestTopologyTranslation(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "GCE PD with zone labels and topology",
|
||||
pv: makeGCEPDPV(defaultZoneLabels, makeTopology(v1.LabelZoneFailureDomain, "us-east-2a")),
|
||||
pv: makeGCEPDPV(defaultZoneLabels, makeTopology(v1.LabelFailureDomainBetaZone, "us-east-2a")),
|
||||
expectedNodeAffinity: makeNodeAffinity(false /*multiTerms*/, plugins.GCEPDTopologyKey, "us-east-2a"),
|
||||
},
|
||||
{
|
||||
@ -124,20 +124,20 @@ func TestTopologyTranslation(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "GCE PD with regional topology",
|
||||
pv: makeGCEPDPV(nil /*labels*/, makeTopology(v1.LabelZoneFailureDomain, "europe-west1-b", "europe-west1-c")),
|
||||
pv: makeGCEPDPV(nil /*labels*/, makeTopology(v1.LabelFailureDomainBetaZone, "europe-west1-b", "europe-west1-c")),
|
||||
expectedNodeAffinity: makeNodeAffinity(false /*multiTerms*/, plugins.GCEPDTopologyKey, "europe-west1-b", "europe-west1-c"),
|
||||
},
|
||||
{
|
||||
name: "GCE PD with regional zone and topology",
|
||||
pv: makeGCEPDPV(regionalPDLabels, makeTopology(v1.LabelZoneFailureDomain, "europe-west1-f", "europe-west1-g")),
|
||||
pv: makeGCEPDPV(regionalPDLabels, makeTopology(v1.LabelFailureDomainBetaZone, "europe-west1-f", "europe-west1-g")),
|
||||
expectedNodeAffinity: makeNodeAffinity(false /*multiTerms*/, plugins.GCEPDTopologyKey, "europe-west1-f", "europe-west1-g"),
|
||||
},
|
||||
{
|
||||
name: "GCE PD with multiple node selector terms",
|
||||
pv: makeGCEPDPVMultTerms(
|
||||
nil, /*labels*/
|
||||
makeTopology(v1.LabelZoneFailureDomain, "europe-west1-f"),
|
||||
makeTopology(v1.LabelZoneFailureDomain, "europe-west1-g")),
|
||||
makeTopology(v1.LabelFailureDomainBetaZone, "europe-west1-f"),
|
||||
makeTopology(v1.LabelFailureDomainBetaZone, "europe-west1-g")),
|
||||
expectedNodeAffinity: makeNodeAffinity(
|
||||
true, /*multiTerms*/
|
||||
plugins.GCEPDTopologyKey, "europe-west1-f", "europe-west1-g"),
|
||||
@ -150,7 +150,7 @@ func TestTopologyTranslation(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "AWS EBS with zone labels and topology",
|
||||
pv: makeAWSEBSPV(defaultZoneLabels, makeTopology(v1.LabelZoneFailureDomain, "us-east-2a")),
|
||||
pv: makeAWSEBSPV(defaultZoneLabels, makeTopology(v1.LabelFailureDomainBetaZone, "us-east-2a")),
|
||||
expectedNodeAffinity: makeNodeAffinity(false /*multiTerms*/, plugins.AWSEBSTopologyKey, "us-east-2a"),
|
||||
},
|
||||
// Cinder test cases: test mosty topology key, i.e., don't repeat testing done with GCE
|
||||
@ -161,7 +161,7 @@ func TestTopologyTranslation(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "OpenStack Cinder with zone labels and topology",
|
||||
pv: makeCinderPV(defaultZoneLabels, makeTopology(v1.LabelZoneFailureDomain, "us-east-2a")),
|
||||
pv: makeCinderPV(defaultZoneLabels, makeTopology(v1.LabelFailureDomainBetaZone, "us-east-2a")),
|
||||
expectedNodeAffinity: makeNodeAffinity(false /*multiTerms*/, plugins.CinderTopologyKey, "us-east-2a"),
|
||||
},
|
||||
}
|
||||
|
@ -2739,12 +2739,12 @@ func (c *Cloud) GetVolumeLabels(volumeName KubernetesVolumeID) (map[string]strin
|
||||
return nil, fmt.Errorf("volume did not have AZ information: %q", aws.StringValue(info.VolumeId))
|
||||
}
|
||||
|
||||
labels[v1.LabelZoneFailureDomain] = az
|
||||
labels[v1.LabelFailureDomainBetaZone] = az
|
||||
region, err := azToRegion(az)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
labels[v1.LabelZoneRegion] = region
|
||||
labels[v1.LabelFailureDomainBetaRegion] = region
|
||||
|
||||
return labels, nil
|
||||
}
|
||||
|
@ -1225,8 +1225,8 @@ func TestGetVolumeLabels(t *testing.T) {
|
||||
|
||||
assert.Nil(t, err, "Error creating Volume %v", err)
|
||||
assert.Equal(t, map[string]string{
|
||||
v1.LabelZoneFailureDomain: "us-east-1a",
|
||||
v1.LabelZoneRegion: "us-east-1"}, labels)
|
||||
v1.LabelFailureDomainBetaZone: "us-east-1a",
|
||||
v1.LabelFailureDomainBetaRegion: "us-east-1"}, labels)
|
||||
awsServices.ec2.(*MockedFakeEC2).AssertExpectations(t)
|
||||
}
|
||||
|
||||
@ -1299,8 +1299,8 @@ func TestGetLabelsForVolume(t *testing.T) {
|
||||
AvailabilityZone: aws.String("us-east-1a"),
|
||||
}},
|
||||
map[string]string{
|
||||
v1.LabelZoneFailureDomain: "us-east-1a",
|
||||
v1.LabelZoneRegion: "us-east-1",
|
||||
v1.LabelFailureDomainBetaZone: "us-east-1a",
|
||||
v1.LabelFailureDomainBetaRegion: "us-east-1",
|
||||
},
|
||||
nil,
|
||||
},
|
||||
|
@ -733,8 +733,8 @@ func (az *Cloud) SetInformers(informerFactory informers.SharedInformerFactory) {
|
||||
UpdateFunc: func(prev, obj interface{}) {
|
||||
prevNode := prev.(*v1.Node)
|
||||
newNode := obj.(*v1.Node)
|
||||
if newNode.Labels[v1.LabelZoneFailureDomain] ==
|
||||
prevNode.Labels[v1.LabelZoneFailureDomain] {
|
||||
if newNode.Labels[v1.LabelFailureDomainBetaZone] ==
|
||||
prevNode.Labels[v1.LabelFailureDomainBetaZone] {
|
||||
return
|
||||
}
|
||||
az.updateNodeCaches(prevNode, newNode)
|
||||
@ -768,7 +768,7 @@ func (az *Cloud) updateNodeCaches(prevNode, newNode *v1.Node) {
|
||||
|
||||
if prevNode != nil {
|
||||
// Remove from nodeZones cache.
|
||||
prevZone, ok := prevNode.ObjectMeta.Labels[v1.LabelZoneFailureDomain]
|
||||
prevZone, ok := prevNode.ObjectMeta.Labels[v1.LabelFailureDomainBetaZone]
|
||||
if ok && az.isAvailabilityZone(prevZone) {
|
||||
az.nodeZones[prevZone].Delete(prevNode.ObjectMeta.Name)
|
||||
if az.nodeZones[prevZone].Len() == 0 {
|
||||
@ -791,7 +791,7 @@ func (az *Cloud) updateNodeCaches(prevNode, newNode *v1.Node) {
|
||||
|
||||
if newNode != nil {
|
||||
// Add to nodeZones cache.
|
||||
newZone, ok := newNode.ObjectMeta.Labels[v1.LabelZoneFailureDomain]
|
||||
newZone, ok := newNode.ObjectMeta.Labels[v1.LabelFailureDomainBetaZone]
|
||||
if ok && az.isAvailabilityZone(newZone) {
|
||||
if az.nodeZones[newZone] == nil {
|
||||
az.nodeZones[newZone] = sets.NewString()
|
||||
|
@ -351,7 +351,7 @@ func (c *Cloud) GetAzureDiskLabels(diskURI string) (map[string]string, error) {
|
||||
}
|
||||
|
||||
labels := map[string]string{
|
||||
v1.LabelZoneRegion: c.Location,
|
||||
v1.LabelFailureDomainBetaRegion: c.Location,
|
||||
}
|
||||
// no azure credential is set, return nil
|
||||
if c.DisksClient == nil {
|
||||
@ -380,6 +380,6 @@ func (c *Cloud) GetAzureDiskLabels(diskURI string) (map[string]string, error) {
|
||||
|
||||
zone := c.makeZone(c.Location, zoneID)
|
||||
klog.V(4).Infof("Got zone %q for Azure disk %q", zone, diskName)
|
||||
labels[v1.LabelZoneFailureDomain] = zone
|
||||
labels[v1.LabelFailureDomainBetaZone] = zone
|
||||
return labels, nil
|
||||
}
|
||||
|
@ -417,8 +417,8 @@ func TestGetLabelsForVolume(t *testing.T) {
|
||||
},
|
||||
existedDisk: compute.Disk{Name: to.StringPtr(diskName), DiskProperties: &compute.DiskProperties{DiskSizeGB: &diskSizeGB}, Zones: &[]string{"1"}},
|
||||
expected: map[string]string{
|
||||
v1.LabelZoneRegion: testCloud0.Location,
|
||||
v1.LabelZoneFailureDomain: testCloud0.makeZone(testCloud0.Location, 1),
|
||||
v1.LabelFailureDomainBetaRegion: testCloud0.Location,
|
||||
v1.LabelFailureDomainBetaZone: testCloud0.makeZone(testCloud0.Location, 1),
|
||||
},
|
||||
expectedErr: false,
|
||||
},
|
||||
@ -454,7 +454,7 @@ func TestGetLabelsForVolume(t *testing.T) {
|
||||
},
|
||||
existedDisk: compute.Disk{Name: to.StringPtr(diskName), DiskProperties: &compute.DiskProperties{DiskSizeGB: &diskSizeGB}},
|
||||
expected: map[string]string{
|
||||
v1.LabelZoneRegion: testCloud0.Location,
|
||||
v1.LabelFailureDomainBetaRegion: testCloud0.Location,
|
||||
},
|
||||
expectedErr: false,
|
||||
expectedErrMsg: nil,
|
||||
|
@ -3248,9 +3248,9 @@ func TestUpdateNodeCaches(t *testing.T) {
|
||||
prevNode := v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneFailureDomain: zone,
|
||||
externalResourceGroupLabel: "true",
|
||||
managedByAzureLabel: "false",
|
||||
v1.LabelFailureDomainBetaZone: zone,
|
||||
externalResourceGroupLabel: "true",
|
||||
managedByAzureLabel: "false",
|
||||
},
|
||||
Name: "prevNode",
|
||||
},
|
||||
@ -3264,9 +3264,9 @@ func TestUpdateNodeCaches(t *testing.T) {
|
||||
newNode := v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneFailureDomain: zone,
|
||||
externalResourceGroupLabel: "true",
|
||||
managedByAzureLabel: "false",
|
||||
v1.LabelFailureDomainBetaZone: zone,
|
||||
externalResourceGroupLabel: "true",
|
||||
managedByAzureLabel: "false",
|
||||
},
|
||||
Name: "newNode",
|
||||
},
|
||||
|
@ -737,8 +737,8 @@ func (g *Cloud) SetInformers(informerFactory informers.SharedInformerFactory) {
|
||||
UpdateFunc: func(prev, obj interface{}) {
|
||||
prevNode := prev.(*v1.Node)
|
||||
newNode := obj.(*v1.Node)
|
||||
if newNode.Labels[v1.LabelZoneFailureDomain] ==
|
||||
prevNode.Labels[v1.LabelZoneFailureDomain] {
|
||||
if newNode.Labels[v1.LabelFailureDomainBetaZone] ==
|
||||
prevNode.Labels[v1.LabelFailureDomainBetaZone] {
|
||||
return
|
||||
}
|
||||
g.updateNodeZones(prevNode, newNode)
|
||||
@ -769,7 +769,7 @@ func (g *Cloud) updateNodeZones(prevNode, newNode *v1.Node) {
|
||||
g.nodeZonesLock.Lock()
|
||||
defer g.nodeZonesLock.Unlock()
|
||||
if prevNode != nil {
|
||||
prevZone, ok := prevNode.ObjectMeta.Labels[v1.LabelZoneFailureDomain]
|
||||
prevZone, ok := prevNode.ObjectMeta.Labels[v1.LabelFailureDomainBetaZone]
|
||||
if ok {
|
||||
g.nodeZones[prevZone].Delete(prevNode.ObjectMeta.Name)
|
||||
if g.nodeZones[prevZone].Len() == 0 {
|
||||
@ -778,7 +778,7 @@ func (g *Cloud) updateNodeZones(prevNode, newNode *v1.Node) {
|
||||
}
|
||||
}
|
||||
if newNode != nil {
|
||||
newZone, ok := newNode.ObjectMeta.Labels[v1.LabelZoneFailureDomain]
|
||||
newZone, ok := newNode.ObjectMeta.Labels[v1.LabelFailureDomainBetaZone]
|
||||
if ok {
|
||||
if g.nodeZones[newZone] == nil {
|
||||
g.nodeZones[newZone] = sets.NewString()
|
||||
|
@ -515,7 +515,7 @@ func (g *Cloud) GetLabelsForVolume(ctx context.Context, pv *v1.PersistentVolume)
|
||||
|
||||
// If the zone is already labeled, honor the hint
|
||||
name := pv.Spec.GCEPersistentDisk.PDName
|
||||
zone := pv.Labels[v1.LabelZoneFailureDomain]
|
||||
zone := pv.Labels[v1.LabelFailureDomainBetaZone]
|
||||
|
||||
disk, err := g.getDiskByNameAndOptionalLabelZones(name, zone)
|
||||
if err != nil {
|
||||
@ -858,16 +858,16 @@ func (g *Cloud) GetAutoLabelsForPD(disk *Disk) (map[string]string, error) {
|
||||
// Unexpected, but sanity-check
|
||||
return nil, fmt.Errorf("PD did not have zone/region information: %v", disk)
|
||||
}
|
||||
labels[v1.LabelZoneFailureDomain] = zoneInfo.zone
|
||||
labels[v1.LabelZoneRegion] = disk.Region
|
||||
labels[v1.LabelFailureDomainBetaZone] = zoneInfo.zone
|
||||
labels[v1.LabelFailureDomainBetaRegion] = disk.Region
|
||||
case multiZone:
|
||||
if zoneInfo.replicaZones == nil || zoneInfo.replicaZones.Len() <= 0 {
|
||||
// Unexpected, but sanity-check
|
||||
return nil, fmt.Errorf("PD is regional but does not have any replicaZones specified: %v", disk)
|
||||
}
|
||||
labels[v1.LabelZoneFailureDomain] =
|
||||
labels[v1.LabelFailureDomainBetaZone] =
|
||||
volumehelpers.ZonesSetToLabelValue(zoneInfo.replicaZones)
|
||||
labels[v1.LabelZoneRegion] = disk.Region
|
||||
labels[v1.LabelFailureDomainBetaRegion] = disk.Region
|
||||
case nil:
|
||||
// Unexpected, but sanity-check
|
||||
return nil, fmt.Errorf("PD did not have ZoneInfo: %v", disk)
|
||||
|
@ -443,7 +443,7 @@ func pv(name, zone string) *v1.PersistentVolume {
|
||||
return &v1.PersistentVolume{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
v1.LabelZoneFailureDomain: zone,
|
||||
v1.LabelFailureDomainBetaZone: zone,
|
||||
},
|
||||
},
|
||||
Spec: v1.PersistentVolumeSpec{
|
||||
@ -484,12 +484,12 @@ func TestGetLabelsForVolume_Basic(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if labels[v1.LabelZoneFailureDomain] != zone {
|
||||
if labels[v1.LabelFailureDomainBetaZone] != zone {
|
||||
t.Errorf("Failure domain is '%v', but zone is '%v'",
|
||||
labels[v1.LabelZoneFailureDomain], zone)
|
||||
labels[v1.LabelFailureDomainBetaZone], zone)
|
||||
}
|
||||
if labels[v1.LabelZoneRegion] != gceRegion {
|
||||
t.Errorf("Region is '%v', but region is 'us-central1'", labels[v1.LabelZoneRegion])
|
||||
if labels[v1.LabelFailureDomainBetaRegion] != gceRegion {
|
||||
t.Errorf("Region is '%v', but region is 'us-central1'", labels[v1.LabelFailureDomainBetaRegion])
|
||||
}
|
||||
}
|
||||
|
||||
@ -515,7 +515,7 @@ func TestGetLabelsForVolume_NoZone(t *testing.T) {
|
||||
gce.CreateDisk(diskName, diskType, zone, sizeGb, nil)
|
||||
|
||||
pv := pv(diskName, zone)
|
||||
delete(pv.Labels, v1.LabelZoneFailureDomain)
|
||||
delete(pv.Labels, v1.LabelFailureDomainBetaZone)
|
||||
|
||||
/* Act */
|
||||
labels, err := gce.GetLabelsForVolume(ctx, pv)
|
||||
@ -524,12 +524,12 @@ func TestGetLabelsForVolume_NoZone(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if labels[v1.LabelZoneFailureDomain] != zone {
|
||||
if labels[v1.LabelFailureDomainBetaZone] != zone {
|
||||
t.Errorf("Failure domain is '%v', but zone is '%v'",
|
||||
labels[v1.LabelZoneFailureDomain], zone)
|
||||
labels[v1.LabelFailureDomainBetaZone], zone)
|
||||
}
|
||||
if labels[v1.LabelZoneRegion] != gceRegion {
|
||||
t.Errorf("Region is '%v', but region is 'europe-west1'", labels[v1.LabelZoneRegion])
|
||||
if labels[v1.LabelFailureDomainBetaRegion] != gceRegion {
|
||||
t.Errorf("Region is '%v', but region is 'europe-west1'", labels[v1.LabelFailureDomainBetaRegion])
|
||||
}
|
||||
}
|
||||
|
||||
@ -575,7 +575,7 @@ func TestGetLabelsForVolume_DiskNotFoundAndNoZone(t *testing.T) {
|
||||
}
|
||||
|
||||
pv := pv(diskName, zone)
|
||||
delete(pv.Labels, v1.LabelZoneFailureDomain)
|
||||
delete(pv.Labels, v1.LabelFailureDomainBetaZone)
|
||||
|
||||
/* Act */
|
||||
_, err := gce.GetLabelsForVolume(ctx, pv)
|
||||
@ -617,12 +617,12 @@ func TestGetLabelsForVolume_DupDisk(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error("Disk name and zone uniquely identifies a disk, yet an error is returned.")
|
||||
}
|
||||
if labels[v1.LabelZoneFailureDomain] != zone {
|
||||
if labels[v1.LabelFailureDomainBetaZone] != zone {
|
||||
t.Errorf("Failure domain is '%v', but zone is '%v'",
|
||||
labels[v1.LabelZoneFailureDomain], zone)
|
||||
labels[v1.LabelFailureDomainBetaZone], zone)
|
||||
}
|
||||
if labels[v1.LabelZoneRegion] != gceRegion {
|
||||
t.Errorf("Region is '%v', but region is 'us-west1'", labels[v1.LabelZoneRegion])
|
||||
if labels[v1.LabelFailureDomainBetaRegion] != gceRegion {
|
||||
t.Errorf("Region is '%v', but region is 'us-west1'", labels[v1.LabelFailureDomainBetaRegion])
|
||||
}
|
||||
}
|
||||
|
||||
@ -651,7 +651,7 @@ func TestGetLabelsForVolume_DupDiskNoZone(t *testing.T) {
|
||||
}
|
||||
|
||||
pv := pv(diskName, zone)
|
||||
delete(pv.Labels, v1.LabelZoneFailureDomain)
|
||||
delete(pv.Labels, v1.LabelFailureDomainBetaZone)
|
||||
|
||||
/* Act */
|
||||
_, err := gce.GetLabelsForVolume(ctx, pv)
|
||||
@ -746,13 +746,13 @@ func TestGetAutoLabelsForPD(t *testing.T) {
|
||||
return
|
||||
}
|
||||
|
||||
if got := labels[v1.LabelZoneFailureDomain]; !tc.wantZoneLabel.Has(got) {
|
||||
t.Errorf("labels[v1.LabelZoneFailureDomain] = %v; want one of: %v", got, tc.wantZoneLabel.List())
|
||||
if got := labels[v1.LabelFailureDomainBetaZone]; !tc.wantZoneLabel.Has(got) {
|
||||
t.Errorf("labels[v1.LabelFailureDomainBetaZone] = %v; want one of: %v", got, tc.wantZoneLabel.List())
|
||||
}
|
||||
|
||||
// Validate labels
|
||||
if got := labels[v1.LabelZoneRegion]; got != gceRegion {
|
||||
t.Errorf("labels[v1.LabelZoneRegion] = %v; want: %v", got, gceRegion)
|
||||
if got := labels[v1.LabelFailureDomainBetaRegion]; got != gceRegion {
|
||||
t.Errorf("labels[v1.LabelFailureDomainBetaRegion] = %v; want: %v", got, gceRegion)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ func splitNodesByZone(nodes []*v1.Node) map[string][]*v1.Node {
|
||||
}
|
||||
|
||||
func getZone(n *v1.Node) string {
|
||||
zone, ok := n.Labels[v1.LabelZoneFailureDomain]
|
||||
zone, ok := n.Labels[v1.LabelFailureDomainBetaZone]
|
||||
if !ok {
|
||||
return defaultZone
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ import (
|
||||
compute "google.golang.org/api/compute/v1"
|
||||
|
||||
"github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud"
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/tools/record"
|
||||
servicehelpers "k8s.io/cloud-provider/service/helpers"
|
||||
@ -109,8 +109,8 @@ func createAndInsertNodes(gce *Cloud, nodeNames []string, zoneName string) ([]*v
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
Labels: map[string]string{
|
||||
v1.LabelHostname: name,
|
||||
v1.LabelZoneFailureDomain: zoneName,
|
||||
v1.LabelHostname: name,
|
||||
v1.LabelFailureDomainBetaZone: zoneName,
|
||||
},
|
||||
},
|
||||
Status: v1.NodeStatus{
|
||||
|
@ -745,10 +745,10 @@ func (os *OpenStack) GetLabelsForVolume(ctx context.Context, pv *v1.PersistentVo
|
||||
// Construct Volume Labels
|
||||
labels := make(map[string]string)
|
||||
if volume.AvailabilityZone != "" {
|
||||
labels[v1.LabelZoneFailureDomain] = volume.AvailabilityZone
|
||||
labels[v1.LabelFailureDomainBetaZone] = volume.AvailabilityZone
|
||||
}
|
||||
if os.region != "" {
|
||||
labels[v1.LabelZoneRegion] = os.region
|
||||
labels[v1.LabelFailureDomainBetaRegion] = os.region
|
||||
}
|
||||
klog.V(4).Infof("The Volume %s has labels %v", pv.Spec.Cinder.VolumeID, labels)
|
||||
|
||||
|
@ -203,8 +203,8 @@ func (nm *NodeManager) DiscoverNode(node *v1.Node) error {
|
||||
node.Name, vm, res.vc, res.datacenter.Name())
|
||||
|
||||
// Get the node zone information
|
||||
nodeFd := node.ObjectMeta.Labels[v1.LabelZoneFailureDomain]
|
||||
nodeRegion := node.ObjectMeta.Labels[v1.LabelZoneRegion]
|
||||
nodeFd := node.ObjectMeta.Labels[v1.LabelFailureDomainBetaZone]
|
||||
nodeRegion := node.ObjectMeta.Labels[v1.LabelFailureDomainBetaRegion]
|
||||
nodeZone := &cloudprovider.Zone{FailureDomain: nodeFd, Region: nodeRegion}
|
||||
nodeInfo := &NodeInfo{dataCenter: res.datacenter, vm: vm, vcServer: res.vc, vmUUID: nodeUUID, zone: nodeZone}
|
||||
nm.addNodeInfo(node.ObjectMeta.Name, nodeInfo)
|
||||
|
@ -1735,8 +1735,8 @@ func (vs *VSphere) GetVolumeLabels(volumePath string) (map[string]string, error)
|
||||
// FIXME: For now, pick the first zone of datastore as the zone of volume
|
||||
labels := make(map[string]string)
|
||||
if len(dsZones) > 0 {
|
||||
labels[v1.LabelZoneRegion] = dsZones[0].Region
|
||||
labels[v1.LabelZoneFailureDomain] = dsZones[0].FailureDomain
|
||||
labels[v1.LabelFailureDomainBetaRegion] = dsZones[0].Region
|
||||
labels[v1.LabelFailureDomainBetaZone] = dsZones[0].FailureDomain
|
||||
}
|
||||
return labels, nil
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ func RestartNodes(c clientset.Interface, nodes []v1.Node) error {
|
||||
for i := range nodes {
|
||||
node := &nodes[i]
|
||||
zone := framework.TestContext.CloudConfig.Zone
|
||||
if z, ok := node.Labels[v1.LabelZoneFailureDomain]; ok {
|
||||
if z, ok := node.Labels[v1.LabelFailureDomainBetaZone]; ok {
|
||||
zone = z
|
||||
}
|
||||
nodeNamesByZone[zone] = append(nodeNamesByZone[zone], node.Name)
|
||||
|
@ -518,11 +518,11 @@ func GetClusterZones(c clientset.Interface) (sets.String, error) {
|
||||
// collect values of zone label from all nodes
|
||||
zones := sets.NewString()
|
||||
for _, node := range nodes.Items {
|
||||
if zone, found := node.Labels[v1.LabelZoneFailureDomain]; found {
|
||||
if zone, found := node.Labels[v1.LabelFailureDomainBetaZone]; found {
|
||||
zones.Insert(zone)
|
||||
}
|
||||
|
||||
if zone, found := node.Labels[v1.LabelZoneFailureDomainStable]; found {
|
||||
if zone, found := node.Labels[v1.LabelTopologyZone]; found {
|
||||
zones.Insert(zone)
|
||||
}
|
||||
}
|
||||
|
@ -36,12 +36,12 @@ func RecreateNodes(c clientset.Interface, nodes []v1.Node) error {
|
||||
for i := range nodes {
|
||||
node := &nodes[i]
|
||||
|
||||
if zone, ok := node.Labels[v1.LabelZoneFailureDomain]; ok {
|
||||
if zone, ok := node.Labels[v1.LabelFailureDomainBetaZone]; ok {
|
||||
nodeNamesByZone[zone] = append(nodeNamesByZone[zone], node.Name)
|
||||
continue
|
||||
}
|
||||
|
||||
if zone, ok := node.Labels[v1.LabelZoneFailureDomainStable]; ok {
|
||||
if zone, ok := node.Labels[v1.LabelTopologyZone]; ok {
|
||||
nodeNamesByZone[zone] = append(nodeNamesByZone[zone], node.Name)
|
||||
continue
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ var _ = SIGDescribe("Firewall rule", func() {
|
||||
// Instance could run in a different zone in multi-zone test. Figure out which zone
|
||||
// it is in before proceeding.
|
||||
zone := cloudConfig.Zone
|
||||
if zoneInLabel, ok := nodeList.Items[0].Labels[v1.LabelZoneFailureDomain]; ok {
|
||||
if zoneInLabel, ok := nodeList.Items[0].Labels[v1.LabelFailureDomainBetaZone]; ok {
|
||||
zone = zoneInLabel
|
||||
}
|
||||
removedTags := gce.SetInstanceTags(cloudConfig, nodesNames[0], zone, []string{})
|
||||
|
@ -121,12 +121,12 @@ func SpreadServiceOrFail(f *framework.Framework, replicaCount int, image string)
|
||||
// Find the name of the zone in which a Node is running
|
||||
func getZoneNameForNode(node v1.Node) (string, error) {
|
||||
for key, value := range node.Labels {
|
||||
if key == v1.LabelZoneFailureDomain {
|
||||
if key == v1.LabelFailureDomainBetaZone {
|
||||
return value, nil
|
||||
}
|
||||
}
|
||||
return "", fmt.Errorf("Zone name for node %s not found. No label with key %s",
|
||||
node.Name, v1.LabelZoneFailureDomain)
|
||||
node.Name, v1.LabelFailureDomainBetaZone)
|
||||
}
|
||||
|
||||
// Return the number of zones in which we have nodes in this cluster.
|
||||
|
@ -169,7 +169,7 @@ func OnlyAllowNodeZones(f *framework.Framework, zoneCount int, image string) {
|
||||
pv, err := c.CoreV1().PersistentVolumes().Get(context.TODO(), claim.Spec.VolumeName, metav1.GetOptions{})
|
||||
framework.ExpectNoError(err)
|
||||
|
||||
pvZone, ok := pv.ObjectMeta.Labels[v1.LabelZoneFailureDomain]
|
||||
pvZone, ok := pv.ObjectMeta.Labels[v1.LabelFailureDomainBetaZone]
|
||||
framework.ExpectEqual(ok, true, "PV has no LabelZone to be found")
|
||||
pvZones.Insert(pvZone)
|
||||
}
|
||||
|
@ -1071,7 +1071,7 @@ func InitCinderDriver() testsuites.TestDriver {
|
||||
SupportedFsType: sets.NewString(
|
||||
"", // Default fsType
|
||||
),
|
||||
TopologyKeys: []string{v1.LabelZoneFailureDomain},
|
||||
TopologyKeys: []string{v1.LabelFailureDomainBetaZone},
|
||||
Capabilities: map[testsuites.Capability]bool{
|
||||
testsuites.CapPersistence: true,
|
||||
testsuites.CapFsGroup: true,
|
||||
@ -1251,7 +1251,7 @@ func InitGcePdDriver() testsuites.TestDriver {
|
||||
},
|
||||
SupportedFsType: supportedTypes,
|
||||
SupportedMountOption: sets.NewString("debug", "nouid32"),
|
||||
TopologyKeys: []string{v1.LabelZoneFailureDomain},
|
||||
TopologyKeys: []string{v1.LabelFailureDomainBetaZone},
|
||||
Capabilities: map[testsuites.Capability]bool{
|
||||
testsuites.CapPersistence: true,
|
||||
testsuites.CapFsGroup: true,
|
||||
@ -1348,7 +1348,7 @@ func (g *gcePdDriver) CreateVolume(config *testsuites.PerTestConfig, volType tes
|
||||
// so pods should be also scheduled there.
|
||||
config.ClientNodeSelection = e2epod.NodeSelection{
|
||||
Selector: map[string]string{
|
||||
v1.LabelZoneFailureDomain: zone,
|
||||
v1.LabelFailureDomainBetaZone: zone,
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -1394,7 +1394,7 @@ func InitVSphereDriver() testsuites.TestDriver {
|
||||
"", // Default fsType
|
||||
"ext4",
|
||||
),
|
||||
TopologyKeys: []string{v1.LabelZoneFailureDomain},
|
||||
TopologyKeys: []string{v1.LabelFailureDomainBetaZone},
|
||||
Capabilities: map[testsuites.Capability]bool{
|
||||
testsuites.CapPersistence: true,
|
||||
testsuites.CapFsGroup: true,
|
||||
@ -1519,7 +1519,7 @@ func InitAzureDiskDriver() testsuites.TestDriver {
|
||||
"ext4",
|
||||
"xfs",
|
||||
),
|
||||
TopologyKeys: []string{v1.LabelZoneFailureDomain},
|
||||
TopologyKeys: []string{v1.LabelFailureDomainBetaZone},
|
||||
Capabilities: map[testsuites.Capability]bool{
|
||||
testsuites.CapPersistence: true,
|
||||
testsuites.CapFsGroup: true,
|
||||
@ -1613,7 +1613,7 @@ func (a *azureDiskDriver) CreateVolume(config *testsuites.PerTestConfig, volType
|
||||
// so pods should be also scheduled there.
|
||||
config.ClientNodeSelection = e2epod.NodeSelection{
|
||||
Selector: map[string]string{
|
||||
v1.LabelZoneFailureDomain: zone,
|
||||
v1.LabelFailureDomainBetaZone: zone,
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -1661,7 +1661,7 @@ func InitAwsDriver() testsuites.TestDriver {
|
||||
"ntfs",
|
||||
),
|
||||
SupportedMountOption: sets.NewString("debug", "nouid32"),
|
||||
TopologyKeys: []string{v1.LabelZoneFailureDomain},
|
||||
TopologyKeys: []string{v1.LabelFailureDomainBetaZone},
|
||||
Capabilities: map[testsuites.Capability]bool{
|
||||
testsuites.CapPersistence: true,
|
||||
testsuites.CapFsGroup: true,
|
||||
@ -1754,7 +1754,7 @@ func (a *awsDriver) CreateVolume(config *testsuites.PerTestConfig, volType testp
|
||||
// so pods should be also scheduled there.
|
||||
config.ClientNodeSelection = e2epod.NodeSelection{
|
||||
Selector: map[string]string{
|
||||
v1.LabelZoneFailureDomain: zone,
|
||||
v1.LabelFailureDomainBetaZone: zone,
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -1967,7 +1967,7 @@ func getInlineVolumeZone(f *framework.Framework) string {
|
||||
// if zone is not specified we will randomly pick a zone from schedulable nodes for inline tests
|
||||
node, err := e2enode.GetRandomReadySchedulableNode(f.ClientSet)
|
||||
framework.ExpectNoError(err)
|
||||
zone, ok := node.Labels[v1.LabelZoneFailureDomain]
|
||||
zone, ok := node.Labels[v1.LabelFailureDomainBetaZone]
|
||||
if ok {
|
||||
return zone
|
||||
}
|
||||
|
@ -231,10 +231,10 @@ func testZonalFailover(c clientset.Interface, ns string) {
|
||||
nodeName := pod.Spec.NodeName
|
||||
node, err := c.CoreV1().Nodes().Get(context.TODO(), nodeName, metav1.GetOptions{})
|
||||
framework.ExpectNoError(err)
|
||||
podZone := node.Labels[v1.LabelZoneFailureDomain]
|
||||
podZone := node.Labels[v1.LabelFailureDomainBetaZone]
|
||||
|
||||
ginkgo.By("tainting nodes in the zone the pod is scheduled in")
|
||||
selector := labels.SelectorFromSet(labels.Set(map[string]string{v1.LabelZoneFailureDomain: podZone}))
|
||||
selector := labels.SelectorFromSet(labels.Set(map[string]string{v1.LabelFailureDomainBetaZone: podZone}))
|
||||
nodesInZone, err := c.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{LabelSelector: selector.String()})
|
||||
framework.ExpectNoError(err)
|
||||
removeTaintFunc := addTaint(c, ns, nodesInZone.Items, podZone)
|
||||
@ -262,7 +262,7 @@ func testZonalFailover(c clientset.Interface, ns string) {
|
||||
if err != nil {
|
||||
return false, nil
|
||||
}
|
||||
newPodZone := node.Labels[v1.LabelZoneFailureDomain]
|
||||
newPodZone := node.Labels[v1.LabelFailureDomainBetaZone]
|
||||
return newPodZone == otherZone, nil
|
||||
})
|
||||
framework.ExpectNoError(waitErr, "Error waiting for pod to be scheduled in a different zone (%q): %v", otherZone, err)
|
||||
@ -349,9 +349,9 @@ func testRegionalDelayedBinding(c clientset.Interface, ns string, pvcCount int)
|
||||
if node == nil {
|
||||
framework.Failf("unexpected nil node found")
|
||||
}
|
||||
zone, ok := node.Labels[v1.LabelZoneFailureDomain]
|
||||
zone, ok := node.Labels[v1.LabelFailureDomainBetaZone]
|
||||
if !ok {
|
||||
framework.Failf("label %s not found on Node", v1.LabelZoneFailureDomain)
|
||||
framework.Failf("label %s not found on Node", v1.LabelFailureDomainBetaZone)
|
||||
}
|
||||
for _, pv := range pvs {
|
||||
checkZoneFromLabelAndAffinity(pv, zone, false)
|
||||
@ -416,9 +416,9 @@ func testRegionalAllowedTopologiesWithDelayedBinding(c clientset.Interface, ns s
|
||||
if node == nil {
|
||||
framework.Failf("unexpected nil node found")
|
||||
}
|
||||
nodeZone, ok := node.Labels[v1.LabelZoneFailureDomain]
|
||||
nodeZone, ok := node.Labels[v1.LabelFailureDomainBetaZone]
|
||||
if !ok {
|
||||
framework.Failf("label %s not found on Node", v1.LabelZoneFailureDomain)
|
||||
framework.Failf("label %s not found on Node", v1.LabelFailureDomainBetaZone)
|
||||
}
|
||||
zoneFound := false
|
||||
for _, zone := range topoZones {
|
||||
@ -459,7 +459,7 @@ func addAllowedTopologiesToStorageClass(c clientset.Interface, sc *storagev1.Sto
|
||||
term := v1.TopologySelectorTerm{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: zones,
|
||||
},
|
||||
},
|
||||
@ -561,7 +561,7 @@ func getTwoRandomZones(c clientset.Interface) []string {
|
||||
// If match is true, check if zones in PV exactly match zones given.
|
||||
// Otherwise, check whether zones in PV is superset of zones given.
|
||||
func verifyZonesInPV(volume *v1.PersistentVolume, zones sets.String, match bool) error {
|
||||
pvZones, err := volumehelpers.LabelZonesToSet(volume.Labels[v1.LabelZoneFailureDomain])
|
||||
pvZones, err := volumehelpers.LabelZonesToSet(volume.Labels[v1.LabelFailureDomainBetaZone])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -578,17 +578,17 @@ func checkZoneFromLabelAndAffinity(pv *v1.PersistentVolume, zone string, matchZo
|
||||
checkZonesFromLabelAndAffinity(pv, sets.NewString(zone), matchZone)
|
||||
}
|
||||
|
||||
// checkZoneLabelAndAffinity checks the LabelZoneFailureDomain label of PV and terms
|
||||
// with key LabelZoneFailureDomain in PV's node affinity contains zone
|
||||
// checkZoneLabelAndAffinity checks the LabelFailureDomainBetaZone label of PV and terms
|
||||
// with key LabelFailureDomainBetaZone in PV's node affinity contains zone
|
||||
// matchZones is used to indicate if zones should match perfectly
|
||||
func checkZonesFromLabelAndAffinity(pv *v1.PersistentVolume, zones sets.String, matchZones bool) {
|
||||
ginkgo.By("checking PV's zone label and node affinity terms match expected zone")
|
||||
if pv == nil {
|
||||
framework.Failf("nil pv passed")
|
||||
}
|
||||
pvLabel, ok := pv.Labels[v1.LabelZoneFailureDomain]
|
||||
pvLabel, ok := pv.Labels[v1.LabelFailureDomainBetaZone]
|
||||
if !ok {
|
||||
framework.Failf("label %s not found on PV", v1.LabelZoneFailureDomain)
|
||||
framework.Failf("label %s not found on PV", v1.LabelFailureDomainBetaZone)
|
||||
}
|
||||
|
||||
zonesFromLabel, err := volumehelpers.LabelZonesToSet(pvLabel)
|
||||
@ -596,10 +596,10 @@ func checkZonesFromLabelAndAffinity(pv *v1.PersistentVolume, zones sets.String,
|
||||
framework.Failf("unable to parse zone labels %s: %v", pvLabel, err)
|
||||
}
|
||||
if matchZones && !zonesFromLabel.Equal(zones) {
|
||||
framework.Failf("value[s] of %s label for PV: %v does not match expected zone[s]: %v", v1.LabelZoneFailureDomain, zonesFromLabel, zones)
|
||||
framework.Failf("value[s] of %s label for PV: %v does not match expected zone[s]: %v", v1.LabelFailureDomainBetaZone, zonesFromLabel, zones)
|
||||
}
|
||||
if !matchZones && !zonesFromLabel.IsSuperset(zones) {
|
||||
framework.Failf("value[s] of %s label for PV: %v does not contain expected zone[s]: %v", v1.LabelZoneFailureDomain, zonesFromLabel, zones)
|
||||
framework.Failf("value[s] of %s label for PV: %v does not contain expected zone[s]: %v", v1.LabelFailureDomainBetaZone, zonesFromLabel, zones)
|
||||
}
|
||||
if pv.Spec.NodeAffinity == nil {
|
||||
framework.Failf("node affinity not found in PV spec %v", pv.Spec)
|
||||
@ -611,7 +611,7 @@ func checkZonesFromLabelAndAffinity(pv *v1.PersistentVolume, zones sets.String,
|
||||
for _, term := range pv.Spec.NodeAffinity.Required.NodeSelectorTerms {
|
||||
keyFound := false
|
||||
for _, r := range term.MatchExpressions {
|
||||
if r.Key != v1.LabelZoneFailureDomain {
|
||||
if r.Key != v1.LabelFailureDomainBetaZone {
|
||||
continue
|
||||
}
|
||||
keyFound = true
|
||||
@ -625,7 +625,7 @@ func checkZonesFromLabelAndAffinity(pv *v1.PersistentVolume, zones sets.String,
|
||||
break
|
||||
}
|
||||
if !keyFound {
|
||||
framework.Failf("label %s not found in term %v", v1.LabelZoneFailureDomain, term)
|
||||
framework.Failf("label %s not found in term %v", v1.LabelFailureDomainBetaZone, term)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ func getVSphereStorageClassSpec(name string, scParameters map[string]string, zon
|
||||
term := v1.TopologySelectorTerm{
|
||||
MatchLabelExpressions: []v1.TopologySelectorLabelRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Values: zones,
|
||||
},
|
||||
},
|
||||
|
@ -369,7 +369,7 @@ var _ = utils.SIGDescribe("Zone Support [Feature:vsphere]", func() {
|
||||
zones = append(zones, zoneA)
|
||||
nodeSelectorMap := map[string]string{
|
||||
// nodeSelector set as zoneB
|
||||
v1.LabelZoneFailureDomain: zoneB,
|
||||
v1.LabelFailureDomainBetaZone: zoneB,
|
||||
}
|
||||
verifyPodSchedulingFails(client, namespace, nodeSelectorMap, scParameters, zones, storagev1.VolumeBindingWaitForFirstConsumer)
|
||||
})
|
||||
|
@ -181,7 +181,7 @@ func TestTaintBasedEvictions(t *testing.T) {
|
||||
nodes = append(nodes, &v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: fmt.Sprintf("node-%d", i),
|
||||
Labels: map[string]string{v1.LabelZoneRegion: "region1", v1.LabelZoneFailureDomain: "zone1"},
|
||||
Labels: map[string]string{v1.LabelFailureDomainBetaRegion: "region1", v1.LabelFailureDomainBetaZone: "zone1"},
|
||||
},
|
||||
Spec: v1.NodeSpec{},
|
||||
Status: v1.NodeStatus{
|
||||
|
@ -378,7 +378,7 @@ func TestDefaultPodTopologySpreadScore(t *testing.T) {
|
||||
nodeName := fmt.Sprintf("node-%d", i)
|
||||
zone := fmt.Sprintf("zone-%d", i%3)
|
||||
zoneForNode[nodeName] = zone
|
||||
_, err := createNode(cs, st.MakeNode().Name(nodeName).Label(v1.LabelHostname, nodeName).Label(v1.LabelZoneFailureDomainStable, zone).Obj())
|
||||
_, err := createNode(cs, st.MakeNode().Name(nodeName).Label(v1.LabelHostname, nodeName).Label(v1.LabelTopologyZone, zone).Obj())
|
||||
if err != nil {
|
||||
t.Fatalf("Cannot create node: %v", err)
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ func BenchmarkSchedulingWaitForFirstConsumerPVs(b *testing.B) {
|
||||
}
|
||||
basePod := makeBasePod()
|
||||
testStrategy := testutils.NewCreatePodWithPersistentVolumeWithFirstConsumerStrategy(gceVolumeFactory, basePod)
|
||||
nodeStrategy := testutils.NewLabelNodePrepareStrategy(v1.LabelZoneFailureDomain, "zone1")
|
||||
nodeStrategy := testutils.NewLabelNodePrepareStrategy(v1.LabelFailureDomainBetaZone, "zone1")
|
||||
for _, test := range tests {
|
||||
name := fmt.Sprintf("%vNodes/%vPods", test.nodes, test.existingPods)
|
||||
b.Run(name, func(b *testing.B) {
|
||||
@ -218,7 +218,7 @@ func BenchmarkSchedulingPodAffinity(b *testing.B) {
|
||||
)
|
||||
// The test strategy creates pods with affinity for each other.
|
||||
testStrategy := testutils.NewCustomCreatePodStrategy(testBasePod)
|
||||
nodeStrategy := testutils.NewLabelNodePrepareStrategy(v1.LabelZoneFailureDomain, "zone1")
|
||||
nodeStrategy := testutils.NewLabelNodePrepareStrategy(v1.LabelFailureDomainBetaZone, "zone1")
|
||||
for _, test := range defaultTests {
|
||||
name := fmt.Sprintf("%vNodes/%vPods", test.nodes, test.existingPods)
|
||||
b.Run(name, func(b *testing.B) {
|
||||
@ -278,10 +278,10 @@ func BenchmarkSchedulingPreferredPodAntiAffinity(b *testing.B) {
|
||||
// NodeAffinity rules when the cluster has various quantities of nodes and
|
||||
// scheduled pods.
|
||||
func BenchmarkSchedulingNodeAffinity(b *testing.B) {
|
||||
testBasePod := makeBasePodWithNodeAffinity(v1.LabelZoneFailureDomain, []string{"zone1", "zone2"})
|
||||
testBasePod := makeBasePodWithNodeAffinity(v1.LabelFailureDomainBetaZone, []string{"zone1", "zone2"})
|
||||
// The test strategy creates pods with node-affinity for each other.
|
||||
testStrategy := testutils.NewCustomCreatePodStrategy(testBasePod)
|
||||
nodeStrategy := testutils.NewLabelNodePrepareStrategy(v1.LabelZoneFailureDomain, "zone1")
|
||||
nodeStrategy := testutils.NewLabelNodePrepareStrategy(v1.LabelFailureDomainBetaZone, "zone1")
|
||||
for _, test := range defaultTests {
|
||||
name := fmt.Sprintf("%vNodes/%vPods", test.nodes, test.existingPods)
|
||||
b.Run(name, func(b *testing.B) {
|
||||
@ -392,7 +392,7 @@ func makeBasePodWithPodAffinity(podLabels, affinityZoneLabels map[string]string)
|
||||
LabelSelector: &metav1.LabelSelector{
|
||||
MatchLabels: affinityZoneLabels,
|
||||
},
|
||||
TopologyKey: v1.LabelZoneFailureDomain,
|
||||
TopologyKey: v1.LabelFailureDomainBetaZone,
|
||||
Namespaces: []string{testNamespace, setupNamespace},
|
||||
},
|
||||
},
|
||||
@ -587,7 +587,7 @@ func gceVolumeFactory(id int) *v1.PersistentVolume {
|
||||
{
|
||||
MatchExpressions: []v1.NodeSelectorRequirement{
|
||||
{
|
||||
Key: v1.LabelZoneFailureDomain,
|
||||
Key: v1.LabelFailureDomainBetaZone,
|
||||
Operator: v1.NodeSelectorOpIn,
|
||||
Values: []string{"zone1"},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user