Add option for specifying the list of etcd metrics urls

This commit is contained in:
Ciprian Hacman 2023-06-27 18:21:26 +03:00
parent cad5b69446
commit e8980bc21a
10 changed files with 41 additions and 0 deletions

View File

@ -1265,6 +1265,13 @@ spec:
image:
description: Image is the etcd manager image to use.
type: string
listenMetricsURLs:
description: ListenMetricsURLs is the list of URLs to listen
on that will respond to both the /metrics and /health
endpoints
items:
type: string
type: array
logLevel:
description: LogLevel allows the klog library verbose log
level to be set for etcd-manager. The default is 6. https://github.com/google/glog#verbose-logging

View File

@ -680,6 +680,8 @@ type EtcdManagerSpec struct {
BackupRetentionDays *uint32 `json:"backupRetentionDays,omitempty"`
// DiscoveryPollInterval which is used for discovering other cluster members. The default is 60 seconds.
DiscoveryPollInterval *metav1.Duration `json:"discoveryPollInterval,omitempty"`
// ListenMetricsURLs is the list of URLs to listen on that will respond to both the /metrics and /health endpoints
ListenMetricsURLs []string `json:"listenMetricsURLs,omitempty"`
// LogLevel allows the klog library verbose log level to be set for etcd-manager. The default is 6.
// https://github.com/google/glog#verbose-logging
LogLevel *int32 `json:"logLevel,omitempty"`

View File

@ -676,6 +676,8 @@ type EtcdManagerSpec struct {
BackupRetentionDays *uint32 `json:"backupRetentionDays,omitempty"`
// DiscoveryPollInterval which is used for discovering other cluster members. The default is 60 seconds.
DiscoveryPollInterval *metav1.Duration `json:"discoveryPollInterval,omitempty"`
// ListenMetricsURLs is the list of URLs to listen on that will respond to both the /metrics and /health endpoints
ListenMetricsURLs []string `json:"listenMetricsURLs,omitempty"`
// LogLevel allows the klog library verbose log level to be set for etcd-manager. The default is 6.
// https://github.com/google/glog#verbose-logging
LogLevel *int32 `json:"logLevel,omitempty"`

View File

@ -3586,6 +3586,7 @@ func autoConvert_v1alpha2_EtcdManagerSpec_To_kops_EtcdManagerSpec(in *EtcdManage
out.BackupInterval = in.BackupInterval
out.BackupRetentionDays = in.BackupRetentionDays
out.DiscoveryPollInterval = in.DiscoveryPollInterval
out.ListenMetricsURLs = in.ListenMetricsURLs
out.LogLevel = in.LogLevel
return nil
}
@ -3611,6 +3612,7 @@ func autoConvert_kops_EtcdManagerSpec_To_v1alpha2_EtcdManagerSpec(in *kops.EtcdM
out.BackupInterval = in.BackupInterval
out.BackupRetentionDays = in.BackupRetentionDays
out.DiscoveryPollInterval = in.DiscoveryPollInterval
out.ListenMetricsURLs = in.ListenMetricsURLs
out.LogLevel = in.LogLevel
return nil
}

View File

@ -1912,6 +1912,11 @@ func (in *EtcdManagerSpec) DeepCopyInto(out *EtcdManagerSpec) {
*out = new(v1.Duration)
**out = **in
}
if in.ListenMetricsURLs != nil {
in, out := &in.ListenMetricsURLs, &out.ListenMetricsURLs
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.LogLevel != nil {
in, out := &in.LogLevel, &out.LogLevel
*out = new(int32)

View File

@ -637,6 +637,8 @@ type EtcdManagerSpec struct {
BackupRetentionDays *uint32 `json:"backupRetentionDays,omitempty"`
// DiscoveryPollInterval which is used for discovering other cluster members. The default is 60 seconds.
DiscoveryPollInterval *metav1.Duration `json:"discoveryPollInterval,omitempty"`
// ListenMetricsURLs is the list of URLs to listen on that will respond to both the /metrics and /health endpoints
ListenMetricsURLs []string `json:"listenMetricsURLs,omitempty"`
// LogLevel allows the klog library verbose log level to be set for etcd-manager. The default is 6.
// https://github.com/google/glog#verbose-logging
LogLevel *int32 `json:"logLevel,omitempty"`

View File

@ -3813,6 +3813,7 @@ func autoConvert_v1alpha3_EtcdManagerSpec_To_kops_EtcdManagerSpec(in *EtcdManage
out.BackupInterval = in.BackupInterval
out.BackupRetentionDays = in.BackupRetentionDays
out.DiscoveryPollInterval = in.DiscoveryPollInterval
out.ListenMetricsURLs = in.ListenMetricsURLs
out.LogLevel = in.LogLevel
return nil
}
@ -3838,6 +3839,7 @@ func autoConvert_kops_EtcdManagerSpec_To_v1alpha3_EtcdManagerSpec(in *kops.EtcdM
out.BackupInterval = in.BackupInterval
out.BackupRetentionDays = in.BackupRetentionDays
out.DiscoveryPollInterval = in.DiscoveryPollInterval
out.ListenMetricsURLs = in.ListenMetricsURLs
out.LogLevel = in.LogLevel
return nil
}

View File

@ -1802,6 +1802,11 @@ func (in *EtcdManagerSpec) DeepCopyInto(out *EtcdManagerSpec) {
*out = new(v1.Duration)
**out = **in
}
if in.ListenMetricsURLs != nil {
in, out := &in.ListenMetricsURLs, &out.ListenMetricsURLs
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.LogLevel != nil {
in, out := &in.LogLevel, &out.LogLevel
*out = new(int32)

View File

@ -1949,6 +1949,11 @@ func (in *EtcdManagerSpec) DeepCopyInto(out *EtcdManagerSpec) {
*out = new(v1.Duration)
**out = **in
}
if in.ListenMetricsURLs != nil {
in, out := &in.ListenMetricsURLs, &out.ListenMetricsURLs
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.LogLevel != nil {
in, out := &in.LogLevel, &out.LogLevel
*out = new(int32)

View File

@ -541,6 +541,15 @@ func (b *EtcdManagerBuilder) buildPod(etcdCluster kops.EtcdClusterSpec, instance
container.Env = append(container.Env, envVar)
}
if len(etcdCluster.Manager.ListenMetricsURLs) > 0 {
envVar := v1.EnvVar{
Name: "ETCD_LISTEN_METRICS_URLS",
Value: strings.Join(etcdCluster.Manager.ListenMetricsURLs, ","),
}
container.Env = append(container.Env, envVar)
}
for _, envVar := range etcdCluster.Manager.Env {
klog.V(2).Infof("overloading ENV var in manifest %s with %s=%s", bundle, envVar.Name, envVar.Value)
configOverwrite := v1.EnvVar{