2020-11-11 18:40:06 +01:00
|
|
|
package k8s
|
|
|
|
|
|
|
|
import "github.com/TwinProduction/gatus/core"
|
|
|
|
|
2020-11-11 20:46:19 +01:00
|
|
|
// Config for Kubernetes auto-discovery
|
2020-11-11 18:40:06 +01:00
|
|
|
type Config struct {
|
2020-11-11 20:46:19 +01:00
|
|
|
// AutoDiscover to discover services to monitor
|
2020-11-11 18:40:06 +01:00
|
|
|
AutoDiscover bool `yaml:"auto-discover"`
|
|
|
|
|
2020-11-11 22:29:30 +01:00
|
|
|
// ClusterMode is the mode to use to authenticate with Kubernetes
|
|
|
|
ClusterMode ClusterMode `yaml:"cluster-mode"`
|
|
|
|
|
|
|
|
// ServiceTemplate is the template for auto discovered services
|
2020-11-11 20:52:53 +01:00
|
|
|
ServiceTemplate *core.Service `yaml:"service-template"`
|
2020-11-11 18:40:06 +01:00
|
|
|
|
2020-11-11 22:29:30 +01:00
|
|
|
// ExcludedServiceSuffixes is a list of service suffixes that should be ignored
|
|
|
|
ExcludedServiceSuffixes []string `yaml:"excluded-service-suffixes"`
|
2020-11-11 18:40:06 +01:00
|
|
|
|
2020-11-11 22:29:30 +01:00
|
|
|
// Namespaces is a list of configurations for the namespaces from which services will be discovered
|
2020-11-11 20:52:53 +01:00
|
|
|
Namespaces []*NamespaceConfig `yaml:"namespaces"`
|
2020-11-11 18:40:06 +01:00
|
|
|
}
|
|
|
|
|
2020-11-11 20:46:19 +01:00
|
|
|
// NamespaceConfig level config
|
|
|
|
type NamespaceConfig struct {
|
2020-11-11 22:29:30 +01:00
|
|
|
// Name of the namespace
|
2020-11-11 18:40:06 +01:00
|
|
|
Name string `yaml:"name"`
|
2020-11-11 20:46:19 +01:00
|
|
|
|
2020-11-11 22:29:30 +01:00
|
|
|
// ExcludedServices is a list of services to exclude from the auto discovery
|
|
|
|
ExcludedServices []string `yaml:"excluded-services"`
|
|
|
|
|
|
|
|
// HostnameSuffix is a suffix to append to each service name before calling TargetPath
|
|
|
|
HostnameSuffix string `yaml:"hostname-suffix"`
|
2020-11-11 20:46:19 +01:00
|
|
|
|
2020-11-11 22:29:30 +01:00
|
|
|
// TargetPath Path to append after the HostnameSuffix
|
|
|
|
TargetPath string `yaml:"target-path"`
|
2020-11-11 18:40:06 +01:00
|
|
|
}
|
2020-11-11 21:10:44 +01:00
|
|
|
|
|
|
|
// ClusterMode is the mode to use to authenticate to Kubernetes
|
|
|
|
type ClusterMode string
|
|
|
|
|
|
|
|
const (
|
|
|
|
ClusterModeIn ClusterMode = "in"
|
|
|
|
ClusterModeOut ClusterMode = "out"
|
|
|
|
)
|