mirror of
https://github.com/siderolabs/talos.git
synced 2026-01-06 09:11:13 +01:00
This implements abstract `NodeAddressFilter` which can be attached to build additional `NodeAddress` resources filtering out some entries from the complete list. Kubernetes creates two filters to get all node IPs without Kubernetes CIDRs and vice versa, only Kubernetes CIDRs. API certificate generation now considers all addresses minus K8s CIDRs. Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
50 lines
1.4 KiB
Go
50 lines
1.4 KiB
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 network_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/network"
|
|
)
|
|
|
|
func TestRegisterResource(t *testing.T) {
|
|
ctx := context.TODO()
|
|
|
|
resources := state.WrapCore(namespaced.NewState(inmem.Build))
|
|
resourceRegistry := registry.NewResourceRegistry(resources)
|
|
|
|
for _, resource := range []resource.Resource{
|
|
&network.AddressStatus{},
|
|
&network.AddressSpec{},
|
|
&network.HardwareAddr{},
|
|
&network.HostnameStatus{},
|
|
&network.HostnameSpec{},
|
|
&network.LinkRefresh{},
|
|
&network.LinkStatus{},
|
|
&network.LinkSpec{},
|
|
&network.NodeAddress{},
|
|
&network.NodeAddressFilter{},
|
|
&network.OperatorSpec{},
|
|
&network.ResolverStatus{},
|
|
&network.ResolverSpec{},
|
|
&network.RouteStatus{},
|
|
&network.RouteSpec{},
|
|
&network.Status{},
|
|
&network.TimeServerStatus{},
|
|
&network.TimeServerSpec{},
|
|
} {
|
|
assert.NoError(t, resourceRegistry.Register(ctx, resource))
|
|
}
|
|
}
|