Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,5 @@ func (r *Reconciler) profilesToApply(ctx context.Context, logger logr.Logger, no
func (r *Reconciler) getNodeList(ctx context.Context) ([]corev1.Node, error) {
nodeList := corev1.NodeList{}
err := r.client.List(ctx, &nodeList)
if err != nil {
return nodeList.Items, err
}

return nodeList.Items, nil
return nodeList.Items, err
}
3 changes: 3 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ func CacheOptions(logger logr.Logger, opts WatchOptions) cache.Options {
Name: node.Name,
Labels: node.Labels,
},
Status: corev1.NodeStatus{
NodeInfo: node.Status.NodeInfo,
},
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, calling r.getNodeList was returning nodes with an empty status so we couldn't check for Talos linux. This copies the node's NodeInfo into the cache so when we list them later, NodeInfo is populated.

}

return newNode, nil
Expand Down
16 changes: 13 additions & 3 deletions pkg/kubernetes/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,19 @@ func getProviderNodeAffinity(provider string, providerList map[string]struct{})
if provider == "" || providerList == nil || len(providerList) == 0 {
return nil
}
// if only the default provider exists, there should be no affinity override
if provider == DefaultProvider && len(providerList) == 1 {
return nil

if len(providerList) == 1 {
_, ok := providerList[provider]
if ok {
switch provider {
case DefaultProvider:
// if only the default provider exists, there should be no affinity override
return nil
case TalosProvider:
// if only the Talos provider exists, there should be no affinity override.
return nil
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talos, by default, doesn't seem to apply a label to the nodes that we can use like Google COS does. If you have a cluster with both Talos Linux nodes and other nodes, I don't have a good solution for how to handle that right now.

}
}
}

// default provider has NodeAffinity to NOT match provider-specific labels
Expand Down
8 changes: 8 additions & 0 deletions pkg/kubernetes/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,14 @@ func Test_getProviderNodeAffinity(t *testing.T) {
provider: defaultProvider,
wantAffinity: nil,
},
{
name: "single talos provider",
existingProviders: map[string]struct{}{
TalosProvider: {},
},
provider: TalosProvider,
wantAffinity: nil,
},
{
name: "single cos provider",
existingProviders: map[string]struct{}{
Expand Down
Loading