-
Notifications
You must be signed in to change notification settings - Fork 458
/
v1alpha1_discoveryconfig.go
51 lines (40 loc) · 1.56 KB
/
v1alpha1_discoveryconfig.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// 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/siderolabs/go-pointer"
"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 pointer.SafeDeref(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 !pointer.SafeDeref(c.RegistryDisabled)
}
// Enabled implements the config.ServiceRegistry interface.
func (c RegistryServiceConfig) Enabled() bool {
return !pointer.SafeDeref(c.RegistryDisabled)
}
// Endpoint implements the config.ServiceRegistry interface.
func (c RegistryServiceConfig) Endpoint() string {
if c.RegistryEndpoint == "" {
return constants.DefaultDiscoveryServiceEndpoint
}
return c.RegistryEndpoint
}