chore: clean flag

Since the introduction of transformation rules, this logic is no longer necessary.
The skipForeignNode flag was undocumented before, making its removal straightforward.

Signed-off-by: Serge Logvinov <serge.logvinov@sinextra.dev>
This commit is contained in:
Serge Logvinov
2024-05-16 14:21:53 +03:00
parent 9dde8aa331
commit 53034c8151
5 changed files with 6 additions and 19 deletions

View File

@@ -61,10 +61,6 @@ global:
# Parameter is optional, by default is "false"
approveNodeCSR: true
# Skip non-Talos nodes after initialisation
# Parameter is optional, by default is "false"
skipForeignNode: false
# The list of endpoints to connect to the Talos API (control-plane)
# Parameter is optional, by default the controller will discover the control-plane endpoint
endpoints:

View File

@@ -1,6 +1,5 @@
global:
approveNodeCSR: true
skipForeignNode: false
# endpoints:
# - 1.2.3.4
# - 4.3.2.1

View File

@@ -26,8 +26,6 @@ type cloudConfigGlobal struct {
ClusterName string `yaml:"clusterName,omitempty"`
// Talos API endpoints.
Endpoints []string `yaml:"endpoints,omitempty"`
// Do not update foreign initialized node.
SkipForeignNode bool `yaml:"skipForeignNode,omitempty"`
// Prefer IPv6.
PreferIPv6 bool `yaml:"preferIPv6,omitempty"`
}

View File

@@ -104,6 +104,10 @@ func (i *instances) InstanceMetadata(ctx context.Context, node *v1.Node) (*cloud
return nil, fmt.Errorf("error transforming node: %w", err)
}
if nodeSpec == nil {
nodeSpec = &transformer.NodeSpec{}
}
mc = metrics.NewMetricContext("addresses")
ifaces, err := i.c.getNodeIfaces(ctx, nodeIP)
@@ -119,16 +123,7 @@ func (i *instances) InstanceMetadata(ctx context.Context, node *v1.Node) (*cloud
addresses = append(addresses, v1.NodeAddress{Type: v1.NodeInternalDNS, Address: meta.Hostname})
}
// Foreign node, update network only.
if i.c.config.Global.SkipForeignNode && !strings.HasPrefix(node.Spec.ProviderID, ProviderName) {
klog.V(4).Infof("instances.InstanceMetadata() node %s has foreign providerID: %s, skipped", node.Name, node.Spec.ProviderID)
return &cloudprovider.InstanceMetadata{
NodeAddresses: addresses,
}, nil
}
if nodeSpec != nil && nodeSpec.Annotations != nil {
if nodeSpec.Annotations != nil {
klog.V(4).Infof("instances.InstanceMetadata() node %s has annotations: %+v", node.Name, nodeSpec.Annotations)
if err := syncNodeAnnotations(ctx, i.c, node, nodeSpec.Annotations); err != nil {
@@ -138,7 +133,7 @@ func (i *instances) InstanceMetadata(ctx context.Context, node *v1.Node) (*cloud
nodeLabels := setTalosNodeLabels(i.c, meta)
if nodeSpec != nil && nodeSpec.Labels != nil {
if nodeSpec.Labels != nil {
klog.V(4).Infof("instances.InstanceMetadata() node %s has labels: %+v", node.Name, nodeSpec.Labels)
maps.Copy(nodeLabels, nodeSpec.Labels)

View File

@@ -41,7 +41,6 @@ func TestInstanceMetadata(t *testing.T) {
t.Setenv("TALOSCONFIG", "../../hack/talosconfig")
cfg := cloudConfig{}
cfg.Global.SkipForeignNode = true
ctx := context.Background()
client, err := newClient(ctx, &cfg)