Skip to content

Commit

Permalink
Add backwards compatability for previous labels
Browse files Browse the repository at this point in the history
  • Loading branch information
spangenberg committed Feb 20, 2019
1 parent e51e612 commit de09fc6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions pkg/actuators/machine/actuator.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,5 +575,9 @@ func (a *Actuator) updateStatus(machine *machinev1.Machine, instance *ec2.Instan

func getClusterID(machine *machinev1.Machine) (string, bool) {
clusterID, ok := machine.Labels[providerconfigv1.ClusterIDLabel]
// NOTE: This block can be removed after the label renaming transition to machine.openshift.io
if !ok {
clusterID, ok = machine.Labels["sigs.k8s.io/cluster-api-cluster"]
}
return clusterID, ok
}
4 changes: 2 additions & 2 deletions test/e2e/provider_expectations.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func (tc *testConfig) ExpectNewNodeWhenDeletingMachine() error {
var triagedWorkerNode corev1.Node
MachineLoop:
for _, m := range machineList.Items {
if m.Labels["machine.openshift.io/cluster-api-machine-role"] == "worker" {
if m.Labels["machine.openshift.io/cluster-api-machine-role"] == "worker" || m.Labels["sigs.k8s.io/cluster-api-machine-role"] == "worker" {
for _, n := range nodeList.Items {
if m.Status.NodeRef == nil {
glog.Errorf("no NodeRef found in machine %v", m.Name)
Expand Down Expand Up @@ -217,7 +217,7 @@ func (tc *testConfig) ExpectNodeToBeDrainedBeforeDeletingMachine() error {
}
for _, machineItem := range machineList.Items {
// empty or non-worker role skipped
if machineItem.Labels["machine.openshift.io/cluster-api-machine-role"] == "worker" {
if machineItem.Labels["machine.openshift.io/cluster-api-machine-role"] == "worker" || machineItem.Labels["sigs.k8s.io/cluster-api-machine-role"] == "worker" {
if machineItem.Status.NodeRef != nil && machineItem.Status.NodeRef.Name != "" {
machine = machineItem
nodeName = machineItem.Status.NodeRef.Name
Expand Down

0 comments on commit de09fc6

Please sign in to comment.