-
Notifications
You must be signed in to change notification settings - Fork 49
baremetal: sets hostname controller_names/worker_names #1488
Conversation
To add, the hostname change got introduced by #1477 where it was set from the template variable |
bed82b4
to
147040b
Compare
Can you add my comment to the commit message? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could have some tests for this.
In general, I'd like #441 to be resolved in the first place, as it seems to me recently done changes more unify things, rather then retain old behavior, so I'm not sure about this PR. Perhaps someone more involved should decide.
set_standard_hostname = false | ||
clc_snippets = concat(lookup(var.clc_snippets, var.controller_names[count.index], []), [ | ||
<<EOF | ||
storage: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make sure user can still override that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean the user would use a different name for the machine when defining it in the configuration and setting up a domain name than the hostname would be? I think it's good to check first what the behavior of CLC snippets is when the same file gets specified by the user again and if it doesn't work, document that the user has to set the hostname through a one-time service unit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a bug fix and does not change something related to how the user could overwrite the hostname, I think we should merge.
147040b
to
ca0837e
Compare
ca0837e
to
40074e4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mercury-controller-0 name
in Test_Baremetal_NodeSpecificLabels
is mismatching because the K8s node name is node1
based on the hostname. I gues the K8s node name used to be overwritten and now isn't anymore, or this node-specific label test was implemented after the accidental name change. I think it's good to just use the user-provided name and later change the CI node naming to be more specific than node1,
node2,
node3`.
Sets the hostname from the `<cluster_name>-worker-<count_index>` which is set when `set_standard_hostname` is true, to `controller_names<count_index>` for controllers and `worker_names<count_index>` for workers The hostname change got introduced by #1477 where it was set from the template variable `domain_name` coming from var.controller_domains[count.index]
40074e4
to
6f44918
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test error message is not specific enough:
if len(nodes.Items) == 1 && nodes.Items[0].Name != nodeName {
t.Errorf("expected node %q to have the labels %s", nodes.Items[0].Name, labels)
}
I think it should be
if len(nodes.Items) == 1 {
if nodes.Items[0].Name != nodeName {
t.Errorf("expected node %q but found %q to have the labels %s", nodeName, nodes.Items[0].Name, labels)
}
} else {
t.Errorf("expected a single node, got %d", len(nodes.Items))
}
if len(nodes.Items) == 1 {
if nodes.Items[0].Name != nodeName {
t.Errorf("expected node %q but found %q to have the labels %s", nodeName, nodes.Items[0].Name, labels)
}
} else {
t.Errorf("expected a single node, got %d", len(nodes.Items))
} I'd make that two independent asserts with |
Signed-off-by: Imran Pochi <imran@kinvolk.io>
6f44918
to
53d1cb9
Compare
Will merge now and start a new PR based on this |
Sets the hostname from the
<cluster_name>-worker-<count_index>
whichis set when
set_standard_hostname
is true, tocontroller_names<count_index>
for controllers andworker_names<count_index>
for workers