-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: provide machine configuration for KubeSpan and cluster discovery
Fixes #4131 Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
- Loading branch information
Showing
11 changed files
with
754 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
pkg/machinery/config/types/v1alpha1/v1alpha1_discoveryconfig.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// 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 v1alpha1 | ||
|
||
import ( | ||
"github.com/talos-systems/talos/pkg/machinery/config" | ||
"github.com/talos-systems/talos/pkg/machinery/constants" | ||
) | ||
|
||
// Enabled implements the config.ClusterDiscovery interface. | ||
func (c ClusterDiscoveryConfig) Enabled() bool { | ||
return c.DiscoveryEnabled | ||
} | ||
|
||
// Registries implements the config.ClusterDiscovery interface. | ||
func (c ClusterDiscoveryConfig) Registries() config.DiscoveryRegistries { | ||
return c.DiscoveryRegistries | ||
} | ||
|
||
// Kubernetes implements the config.DiscoveryRegistries interface. | ||
func (c DiscoveryRegistriesConfig) Kubernetes() config.KubernetesRegistry { | ||
return c.RegistryKubernetes | ||
} | ||
|
||
// Service implements the config.DiscoveryRegistries interface. | ||
func (c DiscoveryRegistriesConfig) Service() config.ServiceRegistry { | ||
return c.RegistryService | ||
} | ||
|
||
// Enabled implements the config.KubernetesRegistry interface. | ||
func (c RegistryKubernetesConfig) Enabled() bool { | ||
return !c.RegistryDisabled | ||
} | ||
|
||
// Enabled implements the config.ServiceRegistry interface. | ||
func (c RegistryServiceConfig) Enabled() bool { | ||
return !c.RegistryDisabled | ||
} | ||
|
||
// Endpoint implements the config.ServiceRegistry interface. | ||
func (c RegistryServiceConfig) Endpoint() string { | ||
if c.RegistryEndpoint == "" { | ||
return constants.DefaultDiscoveryServiceEndpoint | ||
} | ||
|
||
return c.RegistryEndpoint | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.