mirror of
https://github.com/siderolabs/talos.git
synced 2025-11-01 08:51:15 +01:00
This includes multiple controllers responsible for different stages of `AddressSpec` conversion: * `AddressConfigController` produces initial unmerged configuration from multiple sources (more sources coming later, e.g. DHCP) * `AddressMergeController` merges address configuration into final representation * `AddressSpecController` syncs resources with kernel state Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
32 lines
1.1 KiB
Go
32 lines
1.1 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 provides resources which describe networking subsystem state.
|
|
package network
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/cosi-project/runtime/pkg/resource"
|
|
"inet.af/netaddr"
|
|
)
|
|
|
|
// NamespaceName contains resources related to networking.
|
|
const NamespaceName resource.Namespace = "network"
|
|
|
|
// ConfigNamespaceName contains umerged resources related to networking generate from the configuration.
|
|
//
|
|
// Resources in the ConfigNamespaceName namespace are merged to produce final versions in the NamespaceName namespace.
|
|
const ConfigNamespaceName resource.Namespace = "network-config"
|
|
|
|
// AddressID builds ID (primary key) for the address.
|
|
func AddressID(linkName string, addr netaddr.IPPrefix) string {
|
|
return fmt.Sprintf("%s/%s", linkName, addr)
|
|
}
|
|
|
|
// LayeredID builds configuration for the entity at some layer.
|
|
func LayeredID(layer ConfigLayer, id string) string {
|
|
return fmt.Sprintf("%s/%s", layer, id)
|
|
}
|