Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop unused labels from installer machineSets #182

Merged

Conversation

vikaschoudhary16
Copy link

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 21, 2019
@vikaschoudhary16 vikaschoudhary16 force-pushed the drop-unused-labels branch 3 times, most recently from 6119232 to f79bd3f Compare March 21, 2019 11:27
spec:
metadata:
labels:
node-role.kubernetes.io/master: "infra"
Copy link
Member

@ingvagabund ingvagabund Mar 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is node-role.kubernetes.io/master: "infra" a valid role label? I am familiar only with node-role.kubernetes.io/master: "" and node-role.kubernetes.io/worker: "" forms.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since value is string type and i have seen forms like node-role.kubernetes.io/master: "true" as well, I think it depends on implementation that what is treated as valid.

Alternative could be to use two labels: node-role.kubernetes.io/master: "" and node-role.kubernetes.io/infra: "" . But since data type allows arbitrary strings, thought of using it instead of increasing label count.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be node-role.kubernetes.io/master and node-role.kubernetes.io/infra.

@@ -6,8 +6,6 @@ metadata:
namespace: test
labels:
machine.openshift.io/cluster-api-cluster: tb-asg-35
machine.openshift.io/cluster-api-machine-role: infra
machine.openshift.io/cluster-api-machine-type: master
spec:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Machine HC controller is still using the labels to filter out master nodes [1]. Do we have any replacement for it?

[1] https://github.com/openshift/machine-api-operator/blob/c4a348a011c07db7e3f864380b0134b318112d19/pkg/controller/machinehealthcheck/machinehealthcheck_controller.go#L335-L336

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will update mao as well. Thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vikaschoudhary16
Copy link
Author

/test e2e-aws-operator

@@ -189,7 +189,7 @@ func providerConfigFromMachine(client client.Client, machine *machinev1.Machine,

// isMaster returns true if the machine is part of a cluster's control plane
func isMaster(machine *machinev1.Machine) bool {
if machineType, exists := machine.ObjectMeta.Labels[providerconfigv1.MachineTypeLabel]; exists && machineType == "master" {
if _, exists := machine.Spec.ObjectMeta.Labels["node-role.kubernetes.io/master"]; exists {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we fetch from node here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@enxebre done!

@vikaschoudhary16
Copy link
Author

/test e2e

@vikaschoudhary16
Copy link
Author

/test e2e-aws

@ingvagabund
Copy link
Member

/retest

@ingvagabund
Copy link
Member

/approve

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ingvagabund

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 28, 2019
@enxebre
Copy link
Member

enxebre commented Mar 29, 2019

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 29, 2019
@openshift-merge-robot openshift-merge-robot merged commit 4d95324 into openshift:master Mar 29, 2019
@vikaschoudhary16 vikaschoudhary16 deleted the drop-unused-labels branch March 29, 2019 11:59
Copy link

@frobware frobware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this has merged but I had some comments having looked at the description for:

ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
"node-role.kubernetes.io/master": "",
"node-role.kubernetes.io/infra": "",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking through the PR I got the impression we were removing infra.

return true
func (a *Actuator) isMaster(machine *machinev1.Machine) (bool, error) {
if machine.Status.NodeRef == nil {
glog.Errorf("NodeRef not found in machine %s", machine.Name)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this can be transient should we log at warning level?

return false, fmt.Errorf("failed to get node from machine %s", machine.Name)
}

if _, exists := node.Labels["node-role.kubernetes.io/master"]; exists {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest of this can collapse to:

_, exists := node.Labels["node-role.kubernetes.io/master"]
return exists

michaelgugino pushed a commit to mgugino-upstream-stage/cluster-api-provider-aws that referenced this pull request Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants