mirror of
				https://github.com/siderolabs/talos.git
				synced 2025-10-31 00:11:36 +01:00 
			
		
		
		
	Fixes #4139 This builds the local (for the node) `Affiliate` structure which describes node for the cluster discovery. Dependending on the configuration, KubeSpan information might be included as well. `NodeAddresses` were updated to hold CIDRs instead of simple IPs. The `Affiliate` will be pushed to the registries, while `Affiliate`s for other nodes will be fetched back from the registries. Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
		
			
				
	
	
		
			35 lines
		
	
	
		
			997 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			997 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| // This Source Code Form is subject to the terms of the Mozilla Public
 | |
| // License, v. 2.0. If a copy of the MPL was not distributed with this
 | |
| // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | |
| 
 | |
| package cluster_test
 | |
| 
 | |
| import (
 | |
| 	"context"
 | |
| 	"testing"
 | |
| 
 | |
| 	"github.com/cosi-project/runtime/pkg/resource"
 | |
| 	"github.com/cosi-project/runtime/pkg/state"
 | |
| 	"github.com/cosi-project/runtime/pkg/state/impl/inmem"
 | |
| 	"github.com/cosi-project/runtime/pkg/state/impl/namespaced"
 | |
| 	"github.com/cosi-project/runtime/pkg/state/registry"
 | |
| 	"github.com/stretchr/testify/assert"
 | |
| 
 | |
| 	"github.com/talos-systems/talos/pkg/resources/cluster"
 | |
| )
 | |
| 
 | |
| func TestRegisterResource(t *testing.T) {
 | |
| 	ctx := context.TODO()
 | |
| 
 | |
| 	resources := state.WrapCore(namespaced.NewState(inmem.Build))
 | |
| 	resourceRegistry := registry.NewResourceRegistry(resources)
 | |
| 
 | |
| 	for _, resource := range []resource.Resource{
 | |
| 		&cluster.Affiliate{},
 | |
| 		&cluster.Config{},
 | |
| 		&cluster.Identity{},
 | |
| 	} {
 | |
| 		assert.NoError(t, resourceRegistry.Register(ctx, resource))
 | |
| 	}
 | |
| }
 |