Open leonsteinhaeuser opened 2 years ago
The best way to check is to go to rancher and view the node template in the API. I do notice that the hetznerConfig.serverLabels
field is not set when viewed from the API. I'm not familiar enough with the rancher API -> node driver connection to say if this is a bug or not because you can label a node by setting the label on the node template itself, rancher2_node_template.labels
.
Though this raises the question of whether or not the node template labels should be separated from the node labels. Personally I think they should be separated, but it might not be so easy to implement that consistently over all drivers.
This field was introduced in https://github.com/rancher/terraform-provider-rancher2/pull/851. I've tried to patch the node template from the rancher API, and couldn't get this to work. Maybe I'm missing something. I'm on the 3.7.1 driver.
@stefandanaita whats your input?
I have the same problem
hetzner_config {
api_token = var.hcloud_token
image = var.k8s_node_image
server_location = var.k8s_node_location
use_private_network = false
server_labels = {
terraform = true
k8s_node = true
}
server_type = "cpx31"
}
And still nothing in rancher nodeTemplates api
Driver version: 3.7.1
We discovered the same problem in our project. Driver-Version: 3.7.1 Rancher-Version: 2.6.5
I found a solution, by compiling Rancher2 myself on my machine until the merge Requests are handeld one day.
My solution includes the missing fields for the Firewalls, AdditionalKeys and the PlacementGroup, as suggested here: https://github.com/rancher/terraform-provider-rancher2/pull/894
The Code in File schema_node_template_hetzner.go Line 17:
ServerLabel []string `json:"serverLabel,omitempty" yaml:"serverLabel,omitempty"`
Lines 41 - 45
"server_label": {
Type: schema.TypeString,
Optional: true,
Description: "Comma-separated list of labels which will be assigned to the server",
},
In File structure_node_template_hetzner.go Line 21
if len(in.ServerLabel) > 0 {
obj["server_label"] = strings.Join(in.ServerLabel, ",")
}
Line 87
if v, ok := in["server_label"].(string); ok && len(v) > 0 {
obj.ServerLabel = strings.Split(v, ",")
}
The TERRAFORM-File contains this then.
source "rancher2_node_template" "hetzner_create_template" {
labels = {
cluster=each.key
}
hetzner_config {
server_label = "cluster=${each.key}"
}
}
I do use the same values for labels as for server_label as I found using the GUI that both values are set with the very same values. So I just wanted to make sure, without further analysing if this is necessary.
The main findings are:
Hi there,
I have tried adding
server_labels
to my node_template to distinguish between the roles a server has been given. So far all my tests have been unsuccessful, so I guess there is a problem.My config:
Terraform plan outcome:
@process0 can you validate that this functionality is not working?