Add support for configuring which metrics cilium will export

This commit is contained in:
Ole Markus With 2022-05-26 08:36:27 +02:00
parent 074f780990
commit 77ebba84b8
10 changed files with 44 additions and 0 deletions

View File

@ -4901,6 +4901,12 @@ spec:
+ operator container. (default: 128Mi)'
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
metrics:
description: Metrics is a list of metrics to add or remove
from the default list of metrics the agent exposes.
items:
type: string
type: array
monitorAggregation:
description: 'MonitorAggregation sets the level of packet
monitoring. Possible values are "low", "medium", or "maximum".

View File

@ -278,6 +278,9 @@ type CiliumNetworkingSpec struct {
// AgentPrometheusPort is the port to listen to for Prometheus metrics.
// Defaults to 9090.
AgentPrometheusPort int `json:"agentPrometheusPort,omitempty"`
// Metrics is a list of metrics to add or remove from the default list of metrics the agent exposes.
Metrics []string `json:"metrics,omitempty"`
// ChainingMode allows using Cilium in combination with other CNI plugins.
// With Cilium CNI chaining, the base network connectivity and IP address management is managed
// by the non-Cilium CNI plugin, but Cilium attaches eBPF programs to the network devices created

View File

@ -290,9 +290,13 @@ type CiliumNetworkingSpec struct {
// AgentLabels is unused.
// +k8s:conversion-gen=false
AgentLabels []string `json:"agentLabels,omitempty"`
// AgentPrometheusPort is the port to listen to for Prometheus metrics.
// Defaults to 9090.
AgentPrometheusPort int `json:"agentPrometheusPort,omitempty"`
// Metrics is a list of metrics to add or remove from the default list of metrics the agent exposes.
Metrics []string `json:"metrics,omitempty"`
// AllowLocalhost is unused.
// +k8s:conversion-gen=false
AllowLocalhost string `json:"allowLocalhost,omitempty"`

View File

@ -1916,6 +1916,7 @@ func autoConvert_v1alpha2_CiliumNetworkingSpec_To_kops_CiliumNetworkingSpec(in *
// INFO: in.AccessLog opted out of conversion generation
// INFO: in.AgentLabels opted out of conversion generation
out.AgentPrometheusPort = in.AgentPrometheusPort
out.Metrics = in.Metrics
// INFO: in.AllowLocalhost opted out of conversion generation
// INFO: in.AutoIpv6NodeRoutes opted out of conversion generation
// INFO: in.BPFRoot opted out of conversion generation
@ -2022,6 +2023,7 @@ func autoConvert_kops_CiliumNetworkingSpec_To_v1alpha2_CiliumNetworkingSpec(in *
out.MemoryRequest = in.MemoryRequest
out.CPURequest = in.CPURequest
out.AgentPrometheusPort = in.AgentPrometheusPort
out.Metrics = in.Metrics
out.ChainingMode = in.ChainingMode
out.Debug = in.Debug
out.DisableEndpointCRD = in.DisableEndpointCRD

View File

@ -555,6 +555,11 @@ func (in *CiliumNetworkingSpec) DeepCopyInto(out *CiliumNetworkingSpec) {
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Metrics != nil {
in, out := &in.Metrics, &out.Metrics
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.ContainerRuntime != nil {
in, out := &in.ContainerRuntime, &out.ContainerRuntime
*out = make([]string, len(*in))

View File

@ -262,6 +262,9 @@ type CiliumNetworkingSpec struct {
// AgentPrometheusPort is the port to listen to for Prometheus metrics.
// Defaults to 9090.
AgentPrometheusPort int `json:"agentPrometheusPort,omitempty"`
// Metrics is a list of metrics to add or remove from the default list of metrics the agent exposes.
Metrics []string `json:"metrics,omitempty"`
// ChainingMode allows using Cilium in combination with other CNI plugins.
// With Cilium CNI chaining, the base network connectivity and IP address management is managed
// by the non-Cilium CNI plugin, but Cilium attaches eBPF programs to the network devices created

View File

@ -1940,6 +1940,7 @@ func autoConvert_v1alpha3_CiliumNetworkingSpec_To_kops_CiliumNetworkingSpec(in *
out.MemoryRequest = in.MemoryRequest
out.CPURequest = in.CPURequest
out.AgentPrometheusPort = in.AgentPrometheusPort
out.Metrics = in.Metrics
out.ChainingMode = in.ChainingMode
out.Debug = in.Debug
out.DisableEndpointCRD = in.DisableEndpointCRD
@ -2001,6 +2002,7 @@ func autoConvert_kops_CiliumNetworkingSpec_To_v1alpha3_CiliumNetworkingSpec(in *
out.MemoryRequest = in.MemoryRequest
out.CPURequest = in.CPURequest
out.AgentPrometheusPort = in.AgentPrometheusPort
out.Metrics = in.Metrics
out.ChainingMode = in.ChainingMode
out.Debug = in.Debug
out.DisableEndpointCRD = in.DisableEndpointCRD

View File

@ -567,6 +567,11 @@ func (in *CiliumNetworkingSpec) DeepCopyInto(out *CiliumNetworkingSpec) {
x := (*in).DeepCopy()
*out = &x
}
if in.Metrics != nil {
in, out := &in.Metrics, &out.Metrics
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.EnableL7Proxy != nil {
in, out := &in.EnableL7Proxy, &out.EnableL7Proxy
*out = new(bool)

View File

@ -648,6 +648,11 @@ func (in *CiliumNetworkingSpec) DeepCopyInto(out *CiliumNetworkingSpec) {
x := (*in).DeepCopy()
*out = &x
}
if in.Metrics != nil {
in, out := &in.Metrics, &out.Metrics
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.EnableL7Proxy != nil {
in, out := &in.EnableL7Proxy, &out.EnableL7Proxy
*out = new(bool)

View File

@ -85,6 +85,15 @@ data:
enable-metrics: "true"
{{ end }}
{{ if .Metrics }}
# Metrics that should be enabled or disabled from the default metric
# list. (+metric_foo to enable metric_foo , -metric_bar to disable
# metric_bar).
metrics: {{- range .Metrics }}
{{ . }}
{{- end }}
{{ end }}
{{ if .EnableEncryption }}
{{ if eq .EncryptionType "ipsec" }}
enable-ipsec: "true"