mirror of
https://github.com/outbackdingo/talos-cloud-controller-manager.git
synced 2026-01-27 10:20:27 +00:00
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:
@@ -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:
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
global:
|
||||
approveNodeCSR: true
|
||||
skipForeignNode: false
|
||||
# endpoints:
|
||||
# - 1.2.3.4
|
||||
# - 4.3.2.1
|
||||
|
||||
@@ -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"`
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user