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

chore: clean flag #162

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion hack/ccm-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
global:
approveNodeCSR: true
skipForeignNode: false
# endpoints:
# - 1.2.3.4
# - 4.3.2.1
Expand Down
2 changes: 0 additions & 2 deletions pkg/talos/cloud_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down
17 changes: 6 additions & 11 deletions pkg/talos/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 {
Expand All @@ -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)
Expand Down
1 change: 0 additions & 1 deletion pkg/talos/instances_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down