From d46833a062fe7f2a543eb1094001e0cc5d832d11 Mon Sep 17 00:00:00 2001 From: Israel Blancas Date: Tue, 20 Aug 2024 09:23:52 +0200 Subject: [PATCH 01/41] Fix permission issues when copying files for nginx autoinstrumentation (#3214) Signed-off-by: Israel Blancas --- .../2726-non-root-nginx-autoinstrumentation.yaml | 16 ++++++++++++++++ pkg/instrumentation/nginx.go | 2 +- pkg/instrumentation/nginx_test.go | 2 +- .../instrumentation-nginx/01-install-app.yaml | 1 - 4 files changed, 18 insertions(+), 3 deletions(-) create mode 100755 .chloggen/2726-non-root-nginx-autoinstrumentation.yaml diff --git a/.chloggen/2726-non-root-nginx-autoinstrumentation.yaml b/.chloggen/2726-non-root-nginx-autoinstrumentation.yaml new file mode 100755 index 0000000000..04310f0375 --- /dev/null +++ b/.chloggen/2726-non-root-nginx-autoinstrumentation.yaml @@ -0,0 +1,16 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: 'bug_fix' + +# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) +component: auto-instrumentation + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Fix file copy for NGINX auto-instrumentation for non-root workloads." + +# One or more tracking issues related to the change +issues: [2726] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/pkg/instrumentation/nginx.go b/pkg/instrumentation/nginx.go index 80b53d8295..350a3533b9 100644 --- a/pkg/instrumentation/nginx.go +++ b/pkg/instrumentation/nginx.go @@ -186,7 +186,7 @@ NGINX_SID_VALUE=$5 \n echo "Input Parameters: $@" \n set -x \n \n -cp -ar /opt/opentelemetry/* ${NGINX_AGENT_DIR_FULL} \n +cp -r /opt/opentelemetry/* ${NGINX_AGENT_DIR_FULL} \n \n NGINX_VERSION=$(cat ${NGINX_AGENT_CONF_DIR_FULL}/version.txt) \n NGINX_AGENT_LOG_DIR=$(echo "${NGINX_AGENT_DIR_FULL}/logs" | sed 's,/,\\/,g') \n diff --git a/pkg/instrumentation/nginx_test.go b/pkg/instrumentation/nginx_test.go index 91d2a9d8c8..65a9d5b8a0 100644 --- a/pkg/instrumentation/nginx_test.go +++ b/pkg/instrumentation/nginx_test.go @@ -28,7 +28,7 @@ import ( var nginxSdkInitContainerTestCommand = "echo -e $OTEL_NGINX_I13N_SCRIPT > /opt/opentelemetry-webserver/agent/nginx_instrumentation.sh && chmod +x /opt/opentelemetry-webserver/agent/nginx_instrumentation.sh && cat /opt/opentelemetry-webserver/agent/nginx_instrumentation.sh && /opt/opentelemetry-webserver/agent/nginx_instrumentation.sh \"/opt/opentelemetry-webserver/agent\" \"/opt/opentelemetry-webserver/source-conf\" \"nginx.conf\" \"<>\"" var nginxSdkInitContainerTestCommandCustomFile = "echo -e $OTEL_NGINX_I13N_SCRIPT > /opt/opentelemetry-webserver/agent/nginx_instrumentation.sh && chmod +x /opt/opentelemetry-webserver/agent/nginx_instrumentation.sh && cat /opt/opentelemetry-webserver/agent/nginx_instrumentation.sh && /opt/opentelemetry-webserver/agent/nginx_instrumentation.sh \"/opt/opentelemetry-webserver/agent\" \"/opt/opentelemetry-webserver/source-conf\" \"custom-nginx.conf\" \"<>\"" -var nginxSdkInitContainerI13nScript = "\nNGINX_AGENT_DIR_FULL=$1\t\\n\nNGINX_AGENT_CONF_DIR_FULL=$2 \\n\nNGINX_CONFIG_FILE=$3 \\n\nNGINX_SID_PLACEHOLDER=$4 \\n\nNGINX_SID_VALUE=$5 \\n\necho \"Input Parameters: $@\" \\n\nset -x \\n\n\\n\ncp -ar /opt/opentelemetry/* ${NGINX_AGENT_DIR_FULL} \\n\n\\n\nNGINX_VERSION=$(cat ${NGINX_AGENT_CONF_DIR_FULL}/version.txt) \\n\nNGINX_AGENT_LOG_DIR=$(echo \"${NGINX_AGENT_DIR_FULL}/logs\" | sed 's,/,\\\\/,g') \\n\n\\n\ncat ${NGINX_AGENT_DIR_FULL}/conf/opentelemetry_sdk_log4cxx.xml.template | sed 's,__agent_log_dir__,'${NGINX_AGENT_LOG_DIR}',g' > ${NGINX_AGENT_DIR_FULL}/conf/opentelemetry_sdk_log4cxx.xml \\n\necho -e $OTEL_NGINX_AGENT_CONF > ${NGINX_AGENT_CONF_DIR_FULL}/opentelemetry_agent.conf \\n\nsed -i \"s,${NGINX_SID_PLACEHOLDER},${OTEL_NGINX_SERVICE_INSTANCE_ID},g\" ${NGINX_AGENT_CONF_DIR_FULL}/opentelemetry_agent.conf \\n\nsed -i \"1s,^,load_module ${NGINX_AGENT_DIR_FULL}/WebServerModule/Nginx/${NGINX_VERSION}/ngx_http_opentelemetry_module.so;\\\\n,g\" ${NGINX_AGENT_CONF_DIR_FULL}/${NGINX_CONFIG_FILE} \\n\nsed -i \"1s,^,env OTEL_RESOURCE_ATTRIBUTES;\\\\n,g\" ${NGINX_AGENT_CONF_DIR_FULL}/${NGINX_CONFIG_FILE} \\n\nmv ${NGINX_AGENT_CONF_DIR_FULL}/opentelemetry_agent.conf ${NGINX_AGENT_CONF_DIR_FULL}/conf.d \\n\n\t\t" +var nginxSdkInitContainerI13nScript = "\nNGINX_AGENT_DIR_FULL=$1\t\\n\nNGINX_AGENT_CONF_DIR_FULL=$2 \\n\nNGINX_CONFIG_FILE=$3 \\n\nNGINX_SID_PLACEHOLDER=$4 \\n\nNGINX_SID_VALUE=$5 \\n\necho \"Input Parameters: $@\" \\n\nset -x \\n\n\\n\ncp -r /opt/opentelemetry/* ${NGINX_AGENT_DIR_FULL} \\n\n\\n\nNGINX_VERSION=$(cat ${NGINX_AGENT_CONF_DIR_FULL}/version.txt) \\n\nNGINX_AGENT_LOG_DIR=$(echo \"${NGINX_AGENT_DIR_FULL}/logs\" | sed 's,/,\\\\/,g') \\n\n\\n\ncat ${NGINX_AGENT_DIR_FULL}/conf/opentelemetry_sdk_log4cxx.xml.template | sed 's,__agent_log_dir__,'${NGINX_AGENT_LOG_DIR}',g' > ${NGINX_AGENT_DIR_FULL}/conf/opentelemetry_sdk_log4cxx.xml \\n\necho -e $OTEL_NGINX_AGENT_CONF > ${NGINX_AGENT_CONF_DIR_FULL}/opentelemetry_agent.conf \\n\nsed -i \"s,${NGINX_SID_PLACEHOLDER},${OTEL_NGINX_SERVICE_INSTANCE_ID},g\" ${NGINX_AGENT_CONF_DIR_FULL}/opentelemetry_agent.conf \\n\nsed -i \"1s,^,load_module ${NGINX_AGENT_DIR_FULL}/WebServerModule/Nginx/${NGINX_VERSION}/ngx_http_opentelemetry_module.so;\\\\n,g\" ${NGINX_AGENT_CONF_DIR_FULL}/${NGINX_CONFIG_FILE} \\n\nsed -i \"1s,^,env OTEL_RESOURCE_ATTRIBUTES;\\\\n,g\" ${NGINX_AGENT_CONF_DIR_FULL}/${NGINX_CONFIG_FILE} \\n\nmv ${NGINX_AGENT_CONF_DIR_FULL}/opentelemetry_agent.conf ${NGINX_AGENT_CONF_DIR_FULL}/conf.d \\n\n\t\t" func TestInjectNginxSDK(t *testing.T) { diff --git a/tests/e2e-instrumentation/instrumentation-nginx/01-install-app.yaml b/tests/e2e-instrumentation/instrumentation-nginx/01-install-app.yaml index 13304afb75..3ca305fa63 100644 --- a/tests/e2e-instrumentation/instrumentation-nginx/01-install-app.yaml +++ b/tests/e2e-instrumentation/instrumentation-nginx/01-install-app.yaml @@ -42,7 +42,6 @@ spec: mountPath: /etc/nginx/nginx.conf subPath: nginx.conf readOnly: true - imagePullPolicy: Always resources: limits: cpu: "1" From 03b4bd50e84f879e544b8934cc86a7119fdfaa0a Mon Sep 17 00:00:00 2001 From: Jacob Aronoff Date: Tue, 20 Aug 2024 12:31:16 -0400 Subject: [PATCH 02/41] Propagate global scrape protocols by allowing for global config setting (#3161) * allow for global config setting for target allocator * allow for global config setting for target allocator * fix e2e test * reset * should be in data * fix test namespace for instance * working test * link to prom docs --- .../propagate-global-scrape-protocols.yaml | 16 +++++ apis/v1alpha1/targetallocator_types.go | 3 + apis/v1alpha1/zz_generated.deepcopy.go | 1 + .../opentelemetry.io_targetallocators.yaml | 2 + .../manifests/collector/targetallocator.go | 24 +++++++ .../collector/targetallocator_test.go | 63 +++++++++++++++++++ .../manifests/targetallocator/configmap.go | 12 +++- .../targetallocator/configmap_test.go | 14 ++++- .../e2e/smoke-targetallocator/00-assert.yaml | 11 +++- .../e2e/smoke-targetallocator/00-install.yaml | 3 + .../smoke-targetallocator/chainsaw-test.yaml | 35 +++++++++++ 11 files changed, 178 insertions(+), 6 deletions(-) create mode 100755 .chloggen/propagate-global-scrape-protocols.yaml diff --git a/.chloggen/propagate-global-scrape-protocols.yaml b/.chloggen/propagate-global-scrape-protocols.yaml new file mode 100755 index 0000000000..c9606ca18a --- /dev/null +++ b/.chloggen/propagate-global-scrape-protocols.yaml @@ -0,0 +1,16 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) +component: target allocator + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: introduces the global field in the TA config to allow for setting scrape protocols + +# One or more tracking issues related to the change +issues: [3160] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/apis/v1alpha1/targetallocator_types.go b/apis/v1alpha1/targetallocator_types.go index 54df8a9a2d..a5e47d924f 100644 --- a/apis/v1alpha1/targetallocator_types.go +++ b/apis/v1alpha1/targetallocator_types.go @@ -73,6 +73,9 @@ type TargetAllocatorSpec struct { // +optional // +kubebuilder:default:=relabel-config FilterStrategy v1beta1.TargetAllocatorFilterStrategy `json:"filterStrategy,omitempty"` + // GlobalConfig configures the global configuration for Prometheus + // For more info, see https://prometheus.io/docs/prometheus/latest/configuration/configuration/#configuration-file. + GlobalConfig v1beta1.AnyConfig `json:"global,omitempty"` // ScrapeConfigs define static Prometheus scrape configurations for the target allocator. // To use dynamic configurations from ServiceMonitors and PodMonitors, see the PrometheusCR section. // For the exact format, see https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config. diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1alpha1/zz_generated.deepcopy.go index 87092d21f8..3d410949f0 100644 --- a/apis/v1alpha1/zz_generated.deepcopy.go +++ b/apis/v1alpha1/zz_generated.deepcopy.go @@ -1319,6 +1319,7 @@ func (in *TargetAllocatorList) DeepCopyObject() runtime.Object { func (in *TargetAllocatorSpec) DeepCopyInto(out *TargetAllocatorSpec) { *out = *in in.OpenTelemetryCommonFields.DeepCopyInto(&out.OpenTelemetryCommonFields) + in.GlobalConfig.DeepCopyInto(&out.GlobalConfig) if in.ScrapeConfigs != nil { in, out := &in.ScrapeConfigs, &out.ScrapeConfigs *out = make([]v1beta1.AnyConfig, len(*in)) diff --git a/config/crd/bases/opentelemetry.io_targetallocators.yaml b/config/crd/bases/opentelemetry.io_targetallocators.yaml index 3543bf1141..42cbd7c934 100644 --- a/config/crd/bases/opentelemetry.io_targetallocators.yaml +++ b/config/crd/bases/opentelemetry.io_targetallocators.yaml @@ -1248,6 +1248,8 @@ spec: - "" - relabel-config type: string + global: + type: object hostNetwork: type: boolean image: diff --git a/internal/manifests/collector/targetallocator.go b/internal/manifests/collector/targetallocator.go index 44fa38a7fb..cf1e70ff55 100644 --- a/internal/manifests/collector/targetallocator.go +++ b/internal/manifests/collector/targetallocator.go @@ -15,6 +15,7 @@ package collector import ( + "github.com/mitchellh/mapstructure" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" @@ -39,6 +40,10 @@ func TargetAllocator(params manifests.Params) (*v1alpha1.TargetAllocator, error) if err != nil { return nil, err } + globalConfig, err := getGlobalConfig(params.OtelCol.Spec.Config) + if err != nil { + return nil, err + } return &v1alpha1.TargetAllocator{ ObjectMeta: metav1.ObjectMeta{ @@ -66,12 +71,31 @@ func TargetAllocator(params manifests.Params) (*v1alpha1.TargetAllocator, error) AllocationStrategy: taSpec.AllocationStrategy, FilterStrategy: taSpec.FilterStrategy, ScrapeConfigs: scrapeConfigs, + GlobalConfig: globalConfig, PrometheusCR: taSpec.PrometheusCR, Observability: taSpec.Observability, }, }, nil } +func getGlobalConfig(otelConfig v1beta1.Config) (v1beta1.AnyConfig, error) { + // TODO: Eventually we should figure out a way to pull this in to the main specification for the TA + type promReceiverConfig struct { + Prometheus struct { + Config struct { + Global map[string]interface{} `mapstructure:"global"` + } `mapstructure:"config"` + } `mapstructure:"prometheus"` + } + decodedConfig := &promReceiverConfig{} + if err := mapstructure.Decode(otelConfig.Receivers.Object, decodedConfig); err != nil { + return v1beta1.AnyConfig{}, err + } + return v1beta1.AnyConfig{ + Object: decodedConfig.Prometheus.Config.Global, + }, nil +} + func getScrapeConfigs(otelcolConfig string) ([]v1beta1.AnyConfig, error) { // Collector supports environment variable substitution, but the TA does not. // TA Scrape Configs should have a single "$", as it does not support env var substitution diff --git a/internal/manifests/collector/targetallocator_test.go b/internal/manifests/collector/targetallocator_test.go index 98cbc76089..ababa4acb7 100644 --- a/internal/manifests/collector/targetallocator_test.go +++ b/internal/manifests/collector/targetallocator_test.go @@ -91,6 +91,7 @@ func TestTargetAllocator(t *testing.T) { ObjectMeta: objectMetadata, Spec: v1alpha1.TargetAllocatorSpec{ ScrapeConfigs: []v1beta1.AnyConfig{}, + GlobalConfig: v1beta1.AnyConfig{}, }, }, }, @@ -420,3 +421,65 @@ func TestGetScrapeConfigs(t *testing.T) { }) } } + +func Test_getGlobalConfig(t *testing.T) { + type args struct { + otelConfig v1beta1.Config + } + tests := []struct { + name string + args args + want v1beta1.AnyConfig + wantErr error + }{ + { + name: "Valid Global Config", + args: args{ + otelConfig: v1beta1.Config{ + Receivers: v1beta1.AnyConfig{ + Object: map[string]interface{}{ + "prometheus": map[string]interface{}{ + "config": map[string]interface{}{ + "global": map[string]interface{}{ + "scrape_interval": "15s", + "scrape_protocols": []string{"PrometheusProto", "OpenMetricsText1.0.0", "OpenMetricsText0.0.1", "PrometheusText0.0.4"}, + }, + }, + }, + }, + }, + }, + }, + want: v1beta1.AnyConfig{ + Object: map[string]interface{}{ + "scrape_interval": "15s", + "scrape_protocols": []string{"PrometheusProto", "OpenMetricsText1.0.0", "OpenMetricsText0.0.1", "PrometheusText0.0.4"}, + }, + }, + wantErr: nil, + }, + { + name: "Invalid Global Config - Missing Global", + args: args{ + otelConfig: v1beta1.Config{ + Receivers: v1beta1.AnyConfig{ + Object: map[string]interface{}{ + "prometheus": map[string]interface{}{ + "config": map[string]interface{}{}, + }, + }, + }, + }, + }, + want: v1beta1.AnyConfig{}, + wantErr: nil, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := getGlobalConfig(tt.args.otelConfig) + assert.Equal(t, tt.wantErr, err) + assert.Equal(t, tt.want, got) + }) + } +} diff --git a/internal/manifests/targetallocator/configmap.go b/internal/manifests/targetallocator/configmap.go index 5e32803882..eca98615f7 100644 --- a/internal/manifests/targetallocator/configmap.go +++ b/internal/manifests/targetallocator/configmap.go @@ -41,11 +41,17 @@ func ConfigMap(params Params) (*corev1.ConfigMap, error) { MatchLabels: manifestutils.SelectorLabels(params.Collector.ObjectMeta, collector.ComponentOpenTelemetryCollector), } + // Set config if global or scrape configs set + config := map[string]interface{}{} + if instance.Spec.GlobalConfig.Object != nil { + config["global"] = instance.Spec.GlobalConfig + } // Add scrape configs if present if instance.Spec.ScrapeConfigs != nil && len(instance.Spec.ScrapeConfigs) > 0 { - taConfig["config"] = map[string]interface{}{ - "scrape_configs": instance.Spec.ScrapeConfigs, - } + config["scrape_configs"] = instance.Spec.ScrapeConfigs + } + if len(config) != 0 { + taConfig["config"] = config } if len(taSpec.AllocationStrategy) > 0 { diff --git a/internal/manifests/targetallocator/configmap_test.go b/internal/manifests/targetallocator/configmap_test.go index e3999805ee..a8b83dfc4f 100644 --- a/internal/manifests/targetallocator/configmap_test.go +++ b/internal/manifests/targetallocator/configmap_test.go @@ -118,6 +118,13 @@ collector_selector: app.kubernetes.io/part-of: opentelemetry matchexpressions: [] config: + global: + scrape_interval: 30s + scrape_protocols: + - PrometheusProto + - OpenMetricsText1.0.0 + - OpenMetricsText0.0.1 + - PrometheusText0.0.4 scrape_configs: - job_name: otel-collector scrape_interval: 10s @@ -149,10 +156,15 @@ prometheus_cr: MatchLabels: map[string]string{ "release": "my-instance", }} + targetAllocator.Spec.GlobalConfig = v1beta1.AnyConfig{ + Object: map[string]interface{}{ + "scrape_interval": "30s", + "scrape_protocols": []string{"PrometheusProto", "OpenMetricsText1.0.0", "OpenMetricsText0.0.1", "PrometheusText0.0.4"}, + }, + } params.TargetAllocator = targetAllocator actual, err := ConfigMap(params) assert.NoError(t, err) - assert.Equal(t, "my-instance-targetallocator", actual.Name) assert.Equal(t, expectedLabels, actual.Labels) assert.Equal(t, expectedData, actual.Data) diff --git a/tests/e2e/smoke-targetallocator/00-assert.yaml b/tests/e2e/smoke-targetallocator/00-assert.yaml index 5d01cb06ed..095ea679d5 100644 --- a/tests/e2e/smoke-targetallocator/00-assert.yaml +++ b/tests/e2e/smoke-targetallocator/00-assert.yaml @@ -30,7 +30,14 @@ data: protocols: grpc: null prometheus: - config: {} + config: + global: + scrape_interval: 30s + scrape_protocols: + - PrometheusProto + - OpenMetricsText1.0.0 + - OpenMetricsText0.0.1 + - PrometheusText0.0.4 target_allocator: collector_id: ${POD_NAME} endpoint: http://stateful-targetallocator.chainsaw-smoke-targetallocator.svc.cluster.local:80 @@ -44,4 +51,4 @@ data: - jaeger kind: ConfigMap metadata: - name: stateful-collector-2687b61c + name: stateful-collector-eebfc9d2 diff --git a/tests/e2e/smoke-targetallocator/00-install.yaml b/tests/e2e/smoke-targetallocator/00-install.yaml index 5eac75d547..806224f6ee 100644 --- a/tests/e2e/smoke-targetallocator/00-install.yaml +++ b/tests/e2e/smoke-targetallocator/00-install.yaml @@ -46,6 +46,9 @@ spec: # Collect own metrics prometheus: config: + global: + scrape_interval: 30s + scrape_protocols: ['PrometheusProto','OpenMetricsText1.0.0','OpenMetricsText0.0.1','PrometheusText0.0.4'] scrape_configs: - job_name: 'otel-collector' scrape_interval: 10s diff --git a/tests/e2e/smoke-targetallocator/chainsaw-test.yaml b/tests/e2e/smoke-targetallocator/chainsaw-test.yaml index e8ddfd8022..aca5291cae 100755 --- a/tests/e2e/smoke-targetallocator/chainsaw-test.yaml +++ b/tests/e2e/smoke-targetallocator/chainsaw-test.yaml @@ -17,6 +17,41 @@ spec: catch: - podLogs: selector: app.kubernetes.io/component=opentelemetry-targetallocator + - name: assert-data-propagates + try: + - assert: + resource: + apiVersion: v1 + kind: ConfigMap + metadata: + name: stateful-targetallocator + namespace: ($namespace) + data: + targetallocator.yaml: + (parse_yaml(@)): + allocation_strategy: consistent-hashing + collector_selector: + matchlabels: + app.kubernetes.io/component: opentelemetry-collector + app.kubernetes.io/instance: (join('.', [$namespace, 'stateful'])) + app.kubernetes.io/managed-by: opentelemetry-operator + app.kubernetes.io/part-of: opentelemetry + matchexpressions: [ ] + config: + global: + scrape_interval: 30s + scrape_protocols: + - PrometheusProto + - OpenMetricsText1.0.0 + - OpenMetricsText0.0.1 + - PrometheusText0.0.4 + scrape_configs: + - job_name: otel-collector + scrape_interval: 10s + static_configs: + - targets: + - 0.0.0.0:8888 + filter_strategy: relabel-config - name: step-01 try: - apply: From 7d59d65f9406f69b67451f67a774c2ac74bc3bfb Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Tue, 20 Aug 2024 18:31:58 +0200 Subject: [PATCH 03/41] instrumentation/python: set OTEL_EXPORTER_OTLP_PROTOCOL to http/protobuf (#3165) * instrumentation/python: set OTEL_EXPORTER_OTLP_PROTOCOL instead of signal specific env vars Instead of setting the environment variable for each signal use the common one that it is also set by the distro. * Add changelog * WIP e2e * Run gofmt * Update .chloggen/3165-python-otlp-protocol-env-var.yaml --- .../3165-python-otlp-protocol-env-var.yaml | 16 +++ pkg/instrumentation/podmutator_test.go | 66 ++++------- pkg/instrumentation/python.go | 44 +++----- pkg/instrumentation/python_test.go | 106 +++++++++++++----- pkg/instrumentation/sdk_test.go | 12 +- .../01-assert.yaml | 12 +- .../02-assert.yaml | 6 +- .../instrumentation-python/01-assert.yaml | 4 +- .../01-assert.yaml | 6 +- 9 files changed, 146 insertions(+), 126 deletions(-) create mode 100755 .chloggen/3165-python-otlp-protocol-env-var.yaml diff --git a/.chloggen/3165-python-otlp-protocol-env-var.yaml b/.chloggen/3165-python-otlp-protocol-env-var.yaml new file mode 100755 index 0000000000..cba8188516 --- /dev/null +++ b/.chloggen/3165-python-otlp-protocol-env-var.yaml @@ -0,0 +1,16 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) +component: auto-instrumentation + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: set OTEL_EXPORTER_OTLP_PROTOCOL instead of signal specific env vars in python instrumentation + +# One or more tracking issues related to the change +issues: [3165] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/pkg/instrumentation/podmutator_test.go b/pkg/instrumentation/podmutator_test.go index 01232935ee..b1bdb81c95 100644 --- a/pkg/instrumentation/podmutator_test.go +++ b/pkg/instrumentation/podmutator_test.go @@ -1309,11 +1309,7 @@ func TestMutatePod(t *testing.T) { Value: fmt.Sprintf("%s:%s", pythonPathPrefix, pythonPathSuffix), }, { - Name: "OTEL_EXPORTER_OTLP_TRACES_PROTOCOL", - Value: "http/protobuf", - }, - { - Name: "OTEL_EXPORTER_OTLP_METRICS_PROTOCOL", + Name: "OTEL_EXPORTER_OTLP_PROTOCOL", Value: "http/protobuf", }, { @@ -1514,11 +1510,7 @@ func TestMutatePod(t *testing.T) { Value: fmt.Sprintf("%s:%s", pythonPathPrefix, pythonPathSuffix), }, { - Name: "OTEL_EXPORTER_OTLP_TRACES_PROTOCOL", - Value: "http/protobuf", - }, - { - Name: "OTEL_EXPORTER_OTLP_METRICS_PROTOCOL", + Name: "OTEL_EXPORTER_OTLP_PROTOCOL", Value: "http/protobuf", }, { @@ -1609,11 +1601,7 @@ func TestMutatePod(t *testing.T) { Value: fmt.Sprintf("%s:%s", pythonPathPrefix, pythonPathSuffix), }, { - Name: "OTEL_EXPORTER_OTLP_TRACES_PROTOCOL", - Value: "http/protobuf", - }, - { - Name: "OTEL_EXPORTER_OTLP_METRICS_PROTOCOL", + Name: "OTEL_EXPORTER_OTLP_PROTOCOL", Value: "http/protobuf", }, { @@ -4065,20 +4053,16 @@ func TestMutatePod(t *testing.T) { Value: fmt.Sprintf("%s:%s", pythonPathPrefix, pythonPathSuffix), }, { - Name: "OTEL_TRACES_EXPORTER", - Value: "otlp", - }, - { - Name: "OTEL_EXPORTER_OTLP_TRACES_PROTOCOL", + Name: "OTEL_EXPORTER_OTLP_PROTOCOL", Value: "http/protobuf", }, { - Name: "OTEL_METRICS_EXPORTER", + Name: "OTEL_TRACES_EXPORTER", Value: "otlp", }, { - Name: "OTEL_EXPORTER_OTLP_METRICS_PROTOCOL", - Value: "http/protobuf", + Name: "OTEL_METRICS_EXPORTER", + Value: "otlp", }, { Name: "OTEL_SERVICE_NAME", @@ -4144,20 +4128,16 @@ func TestMutatePod(t *testing.T) { Value: fmt.Sprintf("%s:%s", pythonPathPrefix, pythonPathSuffix), }, { - Name: "OTEL_TRACES_EXPORTER", - Value: "otlp", - }, - { - Name: "OTEL_EXPORTER_OTLP_TRACES_PROTOCOL", + Name: "OTEL_EXPORTER_OTLP_PROTOCOL", Value: "http/protobuf", }, { - Name: "OTEL_METRICS_EXPORTER", + Name: "OTEL_TRACES_EXPORTER", Value: "otlp", }, { - Name: "OTEL_EXPORTER_OTLP_METRICS_PROTOCOL", - Value: "http/protobuf", + Name: "OTEL_METRICS_EXPORTER", + Value: "otlp", }, { Name: "OTEL_SERVICE_NAME", @@ -4850,20 +4830,16 @@ func TestMutatePod(t *testing.T) { Value: fmt.Sprintf("%s:%s", pythonPathPrefix, pythonPathSuffix), }, { - Name: "OTEL_TRACES_EXPORTER", - Value: "otlp", - }, - { - Name: "OTEL_EXPORTER_OTLP_TRACES_PROTOCOL", + Name: "OTEL_EXPORTER_OTLP_PROTOCOL", Value: "http/protobuf", }, { - Name: "OTEL_METRICS_EXPORTER", + Name: "OTEL_TRACES_EXPORTER", Value: "otlp", }, { - Name: "OTEL_EXPORTER_OTLP_METRICS_PROTOCOL", - Value: "http/protobuf", + Name: "OTEL_METRICS_EXPORTER", + Value: "otlp", }, { Name: "OTEL_SERVICE_NAME", @@ -4929,20 +4905,16 @@ func TestMutatePod(t *testing.T) { Value: fmt.Sprintf("%s:%s", pythonPathPrefix, pythonPathSuffix), }, { - Name: "OTEL_TRACES_EXPORTER", - Value: "otlp", - }, - { - Name: "OTEL_EXPORTER_OTLP_TRACES_PROTOCOL", + Name: "OTEL_EXPORTER_OTLP_PROTOCOL", Value: "http/protobuf", }, { - Name: "OTEL_METRICS_EXPORTER", + Name: "OTEL_TRACES_EXPORTER", Value: "otlp", }, { - Name: "OTEL_EXPORTER_OTLP_METRICS_PROTOCOL", - Value: "http/protobuf", + Name: "OTEL_METRICS_EXPORTER", + Value: "otlp", }, { Name: "OTEL_SERVICE_NAME", diff --git a/pkg/instrumentation/python.go b/pkg/instrumentation/python.go index ca51bbcd7c..d3cfc51ca4 100644 --- a/pkg/instrumentation/python.go +++ b/pkg/instrumentation/python.go @@ -23,16 +23,15 @@ import ( ) const ( - envPythonPath = "PYTHONPATH" - envOtelTracesExporter = "OTEL_TRACES_EXPORTER" - envOtelMetricsExporter = "OTEL_METRICS_EXPORTER" - envOtelExporterOTLPTracesProtocol = "OTEL_EXPORTER_OTLP_TRACES_PROTOCOL" - envOtelExporterOTLPMetricsProtocol = "OTEL_EXPORTER_OTLP_METRICS_PROTOCOL" - pythonPathPrefix = "/otel-auto-instrumentation-python/opentelemetry/instrumentation/auto_instrumentation" - pythonPathSuffix = "/otel-auto-instrumentation-python" - pythonInstrMountPath = "/otel-auto-instrumentation-python" - pythonVolumeName = volumeName + "-python" - pythonInitContainerName = initContainerName + "-python" + envPythonPath = "PYTHONPATH" + envOtelTracesExporter = "OTEL_TRACES_EXPORTER" + envOtelMetricsExporter = "OTEL_METRICS_EXPORTER" + envOtelExporterOTLPProtocol = "OTEL_EXPORTER_OTLP_PROTOCOL" + pythonPathPrefix = "/otel-auto-instrumentation-python/opentelemetry/instrumentation/auto_instrumentation" + pythonPathSuffix = "/otel-auto-instrumentation-python" + pythonInstrMountPath = "/otel-auto-instrumentation-python" + pythonVolumeName = volumeName + "-python" + pythonInitContainerName = initContainerName + "-python" ) func injectPythonSDK(pythonSpec v1alpha1.Python, pod corev1.Pod, index int) (corev1.Pod, error) { @@ -62,21 +61,21 @@ func injectPythonSDK(pythonSpec v1alpha1.Python, pod corev1.Pod, index int) (cor container.Env[idx].Value = fmt.Sprintf("%s:%s:%s", pythonPathPrefix, container.Env[idx].Value, pythonPathSuffix) } - // Set OTEL_TRACES_EXPORTER to HTTP exporter if not set by user because it is what our autoinstrumentation supports. - idx = getIndexOfEnv(container.Env, envOtelTracesExporter) + // Set OTEL_EXPORTER_OTLP_PROTOCOL to http/protobuf if not set by user because it is what our autoinstrumentation supports. + idx = getIndexOfEnv(container.Env, envOtelExporterOTLPProtocol) if idx == -1 { container.Env = append(container.Env, corev1.EnvVar{ - Name: envOtelTracesExporter, - Value: "otlp", + Name: envOtelExporterOTLPProtocol, + Value: "http/protobuf", }) } - // Set OTEL_EXPORTER_OTLP_TRACES_PROTOCOL to http/protobuf if not set by user because it is what our autoinstrumentation supports. - idx = getIndexOfEnv(container.Env, envOtelExporterOTLPTracesProtocol) + // Set OTEL_TRACES_EXPORTER to HTTP exporter if not set by user because it is what our autoinstrumentation supports. + idx = getIndexOfEnv(container.Env, envOtelTracesExporter) if idx == -1 { container.Env = append(container.Env, corev1.EnvVar{ - Name: envOtelExporterOTLPTracesProtocol, - Value: "http/protobuf", + Name: envOtelTracesExporter, + Value: "otlp", }) } @@ -89,15 +88,6 @@ func injectPythonSDK(pythonSpec v1alpha1.Python, pod corev1.Pod, index int) (cor }) } - // Set OTEL_EXPORTER_OTLP_METRICS_PROTOCOL to http/protobuf if not set by user because it is what our autoinstrumentation supports. - idx = getIndexOfEnv(container.Env, envOtelExporterOTLPMetricsProtocol) - if idx == -1 { - container.Env = append(container.Env, corev1.EnvVar{ - Name: envOtelExporterOTLPMetricsProtocol, - Value: "http/protobuf", - }) - } - container.VolumeMounts = append(container.VolumeMounts, corev1.VolumeMount{ Name: pythonVolumeName, MountPath: pythonInstrMountPath, diff --git a/pkg/instrumentation/python_test.go b/pkg/instrumentation/python_test.go index 04aa11c61a..2ced01bb07 100644 --- a/pkg/instrumentation/python_test.go +++ b/pkg/instrumentation/python_test.go @@ -79,20 +79,16 @@ func TestInjectPythonSDK(t *testing.T) { Value: fmt.Sprintf("%s:%s", "/otel-auto-instrumentation-python/opentelemetry/instrumentation/auto_instrumentation", "/otel-auto-instrumentation-python"), }, { - Name: "OTEL_TRACES_EXPORTER", - Value: "otlp", - }, - { - Name: "OTEL_EXPORTER_OTLP_TRACES_PROTOCOL", + Name: "OTEL_EXPORTER_OTLP_PROTOCOL", Value: "http/protobuf", }, { - Name: "OTEL_METRICS_EXPORTER", + Name: "OTEL_TRACES_EXPORTER", Value: "otlp", }, { - Name: "OTEL_EXPORTER_OTLP_METRICS_PROTOCOL", - Value: "http/protobuf", + Name: "OTEL_METRICS_EXPORTER", + Value: "otlp", }, }, }, @@ -156,20 +152,16 @@ func TestInjectPythonSDK(t *testing.T) { Value: fmt.Sprintf("%s:%s:%s", "/otel-auto-instrumentation-python/opentelemetry/instrumentation/auto_instrumentation", "/foo:/bar", "/otel-auto-instrumentation-python"), }, { - Name: "OTEL_TRACES_EXPORTER", - Value: "otlp", - }, - { - Name: "OTEL_EXPORTER_OTLP_TRACES_PROTOCOL", + Name: "OTEL_EXPORTER_OTLP_PROTOCOL", Value: "http/protobuf", }, { - Name: "OTEL_METRICS_EXPORTER", + Name: "OTEL_TRACES_EXPORTER", Value: "otlp", }, { - Name: "OTEL_EXPORTER_OTLP_METRICS_PROTOCOL", - Value: "http/protobuf", + Name: "OTEL_METRICS_EXPORTER", + Value: "otlp", }, }, }, @@ -236,17 +228,13 @@ func TestInjectPythonSDK(t *testing.T) { Value: fmt.Sprintf("%s:%s", "/otel-auto-instrumentation-python/opentelemetry/instrumentation/auto_instrumentation", "/otel-auto-instrumentation-python"), }, { - Name: "OTEL_EXPORTER_OTLP_TRACES_PROTOCOL", + Name: "OTEL_EXPORTER_OTLP_PROTOCOL", Value: "http/protobuf", }, { Name: "OTEL_METRICS_EXPORTER", Value: "otlp", }, - { - Name: "OTEL_EXPORTER_OTLP_METRICS_PROTOCOL", - Value: "http/protobuf", - }, }, }, }, @@ -311,17 +299,85 @@ func TestInjectPythonSDK(t *testing.T) { Name: "PYTHONPATH", Value: fmt.Sprintf("%s:%s", "/otel-auto-instrumentation-python/opentelemetry/instrumentation/auto_instrumentation", "/otel-auto-instrumentation-python"), }, + { + Name: "OTEL_EXPORTER_OTLP_PROTOCOL", + Value: "http/protobuf", + }, { Name: "OTEL_TRACES_EXPORTER", Value: "otlp", }, + }, + }, + }, + }, + }, + err: nil, + }, + { + name: "OTEL_EXPORTER_OTLP_PROTOCOL defined", + Python: v1alpha1.Python{Image: "foo/bar:1"}, + pod: corev1.Pod{ + Spec: corev1.PodSpec{ + Containers: []corev1.Container{ + { + Env: []corev1.EnvVar{ { - Name: "OTEL_EXPORTER_OTLP_TRACES_PROTOCOL", - Value: "http/protobuf", + Name: "OTEL_EXPORTER_OTLP_PROTOCOL", + Value: "somebackend", }, + }, + }, + }, + }, + }, + expected: corev1.Pod{ + Spec: corev1.PodSpec{ + Volumes: []corev1.Volume{ + { + Name: "opentelemetry-auto-instrumentation-python", + VolumeSource: corev1.VolumeSource{ + EmptyDir: &corev1.EmptyDirVolumeSource{ + SizeLimit: &defaultVolumeLimitSize, + }, + }, + }, + }, + InitContainers: []corev1.Container{ + { + Name: "opentelemetry-auto-instrumentation-python", + Image: "foo/bar:1", + Command: []string{"cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-python"}, + VolumeMounts: []corev1.VolumeMount{{ + Name: "opentelemetry-auto-instrumentation-python", + MountPath: "/otel-auto-instrumentation-python", + }}, + }, + }, + Containers: []corev1.Container{ + { + VolumeMounts: []corev1.VolumeMount{ { - Name: "OTEL_EXPORTER_OTLP_METRICS_PROTOCOL", - Value: "http/protobuf", + Name: "opentelemetry-auto-instrumentation-python", + MountPath: "/otel-auto-instrumentation-python", + }, + }, + Env: []corev1.EnvVar{ + { + Name: "OTEL_EXPORTER_OTLP_PROTOCOL", + Value: "somebackend", + }, + { + Name: "PYTHONPATH", + Value: fmt.Sprintf("%s:%s", "/otel-auto-instrumentation-python/opentelemetry/instrumentation/auto_instrumentation", "/otel-auto-instrumentation-python"), + }, + { + Name: "OTEL_TRACES_EXPORTER", + Value: "otlp", + }, + { + Name: "OTEL_METRICS_EXPORTER", + Value: "otlp", }, }, }, diff --git a/pkg/instrumentation/sdk_test.go b/pkg/instrumentation/sdk_test.go index 96346963dc..84859d3bc1 100644 --- a/pkg/instrumentation/sdk_test.go +++ b/pkg/instrumentation/sdk_test.go @@ -965,20 +965,16 @@ func TestInjectPython(t *testing.T) { Value: fmt.Sprintf("%s:%s", pythonPathPrefix, pythonPathSuffix), }, { - Name: "OTEL_TRACES_EXPORTER", - Value: "otlp", - }, - { - Name: "OTEL_EXPORTER_OTLP_TRACES_PROTOCOL", + Name: "OTEL_EXPORTER_OTLP_PROTOCOL", Value: "http/protobuf", }, { - Name: "OTEL_METRICS_EXPORTER", + Name: "OTEL_TRACES_EXPORTER", Value: "otlp", }, { - Name: "OTEL_EXPORTER_OTLP_METRICS_PROTOCOL", - Value: "http/protobuf", + Name: "OTEL_METRICS_EXPORTER", + Value: "otlp", }, { Name: "OTEL_SERVICE_NAME", diff --git a/tests/e2e-instrumentation/instrumentation-python-multicontainer/01-assert.yaml b/tests/e2e-instrumentation/instrumentation-python-multicontainer/01-assert.yaml index 84507895ad..5069eee345 100644 --- a/tests/e2e-instrumentation/instrumentation-python-multicontainer/01-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-python-multicontainer/01-assert.yaml @@ -20,14 +20,12 @@ spec: fieldPath: status.podIP - name: PYTHONPATH value: /otel-auto-instrumentation-python/opentelemetry/instrumentation/auto_instrumentation:/otel-auto-instrumentation-python + - name: OTEL_EXPORTER_OTLP_PROTOCOL + value: http/protobuf - name: OTEL_TRACES_EXPORTER value: otlp - - name: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL - value: http/protobuf - name: OTEL_METRICS_EXPORTER value: otlp - - name: OTEL_EXPORTER_OTLP_METRICS_PROTOCOL - value: http/protobuf - name: OTEL_EXPORTER_OTLP_ENDPOINT value: http://localhost:4317 - name: OTEL_EXPORTER_OTLP_TIMEOUT @@ -70,14 +68,12 @@ spec: fieldPath: status.podIP - name: PYTHONPATH value: /otel-auto-instrumentation-python/opentelemetry/instrumentation/auto_instrumentation:/otel-auto-instrumentation-python + - name: OTEL_EXPORTER_OTLP_PROTOCOL + value: http/protobuf - name: OTEL_TRACES_EXPORTER value: otlp - - name: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL - value: http/protobuf - name: OTEL_METRICS_EXPORTER value: otlp - - name: OTEL_EXPORTER_OTLP_METRICS_PROTOCOL - value: http/protobuf - name: OTEL_EXPORTER_OTLP_ENDPOINT value: http://localhost:4317 - name: OTEL_EXPORTER_OTLP_TIMEOUT diff --git a/tests/e2e-instrumentation/instrumentation-python-multicontainer/02-assert.yaml b/tests/e2e-instrumentation/instrumentation-python-multicontainer/02-assert.yaml index 7395299f3c..2916f799e6 100644 --- a/tests/e2e-instrumentation/instrumentation-python-multicontainer/02-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-python-multicontainer/02-assert.yaml @@ -31,14 +31,12 @@ spec: fieldPath: status.podIP - name: PYTHONPATH value: /otel-auto-instrumentation-python/opentelemetry/instrumentation/auto_instrumentation:/otel-auto-instrumentation-python + - name: OTEL_EXPORTER_OTLP_PROTOCOL + value: http/protobuf - name: OTEL_TRACES_EXPORTER value: otlp - - name: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL - value: http/protobuf - name: OTEL_METRICS_EXPORTER value: otlp - - name: OTEL_EXPORTER_OTLP_METRICS_PROTOCOL - value: http/protobuf - name: OTEL_EXPORTER_OTLP_ENDPOINT value: http://localhost:4317 - name: OTEL_EXPORTER_OTLP_TIMEOUT diff --git a/tests/e2e-instrumentation/instrumentation-python/01-assert.yaml b/tests/e2e-instrumentation/instrumentation-python/01-assert.yaml index c13213cd98..15a1009ced 100644 --- a/tests/e2e-instrumentation/instrumentation-python/01-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-python/01-assert.yaml @@ -25,12 +25,10 @@ spec: value: http://localhost:4318 - name: PYTHONPATH value: /otel-auto-instrumentation-python/opentelemetry/instrumentation/auto_instrumentation:/otel-auto-instrumentation-python - - name: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL + - name: OTEL_EXPORTER_OTLP_PROTOCOL value: http/protobuf - name: OTEL_METRICS_EXPORTER value: otlp - - name: OTEL_EXPORTER_OTLP_METRICS_PROTOCOL - value: http/protobuf - name: OTEL_EXPORTER_OTLP_TIMEOUT value: "20" - name: OTEL_TRACES_SAMPLER diff --git a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/01-assert.yaml b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/01-assert.yaml index 2b93ae7019..89ad0aa61e 100644 --- a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/01-assert.yaml +++ b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/01-assert.yaml @@ -166,14 +166,12 @@ spec: value: http://localhost:4318 - name: PYTHONPATH value: /otel-auto-instrumentation-python/opentelemetry/instrumentation/auto_instrumentation:/otel-auto-instrumentation-python + - name: OTEL_EXPORTER_OTLP_PROTOCOL + value: http/protobuf - name: OTEL_TRACES_EXPORTER value: otlp - - name: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL - value: http/protobuf - name: OTEL_METRICS_EXPORTER value: otlp - - name: OTEL_EXPORTER_OTLP_METRICS_PROTOCOL - value: http/protobuf - name: OTEL_TRACES_SAMPLER value: parentbased_traceidratio - name: OTEL_TRACES_SAMPLER_ARG From 3b1eac22a821b0e75ec0090431826b0362294e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20=C5=9Awi=C4=85tek?= Date: Wed, 21 Aug 2024 09:46:11 +0200 Subject: [PATCH 04/41] Bump prometheus-operator dependencies to 0.76.0 (#3229) --- cmd/otel-allocator/watcher/promOperator.go | 19 +++- .../watcher/promOperator_test.go | 8 +- go.mod | 38 ++++---- go.sum | 87 ++++++++++--------- 4 files changed, 86 insertions(+), 66 deletions(-) diff --git a/cmd/otel-allocator/watcher/promOperator.go b/cmd/otel-allocator/watcher/promOperator.go index 790c6c36cf..aa066a7468 100644 --- a/cmd/otel-allocator/watcher/promOperator.go +++ b/cmd/otel-allocator/watcher/promOperator.go @@ -17,9 +17,11 @@ package watcher import ( "context" "fmt" + "log/slog" "os" "time" + "github.com/blang/semver/v4" "github.com/go-kit/log" "github.com/go-kit/log/level" "github.com/go-logr/logr" @@ -68,6 +70,9 @@ func NewPrometheusCRWatcher(ctx context.Context, logger logr.Logger, cfg allocat return nil, err } + // we want to use endpointslices by default + serviceDiscoveryRole := monitoringv1.ServiceDiscoveryRole("EndpointSlice") + // TODO: We should make these durations configurable prom := &monitoringv1.Prometheus{ Spec: monitoringv1.PrometheusSpec{ @@ -77,11 +82,13 @@ func NewPrometheusCRWatcher(ctx context.Context, logger logr.Logger, cfg allocat PodMonitorSelector: cfg.PrometheusCR.PodMonitorSelector, ServiceMonitorNamespaceSelector: cfg.PrometheusCR.ServiceMonitorNamespaceSelector, PodMonitorNamespaceSelector: cfg.PrometheusCR.PodMonitorNamespaceSelector, + ServiceDiscoveryRole: &serviceDiscoveryRole, }, }, } promOperatorLogger := level.NewFilter(log.NewLogfmtLogger(os.Stderr), level.AllowWarn()) + promOperatorSlogLogger := slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: slog.LevelWarn})) generator, err := prometheus.NewConfigGenerator(promOperatorLogger, prom, true) if err != nil { @@ -97,9 +104,11 @@ func NewPrometheusCRWatcher(ctx context.Context, logger logr.Logger, cfg allocat nsMonInf, err := getNamespaceInformer(ctx, map[string]struct{}{v1.NamespaceAll: {}}, promOperatorLogger, clientset, operatorMetrics) if err != nil { logger.Error(err, "Failed to create namespace informer in promOperator CRD watcher") - } else { - resourceSelector = prometheus.NewResourceSelector(promOperatorLogger, prom, store, nsMonInf, operatorMetrics, eventRecorder) + resourceSelector, err = prometheus.NewResourceSelector(promOperatorSlogLogger, prom, store, nsMonInf, operatorMetrics, eventRecorder) + if err != nil { + logger.Error(err, "Failed to create resource selector in promOperator CRD watcher") + } } return &PrometheusCRWatcher{ @@ -141,10 +150,14 @@ func getNamespaceInformer(ctx context.Context, allowList map[string]struct{}, pr if err != nil { return nil, err } + kubernetesSemverVersion, err := semver.ParseTolerant(kubernetesVersion.String()) + if err != nil { + return nil, err + } lw, _, err := listwatch.NewNamespaceListWatchFromClient( ctx, promOperatorLogger, - *kubernetesVersion, + kubernetesSemverVersion, clientset.CoreV1(), clientset.AuthorizationV1().SelfSubjectAccessReviews(), allowList, diff --git a/cmd/otel-allocator/watcher/promOperator_test.go b/cmd/otel-allocator/watcher/promOperator_test.go index 180d34acd3..7bd3f0f443 100644 --- a/cmd/otel-allocator/watcher/promOperator_test.go +++ b/cmd/otel-allocator/watcher/promOperator_test.go @@ -16,6 +16,7 @@ package watcher import ( "context" + "log/slog" "os" "testing" "time" @@ -1085,6 +1086,8 @@ func getTestPrometheusCRWatcher(t *testing.T, svcMonitors []*monitoringv1.Servic t.Fatal(t, err) } + serviceDiscoveryRole := monitoringv1.ServiceDiscoveryRole("EndpointSlice") + prom := &monitoringv1.Prometheus{ Spec: monitoringv1.PrometheusSpec{ CommonPrometheusFields: monitoringv1.CommonPrometheusFields{ @@ -1093,11 +1096,13 @@ func getTestPrometheusCRWatcher(t *testing.T, svcMonitors []*monitoringv1.Servic PodMonitorSelector: cfg.PrometheusCR.PodMonitorSelector, ServiceMonitorNamespaceSelector: cfg.PrometheusCR.ServiceMonitorNamespaceSelector, PodMonitorNamespaceSelector: cfg.PrometheusCR.PodMonitorNamespaceSelector, + ServiceDiscoveryRole: &serviceDiscoveryRole, }, }, } promOperatorLogger := level.NewFilter(log.NewLogfmtLogger(os.Stderr), level.AllowWarn()) + promOperatorSlogLogger := slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: slog.LevelWarn})) generator, err := prometheus.NewConfigGenerator(promOperatorLogger, prom, true) if err != nil { @@ -1121,7 +1126,8 @@ func getTestPrometheusCRWatcher(t *testing.T, svcMonitors []*monitoringv1.Servic // create the shared informer and resync every 1s nsMonInf := cache.NewSharedInformer(source, &v1.Namespace{}, 1*time.Second).(cache.SharedIndexInformer) - resourceSelector := prometheus.NewResourceSelector(promOperatorLogger, prom, store, nsMonInf, operatorMetrics, eventRecorder) + resourceSelector, err := prometheus.NewResourceSelector(promOperatorSlogLogger, prom, store, nsMonInf, operatorMetrics, eventRecorder) + require.NoError(t, err) return &PrometheusCRWatcher{ kubeMonitoringClient: mClient, diff --git a/go.mod b/go.mod index 33a6fda4cb..38888e5089 100644 --- a/go.mod +++ b/go.mod @@ -20,9 +20,9 @@ require ( github.com/open-telemetry/opamp-go v0.15.0 github.com/openshift/api v0.0.0-20240124164020-e2ce40831f2e github.com/operator-framework/operator-lib v0.14.0 - github.com/prometheus-operator/prometheus-operator v0.75.0 - github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.75.2 - github.com/prometheus-operator/prometheus-operator/pkg/client v0.75.2 + github.com/prometheus-operator/prometheus-operator v0.76.0 + github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.76.0 + github.com/prometheus-operator/prometheus-operator/pkg/client v0.76.0 github.com/prometheus/client_golang v1.20.0 github.com/prometheus/common v0.55.0 github.com/prometheus/prometheus v0.54.0 @@ -47,8 +47,8 @@ require ( k8s.io/component-base v0.30.3 k8s.io/klog/v2 v2.130.1 k8s.io/kubectl v0.30.3 - k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 - sigs.k8s.io/controller-runtime v0.18.4 + k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 + sigs.k8s.io/controller-runtime v0.18.5 sigs.k8s.io/yaml v1.4.0 ) @@ -152,7 +152,7 @@ require ( github.com/josharian/intern v1.0.0 // indirect github.com/jpillora/backoff v1.0.0 // indirect github.com/klauspost/compress v1.17.9 // indirect - github.com/klauspost/cpuid/v2 v2.2.7 // indirect + github.com/klauspost/cpuid/v2 v2.2.8 // indirect github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/leodido/go-urn v1.4.0 // indirect @@ -177,7 +177,7 @@ require ( github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus-community/prom-label-proxy v0.10.0 // indirect + github.com/prometheus-community/prom-label-proxy v0.11.0 // indirect github.com/prometheus/alertmanager v0.27.0 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common/sigv4 v0.1.0 // indirect @@ -197,17 +197,17 @@ require ( go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/atomic v1.11.0 // indirect golang.org/x/arch v0.8.0 // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect - golang.org/x/mod v0.19.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/oauth2 v0.21.0 // indirect - golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/term v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect - golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.23.0 // indirect + golang.org/x/crypto v0.26.0 // indirect + golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect + golang.org/x/mod v0.20.0 // indirect + golang.org/x/net v0.28.0 // indirect + golang.org/x/oauth2 v0.22.0 // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.24.0 // indirect + golang.org/x/term v0.23.0 // indirect + golang.org/x/text v0.17.0 // indirect + golang.org/x/time v0.6.0 // indirect + golang.org/x/tools v0.24.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect google.golang.org/api v0.188.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d // indirect @@ -216,7 +216,7 @@ require ( google.golang.org/protobuf v1.34.2 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect - k8s.io/kube-openapi v0.0.0-20240620174524-b456828f718b // indirect + k8s.io/kube-openapi v0.0.0-20240808142205-8e686545bdb8 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect ) diff --git a/go.sum b/go.sum index 0f7de8b44a..b2de8d544b 100644 --- a/go.sum +++ b/go.sum @@ -307,8 +307,8 @@ github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20240711041743-f6c9dda6c6da h1:xRmpO92tb8y+Z85iUOMOicpCfaYcv7o3Cg3wKrIpg8g= -github.com/google/pprof v0.0.0-20240711041743-f6c9dda6c6da/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= +github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 h1:FKHo8hFI3A+7w0aUQuYXQ+6EN5stWmeY/AZqtM8xk9k= +github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= @@ -416,8 +416,8 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= -github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/cpuid/v2 v2.2.8 h1:+StwCXwm9PdpiEkPyzBXIy+M9KUb4ODm0Zarf1kS5BM= +github.com/klauspost/cpuid/v2 v2.2.8/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b h1:udzkj9S/zlT5X367kqJis0QP7YMxobob6zhzq6Yre00= github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b/go.mod h1:pcaDhQK0/NJZEvtCO0qQPPropqV0sJOJ6YW7X+9kRwM= @@ -493,10 +493,10 @@ github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/onsi/ginkgo/v2 v2.17.2 h1:7eMhcy3GimbsA3hEnVKdw/PQM9XN9krpKVXsZdph0/g= -github.com/onsi/ginkgo/v2 v2.17.2/go.mod h1:nP2DPOQoNsQmsVyv5rDA8JkXQoCs6goXIvr/PRJ1eCc= -github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= -github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= +github.com/onsi/ginkgo/v2 v2.20.0 h1:PE84V2mHqoT1sglvHc8ZdQtPcwmvvt29WLEEO3xmdZw= +github.com/onsi/ginkgo/v2 v2.20.0/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI= +github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k= +github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY= github.com/open-telemetry/opamp-go v0.15.0 h1:X2TWhEsGQ8GP7Uos3Ic9v/1aFUqoECZXKS7xAF5HqsA= github.com/open-telemetry/opamp-go v0.15.0/go.mod h1:QyPeN56JXlcZt5yG5RMdZ50Ju+zMFs1Ihy/hwHyF8Oo= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= @@ -527,14 +527,14 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= -github.com/prometheus-community/prom-label-proxy v0.10.0 h1:49S1uMRHuTUKoWU9Oj3hrKM2m8F3qkY3TPAOyKQnAVo= -github.com/prometheus-community/prom-label-proxy v0.10.0/go.mod h1:hUQJDmGpo2bVBA03jBur8vvicfA8dbJdDg5hCjPZPw8= -github.com/prometheus-operator/prometheus-operator v0.75.0 h1:ldUas8b691Pu/DnflWywCQkhRRzB/FKVfZ9EcvzdIo0= -github.com/prometheus-operator/prometheus-operator v0.75.0/go.mod h1:nGYa8UDIfPIh2vUf93JbS0GGucx/P6vRur0wPo2DM+s= -github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.75.2 h1:6UsAv+jAevuGO2yZFU/BukV4o9NKnFMOuoouSA4G0ns= -github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.75.2/go.mod h1:XYrdZw5dW12Cjkt4ndbeNZZTBp4UCHtW0ccR9+sTtPU= -github.com/prometheus-operator/prometheus-operator/pkg/client v0.75.2 h1:71GOmhZFA2/17maXqCcuJEzpJDyqPty8SpEOGZWyVec= -github.com/prometheus-operator/prometheus-operator/pkg/client v0.75.2/go.mod h1:Sv6XsfGGkR9gKnhP92F5dNXEpsSePn0W+7JwYP0NVkc= +github.com/prometheus-community/prom-label-proxy v0.11.0 h1:IO02WiiFMfcIqvjhwMbCYnDJiTNcSHBrkCGRQ/7KDd0= +github.com/prometheus-community/prom-label-proxy v0.11.0/go.mod h1:lfvrG70XqsxWDrSh1843QXBG0fSg8EbIXmAo8xGsvw8= +github.com/prometheus-operator/prometheus-operator v0.76.0 h1:EjGJiQVF3BUy/iygeRlN6iMBIAySMGZobEm7+7A95pI= +github.com/prometheus-operator/prometheus-operator v0.76.0/go.mod h1:y4PxsSBsOBwK1vXIw9U8DGLi8EptquItyP2IpqUtTGs= +github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.76.0 h1:tRwEFYFg+To2TGnibGl8dHBCh8Z/BVNKnXj2O5Za/2M= +github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.76.0/go.mod h1:Rd8YnCqz+2FYsiGmE2DMlaLjQRB4v2jFNnzCt9YY4IM= +github.com/prometheus-operator/prometheus-operator/pkg/client v0.76.0 h1:bJhRd6R4kaYBZpH7cBrzbJpEKJjHx8cbVW1n3dxYnag= +github.com/prometheus-operator/prometheus-operator/pkg/client v0.76.0/go.mod h1:Nu6G9XLApnqXqunMwMYulcHlaxRwoveH4p4WnZsBHD8= github.com/prometheus/alertmanager v0.27.0 h1:V6nTa2J5V4s8TG4C4HtrBP/WNSebCCTYGGv4qecA/+I= github.com/prometheus/alertmanager v0.27.0/go.mod h1:8Ia/R3urPmbzJ8OsdvmZvIprDwvwmYCmUbwBL+jlPOE= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -682,8 +682,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= +golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= +golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -694,8 +694,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY= -golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI= +golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDTwym6AYBu0qzT8AcHdI= +golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -718,8 +718,8 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8= -golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= +golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -760,16 +760,16 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= -golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= +golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -783,8 +783,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -844,16 +844,16 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= -golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk= -golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4= +golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= +golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -865,13 +865,14 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= +golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -917,8 +918,8 @@ golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg= -golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI= +golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= +golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1053,19 +1054,19 @@ k8s.io/component-base v0.30.3 h1:Ci0UqKWf4oiwy8hr1+E3dsnliKnkMLZMVbWzeorlk7s= k8s.io/component-base v0.30.3/go.mod h1:C1SshT3rGPCuNtBs14RmVD2xW0EhRSeLvBh7AGk1quA= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kube-openapi v0.0.0-20240620174524-b456828f718b h1:Q9xmGWBvOGd8UJyccgpYlLosk/JlfP3xQLNkQlHJeXw= -k8s.io/kube-openapi v0.0.0-20240620174524-b456828f718b/go.mod h1:UxDHUPsUwTOOxSU+oXURfFBcAS6JwiRXTYqYwfuGowc= +k8s.io/kube-openapi v0.0.0-20240808142205-8e686545bdb8 h1:1Wof1cGQgA5pqgo8MxKPtf+qN6Sh/0JzznmeGPm1HnE= +k8s.io/kube-openapi v0.0.0-20240808142205-8e686545bdb8/go.mod h1:Os6V6dZwLNii3vxFpxcNaTmH8LJJBkOTg1N0tOA0fvA= k8s.io/kubectl v0.30.3 h1:YIBBvMdTW0xcDpmrOBzcpUVsn+zOgjMYIu7kAq+yqiI= k8s.io/kubectl v0.30.3/go.mod h1:IcR0I9RN2+zzTRUa1BzZCm4oM0NLOawE6RzlDvd1Fpo= -k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 h1:jgGTlFYnhF1PM1Ax/lAlxUPE+KfCIXHaathvJg1C3ak= -k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= +k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -sigs.k8s.io/controller-runtime v0.18.4 h1:87+guW1zhvuPLh1PHybKdYFLU0YJp4FhJRmiHvm5BZw= -sigs.k8s.io/controller-runtime v0.18.4/go.mod h1:TVoGrfdpbA9VRFaRnKgk9P5/atA0pMwq+f+msb9M8Sg= +sigs.k8s.io/controller-runtime v0.18.5 h1:nTHio/W+Q4aBlQMgbnC5hZb4IjIidyrizMai9P6n4Rk= +sigs.k8s.io/controller-runtime v0.18.5/go.mod h1:TVoGrfdpbA9VRFaRnKgk9P5/atA0pMwq+f+msb9M8Sg= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= From a42426d2d54779aec1eb5314faf597ea7c664532 Mon Sep 17 00:00:00 2001 From: Jacob Aronoff Date: Wed, 21 Aug 2024 10:56:04 -0400 Subject: [PATCH 05/41] Create RFC template (#3193) * Create RFC template * include process doc * feedback * spacing * enumerate status --- docs/rfcs/README.md | 30 ++++++++++++++++++++++++++++ docs/rfcs/template.md | 46 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 docs/rfcs/README.md create mode 100644 docs/rfcs/template.md diff --git a/docs/rfcs/README.md b/docs/rfcs/README.md new file mode 100644 index 0000000000..d7cb97e225 --- /dev/null +++ b/docs/rfcs/README.md @@ -0,0 +1,30 @@ +# RFC Process + +The RFC process for the OpenTelemetry Operator exists so that community members can effectively review and understand +major decisions made by the Operator SIG. The RFC process also allows users to comment asynchronously on design +decisions. + +We aim to improve the experience for using OpenTelemetry tools in a Kubernetes +environment. Proposals here should only focus on improving that experience by composing existing +OpenTelemetry components such as the OpenTelemetry Collector, OpenTelemetry Instrumentation, OpAMP, etc. +If a proposal requires new components to exist that do not logically fit within that mission, it's recommended to +open proposals with the proper SIGs. + +## Process + +1. Copy and fill the [template.md](./template.md) document +2. Open a PR to get initial feedback on RFC +3. The RFC must be discussed at the Operator SIG Meeting at least once prior to merge +4. Upon merge, the RFC's status will still be Draft. At this point, the RFC has been accepted and an implementation +can be started + 1. The initial implementation's PR should change the status to accepted + 2. If any significant changes are made that deviate from the RFC, the RFC should be updated to reflect that + +## Recommendations + +During the RFC process, the [template.md](./template.md) must be filled out. We recommend also doing the following: + +* Include a proof-of-concept to confirm the design +* Share alternatives considered and tradeoffs + * A valid alternative to consider is always "do nothing" +* Pair with a SIG member to sort through unknowns / ask for help diff --git a/docs/rfcs/template.md b/docs/rfcs/template.md new file mode 100644 index 0000000000..8bd1d3712c --- /dev/null +++ b/docs/rfcs/template.md @@ -0,0 +1,46 @@ +# TITLE + +**Status:** [*Draft* | *Accepted*] + +**Author:** + +**Date:** + + +## Objective + +[comment]: # (Describe the objective for this proposal) + +## Summary + +[comment]: # (Summarize the design for the proposal) + +## Goals and non-goals + +[comment]: # (Describe the objective for this proposal) + +## Use cases for proposal + +### CASE 1 + +[comment]: # (Describe case #1) + +### CASE 2 + +[comment]: # (Describe case #2) + +### CASE N + +[comment]: # (Describe case #N) + +## Struct Design + +[comment]: # (Describe the go struct that will be introduced for this change, if applicable) + +## Rollout Plan + +[comment]: # (Describe how the change will be rolled out in the operator repo and for users) + +## Limitations + +[comment]: # (Describe the limitations and design decisions made here) From dbf5f0bb1e1002d34f2caeef79be76bfbced2da9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20=C5=9Awi=C4=85tek?= Date: Wed, 21 Aug 2024 19:11:07 +0200 Subject: [PATCH 06/41] Update @swiatekm's affiliation in the README (#3235) I now work for Elastic, and wanted to reflect that in the README. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d2a64dae70..1fbf1d5f4c 100644 --- a/README.md +++ b/README.md @@ -815,7 +815,7 @@ Emeritus Target Allocator Maintainers Maintainers ([@open-telemetry/operator-maintainers](https://github.com/orgs/open-telemetry/teams/operator-maintainers)): - [Jacob Aronoff](https://github.com/jaronoff97), Lightstep -- [Mikołaj Świątek](https://github.com/swiatekm), Sumo Logic +- [Mikołaj Świątek](https://github.com/swiatekm), Elastic - [Pavol Loffay](https://github.com/pavolloffay), Red Hat Emeritus Maintainers From 2866a95c19668de7eef7a37593fe5ba2ab470466 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20=C5=9Awi=C4=85tek?= Date: Thu, 22 Aug 2024 17:51:42 +0200 Subject: [PATCH 07/41] Bump k8s dependencies to 1.31.0 (#3234) Also bump controller-runtime to 0.19.0. --- Makefile | 2 +- ...emetry-operator.clusterserviceversion.yaml | 27 +- .../opentelemetry.io_instrumentations.yaml | 16 +- .../opentelemetry.io_opampbridges.yaml | 21 +- ...ntelemetry.io_opentelemetrycollectors.yaml | 72 +- ...emetry-operator.clusterserviceversion.yaml | 27 +- .../opentelemetry.io_instrumentations.yaml | 16 +- .../opentelemetry.io_opampbridges.yaml | 21 +- ...ntelemetry.io_opentelemetrycollectors.yaml | 72 +- .../opentelemetry.io_instrumentations.yaml | 16 +- .../bases/opentelemetry.io_opampbridges.yaml | 21 +- ...ntelemetry.io_opentelemetrycollectors.yaml | 72 +- .../opentelemetry.io_targetallocators.yaml | 33 +- config/rbac/role.yaml | 25 +- docs/api.md | 1409 +++++++++-------- go.mod | 20 +- go.sum | 40 +- ...tall-collectors-without-node-selector.yaml | 3 + .../chainsaw-test.yaml | 10 +- 19 files changed, 1130 insertions(+), 793 deletions(-) diff --git a/Makefile b/Makefile index b1f84e298e..cd614f1f20 100644 --- a/Makefile +++ b/Makefile @@ -437,7 +437,7 @@ GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint CHAINSAW ?= $(LOCALBIN)/chainsaw KUSTOMIZE_VERSION ?= v5.0.3 -CONTROLLER_TOOLS_VERSION ?= v0.14.0 +CONTROLLER_TOOLS_VERSION ?= v0.16.1 GOLANGCI_LINT_VERSION ?= v1.57.2 KIND_VERSION ?= v0.20.0 CHAINSAW_VERSION ?= v0.2.5 diff --git a/bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml b/bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml index 20925d2592..99cd4823de 100644 --- a/bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml +++ b/bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml @@ -99,7 +99,7 @@ metadata: categories: Logging & Tracing,Monitoring certified: "false" containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator - createdAt: "2024-08-14T11:18:29Z" + createdAt: "2024-08-21T12:36:08Z" description: Provides the OpenTelemetry components, including the Collector operators.operatorframework.io/builder: operator-sdk-v1.29.0 operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 @@ -378,6 +378,7 @@ spec: - opentelemetry.io resources: - instrumentations + - opentelemetrycollectors verbs: - get - list @@ -406,31 +407,7 @@ spec: - opentelemetry.io resources: - opampbridges/status - verbs: - - get - - patch - - update - - apiGroups: - - opentelemetry.io - resources: - - opentelemetrycollectors - verbs: - - get - - list - - patch - - update - - watch - - apiGroups: - - opentelemetry.io - resources: - opentelemetrycollectors/finalizers - verbs: - - get - - patch - - update - - apiGroups: - - opentelemetry.io - resources: - opentelemetrycollectors/status verbs: - get diff --git a/bundle/community/manifests/opentelemetry.io_instrumentations.yaml b/bundle/community/manifests/opentelemetry.io_instrumentations.yaml index a4da85a238..1aa55479f8 100644 --- a/bundle/community/manifests/opentelemetry.io_instrumentations.yaml +++ b/bundle/community/manifests/opentelemetry.io_instrumentations.yaml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 creationTimestamp: null labels: app.kubernetes.io/name: opentelemetry-operator @@ -189,6 +189,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -299,6 +301,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -478,6 +482,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -598,6 +604,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -774,6 +782,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -882,6 +892,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -1003,6 +1015,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object diff --git a/bundle/community/manifests/opentelemetry.io_opampbridges.yaml b/bundle/community/manifests/opentelemetry.io_opampbridges.yaml index f20a9de845..306375654e 100644 --- a/bundle/community/manifests/opentelemetry.io_opampbridges.yaml +++ b/bundle/community/manifests/opentelemetry.io_opampbridges.yaml @@ -3,7 +3,7 @@ kind: CustomResourceDefinition metadata: annotations: cert-manager.io/inject-ca-from: opentelemetry-operator-system/opentelemetry-operator-serving-cert - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 creationTimestamp: null labels: app.kubernetes.io/name: opentelemetry-operator @@ -679,6 +679,8 @@ spec: type: integer type: array x-kubernetes-list-type: atomic + supplementalGroupsPolicy: + type: string sysctls: items: properties: @@ -743,6 +745,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -965,10 +969,12 @@ spec: diskURI: type: string fsType: + default: ext4 type: string kind: type: string readOnly: + default: false type: boolean required: - diskName @@ -1345,6 +1351,13 @@ spec: required: - path type: object + image: + properties: + pullPolicy: + type: string + reference: + type: string + type: object iscsi: properties: chapAuthDiscovery: @@ -1358,6 +1371,7 @@ spec: iqn: type: string iscsiInterface: + default: default type: string lun: format: int32 @@ -1606,6 +1620,7 @@ spec: image: type: string keyring: + default: /etc/ceph/keyring type: string monitors: items: @@ -1613,6 +1628,7 @@ spec: type: array x-kubernetes-list-type: atomic pool: + default: rbd type: string readOnly: type: boolean @@ -1624,6 +1640,7 @@ spec: type: object x-kubernetes-map-type: atomic user: + default: admin type: string required: - image @@ -1632,6 +1649,7 @@ spec: scaleIO: properties: fsType: + default: xfs type: string gateway: type: string @@ -1649,6 +1667,7 @@ spec: sslEnabled: type: boolean storageMode: + default: ThinProvisioned type: string storagePool: type: string diff --git a/bundle/community/manifests/opentelemetry.io_opentelemetrycollectors.yaml b/bundle/community/manifests/opentelemetry.io_opentelemetrycollectors.yaml index 44c99242ad..594e0f4aea 100644 --- a/bundle/community/manifests/opentelemetry.io_opentelemetrycollectors.yaml +++ b/bundle/community/manifests/opentelemetry.io_opentelemetrycollectors.yaml @@ -3,7 +3,7 @@ kind: CustomResourceDefinition metadata: annotations: cert-manager.io/inject-ca-from: opentelemetry-operator-system/opentelemetry-operator-serving-cert - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 creationTimestamp: null labels: app.kubernetes.io/name: opentelemetry-operator @@ -322,6 +322,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -428,6 +429,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -509,6 +511,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -626,6 +630,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -1752,6 +1757,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -1858,6 +1864,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -1939,6 +1946,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -2056,6 +2065,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -2417,6 +2427,8 @@ spec: type: integer type: array x-kubernetes-list-type: atomic + supplementalGroupsPolicy: + type: string sysctls: items: properties: @@ -2483,6 +2495,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -3181,6 +3195,8 @@ spec: type: integer type: array x-kubernetes-list-type: atomic + supplementalGroupsPolicy: + type: string sysctls: items: properties: @@ -3233,6 +3249,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -3731,10 +3749,12 @@ spec: diskURI: type: string fsType: + default: ext4 type: string kind: type: string readOnly: + default: false type: boolean required: - diskName @@ -4111,6 +4131,13 @@ spec: required: - path type: object + image: + properties: + pullPolicy: + type: string + reference: + type: string + type: object iscsi: properties: chapAuthDiscovery: @@ -4124,6 +4151,7 @@ spec: iqn: type: string iscsiInterface: + default: default type: string lun: format: int32 @@ -4372,6 +4400,7 @@ spec: image: type: string keyring: + default: /etc/ceph/keyring type: string monitors: items: @@ -4379,6 +4408,7 @@ spec: type: array x-kubernetes-list-type: atomic pool: + default: rbd type: string readOnly: type: boolean @@ -4390,6 +4420,7 @@ spec: type: object x-kubernetes-map-type: atomic user: + default: admin type: string required: - image @@ -4398,6 +4429,7 @@ spec: scaleIO: properties: fsType: + default: xfs type: string gateway: type: string @@ -4415,6 +4447,7 @@ spec: sslEnabled: type: boolean storageMode: + default: ThinProvisioned type: string storagePool: type: string @@ -4489,6 +4522,9 @@ spec: type: object type: array x-kubernetes-list-type: atomic + required: + - config + - managementState type: object status: properties: @@ -4812,6 +4848,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -4918,6 +4955,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -4999,6 +5037,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -5116,6 +5156,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -6318,6 +6359,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -6424,6 +6466,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -6505,6 +6548,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -6622,6 +6667,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -7007,6 +7053,8 @@ spec: type: integer type: array x-kubernetes-list-type: atomic + supplementalGroupsPolicy: + type: string sysctls: items: properties: @@ -7094,6 +7142,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -7795,6 +7845,8 @@ spec: type: integer type: array x-kubernetes-list-type: atomic + supplementalGroupsPolicy: + type: string sysctls: items: properties: @@ -7891,6 +7943,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -8371,10 +8425,12 @@ spec: diskURI: type: string fsType: + default: ext4 type: string kind: type: string readOnly: + default: false type: boolean required: - diskName @@ -8751,6 +8807,13 @@ spec: required: - path type: object + image: + properties: + pullPolicy: + type: string + reference: + type: string + type: object iscsi: properties: chapAuthDiscovery: @@ -8764,6 +8827,7 @@ spec: iqn: type: string iscsiInterface: + default: default type: string lun: format: int32 @@ -9012,6 +9076,7 @@ spec: image: type: string keyring: + default: /etc/ceph/keyring type: string monitors: items: @@ -9019,6 +9084,7 @@ spec: type: array x-kubernetes-list-type: atomic pool: + default: rbd type: string readOnly: type: boolean @@ -9030,6 +9096,7 @@ spec: type: object x-kubernetes-map-type: atomic user: + default: admin type: string required: - image @@ -9038,6 +9105,7 @@ spec: scaleIO: properties: fsType: + default: xfs type: string gateway: type: string @@ -9055,6 +9123,7 @@ spec: sslEnabled: type: boolean storageMode: + default: ThinProvisioned type: string storagePool: type: string @@ -9131,6 +9200,7 @@ spec: x-kubernetes-list-type: atomic required: - config + - managementState type: object status: properties: diff --git a/bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml b/bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml index 8911d3ff28..36dc06f975 100644 --- a/bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml +++ b/bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml @@ -99,7 +99,7 @@ metadata: categories: Logging & Tracing,Monitoring certified: "false" containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator - createdAt: "2024-08-14T11:18:33Z" + createdAt: "2024-08-21T12:36:11Z" description: Provides the OpenTelemetry components, including the Collector operators.operatorframework.io/builder: operator-sdk-v1.29.0 operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 @@ -378,6 +378,7 @@ spec: - opentelemetry.io resources: - instrumentations + - opentelemetrycollectors verbs: - get - list @@ -406,31 +407,7 @@ spec: - opentelemetry.io resources: - opampbridges/status - verbs: - - get - - patch - - update - - apiGroups: - - opentelemetry.io - resources: - - opentelemetrycollectors - verbs: - - get - - list - - patch - - update - - watch - - apiGroups: - - opentelemetry.io - resources: - opentelemetrycollectors/finalizers - verbs: - - get - - patch - - update - - apiGroups: - - opentelemetry.io - resources: - opentelemetrycollectors/status verbs: - get diff --git a/bundle/openshift/manifests/opentelemetry.io_instrumentations.yaml b/bundle/openshift/manifests/opentelemetry.io_instrumentations.yaml index a4da85a238..1aa55479f8 100644 --- a/bundle/openshift/manifests/opentelemetry.io_instrumentations.yaml +++ b/bundle/openshift/manifests/opentelemetry.io_instrumentations.yaml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 creationTimestamp: null labels: app.kubernetes.io/name: opentelemetry-operator @@ -189,6 +189,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -299,6 +301,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -478,6 +482,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -598,6 +604,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -774,6 +782,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -882,6 +892,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -1003,6 +1015,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object diff --git a/bundle/openshift/manifests/opentelemetry.io_opampbridges.yaml b/bundle/openshift/manifests/opentelemetry.io_opampbridges.yaml index f20a9de845..306375654e 100644 --- a/bundle/openshift/manifests/opentelemetry.io_opampbridges.yaml +++ b/bundle/openshift/manifests/opentelemetry.io_opampbridges.yaml @@ -3,7 +3,7 @@ kind: CustomResourceDefinition metadata: annotations: cert-manager.io/inject-ca-from: opentelemetry-operator-system/opentelemetry-operator-serving-cert - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 creationTimestamp: null labels: app.kubernetes.io/name: opentelemetry-operator @@ -679,6 +679,8 @@ spec: type: integer type: array x-kubernetes-list-type: atomic + supplementalGroupsPolicy: + type: string sysctls: items: properties: @@ -743,6 +745,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -965,10 +969,12 @@ spec: diskURI: type: string fsType: + default: ext4 type: string kind: type: string readOnly: + default: false type: boolean required: - diskName @@ -1345,6 +1351,13 @@ spec: required: - path type: object + image: + properties: + pullPolicy: + type: string + reference: + type: string + type: object iscsi: properties: chapAuthDiscovery: @@ -1358,6 +1371,7 @@ spec: iqn: type: string iscsiInterface: + default: default type: string lun: format: int32 @@ -1606,6 +1620,7 @@ spec: image: type: string keyring: + default: /etc/ceph/keyring type: string monitors: items: @@ -1613,6 +1628,7 @@ spec: type: array x-kubernetes-list-type: atomic pool: + default: rbd type: string readOnly: type: boolean @@ -1624,6 +1640,7 @@ spec: type: object x-kubernetes-map-type: atomic user: + default: admin type: string required: - image @@ -1632,6 +1649,7 @@ spec: scaleIO: properties: fsType: + default: xfs type: string gateway: type: string @@ -1649,6 +1667,7 @@ spec: sslEnabled: type: boolean storageMode: + default: ThinProvisioned type: string storagePool: type: string diff --git a/bundle/openshift/manifests/opentelemetry.io_opentelemetrycollectors.yaml b/bundle/openshift/manifests/opentelemetry.io_opentelemetrycollectors.yaml index 44c99242ad..594e0f4aea 100644 --- a/bundle/openshift/manifests/opentelemetry.io_opentelemetrycollectors.yaml +++ b/bundle/openshift/manifests/opentelemetry.io_opentelemetrycollectors.yaml @@ -3,7 +3,7 @@ kind: CustomResourceDefinition metadata: annotations: cert-manager.io/inject-ca-from: opentelemetry-operator-system/opentelemetry-operator-serving-cert - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 creationTimestamp: null labels: app.kubernetes.io/name: opentelemetry-operator @@ -322,6 +322,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -428,6 +429,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -509,6 +511,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -626,6 +630,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -1752,6 +1757,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -1858,6 +1864,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -1939,6 +1946,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -2056,6 +2065,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -2417,6 +2427,8 @@ spec: type: integer type: array x-kubernetes-list-type: atomic + supplementalGroupsPolicy: + type: string sysctls: items: properties: @@ -2483,6 +2495,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -3181,6 +3195,8 @@ spec: type: integer type: array x-kubernetes-list-type: atomic + supplementalGroupsPolicy: + type: string sysctls: items: properties: @@ -3233,6 +3249,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -3731,10 +3749,12 @@ spec: diskURI: type: string fsType: + default: ext4 type: string kind: type: string readOnly: + default: false type: boolean required: - diskName @@ -4111,6 +4131,13 @@ spec: required: - path type: object + image: + properties: + pullPolicy: + type: string + reference: + type: string + type: object iscsi: properties: chapAuthDiscovery: @@ -4124,6 +4151,7 @@ spec: iqn: type: string iscsiInterface: + default: default type: string lun: format: int32 @@ -4372,6 +4400,7 @@ spec: image: type: string keyring: + default: /etc/ceph/keyring type: string monitors: items: @@ -4379,6 +4408,7 @@ spec: type: array x-kubernetes-list-type: atomic pool: + default: rbd type: string readOnly: type: boolean @@ -4390,6 +4420,7 @@ spec: type: object x-kubernetes-map-type: atomic user: + default: admin type: string required: - image @@ -4398,6 +4429,7 @@ spec: scaleIO: properties: fsType: + default: xfs type: string gateway: type: string @@ -4415,6 +4447,7 @@ spec: sslEnabled: type: boolean storageMode: + default: ThinProvisioned type: string storagePool: type: string @@ -4489,6 +4522,9 @@ spec: type: object type: array x-kubernetes-list-type: atomic + required: + - config + - managementState type: object status: properties: @@ -4812,6 +4848,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -4918,6 +4955,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -4999,6 +5037,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -5116,6 +5156,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -6318,6 +6359,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -6424,6 +6466,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -6505,6 +6548,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -6622,6 +6667,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -7007,6 +7053,8 @@ spec: type: integer type: array x-kubernetes-list-type: atomic + supplementalGroupsPolicy: + type: string sysctls: items: properties: @@ -7094,6 +7142,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -7795,6 +7845,8 @@ spec: type: integer type: array x-kubernetes-list-type: atomic + supplementalGroupsPolicy: + type: string sysctls: items: properties: @@ -7891,6 +7943,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -8371,10 +8425,12 @@ spec: diskURI: type: string fsType: + default: ext4 type: string kind: type: string readOnly: + default: false type: boolean required: - diskName @@ -8751,6 +8807,13 @@ spec: required: - path type: object + image: + properties: + pullPolicy: + type: string + reference: + type: string + type: object iscsi: properties: chapAuthDiscovery: @@ -8764,6 +8827,7 @@ spec: iqn: type: string iscsiInterface: + default: default type: string lun: format: int32 @@ -9012,6 +9076,7 @@ spec: image: type: string keyring: + default: /etc/ceph/keyring type: string monitors: items: @@ -9019,6 +9084,7 @@ spec: type: array x-kubernetes-list-type: atomic pool: + default: rbd type: string readOnly: type: boolean @@ -9030,6 +9096,7 @@ spec: type: object x-kubernetes-map-type: atomic user: + default: admin type: string required: - image @@ -9038,6 +9105,7 @@ spec: scaleIO: properties: fsType: + default: xfs type: string gateway: type: string @@ -9055,6 +9123,7 @@ spec: sslEnabled: type: boolean storageMode: + default: ThinProvisioned type: string storagePool: type: string @@ -9131,6 +9200,7 @@ spec: x-kubernetes-list-type: atomic required: - config + - managementState type: object status: properties: diff --git a/config/crd/bases/opentelemetry.io_instrumentations.yaml b/config/crd/bases/opentelemetry.io_instrumentations.yaml index 3a25df25ae..8005608fa5 100644 --- a/config/crd/bases/opentelemetry.io_instrumentations.yaml +++ b/config/crd/bases/opentelemetry.io_instrumentations.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: instrumentations.opentelemetry.io spec: group: opentelemetry.io @@ -187,6 +187,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -297,6 +299,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -476,6 +480,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -596,6 +602,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -772,6 +780,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -880,6 +890,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -1001,6 +1013,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object diff --git a/config/crd/bases/opentelemetry.io_opampbridges.yaml b/config/crd/bases/opentelemetry.io_opampbridges.yaml index 7e789c115f..5d37004d5e 100644 --- a/config/crd/bases/opentelemetry.io_opampbridges.yaml +++ b/config/crd/bases/opentelemetry.io_opampbridges.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: opampbridges.opentelemetry.io spec: group: opentelemetry.io @@ -676,6 +676,8 @@ spec: type: integer type: array x-kubernetes-list-type: atomic + supplementalGroupsPolicy: + type: string sysctls: items: properties: @@ -740,6 +742,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -962,10 +966,12 @@ spec: diskURI: type: string fsType: + default: ext4 type: string kind: type: string readOnly: + default: false type: boolean required: - diskName @@ -1342,6 +1348,13 @@ spec: required: - path type: object + image: + properties: + pullPolicy: + type: string + reference: + type: string + type: object iscsi: properties: chapAuthDiscovery: @@ -1355,6 +1368,7 @@ spec: iqn: type: string iscsiInterface: + default: default type: string lun: format: int32 @@ -1603,6 +1617,7 @@ spec: image: type: string keyring: + default: /etc/ceph/keyring type: string monitors: items: @@ -1610,6 +1625,7 @@ spec: type: array x-kubernetes-list-type: atomic pool: + default: rbd type: string readOnly: type: boolean @@ -1621,6 +1637,7 @@ spec: type: object x-kubernetes-map-type: atomic user: + default: admin type: string required: - image @@ -1629,6 +1646,7 @@ spec: scaleIO: properties: fsType: + default: xfs type: string gateway: type: string @@ -1646,6 +1664,7 @@ spec: sslEnabled: type: boolean storageMode: + default: ThinProvisioned type: string storagePool: type: string diff --git a/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml b/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml index 08a229c1fa..05baaaa5df 100644 --- a/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml +++ b/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: opentelemetrycollectors.opentelemetry.io spec: group: opentelemetry.io @@ -308,6 +308,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -414,6 +415,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -495,6 +497,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -612,6 +616,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -1738,6 +1743,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -1844,6 +1850,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -1925,6 +1932,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -2042,6 +2051,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -2403,6 +2413,8 @@ spec: type: integer type: array x-kubernetes-list-type: atomic + supplementalGroupsPolicy: + type: string sysctls: items: properties: @@ -2469,6 +2481,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -3167,6 +3181,8 @@ spec: type: integer type: array x-kubernetes-list-type: atomic + supplementalGroupsPolicy: + type: string sysctls: items: properties: @@ -3219,6 +3235,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -3717,10 +3735,12 @@ spec: diskURI: type: string fsType: + default: ext4 type: string kind: type: string readOnly: + default: false type: boolean required: - diskName @@ -4097,6 +4117,13 @@ spec: required: - path type: object + image: + properties: + pullPolicy: + type: string + reference: + type: string + type: object iscsi: properties: chapAuthDiscovery: @@ -4110,6 +4137,7 @@ spec: iqn: type: string iscsiInterface: + default: default type: string lun: format: int32 @@ -4358,6 +4386,7 @@ spec: image: type: string keyring: + default: /etc/ceph/keyring type: string monitors: items: @@ -4365,6 +4394,7 @@ spec: type: array x-kubernetes-list-type: atomic pool: + default: rbd type: string readOnly: type: boolean @@ -4376,6 +4406,7 @@ spec: type: object x-kubernetes-map-type: atomic user: + default: admin type: string required: - image @@ -4384,6 +4415,7 @@ spec: scaleIO: properties: fsType: + default: xfs type: string gateway: type: string @@ -4401,6 +4433,7 @@ spec: sslEnabled: type: boolean storageMode: + default: ThinProvisioned type: string storagePool: type: string @@ -4475,6 +4508,9 @@ spec: type: object type: array x-kubernetes-list-type: atomic + required: + - config + - managementState type: object status: properties: @@ -4798,6 +4834,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -4904,6 +4941,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -4985,6 +5023,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -5102,6 +5142,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -6304,6 +6345,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -6410,6 +6452,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -6491,6 +6534,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -6608,6 +6653,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -6993,6 +7039,8 @@ spec: type: integer type: array x-kubernetes-list-type: atomic + supplementalGroupsPolicy: + type: string sysctls: items: properties: @@ -7080,6 +7128,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -7781,6 +7831,8 @@ spec: type: integer type: array x-kubernetes-list-type: atomic + supplementalGroupsPolicy: + type: string sysctls: items: properties: @@ -7877,6 +7929,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -8357,10 +8411,12 @@ spec: diskURI: type: string fsType: + default: ext4 type: string kind: type: string readOnly: + default: false type: boolean required: - diskName @@ -8737,6 +8793,13 @@ spec: required: - path type: object + image: + properties: + pullPolicy: + type: string + reference: + type: string + type: object iscsi: properties: chapAuthDiscovery: @@ -8750,6 +8813,7 @@ spec: iqn: type: string iscsiInterface: + default: default type: string lun: format: int32 @@ -8998,6 +9062,7 @@ spec: image: type: string keyring: + default: /etc/ceph/keyring type: string monitors: items: @@ -9005,6 +9070,7 @@ spec: type: array x-kubernetes-list-type: atomic pool: + default: rbd type: string readOnly: type: boolean @@ -9016,6 +9082,7 @@ spec: type: object x-kubernetes-map-type: atomic user: + default: admin type: string required: - image @@ -9024,6 +9091,7 @@ spec: scaleIO: properties: fsType: + default: xfs type: string gateway: type: string @@ -9041,6 +9109,7 @@ spec: sslEnabled: type: boolean storageMode: + default: ThinProvisioned type: string storagePool: type: string @@ -9117,6 +9186,7 @@ spec: x-kubernetes-list-type: atomic required: - config + - managementState type: object status: properties: diff --git a/config/crd/bases/opentelemetry.io_targetallocators.yaml b/config/crd/bases/opentelemetry.io_targetallocators.yaml index 42cbd7c934..5ce85e459c 100644 --- a/config/crd/bases/opentelemetry.io_targetallocators.yaml +++ b/config/crd/bases/opentelemetry.io_targetallocators.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: targetallocators.opentelemetry.io spec: group: opentelemetry.io @@ -280,6 +280,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -386,6 +387,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -467,6 +469,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -584,6 +588,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -1510,6 +1515,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -1616,6 +1622,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -1697,6 +1704,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -1814,6 +1823,7 @@ spec: format: int32 type: integer service: + default: "" type: string required: - port @@ -2171,6 +2181,8 @@ spec: type: integer type: array x-kubernetes-list-type: atomic + supplementalGroupsPolicy: + type: string sysctls: items: properties: @@ -2298,6 +2310,8 @@ spec: properties: name: type: string + request: + type: string required: - name type: object @@ -2526,10 +2540,12 @@ spec: diskURI: type: string fsType: + default: ext4 type: string kind: type: string readOnly: + default: false type: boolean required: - diskName @@ -2906,6 +2922,13 @@ spec: required: - path type: object + image: + properties: + pullPolicy: + type: string + reference: + type: string + type: object iscsi: properties: chapAuthDiscovery: @@ -2919,6 +2942,7 @@ spec: iqn: type: string iscsiInterface: + default: default type: string lun: format: int32 @@ -3167,6 +3191,7 @@ spec: image: type: string keyring: + default: /etc/ceph/keyring type: string monitors: items: @@ -3174,6 +3199,7 @@ spec: type: array x-kubernetes-list-type: atomic pool: + default: rbd type: string readOnly: type: boolean @@ -3185,6 +3211,7 @@ spec: type: object x-kubernetes-map-type: atomic user: + default: admin type: string required: - image @@ -3193,6 +3220,7 @@ spec: scaleIO: properties: fsType: + default: xfs type: string gateway: type: string @@ -3210,6 +3238,7 @@ spec: sslEnabled: type: boolean storageMode: + default: ThinProvisioned type: string storagePool: type: string @@ -3284,6 +3313,8 @@ spec: type: object type: array x-kubernetes-list-type: atomic + required: + - managementState type: object status: properties: diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 7f896580e3..2f92fb087b 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -124,6 +124,7 @@ rules: - opentelemetry.io resources: - instrumentations + - opentelemetrycollectors verbs: - get - list @@ -152,31 +153,7 @@ rules: - opentelemetry.io resources: - opampbridges/status - verbs: - - get - - patch - - update -- apiGroups: - - opentelemetry.io - resources: - - opentelemetrycollectors - verbs: - - get - - list - - patch - - update - - watch -- apiGroups: - - opentelemetry.io - resources: - opentelemetrycollectors/finalizers - verbs: - - get - - patch - - update -- apiGroups: - - opentelemetry.io - resources: - opentelemetrycollectors/status verbs: - get diff --git a/docs/api.md b/docs/api.md index 103258832f..7e84600c32 100644 --- a/docs/api.md +++ b/docs/api.md @@ -388,9 +388,7 @@ Selects a key of a ConfigMap. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -514,9 +512,7 @@ Selects a key of a secret in the pod's namespace This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -662,9 +658,7 @@ Selects a key of a ConfigMap. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -788,9 +782,7 @@ Selects a key of a secret in the pod's namespace This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -829,11 +821,9 @@ Resources describes the compute resource requirements. Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container. - This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. - This field is immutable. It can only be set for containers.
false @@ -884,6 +874,15 @@ the Pod where this field is used. It makes that resource available inside a container.
true + + request + string + + Request is the name chosen for a request in the referenced claim. +If empty, everything from the claim is made available, otherwise +only the result of this request.
+ + false @@ -1069,9 +1068,7 @@ Selects a key of a ConfigMap. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -1195,9 +1192,7 @@ Selects a key of a secret in the pod's namespace This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -1236,11 +1231,9 @@ Resources describes the compute resource requirements. Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container. - This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. - This field is immutable. It can only be set for containers.
false @@ -1291,6 +1284,15 @@ the Pod where this field is used. It makes that resource available inside a container.
true + + request + string + + Request is the name chosen for a request in the referenced claim. +If empty, everything from the claim is made available, otherwise +only the result of this request.
+ + false @@ -1425,9 +1427,7 @@ Selects a key of a ConfigMap. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -1551,9 +1551,7 @@ Selects a key of a secret in the pod's namespace This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -1780,9 +1778,7 @@ Selects a key of a ConfigMap. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -1906,9 +1902,7 @@ Selects a key of a secret in the pod's namespace This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -1947,11 +1941,9 @@ Resources describes the compute resource requirements. Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container. - This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. - This field is immutable. It can only be set for containers.
false @@ -2002,6 +1994,15 @@ the Pod where this field is used. It makes that resource available inside a container.
true + + request + string + + Request is the name chosen for a request in the referenced claim. +If empty, everything from the claim is made available, otherwise +only the result of this request.
+ + false @@ -2195,9 +2196,7 @@ Selects a key of a ConfigMap. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -2321,9 +2320,7 @@ Selects a key of a secret in the pod's namespace This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -2396,11 +2393,9 @@ Resources describes the compute resource requirements. Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container. - This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. - This field is immutable. It can only be set for containers.
false @@ -2451,6 +2446,15 @@ the Pod where this field is used. It makes that resource available inside a container.
true + + request + string + + Request is the name chosen for a request in the referenced claim. +If empty, everything from the claim is made available, otherwise +only the result of this request.
+ + false @@ -2653,9 +2657,7 @@ Selects a key of a ConfigMap. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -2779,9 +2781,7 @@ Selects a key of a secret in the pod's namespace This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -2927,9 +2927,7 @@ Selects a key of a ConfigMap. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -3053,9 +3051,7 @@ Selects a key of a secret in the pod's namespace This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -3094,11 +3090,9 @@ Resources describes the compute resource requirements. Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container. - This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. - This field is immutable. It can only be set for containers.
false @@ -3149,6 +3143,15 @@ the Pod where this field is used. It makes that resource available inside a container.
true + + request + string + + Request is the name chosen for a request in the referenced claim. +If empty, everything from the claim is made available, otherwise +only the result of this request.
+ + false @@ -3334,9 +3337,7 @@ Selects a key of a ConfigMap. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -3460,9 +3461,7 @@ Selects a key of a secret in the pod's namespace This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -3501,11 +3500,9 @@ Resources describes the compute resource requirements. Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container. - This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. - This field is immutable. It can only be set for containers.
false @@ -3556,6 +3553,15 @@ the Pod where this field is used. It makes that resource available inside a container.
true + + request + string + + Request is the name chosen for a request in the referenced claim. +If empty, everything from the claim is made available, otherwise +only the result of this request.
+ + false @@ -3741,9 +3747,7 @@ Selects a key of a ConfigMap. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -3867,9 +3871,7 @@ Selects a key of a secret in the pod's namespace This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -3908,11 +3910,9 @@ Resources describes the compute resource requirements. Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container. - This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. - This field is immutable. It can only be set for containers.
false @@ -3963,6 +3963,15 @@ the Pod where this field is used. It makes that resource available inside a container.
true + + request + string + + Request is the name chosen for a request in the referenced claim. +If empty, everything from the claim is made available, otherwise +only the result of this request.
+ + false @@ -4864,7 +4873,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -4879,7 +4888,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -5128,7 +5137,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -5143,7 +5152,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -5472,7 +5481,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -5487,7 +5496,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -5736,7 +5745,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -5751,7 +5760,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -6078,9 +6087,7 @@ Selects a key of a ConfigMap. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -6204,9 +6211,7 @@ Selects a key of a secret in the pod's namespace This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -6287,9 +6292,7 @@ The ConfigMap to select from This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -6329,9 +6332,7 @@ The Secret to select from This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -6461,12 +6462,10 @@ Note that this field cannot be set when spec.os.name is windows.
Some volume types allow the Kubelet to change the ownership of that volume to be owned by the pod: - 1. The owning GID will be the FSGroup 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) 3. The permission bits are OR'd with rw-rw---- - If unset, the Kubelet will not modify the ownership and permissions of any volume. Note that this field cannot be set when spec.os.name is windows.

@@ -6550,12 +6549,25 @@ Note that this field cannot be set when spec.os.name is windows.
supplementalGroups []integer - A list of groups applied to the first process run in each container, in addition -to the container's primary GID, the fsGroup (if specified), and group memberships -defined in the container image for the uid of the container process. If unspecified, -no additional groups are added to any container. Note that group memberships -defined in the container image for the uid of the container process are still effective, -even if they are not included in this list. + A list of groups applied to the first process run in each container, in +addition to the container's primary GID and fsGroup (if specified). If +the SupplementalGroupsPolicy feature is enabled, the +supplementalGroupsPolicy field determines whether these are in addition +to or instead of any group memberships defined in the container image. +If unspecified, no additional groups are added, though group memberships +defined in the container image may still be used, depending on the +supplementalGroupsPolicy field. +Note that this field cannot be set when spec.os.name is windows.
+ + false + + supplementalGroupsPolicy + string + + Defines how supplemental groups of the first container processes are calculated. +Valid values are "Merge" and "Strict". If not specified, "Merge" is used. +(Alpha) Using the field requires the SupplementalGroupsPolicy feature gate to be enabled +and the container runtime must implement support for this feature. Note that this field cannot be set when spec.os.name is windows.
false @@ -6701,7 +6713,6 @@ Note that this field cannot be set when spec.os.name is windows. type indicates which kind of seccomp profile will be applied. Valid options are: - Localhost - a profile defined in a file on the node should be used. RuntimeDefault - the container runtime default profile should be used. Unconfined - no profile should be applied.
@@ -6848,17 +6859,14 @@ This is used as a hint for implementations to offer richer behavior for protocol This field follows standard Kubernetes label syntax. Valid values are either: - * Un-prefixed protocol names - reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). - * Kubernetes-defined prefixed names: * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 - * Other protocols should use implementation-defined prefixed names such as mycompany.com/my-custom-protocol.
@@ -6942,11 +6950,9 @@ Resources to set on the OpAMPBridge pods. Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container. - This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. - This field is immutable. It can only be set for containers.
false @@ -6997,6 +7003,15 @@ the Pod where this field is used. It makes that resource available inside a container.
true + + request + string + + Request is the name chosen for a request in the referenced claim. +If empty, everything from the claim is made available, otherwise +only the result of this request.
+ + false @@ -7063,7 +7078,7 @@ Note that this field cannot be set when spec.os.name is windows.
string procMount denotes the type of proc mount to use for the containers. -The default is DefaultProcMount which uses the container runtime defaults for +The default value is Default which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled. Note that this field cannot be set when spec.os.name is windows.
@@ -7308,7 +7323,6 @@ Note that this field cannot be set when spec.os.name is windows. type indicates which kind of seccomp profile will be applied. Valid options are: - Localhost - a profile defined in a file on the node should be used. RuntimeDefault - the container runtime default profile should be used. Unconfined - no profile should be applied.
@@ -7557,7 +7571,6 @@ MatchLabelKeys cannot be set when LabelSelector isn't set. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. - This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default).
false @@ -7576,7 +7589,6 @@ If value is nil, the constraint behaves as if MinDomains is equal to 1. Valid values are integers greater than 0. When value is not nil, WhenUnsatisfiable must be DoNotSchedule. - For example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains is set to 5 and pods with the same labelSelector spread as 2/2/2: | zone1 | zone2 | zone3 | @@ -7598,7 +7610,6 @@ when calculating pod topology spread skew. Options are: - Honor: only nodes matching nodeAffinity/nodeSelector are included in the calculations. - Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations. - If this value is nil, the behavior is equivalent to the Honor policy. This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag.
@@ -7613,7 +7624,6 @@ pod topology spread skew. Options are: has a toleration, are included. - Ignore: node taints are ignored. All nodes are included. - If this value is nil, the behavior is equivalent to the Ignore policy. This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag.
@@ -7764,10 +7774,8 @@ Defaults to false.
RecursiveReadOnly specifies whether read-only mounts should be handled recursively. - If ReadOnly is false, this field has no meaning and must be unspecified. - If ReadOnly is true, and this field is set to Disabled, the mount is not made recursively read-only. If this field is set to IfPossible, the mount is made recursively read-only, if it is supported by the container runtime. If this @@ -7775,11 +7783,9 @@ field is set to Enabled, the mount is made recursively read-only if it is supported by the container runtime, otherwise the pod will not be started and an error will be generated to indicate the reason. - If this field is set to IfPossible or Enabled, MountPropagation must be set to None (or be unspecified, which defaults to None). - If this field is not specified, it is treated as an equivalent of Disabled.
false @@ -7905,7 +7911,6 @@ More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir
The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, and deleted when the pod is removed. - Use this if: a) the volume is only needed while the pod runs, b) features of normal volumes like restoring from snapshot or capacity @@ -7916,17 +7921,14 @@ d) the storage driver supports dynamic volume provisioning through information on the connection between this volume type and PersistentVolumeClaim). - Use PersistentVolumeClaim or one of the vendor-specific APIs for volumes that persist for longer than the lifecycle of an individual pod. - Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to be used that way - see the documentation of the driver for more information. - A pod can use both types of ephemeral volumes and persistent volumes at the same time.
@@ -7988,10 +7990,22 @@ More info: https://examples.k8s.io/volumes/glusterfs/README.md
machine that is directly exposed to the container. This is generally used for system agents or other privileged things that are allowed to see the host machine. Most containers will NOT need this. -More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath ---- -TODO(jonesdl) We need to restrict who can use host directory mounts and who can/can not -mount host directories as read/write.
+More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath
+ + false + + image + object + + image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine. +The volume is resolved at pod startup depending on which PullPolicy value is provided: + +- Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. +- Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. +- IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. + +The volume gets re-resolved if the pod gets deleted and recreated, which means that new remote content will become available on pod recreation. +A failure to resolve or pull the image during pod startup will block containers from starting and may add significant latency. Failures will be retried using normal volume backoff and will be reported on the pod reason and message.
false @@ -8122,8 +8136,7 @@ More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockst fsType is the filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. -More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore -TODO: how do we prevent errors in the filesystem from compromising the machine
+More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
false @@ -8194,6 +8207,8 @@ azureDisk represents an Azure Data Disk mount on the host and bind mount to the fsType is Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
+
+ Default: ext4
false @@ -8209,6 +8224,8 @@ Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
readOnly Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.
+
+ Default: false
false @@ -8350,9 +8367,7 @@ More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -8442,9 +8457,7 @@ to OpenStack. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -8505,9 +8518,7 @@ relative and may not contain the '..' path or start with '..'.
This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -8666,9 +8677,7 @@ secret object contains more than one secret, all secret references are passed. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -8904,7 +8913,6 @@ ephemeral represents a volume that is handled by a cluster storage driver. The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, and deleted when the pod is removed. - Use this if: a) the volume is only needed while the pod runs, b) features of normal volumes like restoring from snapshot or capacity @@ -8915,17 +8923,14 @@ d) the storage driver supports dynamic volume provisioning through information on the connection between this volume type and PersistentVolumeClaim). - Use PersistentVolumeClaim or one of the vendor-specific APIs for volumes that persist for longer than the lifecycle of an individual pod. - Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to be used that way - see the documentation of the driver for more information. - A pod can use both types of ephemeral volumes and persistent volumes at the same time. @@ -8950,7 +8955,6 @@ pod. The name of the PVC will be `-` where entry. Pod validation will reject the pod if the concatenated name is not valid for a PVC (for example, too long). - An existing PVC with that name that is not owned by the pod will *not* be used for the pod to avoid using an unrelated volume by mistake. Starting the pod is then blocked until @@ -8960,11 +8964,9 @@ owner reference to the pod once the pod exists. Normally this should not be necessary, but it may be useful when manually reconstructing a broken cluster. - This field is read-only and no changes will be made by Kubernetes to the PVC after it has been created. - Required, must not be nil.
false @@ -8985,7 +8987,6 @@ pod. The name of the PVC will be `-` where entry. Pod validation will reject the pod if the concatenated name is not valid for a PVC (for example, too long). - An existing PVC with that name that is not owned by the pod will *not* be used for the pod to avoid using an unrelated volume by mistake. Starting the pod is then blocked until @@ -8995,11 +8996,9 @@ owner reference to the pod once the pod exists. Normally this should not be necessary, but it may be useful when manually reconstructing a broken cluster. - This field is read-only and no changes will be made by Kubernetes to the PVC after it has been created. - Required, must not be nil. @@ -9138,7 +9137,7 @@ If the resource referred to by volumeAttributesClass does not exist, this Persis set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource exists. More info: https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/ -(Alpha) Using this field requires the VolumeAttributesClass feature gate to be enabled.
+(Beta) Using this field requires the VolumeAttributesClass feature gate to be enabled (off by default).
@@ -9480,8 +9479,7 @@ fc represents a Fibre Channel resource that is attached to a kubelet's host mach @@ -9611,9 +9609,7 @@ scripts. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -9690,8 +9686,7 @@ More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk fsType is filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. -More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk -TODO: how do we prevent errors in the filesystem from compromising the machine
+More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk
@@ -9823,9 +9818,6 @@ machine that is directly exposed to the container. This is generally used for system agents or other privileged things that are allowed to see the host machine. Most containers will NOT need this. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath ---- -TODO(jonesdl) We need to restrict who can use host directory mounts and who can/can not -mount host directories as read/write.
false
fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. -Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. -TODO: how do we prevent errors in the filesystem from compromising the machine
+Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
false
false
@@ -9858,6 +9850,57 @@ More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath
+### OpAMPBridge.spec.volumes[index].image +[↩ Parent](#opampbridgespecvolumesindex) + + + +image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine. +The volume is resolved at pod startup depending on which PullPolicy value is provided: + +- Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. +- Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. +- IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. + +The volume gets re-resolved if the pod gets deleted and recreated, which means that new remote content will become available on pod recreation. +A failure to resolve or pull the image during pod startup will block containers from starting and may add significant latency. Failures will be retried using normal volume backoff and will be reported on the pod reason and message. + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionRequired
pullPolicystring + Policy for pulling OCI objects. Possible values are: +Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. +Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. +IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. +Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
+
false
referencestring + Required: Image or artifact reference to be used. +Behaves in the same way as pod.spec.containers[*].image. +Pull secrets will be assembled in the same way as for the container image by looking up node credentials, SA image pull secrets, and pod spec image pull secrets. +More info: https://kubernetes.io/docs/concepts/containers/images +This field is optional to allow higher level config management to default or override +container images in workload controllers like Deployments and StatefulSets.
+
false
+ + ### OpAMPBridge.spec.volumes[index].iscsi [↩ Parent](#opampbridgespecvolumesindex) @@ -9921,8 +9964,7 @@ is other than default (typically TCP ports 860 and 3260).
fsType is the filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. -More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi -TODO: how do we prevent errors in the filesystem from compromising the machine
+More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi
false @@ -9940,6 +9982,8 @@ If initiatorName is specified with iscsiInterface simultaneously, new iSCSI inte iscsiInterface is the interface Name that uses an iSCSI transport. Defaults to 'default' (tcp).
+
+ Default: default
false @@ -9993,9 +10037,7 @@ secretRef is the CHAP Secret for iSCSI target and initiator authentication This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -10202,7 +10244,8 @@ mode, like fsGroup, and the result can be other mode bits set.
sources []object - sources is the list of volume projections
+ sources is the list of volume projections. Each entry in this list +handles one source.
false @@ -10214,7 +10257,8 @@ mode, like fsGroup, and the result can be other mode bits set.
-Projection that may be projected along with other supported volume types +Projection that may be projected along with other supported volume types. +Exactly one of these fields must be set. @@ -10232,14 +10276,11 @@ Projection that may be projected along with other supported volume types ClusterTrustBundle allows a pod to access the `.spec.trustBundle` field of ClusterTrustBundle objects in an auto-updating file. - Alpha, gated by the ClusterTrustBundleProjection feature gate. - ClusterTrustBundle objects can either be selected by name, or by the combination of signer name and a label selector. - Kubelet performs aggressive normalization of the PEM contents written into the pod filesystem. Esoteric PEM features such as inter-block comments and block headers are stripped. Certificates are deduplicated. @@ -10287,14 +10328,11 @@ may change the order over time.
ClusterTrustBundle allows a pod to access the `.spec.trustBundle` field of ClusterTrustBundle objects in an auto-updating file. - Alpha, gated by the ClusterTrustBundleProjection feature gate. - ClusterTrustBundle objects can either be selected by name, or by the combination of signer name and a label selector. - Kubelet performs aggressive normalization of the PEM contents written into the pod filesystem. Esoteric PEM features such as inter-block comments and block headers are stripped. Certificates are deduplicated. @@ -10481,9 +10519,7 @@ relative and may not contain the '..' path or start with '..'.
This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -10746,9 +10782,7 @@ relative and may not contain the '..' path or start with '..'.
This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -10975,8 +11009,7 @@ More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it
fsType is the filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. -More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd -TODO: how do we prevent errors in the filesystem from compromising the machine
+More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd
@@ -10986,6 +11019,8 @@ TODO: how do we prevent errors in the filesystem from compromising the machine +
+ Default: /etc/ceph/keyring
@@ -10995,6 +11030,8 @@ More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it
pool is the rados pool name. Default is rbd. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it
+
+ Default: rbd
@@ -11023,6 +11060,8 @@ More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it
user is the rados user name. Default is admin. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it
+
+ Default: admin
@@ -11056,9 +11095,7 @@ More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -11113,6 +11150,8 @@ sensitive information. If this is not provided, Login operation will fail.
Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Default is "xfs".
+
+ Default: xfs
@@ -11143,6 +11182,8 @@ the ReadOnly setting in VolumeMounts.
@@ -11189,9 +11230,7 @@ sensitive information. If this is not provided, Login operation will fail. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -11405,9 +11444,7 @@ credentials. If not specified, default values will be attempted. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -11563,6 +11600,24 @@ OpenTelemetryCollectorSpec defines the desired state of OpenTelemetryCollector.
+ + + + + + + + + + @@ -11604,13 +11657,6 @@ doing so, you wil accept the risk of it breaking things.
for the OpenTelemetryCollector workload.
- - - - - @@ -11701,17 +11747,6 @@ https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
It is only effective when healthcheckextension is configured in the OpenTelemetry Collector pipeline.
- - - - - @@ -11780,7 +11815,6 @@ for the OpenTelemetryCollector workload.
opentelemetry-collector pod, when running as a deployment, daemonset, or statefulset. - In sidecar mode, the opentelemetry-operator will ignore this setting.
@@ -11825,12 +11859,10 @@ default.
SecurityContext configures the container security context for the opentelemetry-collector container. - In deployment, daemonset, or statefulset mode, this controls the security context settings for the primary application container. - In sidecar mode, this controls the security context for the injected sidecar container.
@@ -12337,9 +12369,7 @@ Selects a key of a ConfigMap. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -12463,9 +12493,7 @@ Selects a key of a secret in the pod's namespace This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -12546,9 +12574,7 @@ The ConfigMap to select from This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -12588,9 +12614,7 @@ The Secret to select from This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -13330,8 +13354,9 @@ GRPC specifies an action involving a GRPC port. Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - If this is not specified, the default behavior is defined by gRPC.
+
+ Default:
@@ -13719,8 +13744,9 @@ GRPC specifies an action involving a GRPC port. Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - If this is not specified, the default behavior is defined by gRPC.
+
+ Default:
@@ -13918,11 +13944,9 @@ More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-co Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container. - This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. - This field is immutable. It can only be set for containers.
@@ -13973,6 +13997,15 @@ the Pod where this field is used. It makes that resource available inside a container.
+ + + + +
false
false
false
false
false
storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. Default is ThinProvisioned.
+
+ Default: ThinProvisioned
false
configstring + Config is the raw YAML to be used as the collector's configuration. Refer to the OpenTelemetry Collector documentation for details.
+
true
managementStateenum + ManagementState defines if the CR should be managed by the operator or not. +Default is managed.
+
+ Enum: managed, unmanaged
+ Default: managed
+
true
additionalContainers []object @@ -11573,11 +11628,9 @@ applies to Deployment, DaemonSet, and StatefulSet deployment modes of the collec deployment mode. More info about sidecars: https://kubernetes.io/docs/tasks/configure-pod-container/share-process-namespace/ - Container names managed by the operator: * `otc-container` - Overriding containers managed by the operator is outside the scope of what the maintainers will support and by doing so, you wil accept the risk of it breaking things.
false
configstring - Config is the raw YAML to be used as the collector's configuration. Refer to the OpenTelemetry Collector documentation for details.
-
false
configmaps []objectfalse
managementStateenum - ManagementState defines if the CR should be managed by the operator or not. -Default is managed.
-
- Enum: managed, unmanaged
- Default: managed
-
false
maxReplicas integerfalsefalse
false
falsetrue
requeststring + Request is the name chosen for a request in the referenced claim. +If empty, everything from the claim is made available, otherwise +only the result of this request.
+
false
@@ -14041,7 +14074,7 @@ Note that this field cannot be set when spec.os.name is windows.
string procMount denotes the type of proc mount to use for the containers. -The default is DefaultProcMount which uses the container runtime defaults for +The default value is Default which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled. Note that this field cannot be set when spec.os.name is windows.
@@ -14286,7 +14319,6 @@ Note that this field cannot be set when spec.os.name is windows. type indicates which kind of seccomp profile will be applied. Valid options are: - Localhost - a profile defined in a file on the node should be used. RuntimeDefault - the container runtime default profile should be used. Unconfined - no profile should be applied.
@@ -14551,8 +14583,9 @@ GRPC specifies an action involving a GRPC port. Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - If this is not specified, the default behavior is defined by gRPC.
+
+ Default:
false @@ -14781,10 +14814,8 @@ Defaults to false.
RecursiveReadOnly specifies whether read-only mounts should be handled recursively. - If ReadOnly is false, this field has no meaning and must be unspecified. - If ReadOnly is true, and this field is set to Disabled, the mount is not made recursively read-only. If this field is set to IfPossible, the mount is made recursively read-only, if it is supported by the container runtime. If this @@ -14792,11 +14823,9 @@ field is set to Enabled, the mount is made recursively read-only if it is supported by the container runtime, otherwise the pod will not be started and an error will be generated to indicate the reason. - If this field is set to IfPossible or Enabled, MountPropagation must be set to None (or be unspecified, which defaults to None). - If this field is not specified, it is treated as an equivalent of Disabled.
false @@ -15367,7 +15396,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -15382,7 +15411,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -15631,7 +15660,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -15646,7 +15675,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -15975,7 +16004,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -15990,7 +16019,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -16239,7 +16268,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -16254,7 +16283,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -17076,10 +17105,7 @@ This is only applicable to Deployment mode. object Rolling update config params. Present only if DeploymentStrategyType = -RollingUpdate. ---- -TODO: Update this to follow our convention for oneOf, whatever we decide it -to be.
+RollingUpdate.
false @@ -17100,9 +17126,6 @@ to be.
Rolling update config params. Present only if DeploymentStrategyType = RollingUpdate. ---- -TODO: Update this to follow our convention for oneOf, whatever we decide it -to be. @@ -17280,9 +17303,7 @@ Selects a key of a ConfigMap. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -17406,9 +17427,7 @@ Selects a key of a secret in the pod's namespace This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -17489,9 +17508,7 @@ The ConfigMap to select from This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -17531,9 +17548,7 @@ The Secret to select from This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -18112,9 +18127,7 @@ Selects a key of a ConfigMap. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -18238,9 +18251,7 @@ Selects a key of a secret in the pod's namespace This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -18321,9 +18332,7 @@ The ConfigMap to select from This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -18363,9 +18372,7 @@ The Secret to select from This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -19105,8 +19112,9 @@ GRPC specifies an action involving a GRPC port. Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - If this is not specified, the default behavior is defined by gRPC.
+
+ Default:
@@ -19494,8 +19502,9 @@ GRPC specifies an action involving a GRPC port. Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - If this is not specified, the default behavior is defined by gRPC.
+
+ Default:
@@ -19693,11 +19702,9 @@ More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-co Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container. - This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. - This field is immutable. It can only be set for containers.
@@ -19748,6 +19755,15 @@ the Pod where this field is used. It makes that resource available inside a container.
+ + + + +
false
false
false true
requeststring + Request is the name chosen for a request in the referenced claim. +If empty, everything from the claim is made available, otherwise +only the result of this request.
+
false
@@ -19816,7 +19832,7 @@ Note that this field cannot be set when spec.os.name is windows.
string procMount denotes the type of proc mount to use for the containers. -The default is DefaultProcMount which uses the container runtime defaults for +The default value is Default which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled. Note that this field cannot be set when spec.os.name is windows.
@@ -20061,7 +20077,6 @@ Note that this field cannot be set when spec.os.name is windows. type indicates which kind of seccomp profile will be applied. Valid options are: - Localhost - a profile defined in a file on the node should be used. RuntimeDefault - the container runtime default profile should be used. Unconfined - no profile should be applied.
@@ -20326,8 +20341,9 @@ GRPC specifies an action involving a GRPC port. Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - If this is not specified, the default behavior is defined by gRPC.
+
+ Default:
false @@ -20556,10 +20572,8 @@ Defaults to false.
RecursiveReadOnly specifies whether read-only mounts should be handled recursively. - If ReadOnly is false, this field has no meaning and must be unspecified. - If ReadOnly is true, and this field is set to Disabled, the mount is not made recursively read-only. If this field is set to IfPossible, the mount is made recursively read-only, if it is supported by the container runtime. If this @@ -20567,11 +20581,9 @@ field is set to Enabled, the mount is made recursively read-only if it is supported by the container runtime, otherwise the pod will not be started and an error will be generated to indicate the reason. - If this field is set to IfPossible or Enabled, MountPropagation must be set to None (or be unspecified, which defaults to None). - If this field is not specified, it is treated as an equivalent of Disabled.
false @@ -21341,7 +21353,6 @@ PodSecurityContext configures the pod security context for the opentelemetry-collector pod, when running as a deployment, daemonset, or statefulset. - In sidecar mode, the opentelemetry-operator will ignore this setting. @@ -21369,12 +21380,10 @@ Note that this field cannot be set when spec.os.name is windows.
Some volume types allow the Kubelet to change the ownership of that volume to be owned by the pod: - 1. The owning GID will be the FSGroup 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) 3. The permission bits are OR'd with rw-rw---- - If unset, the Kubelet will not modify the ownership and permissions of any volume. Note that this field cannot be set when spec.os.name is windows.

@@ -21458,12 +21467,25 @@ Note that this field cannot be set when spec.os.name is windows.
+ + + + + @@ -21609,7 +21631,6 @@ Note that this field cannot be set when spec.os.name is windows. type indicates which kind of seccomp profile will be applied. Valid options are: - Localhost - a profile defined in a file on the node should be used. RuntimeDefault - the container runtime default profile should be used. Unconfined - no profile should be applied.
@@ -21756,17 +21777,14 @@ This is used as a hint for implementations to offer richer behavior for protocol This field follows standard Kubernetes label syntax. Valid values are either: - * Un-prefixed protocol names - reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). - * Kubernetes-defined prefixed names: * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 - * Other protocols should use implementation-defined prefixed names such as mycompany.com/my-custom-protocol.
@@ -21859,11 +21877,9 @@ Resources to set on the OpenTelemetry Collector pods. Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container. - This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. - This field is immutable. It can only be set for containers.
@@ -21914,6 +21930,15 @@ the Pod where this field is used. It makes that resource available inside a container.
+ + + + +
supplementalGroups []integer - A list of groups applied to the first process run in each container, in addition -to the container's primary GID, the fsGroup (if specified), and group memberships -defined in the container image for the uid of the container process. If unspecified, -no additional groups are added to any container. Note that group memberships -defined in the container image for the uid of the container process are still effective, -even if they are not included in this list. + A list of groups applied to the first process run in each container, in +addition to the container's primary GID and fsGroup (if specified). If +the SupplementalGroupsPolicy feature is enabled, the +supplementalGroupsPolicy field determines whether these are in addition +to or instead of any group memberships defined in the container image. +If unspecified, no additional groups are added, though group memberships +defined in the container image may still be used, depending on the +supplementalGroupsPolicy field. +Note that this field cannot be set when spec.os.name is windows.
+
false
supplementalGroupsPolicystring + Defines how supplemental groups of the first container processes are calculated. +Valid values are "Merge" and "Strict". If not specified, "Merge" is used. +(Alpha) Using the field requires the SupplementalGroupsPolicy feature gate to be enabled +and the container runtime must implement support for this feature. Note that this field cannot be set when spec.os.name is windows.
false false true
requeststring + Request is the name chosen for a request in the referenced claim. +If empty, everything from the claim is made available, otherwise +only the result of this request.
+
false
@@ -21926,12 +21951,10 @@ inside a container.
SecurityContext configures the container security context for the opentelemetry-collector container. - In deployment, daemonset, or statefulset mode, this controls the security context settings for the primary application container. - In sidecar mode, this controls the security context for the injected sidecar container. @@ -21990,7 +22013,7 @@ Note that this field cannot be set when spec.os.name is windows.
string procMount denotes the type of proc mount to use for the containers. -The default is DefaultProcMount which uses the container runtime defaults for +The default value is Default which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled. Note that this field cannot be set when spec.os.name is windows.
@@ -22235,7 +22258,6 @@ Note that this field cannot be set when spec.os.name is windows. type indicates which kind of seccomp profile will be applied. Valid options are: - Localhost - a profile defined in a file on the node should be used. RuntimeDefault - the container runtime default profile should be used. Unconfined - no profile should be applied.
@@ -23022,7 +23044,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -23037,7 +23059,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -23286,7 +23308,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -23301,7 +23323,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -23630,7 +23652,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -23645,7 +23667,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -23894,7 +23916,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -23909,7 +23931,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -24236,9 +24258,7 @@ Selects a key of a ConfigMap. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -24362,9 +24382,7 @@ Selects a key of a secret in the pod's namespace This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -24517,12 +24535,10 @@ Note that this field cannot be set when spec.os.name is windows.
Some volume types allow the Kubelet to change the ownership of that volume to be owned by the pod: - 1. The owning GID will be the FSGroup 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) 3. The permission bits are OR'd with rw-rw---- - If unset, the Kubelet will not modify the ownership and permissions of any volume. Note that this field cannot be set when spec.os.name is windows.

@@ -24606,12 +24622,25 @@ Note that this field cannot be set when spec.os.name is windows.
supplementalGroups []integer - A list of groups applied to the first process run in each container, in addition -to the container's primary GID, the fsGroup (if specified), and group memberships -defined in the container image for the uid of the container process. If unspecified, -no additional groups are added to any container. Note that group memberships -defined in the container image for the uid of the container process are still effective, -even if they are not included in this list. + A list of groups applied to the first process run in each container, in +addition to the container's primary GID and fsGroup (if specified). If +the SupplementalGroupsPolicy feature is enabled, the +supplementalGroupsPolicy field determines whether these are in addition +to or instead of any group memberships defined in the container image. +If unspecified, no additional groups are added, though group memberships +defined in the container image may still be used, depending on the +supplementalGroupsPolicy field. +Note that this field cannot be set when spec.os.name is windows.
+ + false + + supplementalGroupsPolicy + string + + Defines how supplemental groups of the first container processes are calculated. +Valid values are "Merge" and "Strict". If not specified, "Merge" is used. +(Alpha) Using the field requires the SupplementalGroupsPolicy feature gate to be enabled +and the container runtime must implement support for this feature. Note that this field cannot be set when spec.os.name is windows.
false @@ -24757,7 +24786,6 @@ Note that this field cannot be set when spec.os.name is windows. type indicates which kind of seccomp profile will be applied. Valid options are: - Localhost - a profile defined in a file on the node should be used. RuntimeDefault - the container runtime default profile should be used. Unconfined - no profile should be applied.
@@ -24910,7 +24938,6 @@ Empty or nil map matches all pod monitors.
Interval between consecutive scrapes. Equivalent to the same setting on the Prometheus CRD. - Default: "30s"

Format: duration
@@ -24954,11 +24981,9 @@ Resources to set on the OpenTelemetryTargetAllocator containers. Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container. - This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. - This field is immutable. It can only be set for containers.
false @@ -25009,6 +25034,15 @@ the Pod where this field is used. It makes that resource available inside a container.
true + + request + string + + Request is the name chosen for a request in the referenced claim. +If empty, everything from the claim is made available, otherwise +only the result of this request.
+ + false @@ -25076,7 +25110,7 @@ Note that this field cannot be set when spec.os.name is windows.
string procMount denotes the type of proc mount to use for the containers. -The default is DefaultProcMount which uses the container runtime defaults for +The default value is Default which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled. Note that this field cannot be set when spec.os.name is windows.
@@ -25321,7 +25355,6 @@ Note that this field cannot be set when spec.os.name is windows. type indicates which kind of seccomp profile will be applied. Valid options are: - Localhost - a profile defined in a file on the node should be used. RuntimeDefault - the container runtime default profile should be used. Unconfined - no profile should be applied.
@@ -25570,7 +25603,6 @@ MatchLabelKeys cannot be set when LabelSelector isn't set. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. - This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default).
false @@ -25589,7 +25621,6 @@ If value is nil, the constraint behaves as if MinDomains is equal to 1. Valid values are integers greater than 0. When value is not nil, WhenUnsatisfiable must be DoNotSchedule. - For example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains is set to 5 and pods with the same labelSelector spread as 2/2/2: | zone1 | zone2 | zone3 | @@ -25611,7 +25642,6 @@ when calculating pod topology spread skew. Options are: - Honor: only nodes matching nodeAffinity/nodeSelector are included in the calculations. - Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations. - If this value is nil, the behavior is equivalent to the Honor policy. This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag.
@@ -25626,7 +25656,6 @@ pod topology spread skew. Options are: has a toleration, are included. - Ignore: node taints are ignored. All nodes are included. - If this value is nil, the behavior is equivalent to the Ignore policy. This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag.
@@ -25889,7 +25918,6 @@ MatchLabelKeys cannot be set when LabelSelector isn't set. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. - This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default).
false @@ -25908,7 +25936,6 @@ If value is nil, the constraint behaves as if MinDomains is equal to 1. Valid values are integers greater than 0. When value is not nil, WhenUnsatisfiable must be DoNotSchedule. - For example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains is set to 5 and pods with the same labelSelector spread as 2/2/2: | zone1 | zone2 | zone3 | @@ -25930,7 +25957,6 @@ when calculating pod topology spread skew. Options are: - Honor: only nodes matching nodeAffinity/nodeSelector are included in the calculations. - Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations. - If this value is nil, the behavior is equivalent to the Honor policy. This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag.
@@ -25945,7 +25971,6 @@ pod topology spread skew. Options are: has a toleration, are included. - Ignore: node taints are ignored. All nodes are included. - If this value is nil, the behavior is equivalent to the Ignore policy. This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag.
@@ -26060,11 +26085,7 @@ This is only applicable to Daemonset mode. rollingUpdate object - Rolling update config params. Present only if type = "RollingUpdate". ---- -TODO: Update this to follow our convention for oneOf, whatever we decide it -to be. Same as Deployment `strategy.rollingUpdate`. -See https://github.com/kubernetes/kubernetes/issues/35345
+ Rolling update config params. Present only if type = "RollingUpdate".
false @@ -26084,10 +26105,6 @@ See https://github.com/kubernetes/kubernetes/issues/35345
Rolling update config params. Present only if type = "RollingUpdate". ---- -TODO: Update this to follow our convention for oneOf, whatever we decide it -to be. Same as Deployment `strategy.rollingUpdate`. -See https://github.com/kubernetes/kubernetes/issues/35345 @@ -26366,7 +26383,7 @@ If the resource referred to by volumeAttributesClass does not exist, this Persis set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource exists. More info: https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/ -(Alpha) Using this field requires the VolumeAttributesClass feature gate to be enabled.
+(Beta) Using this field requires the VolumeAttributesClass feature gate to be enabled (off by default).
@@ -26667,7 +26684,6 @@ Key names follow standard Kubernetes label syntax. Valid values are either: Apart from above values - keys that are unprefixed or have kubernetes.io prefix are considered reserved and hence may not be used. - ClaimResourceStatus can be in any of following states: - ControllerResizeInProgress: State set when resize controller starts resizing the volume in control-plane. @@ -26695,7 +26711,6 @@ Key names follow standard Kubernetes label syntax. Valid values are either: Apart from above values - keys that are unprefixed or have kubernetes.io prefix are considered reserved and hence may not be used. - Capacity reported here may be larger than the actual capacity when a volume expansion operation is requested. For storage quota, the larger value from allocatedResources and PVC.spec.resources is used. @@ -26704,7 +26719,6 @@ If a volume expansion capacity request is lowered, allocatedResources is only lowered if there are no expansion operations in progress and if the actual volume capacity is equal or lower than the requested capacity. - A controller that receives PVC update with previously unknown resourceName should ignore the update for the purpose it was designed.
@@ -26730,7 +26744,7 @@ resized then the Condition will be set to 'Resizing'.
@@ -26739,7 +26753,7 @@ This is an alpha field and requires enabling VolumeAttributesClass feature.
@@ -26780,7 +26794,15 @@ PersistentVolumeClaimCondition contains details about state of pvc @@ -26828,7 +26850,7 @@ persistent volume is being resized.
ModifyVolumeStatus represents the status object of ControllerModifyVolume operation. When this is unset, there is no ModifyVolume operation being attempted. -This is an alpha field and requires enabling VolumeAttributesClass feature. +This is a beta field and requires enabling VolumeAttributesClass feature (off by default).
false
currentVolumeAttributesClassName is the current name of the VolumeAttributesClass the PVC is using. When unset, there is no VolumeAttributeClass applied to this PersistentVolumeClaim -This is an alpha field and requires enabling VolumeAttributesClass feature.
+This is a beta field and requires enabling VolumeAttributesClass feature (off by default).
false
ModifyVolumeStatus represents the status object of ControllerModifyVolume operation. When this is unset, there is no ModifyVolume operation being attempted. -This is an alpha field and requires enabling VolumeAttributesClass feature.
+This is a beta field and requires enabling VolumeAttributesClass feature (off by default).
false
type string - PersistentVolumeClaimConditionType is a valid value of PersistentVolumeClaimCondition.Type
+ PersistentVolumeClaimConditionType defines the condition of PV claim. +Valid values are: + - "Resizing", "FileSystemResizePending" + +If RecoverVolumeExpansionFailure feature gate is enabled, then following additional values can be expected: + - "ControllerResizeError", "NodeResizeError" + +If VolumeAttributesClass feature gate is enabled, then following additional values can be expected: + - "ModifyVolumeError", "ModifyingVolume"
true
@@ -26924,10 +26946,8 @@ Defaults to false.
RecursiveReadOnly specifies whether read-only mounts should be handled recursively. - If ReadOnly is false, this field has no meaning and must be unspecified. - If ReadOnly is true, and this field is set to Disabled, the mount is not made recursively read-only. If this field is set to IfPossible, the mount is made recursively read-only, if it is supported by the container runtime. If this @@ -26935,11 +26955,9 @@ field is set to Enabled, the mount is made recursively read-only if it is supported by the container runtime, otherwise the pod will not be started and an error will be generated to indicate the reason. - If this field is set to IfPossible or Enabled, MountPropagation must be set to None (or be unspecified, which defaults to None). - If this field is not specified, it is treated as an equivalent of Disabled.
@@ -27065,7 +27083,6 @@ More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir
The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, and deleted when the pod is removed. - Use this if: a) the volume is only needed while the pod runs, b) features of normal volumes like restoring from snapshot or capacity @@ -27076,17 +27093,14 @@ d) the storage driver supports dynamic volume provisioning through information on the connection between this volume type and PersistentVolumeClaim). - Use PersistentVolumeClaim or one of the vendor-specific APIs for volumes that persist for longer than the lifecycle of an individual pod. - Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to be used that way - see the documentation of the driver for more information. - A pod can use both types of ephemeral volumes and persistent volumes at the same time.
@@ -27148,10 +27162,22 @@ More info: https://examples.k8s.io/volumes/glusterfs/README.md
machine that is directly exposed to the container. This is generally used for system agents or other privileged things that are allowed to see the host machine. Most containers will NOT need this. -More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath ---- -TODO(jonesdl) We need to restrict who can use host directory mounts and who can/can not -mount host directories as read/write.
+More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath
+ + + + + + @@ -27282,8 +27308,7 @@ More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockst fsType is the filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. -More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore -TODO: how do we prevent errors in the filesystem from compromising the machine
+More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
@@ -27354,6 +27379,8 @@ azureDisk represents an Azure Data Disk mount on the host and bind mount to the fsType is Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
+
+ Default: ext4
@@ -27369,6 +27396,8 @@ Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
@@ -27510,9 +27539,7 @@ More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -27602,9 +27629,7 @@ to OpenStack. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -27665,9 +27690,7 @@ relative and may not contain the '..' path or start with '..'.
This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -27826,9 +27849,7 @@ secret object contains more than one secret, all secret references are passed. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -28064,7 +28085,6 @@ ephemeral represents a volume that is handled by a cluster storage driver. The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, and deleted when the pod is removed. - Use this if: a) the volume is only needed while the pod runs, b) features of normal volumes like restoring from snapshot or capacity @@ -28075,17 +28095,14 @@ d) the storage driver supports dynamic volume provisioning through information on the connection between this volume type and PersistentVolumeClaim). - Use PersistentVolumeClaim or one of the vendor-specific APIs for volumes that persist for longer than the lifecycle of an individual pod. - Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to be used that way - see the documentation of the driver for more information. - A pod can use both types of ephemeral volumes and persistent volumes at the same time. @@ -28110,7 +28127,6 @@ pod. The name of the PVC will be `-` where entry. Pod validation will reject the pod if the concatenated name is not valid for a PVC (for example, too long). - An existing PVC with that name that is not owned by the pod will *not* be used for the pod to avoid using an unrelated volume by mistake. Starting the pod is then blocked until @@ -28120,11 +28136,9 @@ owner reference to the pod once the pod exists. Normally this should not be necessary, but it may be useful when manually reconstructing a broken cluster. - This field is read-only and no changes will be made by Kubernetes to the PVC after it has been created. - Required, must not be nil.
@@ -28145,7 +28159,6 @@ pod. The name of the PVC will be `-` where entry. Pod validation will reject the pod if the concatenated name is not valid for a PVC (for example, too long). - An existing PVC with that name that is not owned by the pod will *not* be used for the pod to avoid using an unrelated volume by mistake. Starting the pod is then blocked until @@ -28155,11 +28168,9 @@ owner reference to the pod once the pod exists. Normally this should not be necessary, but it may be useful when manually reconstructing a broken cluster. - This field is read-only and no changes will be made by Kubernetes to the PVC after it has been created. - Required, must not be nil.
false false
imageobject + image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine. +The volume is resolved at pod startup depending on which PullPolicy value is provided: + +- Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. +- Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. +- IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. + +The volume gets re-resolved if the pod gets deleted and recreated, which means that new remote content will become available on pod recreation. +A failure to resolve or pull the image during pod startup will block containers from starting and may add significant latency. Failures will be retried using normal volume backoff and will be reported on the pod reason and message.
false
false
false
readOnly Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.
+
+ Default: false
false
false
@@ -28298,7 +28309,7 @@ If the resource referred to by volumeAttributesClass does not exist, this Persis set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource exists. More info: https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/ -(Alpha) Using this field requires the VolumeAttributesClass feature gate to be enabled.
+(Beta) Using this field requires the VolumeAttributesClass feature gate to be enabled (off by default).
@@ -28640,8 +28651,7 @@ fc represents a Fibre Channel resource that is attached to a kubelet's host mach @@ -28771,9 +28781,7 @@ scripts. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -28850,8 +28858,7 @@ More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk fsType is filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. -More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk -TODO: how do we prevent errors in the filesystem from compromising the machine
+More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk
@@ -28983,9 +28990,6 @@ machine that is directly exposed to the container. This is generally used for system agents or other privileged things that are allowed to see the host machine. Most containers will NOT need this. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath ---- -TODO(jonesdl) We need to restrict who can use host directory mounts and who can/can not -mount host directories as read/write.
false
fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. -Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. -TODO: how do we prevent errors in the filesystem from compromising the machine
+Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
false
false
@@ -29018,6 +29022,57 @@ More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath
+### OpenTelemetryCollector.spec.volumes[index].image +[↩ Parent](#opentelemetrycollectorspecvolumesindex) + + + +image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine. +The volume is resolved at pod startup depending on which PullPolicy value is provided: + +- Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. +- Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. +- IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. + +The volume gets re-resolved if the pod gets deleted and recreated, which means that new remote content will become available on pod recreation. +A failure to resolve or pull the image during pod startup will block containers from starting and may add significant latency. Failures will be retried using normal volume backoff and will be reported on the pod reason and message. + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionRequired
pullPolicystring + Policy for pulling OCI objects. Possible values are: +Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. +Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. +IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. +Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
+
false
referencestring + Required: Image or artifact reference to be used. +Behaves in the same way as pod.spec.containers[*].image. +Pull secrets will be assembled in the same way as for the container image by looking up node credentials, SA image pull secrets, and pod spec image pull secrets. +More info: https://kubernetes.io/docs/concepts/containers/images +This field is optional to allow higher level config management to default or override +container images in workload controllers like Deployments and StatefulSets.
+
false
+ + ### OpenTelemetryCollector.spec.volumes[index].iscsi [↩ Parent](#opentelemetrycollectorspecvolumesindex) @@ -29081,8 +29136,7 @@ is other than default (typically TCP ports 860 and 3260).
fsType is the filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. -More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi -TODO: how do we prevent errors in the filesystem from compromising the machine
+More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi
false @@ -29100,6 +29154,8 @@ If initiatorName is specified with iscsiInterface simultaneously, new iSCSI inte iscsiInterface is the interface Name that uses an iSCSI transport. Defaults to 'default' (tcp).
+
+ Default: default
false @@ -29153,9 +29209,7 @@ secretRef is the CHAP Secret for iSCSI target and initiator authentication This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -29362,7 +29416,8 @@ mode, like fsGroup, and the result can be other mode bits set.
sources []object - sources is the list of volume projections
+ sources is the list of volume projections. Each entry in this list +handles one source.
false @@ -29374,7 +29429,8 @@ mode, like fsGroup, and the result can be other mode bits set.
-Projection that may be projected along with other supported volume types +Projection that may be projected along with other supported volume types. +Exactly one of these fields must be set. @@ -29392,14 +29448,11 @@ Projection that may be projected along with other supported volume types ClusterTrustBundle allows a pod to access the `.spec.trustBundle` field of ClusterTrustBundle objects in an auto-updating file. - Alpha, gated by the ClusterTrustBundleProjection feature gate. - ClusterTrustBundle objects can either be selected by name, or by the combination of signer name and a label selector. - Kubelet performs aggressive normalization of the PEM contents written into the pod filesystem. Esoteric PEM features such as inter-block comments and block headers are stripped. Certificates are deduplicated. @@ -29447,14 +29500,11 @@ may change the order over time.
ClusterTrustBundle allows a pod to access the `.spec.trustBundle` field of ClusterTrustBundle objects in an auto-updating file. - Alpha, gated by the ClusterTrustBundleProjection feature gate. - ClusterTrustBundle objects can either be selected by name, or by the combination of signer name and a label selector. - Kubelet performs aggressive normalization of the PEM contents written into the pod filesystem. Esoteric PEM features such as inter-block comments and block headers are stripped. Certificates are deduplicated. @@ -29641,9 +29691,7 @@ relative and may not contain the '..' path or start with '..'.
This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -29906,9 +29954,7 @@ relative and may not contain the '..' path or start with '..'.
This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -30135,8 +30181,7 @@ More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it
fsType is the filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. -More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd -TODO: how do we prevent errors in the filesystem from compromising the machine
+More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd
@@ -30146,6 +30191,8 @@ TODO: how do we prevent errors in the filesystem from compromising the machine +
+ Default: /etc/ceph/keyring
@@ -30155,6 +30202,8 @@ More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it
pool is the rados pool name. Default is rbd. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it
+
+ Default: rbd
@@ -30183,6 +30232,8 @@ More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it
user is the rados user name. Default is admin. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it
+
+ Default: admin
@@ -30216,9 +30267,7 @@ More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -30273,6 +30322,8 @@ sensitive information. If this is not provided, Login operation will fail.
Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Default is "xfs".
+
+ Default: xfs
@@ -30303,6 +30354,8 @@ the ReadOnly setting in VolumeMounts.
@@ -30349,9 +30402,7 @@ sensitive information. If this is not provided, Login operation will fail. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -30565,9 +30616,7 @@ credentials. If not specified, default values will be attempted. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -30818,6 +30867,17 @@ OpenTelemetryCollectorSpec defines the desired state of OpenTelemetryCollector. The empty objects e.g. batch: should be written as batch: {} otherwise they won't work with kustomize or kubectl edit.
+ + + + + @@ -30827,11 +30887,9 @@ These sidecar containers can be used for authentication proxies, log shipping si metrics to their cloud, or in general sidecars that do not support automatic injection. This only works with the following OpenTelemetryCollector mode's: daemonset, statefulset, and deployment. - Container names managed by the operator: * `otc-container` - Overriding containers managed by the operator is outside the scope of what the maintainers will support and by doing so, you wil accept the risk of it breaking things.
@@ -30983,17 +31041,6 @@ to express the family of an IP expressed by a type (e.g. service.spec.ipFamilies It is only effective when healthcheckextension is configured in the OpenTelemetry Collector pipeline.
- - - - - @@ -31049,7 +31096,6 @@ for the generated workload. By default, a PDB with a MaxUnavailable of one is se generated pod, when running as a deployment, daemonset, or statefulset. - In sidecar mode, the opentelemetry-operator will ignore this setting.
@@ -31102,12 +31148,10 @@ It is only effective when healthcheckextension is configured in the OpenTelemetr SecurityContext configures the container security context for the generated main container. - In deployment, daemonset, or statefulset mode, this controls the security context settings for the primary application container. - In sidecar mode, this controls the security context for the injected sidecar container.
@@ -31751,9 +31795,7 @@ Selects a key of a ConfigMap. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -31877,9 +31919,7 @@ Selects a key of a secret in the pod's namespace This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -31960,9 +32000,7 @@ The ConfigMap to select from This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -32002,9 +32040,7 @@ The Secret to select from This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -32744,8 +32780,9 @@ GRPC specifies an action involving a GRPC port. Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - If this is not specified, the default behavior is defined by gRPC.
+
+ Default:
@@ -33133,8 +33170,9 @@ GRPC specifies an action involving a GRPC port. Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - If this is not specified, the default behavior is defined by gRPC.
+
+ Default:
@@ -33332,11 +33370,9 @@ More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-co Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container. - This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. - This field is immutable. It can only be set for containers.
@@ -33387,6 +33423,15 @@ the Pod where this field is used. It makes that resource available inside a container.
+ + + + +
false
false
false
false
false
storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. Default is ThinProvisioned.
+
+ Default: ThinProvisioned
false
true
managementStateenum + ManagementState defines if the CR should be managed by the operator or not. +Default is managed.
+
+ Enum: managed, unmanaged
+ Default: managed
+
true
additionalContainers []objectfalse
managementStateenum - ManagementState defines if the CR should be managed by the operator or not. -Default is managed.
-
- Enum: managed, unmanaged
- Default: managed
-
false
mode enumfalsefalse
false
falsetrue
requeststring + Request is the name chosen for a request in the referenced claim. +If empty, everything from the claim is made available, otherwise +only the result of this request.
+
false
@@ -33455,7 +33500,7 @@ Note that this field cannot be set when spec.os.name is windows.
string procMount denotes the type of proc mount to use for the containers. -The default is DefaultProcMount which uses the container runtime defaults for +The default value is Default which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled. Note that this field cannot be set when spec.os.name is windows.
@@ -33700,7 +33745,6 @@ Note that this field cannot be set when spec.os.name is windows. type indicates which kind of seccomp profile will be applied. Valid options are: - Localhost - a profile defined in a file on the node should be used. RuntimeDefault - the container runtime default profile should be used. Unconfined - no profile should be applied.
@@ -33965,8 +34009,9 @@ GRPC specifies an action involving a GRPC port. Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - If this is not specified, the default behavior is defined by gRPC.
+
+ Default:
false @@ -34195,10 +34240,8 @@ Defaults to false.
RecursiveReadOnly specifies whether read-only mounts should be handled recursively. - If ReadOnly is false, this field has no meaning and must be unspecified. - If ReadOnly is true, and this field is set to Disabled, the mount is not made recursively read-only. If this field is set to IfPossible, the mount is made recursively read-only, if it is supported by the container runtime. If this @@ -34206,11 +34249,9 @@ field is set to Enabled, the mount is made recursively read-only if it is supported by the container runtime, otherwise the pod will not be started and an error will be generated to indicate the reason. - If this field is set to IfPossible or Enabled, MountPropagation must be set to None (or be unspecified, which defaults to None). - If this field is not specified, it is treated as an equivalent of Disabled.
false @@ -34781,7 +34822,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -34796,7 +34837,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -35045,7 +35086,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -35060,7 +35101,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -35389,7 +35430,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -35404,7 +35445,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -35653,7 +35694,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -35668,7 +35709,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -36489,11 +36530,7 @@ This is only applicable to Daemonset mode. rollingUpdate object - Rolling update config params. Present only if type = "RollingUpdate". ---- -TODO: Update this to follow our convention for oneOf, whatever we decide it -to be. Same as Deployment `strategy.rollingUpdate`. -See https://github.com/kubernetes/kubernetes/issues/35345
+ Rolling update config params. Present only if type = "RollingUpdate".
false @@ -36513,10 +36550,6 @@ See https://github.com/kubernetes/kubernetes/issues/35345
Rolling update config params. Present only if type = "RollingUpdate". ---- -TODO: Update this to follow our convention for oneOf, whatever we decide it -to be. Same as Deployment `strategy.rollingUpdate`. -See https://github.com/kubernetes/kubernetes/issues/35345 @@ -36594,10 +36627,7 @@ This is only applicable to Deployment mode. @@ -36618,9 +36648,6 @@ to be.
Rolling update config params. Present only if DeploymentStrategyType = RollingUpdate. ---- -TODO: Update this to follow our convention for oneOf, whatever we decide it -to be.
object Rolling update config params. Present only if DeploymentStrategyType = -RollingUpdate. ---- -TODO: Update this to follow our convention for oneOf, whatever we decide it -to be.
+RollingUpdate.
false
@@ -36798,9 +36825,7 @@ Selects a key of a ConfigMap. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -36924,9 +36949,7 @@ Selects a key of a secret in the pod's namespace This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -37007,9 +37030,7 @@ The ConfigMap to select from This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -37049,9 +37070,7 @@ The Secret to select from This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -37630,9 +37649,7 @@ Selects a key of a ConfigMap. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -37756,9 +37773,7 @@ Selects a key of a secret in the pod's namespace This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -37839,9 +37854,7 @@ The ConfigMap to select from This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -37881,9 +37894,7 @@ The Secret to select from This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -38623,8 +38634,9 @@ GRPC specifies an action involving a GRPC port. Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - If this is not specified, the default behavior is defined by gRPC.
+
+ Default:
@@ -39012,8 +39024,9 @@ GRPC specifies an action involving a GRPC port. Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - If this is not specified, the default behavior is defined by gRPC.
+
+ Default:
@@ -39211,11 +39224,9 @@ More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-co Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container. - This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. - This field is immutable. It can only be set for containers.
@@ -39266,6 +39277,15 @@ the Pod where this field is used. It makes that resource available inside a container.
+ + + + +
false
false
false true
requeststring + Request is the name chosen for a request in the referenced claim. +If empty, everything from the claim is made available, otherwise +only the result of this request.
+
false
@@ -39334,7 +39354,7 @@ Note that this field cannot be set when spec.os.name is windows.
string procMount denotes the type of proc mount to use for the containers. -The default is DefaultProcMount which uses the container runtime defaults for +The default value is Default which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled. Note that this field cannot be set when spec.os.name is windows.
@@ -39579,7 +39599,6 @@ Note that this field cannot be set when spec.os.name is windows. type indicates which kind of seccomp profile will be applied. Valid options are: - Localhost - a profile defined in a file on the node should be used. RuntimeDefault - the container runtime default profile should be used. Unconfined - no profile should be applied.
@@ -39844,8 +39863,9 @@ GRPC specifies an action involving a GRPC port. Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). - If this is not specified, the default behavior is defined by gRPC.
+
+ Default:
false @@ -40074,10 +40094,8 @@ Defaults to false.
RecursiveReadOnly specifies whether read-only mounts should be handled recursively. - If ReadOnly is false, this field has no meaning and must be unspecified. - If ReadOnly is true, and this field is set to Disabled, the mount is not made recursively read-only. If this field is set to IfPossible, the mount is made recursively read-only, if it is supported by the container runtime. If this @@ -40085,11 +40103,9 @@ field is set to Enabled, the mount is made recursively read-only if it is supported by the container runtime, otherwise the pod will not be started and an error will be generated to indicate the reason. - If this field is set to IfPossible or Enabled, MountPropagation must be set to None (or be unspecified, which defaults to None). - If this field is not specified, it is treated as an equivalent of Disabled.
false @@ -40941,7 +40957,6 @@ PodSecurityContext configures the pod security context for the generated pod, when running as a deployment, daemonset, or statefulset. - In sidecar mode, the opentelemetry-operator will ignore this setting. @@ -40969,12 +40984,10 @@ Note that this field cannot be set when spec.os.name is windows.
Some volume types allow the Kubelet to change the ownership of that volume to be owned by the pod: - 1. The owning GID will be the FSGroup 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) 3. The permission bits are OR'd with rw-rw---- - If unset, the Kubelet will not modify the ownership and permissions of any volume. Note that this field cannot be set when spec.os.name is windows.

@@ -41058,12 +41071,25 @@ Note that this field cannot be set when spec.os.name is windows.
+ + + + + @@ -41209,7 +41235,6 @@ Note that this field cannot be set when spec.os.name is windows. type indicates which kind of seccomp profile will be applied. Valid options are: - Localhost - a profile defined in a file on the node should be used. RuntimeDefault - the container runtime default profile should be used. Unconfined - no profile should be applied.
@@ -41356,17 +41381,14 @@ This is used as a hint for implementations to offer richer behavior for protocol This field follows standard Kubernetes label syntax. Valid values are either: - * Un-prefixed protocol names - reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). - * Kubernetes-defined prefixed names: * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 - * Other protocols should use implementation-defined prefixed names such as mycompany.com/my-custom-protocol.
@@ -41550,11 +41572,9 @@ Resources to set on generated pods. Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container. - This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. - This field is immutable. It can only be set for containers.
@@ -41605,6 +41625,15 @@ the Pod where this field is used. It makes that resource available inside a container.
+ + + + +
supplementalGroups []integer - A list of groups applied to the first process run in each container, in addition -to the container's primary GID, the fsGroup (if specified), and group memberships -defined in the container image for the uid of the container process. If unspecified, -no additional groups are added to any container. Note that group memberships -defined in the container image for the uid of the container process are still effective, -even if they are not included in this list. + A list of groups applied to the first process run in each container, in +addition to the container's primary GID and fsGroup (if specified). If +the SupplementalGroupsPolicy feature is enabled, the +supplementalGroupsPolicy field determines whether these are in addition +to or instead of any group memberships defined in the container image. +If unspecified, no additional groups are added, though group memberships +defined in the container image may still be used, depending on the +supplementalGroupsPolicy field. +Note that this field cannot be set when spec.os.name is windows.
+
false
supplementalGroupsPolicystring + Defines how supplemental groups of the first container processes are calculated. +Valid values are "Merge" and "Strict". If not specified, "Merge" is used. +(Alpha) Using the field requires the SupplementalGroupsPolicy feature gate to be enabled +and the container runtime must implement support for this feature. Note that this field cannot be set when spec.os.name is windows.
false false true
requeststring + Request is the name chosen for a request in the referenced claim. +If empty, everything from the claim is made available, otherwise +only the result of this request.
+
false
@@ -41617,12 +41646,10 @@ inside a container.
SecurityContext configures the container security context for the generated main container. - In deployment, daemonset, or statefulset mode, this controls the security context settings for the primary application container. - In sidecar mode, this controls the security context for the injected sidecar container. @@ -41681,7 +41708,7 @@ Note that this field cannot be set when spec.os.name is windows.
string procMount denotes the type of proc mount to use for the containers. -The default is DefaultProcMount which uses the container runtime defaults for +The default value is Default which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled. Note that this field cannot be set when spec.os.name is windows.
@@ -41926,7 +41953,6 @@ Note that this field cannot be set when spec.os.name is windows. type indicates which kind of seccomp profile will be applied. Valid options are: - Localhost - a profile defined in a file on the node should be used. RuntimeDefault - the container runtime default profile should be used. Unconfined - no profile should be applied.
@@ -42715,7 +42741,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -42730,7 +42756,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -42979,7 +43005,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -42994,7 +43020,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -43323,7 +43349,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -43338,7 +43364,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -43587,7 +43613,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -43602,7 +43628,7 @@ for the incoming pod's pod (anti) affinity. Keys that don't exist in the incomin pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. -This is an alpha field and requires enabling MatchLabelKeysInPodAffinity feature gate.
+This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
false @@ -43929,9 +43955,7 @@ Selects a key of a ConfigMap. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -44055,9 +44079,7 @@ Selects a key of a secret in the pod's namespace This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -44211,12 +44233,10 @@ Note that this field cannot be set when spec.os.name is windows.
Some volume types allow the Kubelet to change the ownership of that volume to be owned by the pod: - 1. The owning GID will be the FSGroup 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) 3. The permission bits are OR'd with rw-rw---- - If unset, the Kubelet will not modify the ownership and permissions of any volume. Note that this field cannot be set when spec.os.name is windows.

@@ -44300,12 +44320,25 @@ Note that this field cannot be set when spec.os.name is windows.
supplementalGroups []integer - A list of groups applied to the first process run in each container, in addition -to the container's primary GID, the fsGroup (if specified), and group memberships -defined in the container image for the uid of the container process. If unspecified, -no additional groups are added to any container. Note that group memberships -defined in the container image for the uid of the container process are still effective, -even if they are not included in this list. + A list of groups applied to the first process run in each container, in +addition to the container's primary GID and fsGroup (if specified). If +the SupplementalGroupsPolicy feature is enabled, the +supplementalGroupsPolicy field determines whether these are in addition +to or instead of any group memberships defined in the container image. +If unspecified, no additional groups are added, though group memberships +defined in the container image may still be used, depending on the +supplementalGroupsPolicy field. +Note that this field cannot be set when spec.os.name is windows.
+ + false + + supplementalGroupsPolicy + string + + Defines how supplemental groups of the first container processes are calculated. +Valid values are "Merge" and "Strict". If not specified, "Merge" is used. +(Alpha) Using the field requires the SupplementalGroupsPolicy feature gate to be enabled +and the container runtime must implement support for this feature. Note that this field cannot be set when spec.os.name is windows.
false @@ -44451,7 +44484,6 @@ Note that this field cannot be set when spec.os.name is windows. type indicates which kind of seccomp profile will be applied. Valid options are: - Localhost - a profile defined in a file on the node should be used. RuntimeDefault - the container runtime default profile should be used. Unconfined - no profile should be applied.
@@ -44605,7 +44637,6 @@ label selector matches no objects.
Default interval between consecutive scrapes. Intervals set in ServiceMonitors and PodMonitors override it. Equivalent to the same setting on the Prometheus CR. - Default: "30s"

Format: duration
@@ -44819,11 +44850,9 @@ Resources to set on the OpenTelemetryTargetAllocator containers. Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container. - This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. - This field is immutable. It can only be set for containers.
false @@ -44874,6 +44903,15 @@ the Pod where this field is used. It makes that resource available inside a container.
true + + request + string + + Request is the name chosen for a request in the referenced claim. +If empty, everything from the claim is made available, otherwise +only the result of this request.
+ + false @@ -44941,7 +44979,7 @@ Note that this field cannot be set when spec.os.name is windows.
string procMount denotes the type of proc mount to use for the containers. -The default is DefaultProcMount which uses the container runtime defaults for +The default value is Default which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled. Note that this field cannot be set when spec.os.name is windows.
@@ -45186,7 +45224,6 @@ Note that this field cannot be set when spec.os.name is windows. type indicates which kind of seccomp profile will be applied. Valid options are: - Localhost - a profile defined in a file on the node should be used. RuntimeDefault - the container runtime default profile should be used. Unconfined - no profile should be applied.
@@ -45435,7 +45472,6 @@ MatchLabelKeys cannot be set when LabelSelector isn't set. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. - This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default).
false @@ -45454,7 +45490,6 @@ If value is nil, the constraint behaves as if MinDomains is equal to 1. Valid values are integers greater than 0. When value is not nil, WhenUnsatisfiable must be DoNotSchedule. - For example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains is set to 5 and pods with the same labelSelector spread as 2/2/2: | zone1 | zone2 | zone3 | @@ -45476,7 +45511,6 @@ when calculating pod topology spread skew. Options are: - Honor: only nodes matching nodeAffinity/nodeSelector are included in the calculations. - Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations. - If this value is nil, the behavior is equivalent to the Honor policy. This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag.
@@ -45491,7 +45525,6 @@ pod topology spread skew. Options are: has a toleration, are included. - Ignore: node taints are ignored. All nodes are included. - If this value is nil, the behavior is equivalent to the Ignore policy. This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag.
@@ -45754,7 +45787,6 @@ MatchLabelKeys cannot be set when LabelSelector isn't set. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. - This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default).
false @@ -45773,7 +45805,6 @@ If value is nil, the constraint behaves as if MinDomains is equal to 1. Valid values are integers greater than 0. When value is not nil, WhenUnsatisfiable must be DoNotSchedule. - For example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains is set to 5 and pods with the same labelSelector spread as 2/2/2: | zone1 | zone2 | zone3 | @@ -45795,7 +45826,6 @@ when calculating pod topology spread skew. Options are: - Honor: only nodes matching nodeAffinity/nodeSelector are included in the calculations. - Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations. - If this value is nil, the behavior is equivalent to the Honor policy. This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag.
@@ -45810,7 +45840,6 @@ pod topology spread skew. Options are: has a toleration, are included. - Ignore: node taints are ignored. All nodes are included. - If this value is nil, the behavior is equivalent to the Ignore policy. This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag.
@@ -46127,7 +46156,7 @@ If the resource referred to by volumeAttributesClass does not exist, this Persis set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource exists. More info: https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/ -(Alpha) Using this field requires the VolumeAttributesClass feature gate to be enabled.
+(Beta) Using this field requires the VolumeAttributesClass feature gate to be enabled (off by default).
false @@ -46428,7 +46457,6 @@ Key names follow standard Kubernetes label syntax. Valid values are either: Apart from above values - keys that are unprefixed or have kubernetes.io prefix are considered reserved and hence may not be used. - ClaimResourceStatus can be in any of following states: - ControllerResizeInProgress: State set when resize controller starts resizing the volume in control-plane. @@ -46456,7 +46484,6 @@ Key names follow standard Kubernetes label syntax. Valid values are either: Apart from above values - keys that are unprefixed or have kubernetes.io prefix are considered reserved and hence may not be used. - Capacity reported here may be larger than the actual capacity when a volume expansion operation is requested. For storage quota, the larger value from allocatedResources and PVC.spec.resources is used. @@ -46465,7 +46492,6 @@ If a volume expansion capacity request is lowered, allocatedResources is only lowered if there are no expansion operations in progress and if the actual volume capacity is equal or lower than the requested capacity. - A controller that receives PVC update with previously unknown resourceName should ignore the update for the purpose it was designed.
@@ -46491,7 +46517,7 @@ resized then the Condition will be set to 'Resizing'.
currentVolumeAttributesClassName is the current name of the VolumeAttributesClass the PVC is using. When unset, there is no VolumeAttributeClass applied to this PersistentVolumeClaim -This is an alpha field and requires enabling VolumeAttributesClass feature.
+This is a beta field and requires enabling VolumeAttributesClass feature (off by default).
false @@ -46500,7 +46526,7 @@ This is an alpha field and requires enabling VolumeAttributesClass feature.
ModifyVolumeStatus represents the status object of ControllerModifyVolume operation. When this is unset, there is no ModifyVolume operation being attempted. -This is an alpha field and requires enabling VolumeAttributesClass feature.
+This is a beta field and requires enabling VolumeAttributesClass feature (off by default).
false @@ -46541,7 +46567,15 @@ PersistentVolumeClaimCondition contains details about state of pvc type string - PersistentVolumeClaimConditionType is a valid value of PersistentVolumeClaimCondition.Type
+ PersistentVolumeClaimConditionType defines the condition of PV claim. +Valid values are: + - "Resizing", "FileSystemResizePending" + +If RecoverVolumeExpansionFailure feature gate is enabled, then following additional values can be expected: + - "ControllerResizeError", "NodeResizeError" + +If VolumeAttributesClass feature gate is enabled, then following additional values can be expected: + - "ModifyVolumeError", "ModifyingVolume"
true @@ -46589,7 +46623,7 @@ persistent volume is being resized.
ModifyVolumeStatus represents the status object of ControllerModifyVolume operation. When this is unset, there is no ModifyVolume operation being attempted. -This is an alpha field and requires enabling VolumeAttributesClass feature. +This is a beta field and requires enabling VolumeAttributesClass feature (off by default). @@ -46685,10 +46719,8 @@ Defaults to false.
RecursiveReadOnly specifies whether read-only mounts should be handled recursively. - If ReadOnly is false, this field has no meaning and must be unspecified. - If ReadOnly is true, and this field is set to Disabled, the mount is not made recursively read-only. If this field is set to IfPossible, the mount is made recursively read-only, if it is supported by the container runtime. If this @@ -46696,11 +46728,9 @@ field is set to Enabled, the mount is made recursively read-only if it is supported by the container runtime, otherwise the pod will not be started and an error will be generated to indicate the reason. - If this field is set to IfPossible or Enabled, MountPropagation must be set to None (or be unspecified, which defaults to None). - If this field is not specified, it is treated as an equivalent of Disabled.
@@ -46826,7 +46856,6 @@ More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir
The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, and deleted when the pod is removed. - Use this if: a) the volume is only needed while the pod runs, b) features of normal volumes like restoring from snapshot or capacity @@ -46837,17 +46866,14 @@ d) the storage driver supports dynamic volume provisioning through information on the connection between this volume type and PersistentVolumeClaim). - Use PersistentVolumeClaim or one of the vendor-specific APIs for volumes that persist for longer than the lifecycle of an individual pod. - Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to be used that way - see the documentation of the driver for more information. - A pod can use both types of ephemeral volumes and persistent volumes at the same time.
@@ -46909,10 +46935,22 @@ More info: https://examples.k8s.io/volumes/glusterfs/README.md
machine that is directly exposed to the container. This is generally used for system agents or other privileged things that are allowed to see the host machine. Most containers will NOT need this. -More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath ---- -TODO(jonesdl) We need to restrict who can use host directory mounts and who can/can not -mount host directories as read/write.
+More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath
+ + + + + + @@ -47043,8 +47081,7 @@ More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockst fsType is the filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. -More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore -TODO: how do we prevent errors in the filesystem from compromising the machine
+More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
@@ -47115,6 +47152,8 @@ azureDisk represents an Azure Data Disk mount on the host and bind mount to the fsType is Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
+
+ Default: ext4
@@ -47130,6 +47169,8 @@ Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
@@ -47271,9 +47312,7 @@ More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -47363,9 +47402,7 @@ to OpenStack. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -47426,9 +47463,7 @@ relative and may not contain the '..' path or start with '..'.
This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -47587,9 +47622,7 @@ secret object contains more than one secret, all secret references are passed. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -47825,7 +47858,6 @@ ephemeral represents a volume that is handled by a cluster storage driver. The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, and deleted when the pod is removed. - Use this if: a) the volume is only needed while the pod runs, b) features of normal volumes like restoring from snapshot or capacity @@ -47836,17 +47868,14 @@ d) the storage driver supports dynamic volume provisioning through information on the connection between this volume type and PersistentVolumeClaim). - Use PersistentVolumeClaim or one of the vendor-specific APIs for volumes that persist for longer than the lifecycle of an individual pod. - Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to be used that way - see the documentation of the driver for more information. - A pod can use both types of ephemeral volumes and persistent volumes at the same time. @@ -47871,7 +47900,6 @@ pod. The name of the PVC will be `-` where entry. Pod validation will reject the pod if the concatenated name is not valid for a PVC (for example, too long). - An existing PVC with that name that is not owned by the pod will *not* be used for the pod to avoid using an unrelated volume by mistake. Starting the pod is then blocked until @@ -47881,11 +47909,9 @@ owner reference to the pod once the pod exists. Normally this should not be necessary, but it may be useful when manually reconstructing a broken cluster. - This field is read-only and no changes will be made by Kubernetes to the PVC after it has been created. - Required, must not be nil.
@@ -47906,7 +47932,6 @@ pod. The name of the PVC will be `-` where entry. Pod validation will reject the pod if the concatenated name is not valid for a PVC (for example, too long). - An existing PVC with that name that is not owned by the pod will *not* be used for the pod to avoid using an unrelated volume by mistake. Starting the pod is then blocked until @@ -47916,11 +47941,9 @@ owner reference to the pod once the pod exists. Normally this should not be necessary, but it may be useful when manually reconstructing a broken cluster. - This field is read-only and no changes will be made by Kubernetes to the PVC after it has been created. - Required, must not be nil.
false false
imageobject + image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine. +The volume is resolved at pod startup depending on which PullPolicy value is provided: + +- Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. +- Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. +- IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. + +The volume gets re-resolved if the pod gets deleted and recreated, which means that new remote content will become available on pod recreation. +A failure to resolve or pull the image during pod startup will block containers from starting and may add significant latency. Failures will be retried using normal volume backoff and will be reported on the pod reason and message.
false
false
false
readOnly Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.
+
+ Default: false
false
false
@@ -48059,7 +48082,7 @@ If the resource referred to by volumeAttributesClass does not exist, this Persis set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource exists. More info: https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/ -(Alpha) Using this field requires the VolumeAttributesClass feature gate to be enabled.
+(Beta) Using this field requires the VolumeAttributesClass feature gate to be enabled (off by default).
@@ -48401,8 +48424,7 @@ fc represents a Fibre Channel resource that is attached to a kubelet's host mach @@ -48532,9 +48554,7 @@ scripts. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -48611,8 +48631,7 @@ More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk fsType is filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. -More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk -TODO: how do we prevent errors in the filesystem from compromising the machine
+More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk
@@ -48744,9 +48763,6 @@ machine that is directly exposed to the container. This is generally used for system agents or other privileged things that are allowed to see the host machine. Most containers will NOT need this. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath ---- -TODO(jonesdl) We need to restrict who can use host directory mounts and who can/can not -mount host directories as read/write.
false
fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. -Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. -TODO: how do we prevent errors in the filesystem from compromising the machine
+Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
false
false
@@ -48779,6 +48795,57 @@ More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath
+### OpenTelemetryCollector.spec.volumes[index].image +[↩ Parent](#opentelemetrycollectorspecvolumesindex-1) + + + +image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine. +The volume is resolved at pod startup depending on which PullPolicy value is provided: + +- Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. +- Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. +- IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. + +The volume gets re-resolved if the pod gets deleted and recreated, which means that new remote content will become available on pod recreation. +A failure to resolve or pull the image during pod startup will block containers from starting and may add significant latency. Failures will be retried using normal volume backoff and will be reported on the pod reason and message. + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionRequired
pullPolicystring + Policy for pulling OCI objects. Possible values are: +Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. +Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. +IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. +Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
+
false
referencestring + Required: Image or artifact reference to be used. +Behaves in the same way as pod.spec.containers[*].image. +Pull secrets will be assembled in the same way as for the container image by looking up node credentials, SA image pull secrets, and pod spec image pull secrets. +More info: https://kubernetes.io/docs/concepts/containers/images +This field is optional to allow higher level config management to default or override +container images in workload controllers like Deployments and StatefulSets.
+
false
+ + ### OpenTelemetryCollector.spec.volumes[index].iscsi [↩ Parent](#opentelemetrycollectorspecvolumesindex-1) @@ -48842,8 +48909,7 @@ is other than default (typically TCP ports 860 and 3260).
fsType is the filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. -More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi -TODO: how do we prevent errors in the filesystem from compromising the machine
+More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi
false @@ -48861,6 +48927,8 @@ If initiatorName is specified with iscsiInterface simultaneously, new iSCSI inte iscsiInterface is the interface Name that uses an iSCSI transport. Defaults to 'default' (tcp).
+
+ Default: default
false @@ -48914,9 +48982,7 @@ secretRef is the CHAP Secret for iSCSI target and initiator authentication This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -49123,7 +49189,8 @@ mode, like fsGroup, and the result can be other mode bits set.
sources []object - sources is the list of volume projections
+ sources is the list of volume projections. Each entry in this list +handles one source.
false @@ -49135,7 +49202,8 @@ mode, like fsGroup, and the result can be other mode bits set.
-Projection that may be projected along with other supported volume types +Projection that may be projected along with other supported volume types. +Exactly one of these fields must be set. @@ -49153,14 +49221,11 @@ Projection that may be projected along with other supported volume types ClusterTrustBundle allows a pod to access the `.spec.trustBundle` field of ClusterTrustBundle objects in an auto-updating file. - Alpha, gated by the ClusterTrustBundleProjection feature gate. - ClusterTrustBundle objects can either be selected by name, or by the combination of signer name and a label selector. - Kubelet performs aggressive normalization of the PEM contents written into the pod filesystem. Esoteric PEM features such as inter-block comments and block headers are stripped. Certificates are deduplicated. @@ -49208,14 +49273,11 @@ may change the order over time.
ClusterTrustBundle allows a pod to access the `.spec.trustBundle` field of ClusterTrustBundle objects in an auto-updating file. - Alpha, gated by the ClusterTrustBundleProjection feature gate. - ClusterTrustBundle objects can either be selected by name, or by the combination of signer name and a label selector. - Kubelet performs aggressive normalization of the PEM contents written into the pod filesystem. Esoteric PEM features such as inter-block comments and block headers are stripped. Certificates are deduplicated. @@ -49402,9 +49464,7 @@ relative and may not contain the '..' path or start with '..'.
This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -49667,9 +49727,7 @@ relative and may not contain the '..' path or start with '..'.
This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -49896,8 +49954,7 @@ More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it
fsType is the filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. -More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd -TODO: how do we prevent errors in the filesystem from compromising the machine
+More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd
@@ -49907,6 +49964,8 @@ TODO: how do we prevent errors in the filesystem from compromising the machine +
+ Default: /etc/ceph/keyring
@@ -49916,6 +49975,8 @@ More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it
pool is the rados pool name. Default is rbd. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it
+
+ Default: rbd
@@ -49944,6 +50005,8 @@ More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it
user is the rados user name. Default is admin. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it
+
+ Default: admin
@@ -49977,9 +50040,7 @@ More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -50034,6 +50095,8 @@ sensitive information. If this is not provided, Login operation will fail.
Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Default is "xfs".
+
+ Default: xfs
@@ -50064,6 +50127,8 @@ the ReadOnly setting in VolumeMounts.
@@ -50110,9 +50175,7 @@ sensitive information. If this is not provided, Login operation will fail. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
@@ -50326,9 +50389,7 @@ credentials. If not specified, default values will be attempted. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. -TODO: Add other useful fields. apiVersion, kind, uid? -More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names -TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
+More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

Default:
diff --git a/go.mod b/go.mod index 38888e5089..3e953a02be 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ retract v1.51.0 require ( dario.cat/mergo v1.0.1 github.com/Masterminds/semver/v3 v3.2.1 + github.com/blang/semver/v4 v4.0.0 github.com/buraksezer/consistent v0.10.0 github.com/cespare/xxhash/v2 v2.3.0 github.com/ghodss/yaml v1.0.0 @@ -40,15 +41,15 @@ require ( go.uber.org/zap v1.27.0 gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v3 v3.0.1 - k8s.io/api v0.30.3 - k8s.io/apiextensions-apiserver v0.30.3 - k8s.io/apimachinery v0.30.3 - k8s.io/client-go v0.30.3 - k8s.io/component-base v0.30.3 + k8s.io/api v0.31.0 + k8s.io/apiextensions-apiserver v0.31.0 + k8s.io/apimachinery v0.31.0 + k8s.io/client-go v0.31.0 + k8s.io/component-base v0.31.0 k8s.io/klog/v2 v2.130.1 k8s.io/kubectl v0.30.3 k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 - sigs.k8s.io/controller-runtime v0.18.5 + sigs.k8s.io/controller-runtime v0.19.0 sigs.k8s.io/yaml v1.4.0 ) @@ -69,7 +70,6 @@ require ( github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/aws/aws-sdk-go v1.54.19 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/blang/semver/v4 v4.0.0 // indirect github.com/bytedance/sonic v1.11.6 // indirect github.com/bytedance/sonic/loader v0.1.1 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect @@ -88,12 +88,12 @@ require ( github.com/emicklei/go-restful/v3 v3.12.1 // indirect github.com/envoyproxy/go-control-plane v0.12.0 // indirect github.com/envoyproxy/protoc-gen-validate v1.0.4 // indirect - github.com/evanphx/json-patch v5.9.0+incompatible // indirect github.com/evanphx/json-patch/v5 v5.9.0 // indirect github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb // indirect github.com/fatih/color v1.16.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/fxamacker/cbor/v2 v2.7.0 // indirect github.com/gabriel-vasile/mimetype v1.4.3 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect @@ -183,12 +183,13 @@ require ( github.com/prometheus/common/sigv4 v0.1.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/scaleway/scaleway-sdk-go v1.0.0-beta.29 // indirect - github.com/spf13/cobra v1.7.0 // indirect + github.com/spf13/cobra v1.8.1 // indirect github.com/tklauser/go-sysconf v0.3.13 // indirect github.com/tklauser/numcpus v0.7.0 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.12 // indirect github.com/vultr/govultr/v2 v2.17.2 // indirect + github.com/x448/float16 v0.8.4 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect go.mongodb.org/mongo-driver v1.14.0 // indirect go.opencensus.io v0.24.0 // indirect @@ -214,6 +215,7 @@ require ( google.golang.org/genproto/googleapis/rpc v0.0.0-20240708141625-4ad9e859172b // indirect google.golang.org/grpc v1.65.0 // indirect google.golang.org/protobuf v1.34.2 // indirect + gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect k8s.io/kube-openapi v0.0.0-20240808142205-8e686545bdb8 // indirect diff --git a/go.sum b/go.sum index b2de8d544b..16c8c98e0e 100644 --- a/go.sum +++ b/go.sum @@ -121,7 +121,7 @@ github.com/cncf/xds/go v0.0.0-20240423153145-555b57ec207b h1:ga8SEFjZ60pxLcmhnTh github.com/cncf/xds/go v0.0.0-20240423153145-555b57ec207b/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= @@ -169,6 +169,8 @@ github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2 github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= +github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= @@ -473,8 +475,8 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= -github.com/moby/term v0.0.0-20221205130635-1aeaba878587 h1:HfkjXDfhgVaN5rmueG8cL8KKeFNecRCXFhaJ2qZ5SKA= -github.com/moby/term v0.0.0-20221205130635-1aeaba878587/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= +github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= +github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -587,8 +589,8 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= -github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -620,6 +622,8 @@ github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65E github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/vultr/govultr/v2 v2.17.2 h1:gej/rwr91Puc/tgh+j33p/BLR16UrIPnSr+AIwYWZQs= github.com/vultr/govultr/v2 v2.17.2/go.mod h1:ZFOKGWmgjytfyjeyAdhQlSWwTjh2ig+X49cAp50dzXI= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -1018,6 +1022,8 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= +gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= @@ -1042,16 +1048,16 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/api v0.30.3 h1:ImHwK9DCsPA9uoU3rVh4QHAHHK5dTSv1nxJUapx8hoQ= -k8s.io/api v0.30.3/go.mod h1:GPc8jlzoe5JG3pb0KJCSLX5oAFIW3/qNJITlDj8BH04= -k8s.io/apiextensions-apiserver v0.30.3 h1:oChu5li2vsZHx2IvnGP3ah8Nj3KyqG3kRSaKmijhB9U= -k8s.io/apiextensions-apiserver v0.30.3/go.mod h1:uhXxYDkMAvl6CJw4lrDN4CPbONkF3+XL9cacCT44kV4= -k8s.io/apimachinery v0.30.3 h1:q1laaWCmrszyQuSQCfNB8cFgCuDAoPszKY4ucAjDwHc= -k8s.io/apimachinery v0.30.3/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= -k8s.io/client-go v0.30.3 h1:bHrJu3xQZNXIi8/MoxYtZBBWQQXwy16zqJwloXXfD3k= -k8s.io/client-go v0.30.3/go.mod h1:8d4pf8vYu665/kUbsxWAQ/JDBNWqfFeZnvFiVdmx89U= -k8s.io/component-base v0.30.3 h1:Ci0UqKWf4oiwy8hr1+E3dsnliKnkMLZMVbWzeorlk7s= -k8s.io/component-base v0.30.3/go.mod h1:C1SshT3rGPCuNtBs14RmVD2xW0EhRSeLvBh7AGk1quA= +k8s.io/api v0.31.0 h1:b9LiSjR2ym/SzTOlfMHm1tr7/21aD7fSkqgD/CVJBCo= +k8s.io/api v0.31.0/go.mod h1:0YiFF+JfFxMM6+1hQei8FY8M7s1Mth+z/q7eF1aJkTE= +k8s.io/apiextensions-apiserver v0.31.0 h1:fZgCVhGwsclj3qCw1buVXCV6khjRzKC5eCFt24kyLSk= +k8s.io/apiextensions-apiserver v0.31.0/go.mod h1:b9aMDEYaEe5sdK+1T0KU78ApR/5ZVp4i56VacZYEHxk= +k8s.io/apimachinery v0.31.0 h1:m9jOiSr3FoSSL5WO9bjm1n6B9KROYYgNZOb4tyZ1lBc= +k8s.io/apimachinery v0.31.0/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= +k8s.io/client-go v0.31.0 h1:QqEJzNjbN2Yv1H79SsS+SWnXkBgVu4Pj3CJQgbx0gI8= +k8s.io/client-go v0.31.0/go.mod h1:Y9wvC76g4fLjmU0BA+rV+h2cncoadjvjjkkIGoTLcGU= +k8s.io/component-base v0.31.0 h1:/KIzGM5EvPNQcYgwq5NwoQBaOlVFrghoVGr8lG6vNRs= +k8s.io/component-base v0.31.0/go.mod h1:TYVuzI1QmN4L5ItVdMSXKvH7/DtvIuas5/mm8YT3rTo= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-openapi v0.0.0-20240808142205-8e686545bdb8 h1:1Wof1cGQgA5pqgo8MxKPtf+qN6Sh/0JzznmeGPm1HnE= @@ -1065,8 +1071,8 @@ rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8 rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -sigs.k8s.io/controller-runtime v0.18.5 h1:nTHio/W+Q4aBlQMgbnC5hZb4IjIidyrizMai9P6n4Rk= -sigs.k8s.io/controller-runtime v0.18.5/go.mod h1:TVoGrfdpbA9VRFaRnKgk9P5/atA0pMwq+f+msb9M8Sg= +sigs.k8s.io/controller-runtime v0.19.0 h1:nWVM7aq+Il2ABxwiCizrVDSlmDcshi9llbaFbC0ji/Q= +sigs.k8s.io/controller-runtime v0.19.0/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= diff --git a/tests/e2e/node-selector-collector/00-install-collectors-without-node-selector.yaml b/tests/e2e/node-selector-collector/00-install-collectors-without-node-selector.yaml index 7e007b9267..b4e3044ef0 100644 --- a/tests/e2e/node-selector-collector/00-install-collectors-without-node-selector.yaml +++ b/tests/e2e/node-selector-collector/00-install-collectors-without-node-selector.yaml @@ -6,6 +6,7 @@ metadata: node-selector-mode: without spec: mode: deployment + nodeSelector: config: | receivers: otlp: @@ -32,6 +33,7 @@ metadata: node-selector-mode: without spec: mode: daemonset + nodeSelector: config: | receivers: otlp: @@ -58,6 +60,7 @@ metadata: node-selector-mode: without spec: mode: statefulset + nodeSelector: config: | receivers: otlp: diff --git a/tests/e2e/node-selector-collector/chainsaw-test.yaml b/tests/e2e/node-selector-collector/chainsaw-test.yaml index 60559e2c5e..bba90290e8 100644 --- a/tests/e2e/node-selector-collector/chainsaw-test.yaml +++ b/tests/e2e/node-selector-collector/chainsaw-test.yaml @@ -39,14 +39,8 @@ spec: - name: step-02 description: back to no nodeSelector try: - - command: # while update is not supported on 0.1.7, but 0.1.9 https://kyverno.github.io/chainsaw/0.1.9/operations/update/ - entrypoint: kubectl - args: - - -n - - ${NAMESPACE} - - replace - - -f - - 00-install-collectors-without-node-selector.yaml + - apply: + file: 00-install-collectors-without-node-selector.yaml # deployment - assert: file: 00-assert-deployment-without-node-selector.yaml From dbf9c77dbacde152fe527264cd94fe632fbf714a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 22 Aug 2024 18:28:56 +0200 Subject: [PATCH 08/41] Bump k8s.io/kubectl in the kubernetes group across 1 directory (#3237) Bumps the kubernetes group with 1 update in the / directory: [k8s.io/kubectl](https://github.com/kubernetes/kubectl). Updates `k8s.io/kubectl` from 0.30.3 to 0.31.0 - [Commits](https://github.com/kubernetes/kubectl/compare/v0.30.3...v0.31.0) --- updated-dependencies: - dependency-name: k8s.io/kubectl dependency-type: direct:production update-type: version-update:semver-minor dependency-group: kubernetes ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 3e953a02be..43b182879f 100644 --- a/go.mod +++ b/go.mod @@ -47,7 +47,7 @@ require ( k8s.io/client-go v0.31.0 k8s.io/component-base v0.31.0 k8s.io/klog/v2 v2.130.1 - k8s.io/kubectl v0.30.3 + k8s.io/kubectl v0.31.0 k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 sigs.k8s.io/controller-runtime v0.19.0 sigs.k8s.io/yaml v1.4.0 diff --git a/go.sum b/go.sum index 16c8c98e0e..97074c16c5 100644 --- a/go.sum +++ b/go.sum @@ -1062,8 +1062,8 @@ k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-openapi v0.0.0-20240808142205-8e686545bdb8 h1:1Wof1cGQgA5pqgo8MxKPtf+qN6Sh/0JzznmeGPm1HnE= k8s.io/kube-openapi v0.0.0-20240808142205-8e686545bdb8/go.mod h1:Os6V6dZwLNii3vxFpxcNaTmH8LJJBkOTg1N0tOA0fvA= -k8s.io/kubectl v0.30.3 h1:YIBBvMdTW0xcDpmrOBzcpUVsn+zOgjMYIu7kAq+yqiI= -k8s.io/kubectl v0.30.3/go.mod h1:IcR0I9RN2+zzTRUa1BzZCm4oM0NLOawE6RzlDvd1Fpo= +k8s.io/kubectl v0.31.0 h1:kANwAAPVY02r4U4jARP/C+Q1sssCcN/1p9Nk+7BQKVg= +k8s.io/kubectl v0.31.0/go.mod h1:pB47hhFypGsaHAPjlwrNbvhXgmuAr01ZBvAIIUaI8d4= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= From eed19b2ada232098c1b6877bb4eb71a484f06f44 Mon Sep 17 00:00:00 2001 From: ItielOlenick <67790309+ItielOlenick@users.noreply.github.com> Date: Fri, 23 Aug 2024 17:15:09 +0300 Subject: [PATCH 09/41] App for TA collector mtls e2e tests (#3120) * Added app for TA-collecotr mTLS secert transfer e2e tests * Newline * Added change log * Update publish-test-e2e-images.yaml * Delete .chloggen/publish-test-e2e-images.yaml * Added README.md --- .../workflows/publish-test-e2e-images.yaml | 5 +++ .../metrics-basic-auth/Dockerfile | 10 ++++++ .../metrics-basic-auth/README.md | 8 +++++ tests/test-e2e-apps/metrics-basic-auth/app.py | 36 +++++++++++++++++++ .../metrics-basic-auth/requirements.txt | 2 ++ 5 files changed, 61 insertions(+) create mode 100644 tests/test-e2e-apps/metrics-basic-auth/Dockerfile create mode 100644 tests/test-e2e-apps/metrics-basic-auth/README.md create mode 100644 tests/test-e2e-apps/metrics-basic-auth/app.py create mode 100644 tests/test-e2e-apps/metrics-basic-auth/requirements.txt diff --git a/.github/workflows/publish-test-e2e-images.yaml b/.github/workflows/publish-test-e2e-images.yaml index aee5d03ec1..2f91f08549 100644 --- a/.github/workflows/publish-test-e2e-images.yaml +++ b/.github/workflows/publish-test-e2e-images.yaml @@ -53,3 +53,8 @@ jobs: with: path: nodejs platforms: linux/arm64,linux/amd64,linux/s390x,linux/ppc64le + metrics-basic-auth: + uses: ./.github/workflows/reusable-publish-test-e2e-images.yaml + with: + path: metrics-basic-auth + platforms: linux/arm64,linux/amd64,linux/s390x,linux/ppc64le diff --git a/tests/test-e2e-apps/metrics-basic-auth/Dockerfile b/tests/test-e2e-apps/metrics-basic-auth/Dockerfile new file mode 100644 index 0000000000..0a2d008a30 --- /dev/null +++ b/tests/test-e2e-apps/metrics-basic-auth/Dockerfile @@ -0,0 +1,10 @@ +FROM python:3.11-slim + +COPY requirements.txt . +RUN pip install -r requirements.txt + +COPY app.py . + +EXPOSE 9123 + +CMD ["python", "app.py"] diff --git a/tests/test-e2e-apps/metrics-basic-auth/README.md b/tests/test-e2e-apps/metrics-basic-auth/README.md new file mode 100644 index 0000000000..16ccb48474 --- /dev/null +++ b/tests/test-e2e-apps/metrics-basic-auth/README.md @@ -0,0 +1,8 @@ +# Metrics Basic Auth E2E Test App +Simple web application used in an end-to-end (E2E) test to verify that the OpenTelemetry collector can retrieve secret authentication details from the target allocator over mTLS. + +## Overview +The web app provides a metrics endpoint secured with basic authentication, simulating real-world scenarios where services require secure access to their metrics. + +## Usage +This app is used within the E2E test suite to verify the OpenTelemetry operator's handling of mTLS-secured communications. \ No newline at end of file diff --git a/tests/test-e2e-apps/metrics-basic-auth/app.py b/tests/test-e2e-apps/metrics-basic-auth/app.py new file mode 100644 index 0000000000..f2ffaa7f64 --- /dev/null +++ b/tests/test-e2e-apps/metrics-basic-auth/app.py @@ -0,0 +1,36 @@ +import os +os.environ['PROMETHEUS_DISABLE_CREATED_SERIES'] = 'true' + +from flask import Flask, Response, request +from prometheus_client import Gauge, generate_latest, REGISTRY, PROCESS_COLLECTOR, PLATFORM_COLLECTOR, GC_COLLECTOR + +app = Flask(__name__) + +REGISTRY.unregister(PROCESS_COLLECTOR) +REGISTRY.unregister(PLATFORM_COLLECTOR) +REGISTRY.unregister(GC_COLLECTOR) + +secure = Gauge('authenticated', 'Client was authenticated') +secure.set(1) + +USERNAME = "user" +PASSWORD = "t0p$ecreT" + +def check_auth(username, password): + return username == USERNAME and password == PASSWORD + +def authenticate(): + return Response( + 'Could not verify your access level for that URL.\n' + 'You have to login with proper credentials', 401, + {'WWW-Authenticate': 'Basic realm="Login Required"'}) + +@app.route('/metrics') +def metrics(): + auth = request.authorization + if not auth or not check_auth(auth.username, auth.password): + return authenticate() + return Response(generate_latest(), mimetype='text/plain') + +if __name__ == '__main__': + app.run(host='0.0.0.0', port=9123) diff --git a/tests/test-e2e-apps/metrics-basic-auth/requirements.txt b/tests/test-e2e-apps/metrics-basic-auth/requirements.txt new file mode 100644 index 0000000000..865b49ac22 --- /dev/null +++ b/tests/test-e2e-apps/metrics-basic-auth/requirements.txt @@ -0,0 +1,2 @@ +Flask==2.3.3 +prometheus_client==0.20.0 From ce2692a3c31e8de44b8b1d50d663286d5ad0ad66 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2024 09:31:31 +0200 Subject: [PATCH 10/41] Bump github.com/prometheus/client_golang from 1.20.0 to 1.20.2 (#3239) Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.20.0 to 1.20.2. - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus/client_golang/compare/v1.20.0...v1.20.2) --- updated-dependencies: - dependency-name: github.com/prometheus/client_golang dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 43b182879f..9eac8857de 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,7 @@ require ( github.com/prometheus-operator/prometheus-operator v0.76.0 github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.76.0 github.com/prometheus-operator/prometheus-operator/pkg/client v0.76.0 - github.com/prometheus/client_golang v1.20.0 + github.com/prometheus/client_golang v1.20.2 github.com/prometheus/common v0.55.0 github.com/prometheus/prometheus v0.54.0 github.com/shirou/gopsutil v3.21.11+incompatible diff --git a/go.sum b/go.sum index 97074c16c5..ee4cdd9d0f 100644 --- a/go.sum +++ b/go.sum @@ -545,8 +545,8 @@ github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3O github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.20.0 h1:jBzTZ7B099Rg24tny+qngoynol8LtVYlA2bqx3vEloI= -github.com/prometheus/client_golang v1.20.0/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= From 50008928f34f21f388e59558789a9025fe2bf13f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2024 10:21:43 +0200 Subject: [PATCH 11/41] Bump the otel group with 6 updates (#3238) Bumps the otel group with 6 updates: | Package | From | To | | --- | --- | --- | | [go.opentelemetry.io/otel](https://github.com/open-telemetry/opentelemetry-go) | `1.28.0` | `1.29.0` | | [go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp](https://github.com/open-telemetry/opentelemetry-go) | `1.28.0` | `1.29.0` | | [go.opentelemetry.io/otel/exporters/prometheus](https://github.com/open-telemetry/opentelemetry-go) | `0.50.0` | `0.51.0` | | [go.opentelemetry.io/otel/metric](https://github.com/open-telemetry/opentelemetry-go) | `1.28.0` | `1.29.0` | | [go.opentelemetry.io/otel/sdk](https://github.com/open-telemetry/opentelemetry-go) | `1.28.0` | `1.29.0` | | [go.opentelemetry.io/otel/sdk/metric](https://github.com/open-telemetry/opentelemetry-go) | `1.28.0` | `1.29.0` | Updates `go.opentelemetry.io/otel` from 1.28.0 to 1.29.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.28.0...v1.29.0) Updates `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` from 1.28.0 to 1.29.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.28.0...v1.29.0) Updates `go.opentelemetry.io/otel/exporters/prometheus` from 0.50.0 to 0.51.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/example/prometheus/v0.50.0...example/prometheus/v0.51.0) Updates `go.opentelemetry.io/otel/metric` from 1.28.0 to 1.29.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.28.0...v1.29.0) Updates `go.opentelemetry.io/otel/sdk` from 1.28.0 to 1.29.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.28.0...v1.29.0) Updates `go.opentelemetry.io/otel/sdk/metric` from 1.28.0 to 1.29.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.28.0...v1.29.0) --- updated-dependencies: - dependency-name: go.opentelemetry.io/otel dependency-type: direct:production update-type: version-update:semver-minor dependency-group: otel - dependency-name: go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp dependency-type: direct:production update-type: version-update:semver-minor dependency-group: otel - dependency-name: go.opentelemetry.io/otel/exporters/prometheus dependency-type: direct:production update-type: version-update:semver-minor dependency-group: otel - dependency-name: go.opentelemetry.io/otel/metric dependency-type: direct:production update-type: version-update:semver-minor dependency-group: otel - dependency-name: go.opentelemetry.io/otel/sdk dependency-type: direct:production update-type: version-update:semver-minor dependency-group: otel - dependency-name: go.opentelemetry.io/otel/sdk/metric dependency-type: direct:production update-type: version-update:semver-minor dependency-group: otel ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 20 ++++++++++---------- go.sum | 40 ++++++++++++++++++++-------------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/go.mod b/go.mod index 9eac8857de..357cc726d4 100644 --- a/go.mod +++ b/go.mod @@ -31,12 +31,12 @@ require ( github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/collector/featuregate v1.13.0 - go.opentelemetry.io/otel v1.28.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.28.0 - go.opentelemetry.io/otel/exporters/prometheus v0.50.0 - go.opentelemetry.io/otel/metric v1.28.0 - go.opentelemetry.io/otel/sdk v1.28.0 - go.opentelemetry.io/otel/sdk/metric v1.28.0 + go.opentelemetry.io/otel v1.29.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.29.0 + go.opentelemetry.io/otel/exporters/prometheus v0.51.0 + go.opentelemetry.io/otel/metric v1.29.0 + go.opentelemetry.io/otel/sdk v1.29.0 + go.opentelemetry.io/otel/sdk/metric v1.29.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 gopkg.in/yaml.v2 v2.4.0 @@ -130,7 +130,7 @@ require ( github.com/gophercloud/gophercloud v1.13.0 // indirect github.com/gorilla/websocket v1.5.1 // indirect github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect github.com/hashicorp/consul/api v1.29.2 // indirect github.com/hashicorp/cronexpr v1.1.2 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect @@ -194,7 +194,7 @@ require ( go.mongodb.org/mongo-driver v1.14.0 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect - go.opentelemetry.io/otel/trace v1.28.0 // indirect + go.opentelemetry.io/otel/trace v1.29.0 // indirect go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/atomic v1.11.0 // indirect golang.org/x/arch v0.8.0 // indirect @@ -211,8 +211,8 @@ require ( golang.org/x/tools v0.24.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect google.golang.org/api v0.188.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240708141625-4ad9e859172b // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect google.golang.org/grpc v1.65.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect diff --git a/go.sum b/go.sum index ee4cdd9d0f..05a459a231 100644 --- a/go.sum +++ b/go.sum @@ -329,8 +329,8 @@ github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/ github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc h1:GN2Lv3MGO7AS6PrRoT6yV5+wkrOpcszoIsO4+4ds248= github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc/go.mod h1:+JKpmjMGhpgPL+rXZ5nsZieVzvarn86asRlBg4uNGnk= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjwqUPTYmYuemVOx+Ys= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0/go.mod h1:ggCgvZ2r7uOoQjOyu2Y1NhHmEPPzzuhWgcza5M1Ji1I= github.com/hashicorp/consul/api v1.29.2 h1:aYyRn8EdE2mSfG14S1+L9Qkjtz8RzmaWh6AcNGRNwPw= github.com/hashicorp/consul/api v1.29.2/go.mod h1:0YObcaLNDSbtlgzIRtmRXI1ZkeuK0trCBxwZQ4MYnIk= github.com/hashicorp/consul/proto-public v0.6.2 h1:+DA/3g/IiKlJZb88NBn0ZgXrxJp2NlvCZdEyl+qxvL0= @@ -644,24 +644,24 @@ go.opentelemetry.io/collector/featuregate v1.13.0 h1:rc84eCf5hesXQ8/bP6Zc15wqthb go.opentelemetry.io/collector/featuregate v1.13.0/go.mod h1:PsOINaGgTiFc+Tzu2K/X2jP+Ngmlp7YKGV1XrnBkH7U= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= -go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= -go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.28.0 h1:aLmmtjRke7LPDQ3lvpFz+kNEH43faFhzW7v8BFIEydg= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.28.0/go.mod h1:TC1pyCt6G9Sjb4bQpShH+P5R53pO6ZuGnHuuln9xMeE= +go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw= +go.opentelemetry.io/otel v1.29.0/go.mod h1:N/WtXPs1CNCUEx+Agz5uouwCba+i+bJGFicT8SR4NP8= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.29.0 h1:xvhQxJ/C9+RTnAj5DpTg7LSM1vbbMTiXt7e9hsfqHNw= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.29.0/go.mod h1:Fcvs2Bz1jkDM+Wf5/ozBGmi3tQ/c9zPKLnsipnfhGAo= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 h1:3Q/xZUyC1BBkualc9ROb4G8qkH90LXEIICcs5zv1OYY= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0/go.mod h1:s75jGIWA9OfCMzF0xr+ZgfrB5FEbbV7UuYo32ahUiFI= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.28.0 h1:j9+03ymgYhPKmeXGk5Zu+cIZOlVzd9Zv7QIiyItjFBU= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.28.0/go.mod h1:Y5+XiUG4Emn1hTfciPzGPJaSI+RpDts6BnCIir0SLqk= -go.opentelemetry.io/otel/exporters/prometheus v0.50.0 h1:2Ewsda6hejmbhGFyUvWZjUThC98Cf8Zy6g0zkIimOng= -go.opentelemetry.io/otel/exporters/prometheus v0.50.0/go.mod h1:pMm5PkUo5YwbLiuEf7t2xg4wbP0/eSJrMxIMxKosynY= -go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= -go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= -go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE= -go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg= -go.opentelemetry.io/otel/sdk/metric v1.28.0 h1:OkuaKgKrgAbYrrY0t92c+cC+2F6hsFNnCQArXCKlg08= -go.opentelemetry.io/otel/sdk/metric v1.28.0/go.mod h1:cWPjykihLAPvXKi4iZc1dpER3Jdq2Z0YLse3moQUCpg= -go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= -go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= +go.opentelemetry.io/otel/exporters/prometheus v0.51.0 h1:G7uexXb/K3T+T9fNLCCKncweEtNEBMTO+46hKX5EdKw= +go.opentelemetry.io/otel/exporters/prometheus v0.51.0/go.mod h1:v0mFe5Kk7woIh938mrZBJBmENYquyA0IICrlYm4Y0t4= +go.opentelemetry.io/otel/metric v1.29.0 h1:vPf/HFWTNkPu1aYeIsc98l4ktOQaL6LeSoeV2g+8YLc= +go.opentelemetry.io/otel/metric v1.29.0/go.mod h1:auu/QWieFVWx+DmQOUMgj0F8LHWdgalxXqvp7BII/W8= +go.opentelemetry.io/otel/sdk v1.29.0 h1:vkqKjk7gwhS8VaWb0POZKmIEDimRCMsopNYnriHyryo= +go.opentelemetry.io/otel/sdk v1.29.0/go.mod h1:pM8Dx5WKnvxLCb+8lG1PRNIDxu9g9b9g59Qr7hfAAok= +go.opentelemetry.io/otel/sdk/metric v1.29.0 h1:K2CfmJohnRgvZ9UAj2/FhIf/okdWcNdBwe1m8xFXiSY= +go.opentelemetry.io/otel/sdk/metric v1.29.0/go.mod h1:6zZLdCl2fkauYoZIOn/soQIDSWFmNSRcICarHfuhNJQ= +go.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt39JTi4= +go.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ= go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= @@ -983,10 +983,10 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d h1:kHjw/5UfflP/L5EbledDrcG4C2597RtymmGRZvHiCuY= -google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d/go.mod h1:mw8MG/Qz5wfgYr6VqVCiZcHe/GJEfI+oGGDCohaVgB0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240708141625-4ad9e859172b h1:04+jVzTs2XBnOZcPsLnmrTGqltqJbZQ1Ey26hjYdQQ0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240708141625-4ad9e859172b/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd h1:BBOTEWLuuEGQy9n1y9MhVJ9Qt0BDu21X8qZs71/uPZo= +google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:fO8wJzT2zbQbAjbIoos1285VfEIYKDDY+Dt+WpTkh6g= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= From a1e8f927909b81eb368c0483940e0b90d7fdb057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20=C5=9Awi=C4=85tek?= Date: Tue, 27 Aug 2024 09:39:38 +0200 Subject: [PATCH 12/41] Don't unnecessarily take ownership of PersistentVolumes and PersistentVolumeClaims (#3097) # Conflicts: # bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml --- .chloggen/fix_dont-own-volumes.yaml | 16 ++++++++++++++++ ...telemetry-operator.clusterserviceversion.yaml | 4 +--- ...telemetry-operator.clusterserviceversion.yaml | 4 +--- config/rbac/role.yaml | 2 -- controllers/opentelemetrycollector_controller.go | 4 +--- 5 files changed, 19 insertions(+), 11 deletions(-) create mode 100755 .chloggen/fix_dont-own-volumes.yaml diff --git a/.chloggen/fix_dont-own-volumes.yaml b/.chloggen/fix_dont-own-volumes.yaml new file mode 100755 index 0000000000..5430eaa680 --- /dev/null +++ b/.chloggen/fix_dont-own-volumes.yaml @@ -0,0 +1,16 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) +component: collector + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Don't unnecessarily take ownership of PersistentVolumes and PersistentVolumeClaims + +# One or more tracking issues related to the change +issues: [3042] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml b/bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml index 99cd4823de..037171d74a 100644 --- a/bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml +++ b/bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml @@ -99,7 +99,7 @@ metadata: categories: Logging & Tracing,Monitoring certified: "false" containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator - createdAt: "2024-08-21T12:36:08Z" + createdAt: "2024-08-27T07:26:20Z" description: Provides the OpenTelemetry components, including the Collector operators.operatorframework.io/builder: operator-sdk-v1.29.0 operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 @@ -262,8 +262,6 @@ spec: - "" resources: - configmaps - - persistentvolumeclaims - - persistentvolumes - pods - serviceaccounts - services diff --git a/bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml b/bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml index 36dc06f975..96927cf2be 100644 --- a/bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml +++ b/bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml @@ -99,7 +99,7 @@ metadata: categories: Logging & Tracing,Monitoring certified: "false" containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator - createdAt: "2024-08-21T12:36:11Z" + createdAt: "2024-08-27T07:26:23Z" description: Provides the OpenTelemetry components, including the Collector operators.operatorframework.io/builder: operator-sdk-v1.29.0 operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 @@ -262,8 +262,6 @@ spec: - "" resources: - configmaps - - persistentvolumeclaims - - persistentvolumes - pods - serviceaccounts - services diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 2f92fb087b..73632f89c8 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -8,8 +8,6 @@ rules: - "" resources: - configmaps - - persistentvolumeclaims - - persistentvolumes - pods - serviceaccounts - services diff --git a/controllers/opentelemetrycollector_controller.go b/controllers/opentelemetrycollector_controller.go index ea6f8908d6..be370ba795 100644 --- a/controllers/opentelemetrycollector_controller.go +++ b/controllers/opentelemetrycollector_controller.go @@ -199,7 +199,7 @@ func NewReconciler(p Params) *OpenTelemetryCollectorReconciler { return r } -// +kubebuilder:rbac:groups="",resources=pods;configmaps;services;serviceaccounts;persistentvolumeclaims;persistentvolumes,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups="",resources=pods;configmaps;services;serviceaccounts,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups="",resources=events,verbs=create;patch // +kubebuilder:rbac:groups=apps,resources=daemonsets;deployments;statefulsets,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=autoscaling,resources=horizontalpodautoscalers,verbs=get;list;watch;create;update;patch;delete @@ -297,8 +297,6 @@ func (r *OpenTelemetryCollectorReconciler) SetupWithManager(mgr ctrl.Manager) er Owns(&appsv1.Deployment{}). Owns(&appsv1.DaemonSet{}). Owns(&appsv1.StatefulSet{}). - Owns(&corev1.PersistentVolume{}). - Owns(&corev1.PersistentVolumeClaim{}). Owns(&networkingv1.Ingress{}). Owns(&autoscalingv2.HorizontalPodAutoscaler{}). Owns(&policyV1.PodDisruptionBudget{}) From d4780a6265acf42a869f72ead0acc8b6073761ed Mon Sep 17 00:00:00 2001 From: "Ben B." Date: Thu, 29 Aug 2024 23:35:25 +0200 Subject: [PATCH 13/41] link to offical docs page (#3245) Signed-off-by: Benedikt Bongartz --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1fbf1d5f4c..c1323ce287 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ The operator manages: ## Documentation - [API docs](./docs/api.md) +- [Offical Telemetry Operator page](https://opentelemetry.io/docs/kubernetes/operator/) ## Helm Charts From ef1306b645c50ed813311c8e9d9a2cc778070e87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20=C5=9Awi=C4=85tek?= Date: Fri, 30 Aug 2024 07:09:14 +0200 Subject: [PATCH 14/41] Move TA config parsing to configmap manifest builder (#3243) This is in preparation for the Target Allocator CRD. For that CRD, the Collector instance may be specified via a label or ownership relation. Therefore, we need to pull the necessary data from the Collector instance during TA config generation. It's more convenient to do this in all cases, which is what this change does. --- .../manifests/collector/targetallocator.go | 57 --- .../collector/targetallocator_test.go | 177 +------- .../manifests/targetallocator/configmap.go | 95 ++++- .../targetallocator/configmap_test.go | 377 +++++++++++++++++- 4 files changed, 467 insertions(+), 239 deletions(-) diff --git a/internal/manifests/collector/targetallocator.go b/internal/manifests/collector/targetallocator.go index cf1e70ff55..c37c220a45 100644 --- a/internal/manifests/collector/targetallocator.go +++ b/internal/manifests/collector/targetallocator.go @@ -15,13 +15,11 @@ package collector import ( - "github.com/mitchellh/mapstructure" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" - "github.com/open-telemetry/opentelemetry-operator/internal/manifests/targetallocator/adapters" ) // TargetAllocator builds the TargetAllocator CR for the given instance. @@ -32,19 +30,6 @@ func TargetAllocator(params manifests.Params) (*v1alpha1.TargetAllocator, error) return nil, nil } - configStr, err := params.OtelCol.Spec.Config.Yaml() - if err != nil { - return nil, err - } - scrapeConfigs, err := getScrapeConfigs(configStr) - if err != nil { - return nil, err - } - globalConfig, err := getGlobalConfig(params.OtelCol.Spec.Config) - if err != nil { - return nil, err - } - return &v1alpha1.TargetAllocator{ ObjectMeta: metav1.ObjectMeta{ Name: params.OtelCol.Name, @@ -70,50 +55,8 @@ func TargetAllocator(params manifests.Params) (*v1alpha1.TargetAllocator, error) }, AllocationStrategy: taSpec.AllocationStrategy, FilterStrategy: taSpec.FilterStrategy, - ScrapeConfigs: scrapeConfigs, - GlobalConfig: globalConfig, PrometheusCR: taSpec.PrometheusCR, Observability: taSpec.Observability, }, }, nil } - -func getGlobalConfig(otelConfig v1beta1.Config) (v1beta1.AnyConfig, error) { - // TODO: Eventually we should figure out a way to pull this in to the main specification for the TA - type promReceiverConfig struct { - Prometheus struct { - Config struct { - Global map[string]interface{} `mapstructure:"global"` - } `mapstructure:"config"` - } `mapstructure:"prometheus"` - } - decodedConfig := &promReceiverConfig{} - if err := mapstructure.Decode(otelConfig.Receivers.Object, decodedConfig); err != nil { - return v1beta1.AnyConfig{}, err - } - return v1beta1.AnyConfig{ - Object: decodedConfig.Prometheus.Config.Global, - }, nil -} - -func getScrapeConfigs(otelcolConfig string) ([]v1beta1.AnyConfig, error) { - // Collector supports environment variable substitution, but the TA does not. - // TA Scrape Configs should have a single "$", as it does not support env var substitution - prometheusReceiverConfig, err := adapters.UnescapeDollarSignsInPromConfig(otelcolConfig) - if err != nil { - return nil, err - } - - scrapeConfigs, err := adapters.GetScrapeConfigsFromPromConfig(prometheusReceiverConfig) - if err != nil { - return nil, err - } - - v1beta1scrapeConfigs := make([]v1beta1.AnyConfig, len(scrapeConfigs)) - - for i, config := range scrapeConfigs { - v1beta1scrapeConfigs[i] = v1beta1.AnyConfig{Object: config} - } - - return v1beta1scrapeConfigs, nil -} diff --git a/internal/manifests/collector/targetallocator_test.go b/internal/manifests/collector/targetallocator_test.go index ababa4acb7..3d281d69fd 100644 --- a/internal/manifests/collector/targetallocator_test.go +++ b/internal/manifests/collector/targetallocator_test.go @@ -15,12 +15,10 @@ package collector import ( - "fmt" "testing" "time" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -89,10 +87,7 @@ func TestTargetAllocator(t *testing.T) { }, want: &v1alpha1.TargetAllocator{ ObjectMeta: objectMetadata, - Spec: v1alpha1.TargetAllocatorSpec{ - ScrapeConfigs: []v1beta1.AnyConfig{}, - GlobalConfig: v1beta1.AnyConfig{}, - }, + Spec: v1alpha1.TargetAllocatorSpec{}, }, }, { @@ -291,7 +286,6 @@ func TestTargetAllocator(t *testing.T) { MatchLabels: map[string]string{"servicemonitorkey": "servicemonitorkey"}, }, }, - ScrapeConfigs: []v1beta1.AnyConfig{}, Observability: v1beta1.ObservabilitySpec{ Metrics: v1beta1.MetricsConfigSpec{ EnableMetrics: true, @@ -314,172 +308,3 @@ func TestTargetAllocator(t *testing.T) { }) } } - -func TestGetScrapeConfigs(t *testing.T) { - testCases := []struct { - name string - input v1beta1.Config - want []v1beta1.AnyConfig - wantErr error - }{ - { - name: "empty scrape configs list", - input: v1beta1.Config{ - Receivers: v1beta1.AnyConfig{ - Object: map[string]interface{}{ - "prometheus": map[string]any{ - "config": map[string]any{ - "scrape_configs": []any{}, - }, - }, - }, - }, - }, - want: []v1beta1.AnyConfig{}, - }, - { - name: "no scrape configs key", - input: v1beta1.Config{ - Receivers: v1beta1.AnyConfig{ - Object: map[string]interface{}{ - "prometheus": map[string]any{ - "config": map[string]any{}, - }, - }, - }, - }, - wantErr: fmt.Errorf("no scrape_configs available as part of the configuration"), - }, - { - name: "one scrape config", - input: v1beta1.Config{ - Receivers: v1beta1.AnyConfig{ - Object: map[string]interface{}{ - "prometheus": map[string]any{ - "config": map[string]any{ - "scrape_configs": []any{ - map[string]any{ - "job": "somejob", - }, - }, - }, - }, - }, - }, - }, - want: []v1beta1.AnyConfig{ - {Object: map[string]interface{}{"job": "somejob"}}, - }, - }, - { - name: "regex substitution", - input: v1beta1.Config{ - Receivers: v1beta1.AnyConfig{ - Object: map[string]interface{}{ - "prometheus": map[string]any{ - "config": map[string]any{ - "scrape_configs": []any{ - map[string]any{ - "job": "somejob", - "metric_relabel_configs": []map[string]any{ - { - "action": "labelmap", - "regex": "label_(.+)", - "replacement": "$$1", - }, - }, - }, - }, - }, - }, - }, - }, - }, - want: []v1beta1.AnyConfig{ - {Object: map[string]interface{}{ - "job": "somejob", - "metric_relabel_configs": []any{ - map[any]any{ - "action": "labelmap", - "regex": "label_(.+)", - "replacement": "$1", - }, - }, - }}, - }, - }, - } - - for _, testCase := range testCases { - testCase := testCase - t.Run(testCase.name, func(t *testing.T) { - configStr, err := testCase.input.Yaml() - require.NoError(t, err) - actual, err := getScrapeConfigs(configStr) - assert.Equal(t, testCase.wantErr, err) - assert.Equal(t, testCase.want, actual) - }) - } -} - -func Test_getGlobalConfig(t *testing.T) { - type args struct { - otelConfig v1beta1.Config - } - tests := []struct { - name string - args args - want v1beta1.AnyConfig - wantErr error - }{ - { - name: "Valid Global Config", - args: args{ - otelConfig: v1beta1.Config{ - Receivers: v1beta1.AnyConfig{ - Object: map[string]interface{}{ - "prometheus": map[string]interface{}{ - "config": map[string]interface{}{ - "global": map[string]interface{}{ - "scrape_interval": "15s", - "scrape_protocols": []string{"PrometheusProto", "OpenMetricsText1.0.0", "OpenMetricsText0.0.1", "PrometheusText0.0.4"}, - }, - }, - }, - }, - }, - }, - }, - want: v1beta1.AnyConfig{ - Object: map[string]interface{}{ - "scrape_interval": "15s", - "scrape_protocols": []string{"PrometheusProto", "OpenMetricsText1.0.0", "OpenMetricsText0.0.1", "PrometheusText0.0.4"}, - }, - }, - wantErr: nil, - }, - { - name: "Invalid Global Config - Missing Global", - args: args{ - otelConfig: v1beta1.Config{ - Receivers: v1beta1.AnyConfig{ - Object: map[string]interface{}{ - "prometheus": map[string]interface{}{ - "config": map[string]interface{}{}, - }, - }, - }, - }, - }, - want: v1beta1.AnyConfig{}, - wantErr: nil, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got, err := getGlobalConfig(tt.args.otelConfig) - assert.Equal(t, tt.wantErr, err) - assert.Equal(t, tt.want, got) - }) - } -} diff --git a/internal/manifests/targetallocator/configmap.go b/internal/manifests/targetallocator/configmap.go index eca98615f7..f7e0408974 100644 --- a/internal/manifests/targetallocator/configmap.go +++ b/internal/manifests/targetallocator/configmap.go @@ -15,6 +15,7 @@ package targetallocator import ( + "github.com/mitchellh/mapstructure" "gopkg.in/yaml.v2" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -22,6 +23,7 @@ import ( "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector" "github.com/open-telemetry/opentelemetry-operator/internal/manifests/manifestutils" + "github.com/open-telemetry/opentelemetry-operator/internal/manifests/targetallocator/adapters" "github.com/open-telemetry/opentelemetry-operator/internal/naming" ) @@ -43,13 +45,22 @@ func ConfigMap(params Params) (*corev1.ConfigMap, error) { // Set config if global or scrape configs set config := map[string]interface{}{} - if instance.Spec.GlobalConfig.Object != nil { - config["global"] = instance.Spec.GlobalConfig + globalConfig, err := getGlobalConfig(taSpec.GlobalConfig, params.Collector.Spec.Config) + if err != nil { + return nil, err + } + if len(globalConfig) > 0 { + config["global"] = globalConfig + } + + scrapeConfigs, err := getScrapeConfigs(taSpec.ScrapeConfigs, params.Collector.Spec.Config) + if err != nil { + return nil, err } - // Add scrape configs if present - if instance.Spec.ScrapeConfigs != nil && len(instance.Spec.ScrapeConfigs) > 0 { - config["scrape_configs"] = instance.Spec.ScrapeConfigs + if len(scrapeConfigs) > 0 { + config["scrape_configs"] = scrapeConfigs } + if len(config) != 0 { taConfig["config"] = config } @@ -93,3 +104,77 @@ func ConfigMap(params Params) (*corev1.ConfigMap, error) { }, }, nil } + +func getGlobalConfig(taGlobalConfig v1beta1.AnyConfig, collectorConfig v1beta1.Config) (map[string]any, error) { + // global config from the target allocator has priority + if len(taGlobalConfig.Object) > 0 { + return taGlobalConfig.Object, nil + } + + collectorGlobalConfig, err := getGlobalConfigFromOtelConfig(collectorConfig) + if err != nil { + return nil, err + } + return collectorGlobalConfig.Object, nil +} + +func getScrapeConfigs(taScrapeConfigs []v1beta1.AnyConfig, collectorConfig v1beta1.Config) ([]v1beta1.AnyConfig, error) { + scrapeConfigs := []v1beta1.AnyConfig{} + + // we take scrape configs from both the target allocator spec and the collector config + if len(taScrapeConfigs) > 0 { + scrapeConfigs = append(scrapeConfigs, taScrapeConfigs...) + } + + configStr, err := collectorConfig.Yaml() + if err != nil { + return nil, err + } + + collectorScrapeConfigs, err := getScrapeConfigsFromOtelConfig(configStr) + if err != nil { + return nil, err + } + + return append(scrapeConfigs, collectorScrapeConfigs...), nil +} + +func getGlobalConfigFromOtelConfig(otelConfig v1beta1.Config) (v1beta1.AnyConfig, error) { + // TODO: Eventually we should figure out a way to pull this in to the main specification for the TA + type promReceiverConfig struct { + Prometheus struct { + Config struct { + Global map[string]interface{} `mapstructure:"global"` + } `mapstructure:"config"` + } `mapstructure:"prometheus"` + } + decodedConfig := &promReceiverConfig{} + if err := mapstructure.Decode(otelConfig.Receivers.Object, decodedConfig); err != nil { + return v1beta1.AnyConfig{}, err + } + return v1beta1.AnyConfig{ + Object: decodedConfig.Prometheus.Config.Global, + }, nil +} + +func getScrapeConfigsFromOtelConfig(otelcolConfig string) ([]v1beta1.AnyConfig, error) { + // Collector supports environment variable substitution, but the TA does not. + // TA Scrape Configs should have a single "$", as it does not support env var substitution + prometheusReceiverConfig, err := adapters.UnescapeDollarSignsInPromConfig(otelcolConfig) + if err != nil { + return nil, err + } + + scrapeConfigs, err := adapters.GetScrapeConfigsFromPromConfig(prometheusReceiverConfig) + if err != nil { + return nil, err + } + + v1beta1scrapeConfigs := make([]v1beta1.AnyConfig, len(scrapeConfigs)) + + for i, config := range scrapeConfigs { + v1beta1scrapeConfigs[i] = v1beta1.AnyConfig{Object: config} + } + + return v1beta1scrapeConfigs, nil +} diff --git a/internal/manifests/targetallocator/configmap_test.go b/internal/manifests/targetallocator/configmap_test.go index a8b83dfc4f..cfa45feb8c 100644 --- a/internal/manifests/targetallocator/configmap_test.go +++ b/internal/manifests/targetallocator/configmap_test.go @@ -15,10 +15,12 @@ package targetallocator import ( + "fmt" "testing" "time" "github.com/go-logr/logr" + "github.com/mitchellh/mapstructure" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -96,8 +98,19 @@ filter_strategy: relabel-config targetAllocator = targetAllocatorInstance() targetAllocator.Spec.ScrapeConfigs = []v1beta1.AnyConfig{} params.TargetAllocator = targetAllocator - actual, err := ConfigMap(params) + collectorWithoutPrometheusReceiver := collectorInstance() + collectorWithoutPrometheusReceiver.Spec.Config.Receivers.Object["prometheus"] = map[string]any{ + "config": map[string]any{ + "scrape_configs": []any{}, + }, + } + testParams := Params{ + Collector: collectorWithoutPrometheusReceiver, + TargetAllocator: targetAllocator, + } + actual, err := ConfigMap(testParams) require.NoError(t, err) + params.Collector = collector assert.Equal(t, "my-instance-targetallocator", actual.Name) assert.Equal(t, expectedLabels, actual.Labels) @@ -214,3 +227,365 @@ prometheus_cr: }) } + +func TestGetScrapeConfigsFromOtelConfig(t *testing.T) { + testCases := []struct { + name string + input v1beta1.Config + want []v1beta1.AnyConfig + wantErr error + }{ + { + name: "empty scrape configs list", + input: v1beta1.Config{ + Receivers: v1beta1.AnyConfig{ + Object: map[string]interface{}{ + "prometheus": map[string]any{ + "config": map[string]any{ + "scrape_configs": []any{}, + }, + }, + }, + }, + }, + want: []v1beta1.AnyConfig{}, + }, + { + name: "no scrape configs key", + input: v1beta1.Config{ + Receivers: v1beta1.AnyConfig{ + Object: map[string]interface{}{ + "prometheus": map[string]any{ + "config": map[string]any{}, + }, + }, + }, + }, + wantErr: fmt.Errorf("no scrape_configs available as part of the configuration"), + }, + { + name: "one scrape config", + input: v1beta1.Config{ + Receivers: v1beta1.AnyConfig{ + Object: map[string]interface{}{ + "prometheus": map[string]any{ + "config": map[string]any{ + "scrape_configs": []any{ + map[string]any{ + "job": "somejob", + }, + }, + }, + }, + }, + }, + }, + want: []v1beta1.AnyConfig{ + {Object: map[string]interface{}{"job": "somejob"}}, + }, + }, + { + name: "regex substitution", + input: v1beta1.Config{ + Receivers: v1beta1.AnyConfig{ + Object: map[string]interface{}{ + "prometheus": map[string]any{ + "config": map[string]any{ + "scrape_configs": []any{ + map[string]any{ + "job": "somejob", + "metric_relabel_configs": []map[string]any{ + { + "action": "labelmap", + "regex": "label_(.+)", + "replacement": "$$1", + }, + }, + }, + }, + }, + }, + }, + }, + }, + want: []v1beta1.AnyConfig{ + {Object: map[string]interface{}{ + "job": "somejob", + "metric_relabel_configs": []any{ + map[any]any{ + "action": "labelmap", + "regex": "label_(.+)", + "replacement": "$1", + }, + }, + }}, + }, + }, + } + + for _, testCase := range testCases { + testCase := testCase + t.Run(testCase.name, func(t *testing.T) { + configStr, err := testCase.input.Yaml() + require.NoError(t, err) + actual, err := getScrapeConfigsFromOtelConfig(configStr) + assert.Equal(t, testCase.wantErr, err) + assert.Equal(t, testCase.want, actual) + }) + } +} + +func TestGetGlobalConfigFromOtelConfig(t *testing.T) { + type args struct { + otelConfig v1beta1.Config + } + tests := []struct { + name string + args args + want v1beta1.AnyConfig + wantErr error + }{ + { + name: "Valid Global Config", + args: args{ + otelConfig: v1beta1.Config{ + Receivers: v1beta1.AnyConfig{ + Object: map[string]interface{}{ + "prometheus": map[string]interface{}{ + "config": map[string]interface{}{ + "global": map[string]interface{}{ + "scrape_interval": "15s", + "scrape_protocols": []string{"PrometheusProto", "OpenMetricsText1.0.0", "OpenMetricsText0.0.1", "PrometheusText0.0.4"}, + }, + }, + }, + }, + }, + }, + }, + want: v1beta1.AnyConfig{ + Object: map[string]interface{}{ + "scrape_interval": "15s", + "scrape_protocols": []string{"PrometheusProto", "OpenMetricsText1.0.0", "OpenMetricsText0.0.1", "PrometheusText0.0.4"}, + }, + }, + wantErr: nil, + }, + { + name: "Invalid Global Config - Missing Global", + args: args{ + otelConfig: v1beta1.Config{ + Receivers: v1beta1.AnyConfig{ + Object: map[string]interface{}{ + "prometheus": map[string]interface{}{ + "config": map[string]interface{}{}, + }, + }, + }, + }, + }, + want: v1beta1.AnyConfig{}, + wantErr: nil, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := getGlobalConfigFromOtelConfig(tt.args.otelConfig) + assert.Equal(t, tt.wantErr, err) + assert.Equal(t, tt.want, got) + }) + } +} + +func TestGetScrapeConfigs(t *testing.T) { + type args struct { + taScrapeConfigs []v1beta1.AnyConfig + collectorConfig v1beta1.Config + } + testCases := []struct { + name string + args args + want []v1beta1.AnyConfig + wantErr error + }{ + { + name: "no scrape configs", + args: args{ + taScrapeConfigs: []v1beta1.AnyConfig{}, + collectorConfig: v1beta1.Config{ + Receivers: v1beta1.AnyConfig{ + Object: map[string]interface{}{ + "prometheus": map[string]any{ + "config": map[string]any{ + "scrape_configs": []any{}, + }, + }, + }, + }, + }, + }, + want: []v1beta1.AnyConfig{}, + }, + { + name: "scrape configs in both ta and collector", + args: args{ + taScrapeConfigs: []v1beta1.AnyConfig{ + { + Object: map[string]any{ + "job": "ta", + }, + }, + }, + collectorConfig: v1beta1.Config{ + Receivers: v1beta1.AnyConfig{ + Object: map[string]interface{}{ + "prometheus": map[string]any{ + "config": map[string]any{ + "scrape_configs": []any{ + map[string]any{ + "job": "collector", + }, + }, + }, + }, + }, + }, + }, + }, + want: []v1beta1.AnyConfig{ + {Object: map[string]any{"job": "ta"}}, + {Object: map[string]any{"job": "collector"}}, + }, + }, + { + name: "no scrape configs key", + args: args{ + taScrapeConfigs: []v1beta1.AnyConfig{}, + collectorConfig: v1beta1.Config{ + Receivers: v1beta1.AnyConfig{ + Object: map[string]interface{}{ + "prometheus": map[string]any{ + "config": map[string]any{}, + }, + }, + }, + }, + }, + wantErr: fmt.Errorf("no scrape_configs available as part of the configuration"), + }, + } + + for _, testCase := range testCases { + testCase := testCase + t.Run(testCase.name, func(t *testing.T) { + actual, err := getScrapeConfigs(testCase.args.taScrapeConfigs, testCase.args.collectorConfig) + assert.Equal(t, testCase.wantErr, err) + assert.Equal(t, testCase.want, actual) + }) + } +} + +func TestGetGlobalConfig(t *testing.T) { + type args struct { + taGlobalConfig v1beta1.AnyConfig + collectorConfig v1beta1.Config + } + tests := []struct { + name string + args args + want map[string]any + wantErr error + }{ + { + name: "Valid Global Config in both TA and Collector, TA wins", + args: args{ + collectorConfig: v1beta1.Config{ + Receivers: v1beta1.AnyConfig{ + Object: map[string]interface{}{ + "prometheus": map[string]interface{}{ + "config": map[string]interface{}{ + "global": map[string]interface{}{ + "scrape_interval": "15s", + }, + }, + }, + }, + }, + }, + taGlobalConfig: v1beta1.AnyConfig{ + Object: map[string]interface{}{ + "scrape_protocols": []string{"PrometheusProto"}, + }, + }, + }, + want: map[string]interface{}{ + "scrape_protocols": []string{"PrometheusProto"}, + }, + }, + { + name: "Valid Global Config in TA, not in Collector", + args: args{ + collectorConfig: v1beta1.Config{ + Receivers: v1beta1.AnyConfig{ + Object: map[string]interface{}{ + "prometheus": map[string]interface{}{ + "config": map[string]interface{}{}, + }, + }, + }, + }, + taGlobalConfig: v1beta1.AnyConfig{ + Object: map[string]interface{}{ + "scrape_protocols": []string{"PrometheusProto"}, + }, + }, + }, + want: map[string]interface{}{ + "scrape_protocols": []string{"PrometheusProto"}, + }, + }, + { + name: "Valid Global Config in Collector, not in TA", + args: args{ + collectorConfig: v1beta1.Config{ + Receivers: v1beta1.AnyConfig{ + Object: map[string]interface{}{ + "prometheus": map[string]interface{}{ + "config": map[string]interface{}{ + "global": map[string]interface{}{ + "scrape_interval": "15s", + }, + }, + }, + }, + }, + }, + taGlobalConfig: v1beta1.AnyConfig{}, + }, + want: map[string]interface{}{ + "scrape_interval": "15s", + }, + }, + { + name: "Invalid Global Config in Collector, not in TA", + args: args{ + collectorConfig: v1beta1.Config{ + Receivers: v1beta1.AnyConfig{ + Object: map[string]interface{}{ + "prometheus": "invalid_value", + }, + }, + }, + taGlobalConfig: v1beta1.AnyConfig{}, + }, + wantErr: &mapstructure.Error{Errors: []string{"'prometheus' expected a map, got 'string'"}}, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := getGlobalConfig(tt.args.taGlobalConfig, tt.args.collectorConfig) + assert.Equal(t, tt.wantErr, err) + assert.Equal(t, tt.want, got) + }) + } +} From 1dd161eb9f54f8cc82f55aa548c16891c2efc2f5 Mon Sep 17 00:00:00 2001 From: Vasi Vasireddy <41936996+vasireddy99@users.noreply.github.com> Date: Fri, 30 Aug 2024 05:56:16 -0700 Subject: [PATCH 15/41] Support for kubernetes 1.31 version (#3246) --- .chloggen/operator31.yaml | 16 ++++++++++++++++ .github/workflows/e2e.yaml | 2 +- .github/workflows/scorecard.yaml | 2 +- Makefile | 2 +- kind-1.31.yaml | 20 ++++++++++++++++++++ 5 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 .chloggen/operator31.yaml create mode 100644 kind-1.31.yaml diff --git a/.chloggen/operator31.yaml b/.chloggen/operator31.yaml new file mode 100644 index 0000000000..0e52ea95cb --- /dev/null +++ b/.chloggen/operator31.yaml @@ -0,0 +1,16 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: 'enhancement' + +# The name of the component, or a single word describing the area of concern, (e.g. operator, target allocator, github action) +component: operator + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Support for Kubernetes `1.31` version. + +# One or more tracking issues related to the change +issues: [3247] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 1288d5c054..677b7b0806 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -21,7 +21,7 @@ jobs: # should be compatible with them. kube-version: - "1.23" - - "1.30" + - "1.31" group: - e2e - e2e-automatic-rbac diff --git a/.github/workflows/scorecard.yaml b/.github/workflows/scorecard.yaml index 176392b5df..c031fe333f 100644 --- a/.github/workflows/scorecard.yaml +++ b/.github/workflows/scorecard.yaml @@ -18,7 +18,7 @@ jobs: matrix: kube-version: - "1.23" - - "1.30" + - "1.31" steps: diff --git a/Makefile b/Makefile index cd614f1f20..3a8396009a 100644 --- a/Makefile +++ b/Makefile @@ -57,7 +57,7 @@ endif START_KIND_CLUSTER ?= true -KUBE_VERSION ?= 1.30 +KUBE_VERSION ?= 1.31 KIND_CONFIG ?= kind-$(KUBE_VERSION).yaml KIND_CLUSTER_NAME ?= "otel-operator" diff --git a/kind-1.31.yaml b/kind-1.31.yaml new file mode 100644 index 0000000000..cecb00146f --- /dev/null +++ b/kind-1.31.yaml @@ -0,0 +1,20 @@ +kind: Cluster +apiVersion: kind.x-k8s.io/v1alpha4 +networking: + ipFamily: dual +nodes: + - role: control-plane + image: kindest/node:v1.31.0@sha256:53df588e04085fd41ae12de0c3fe4c72f7013bba32a20e7325357a1ac94ba865 + kubeadmConfigPatches: + - | + kind: InitConfiguration + nodeRegistration: + kubeletExtraArgs: + node-labels: "ingress-ready=true" + extraPortMappings: + - containerPort: 80 + hostPort: 80 + protocol: TCP + - containerPort: 443 + hostPort: 443 + protocol: TCP From 1a5d464d4c9b96a5584ec9f17b332f3612e188b8 Mon Sep 17 00:00:00 2001 From: Israel Blancas Date: Fri, 30 Aug 2024 15:03:07 +0200 Subject: [PATCH 16/41] Not ignore the container-names annotation when the multi-instrumentation is enabled (#3213) * Not ignore the container-names annotation when the multi-instrumentation is enabled Signed-off-by: Israel Blancas * Fixes Signed-off-by: Israel Blancas * Fix unit tests Signed-off-by: Israel Blancas * Apply changes requested in code review Signed-off-by: Israel Blancas --------- Signed-off-by: Israel Blancas --- .chloggen/feature_3090.yaml | 16 + pkg/instrumentation/helper.go | 44 +- pkg/instrumentation/helper_test.go | 12 +- pkg/instrumentation/podmutator.go | 179 ++-- pkg/instrumentation/podmutator_test.go | 871 +----------------- pkg/instrumentation/sdk.go | 48 +- pkg/instrumentation/sdk_test.go | 72 +- .../01-assert.yaml | 11 - .../01-install-app.yaml | 11 +- .../02-assert.yaml | 82 ++ .../02-error.yaml | 114 +++ .../02-install-app.yaml | 38 + 12 files changed, 513 insertions(+), 985 deletions(-) create mode 100755 .chloggen/feature_3090.yaml create mode 100644 tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/02-assert.yaml create mode 100644 tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/02-error.yaml create mode 100644 tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/02-install-app.yaml diff --git a/.chloggen/feature_3090.yaml b/.chloggen/feature_3090.yaml new file mode 100755 index 0000000000..ad1f98094d --- /dev/null +++ b/.chloggen/feature_3090.yaml @@ -0,0 +1,16 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: 'enhancement' + +# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) +component: auto-instrumentation + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Not ignore the `instrumentation.opentelemetry.io/container-names` annotation when the multi-instrumentation is enabled" + +# One or more tracking issues related to the change +issues: [3090] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/pkg/instrumentation/helper.go b/pkg/instrumentation/helper.go index 8306f773ae..1968fe8973 100644 --- a/pkg/instrumentation/helper.go +++ b/pkg/instrumentation/helper.go @@ -16,11 +16,13 @@ package instrumentation import ( "fmt" + "regexp" "sort" "strings" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/utils/strings/slices" "github.com/open-telemetry/opentelemetry-operator/internal/naming" @@ -77,15 +79,9 @@ func isAutoInstrumentationInjected(pod corev1.Pod) bool { // Look for duplicates in the provided containers. func findDuplicatedContainers(ctrs []string) error { - // Merge is needed because of multiple containers can be provided for single instrumentation. - mergedContainers := strings.Join(ctrs, ",") - - // Split all containers. - splitContainers := strings.Split(mergedContainers, ",") - countMap := make(map[string]int) var duplicates []string - for _, str := range splitContainers { + for _, str := range ctrs { countMap[str]++ } @@ -111,7 +107,7 @@ func findDuplicatedContainers(ctrs []string) error { // Return positive for instrumentation with defined containers. func isInstrWithContainers(inst instrumentationWithContainers) int { - if inst.Containers != "" { + if len(inst.Containers) > 0 { return 1 } @@ -120,7 +116,7 @@ func isInstrWithContainers(inst instrumentationWithContainers) int { // Return positive for instrumentation without defined containers. func isInstrWithoutContainers(inst instrumentationWithContainers) int { - if inst.Containers == "" { + if len(inst.Containers) == 0 { return 1 } @@ -133,3 +129,33 @@ func volumeSize(quantity *resource.Quantity) *resource.Quantity { } return quantity } + +func isValidContainersAnnotation(containersAnnotation string) error { + if containersAnnotation == "" { + return nil + } + + matched, err := regexp.MatchString("^[a-zA-Z0-9-,]+$", containersAnnotation) + if err != nil { + return fmt.Errorf("error while checking for instrumentation container annotations %w", err) + } + if !matched { + return fmt.Errorf("not valid characters included in the instrumentation container annotation %s", containersAnnotation) + } + return nil +} + +// setContainersFromAnnotation sets the containers associated to one intrumentation based on the content of the provided annotation. +func setContainersFromAnnotation(inst *instrumentationWithContainers, annotation string, ns metav1.ObjectMeta, pod metav1.ObjectMeta) error { + annotationValue := annotationValue(ns, pod, annotation) + if annotationValue == "" { + return nil + } + + if err := isValidContainersAnnotation(annotationValue); err != nil { + return err + } + languageContainers := strings.Split(annotationValue, ",") + inst.Containers = append(inst.Containers, languageContainers...) + return nil +} diff --git a/pkg/instrumentation/helper_test.go b/pkg/instrumentation/helper_test.go index 72db0b4f21..d852c94a4a 100644 --- a/pkg/instrumentation/helper_test.go +++ b/pkg/instrumentation/helper_test.go @@ -170,12 +170,12 @@ func TestDuplicatedContainers(t *testing.T) { }{ { name: "No duplicates", - containers: []string{"app1,app2", "app3", "app4,app5"}, + containers: []string{"app1", "app2", "app3", "app4", "app5"}, expectedDuplicates: nil, }, { name: "Duplicates in containers", - containers: []string{"app1,app2", "app1", "app1,app3,app4", "app4"}, + containers: []string{"app1", "app2", "app1", "app1", "app3", "app4", "app4"}, expectedDuplicates: fmt.Errorf("duplicated container names detected: [app1 app4]"), }, } @@ -196,12 +196,12 @@ func TestInstrWithContainers(t *testing.T) { }{ { name: "No containers", - containers: instrumentationWithContainers{Containers: ""}, + containers: instrumentationWithContainers{Containers: []string{}}, expectedResult: 0, }, { name: "With containers", - containers: instrumentationWithContainers{Containers: "ct1"}, + containers: instrumentationWithContainers{Containers: []string{"ct1"}}, expectedResult: 1, }, } @@ -222,12 +222,12 @@ func TestInstrWithoutContainers(t *testing.T) { }{ { name: "No containers", - containers: instrumentationWithContainers{Containers: ""}, + containers: instrumentationWithContainers{Containers: []string{}}, expectedResult: 1, }, { name: "With containers", - containers: instrumentationWithContainers{Containers: "ct1"}, + containers: instrumentationWithContainers{Containers: []string{"ct1"}}, expectedResult: 0, }, } diff --git a/pkg/instrumentation/podmutator.go b/pkg/instrumentation/podmutator.go index 7b75576e3d..f0f1f08d52 100644 --- a/pkg/instrumentation/podmutator.go +++ b/pkg/instrumentation/podmutator.go @@ -22,6 +22,7 @@ import ( "github.com/go-logr/logr" corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/tools/record" "sigs.k8s.io/controller-runtime/pkg/client" @@ -46,7 +47,7 @@ type instPodMutator struct { type instrumentationWithContainers struct { Instrumentation *v1alpha1.Instrumentation - Containers string + Containers []string AdditionalAnnotations map[string]string } @@ -61,84 +62,77 @@ type languageInstrumentations struct { Sdk instrumentationWithContainers } -// Check if single instrumentation is configured for Pod and return which is configured. -func (langInsts languageInstrumentations) isSingleInstrumentationEnabled() bool { - count := 0 - - if langInsts.Java.Instrumentation != nil { - count++ - } - if langInsts.NodeJS.Instrumentation != nil { - count++ - } - if langInsts.Python.Instrumentation != nil { - count++ - } - if langInsts.DotNet.Instrumentation != nil { - count++ - } - if langInsts.ApacheHttpd.Instrumentation != nil { - count++ - } - if langInsts.Nginx.Instrumentation != nil { - count++ - } - if langInsts.Go.Instrumentation != nil { - count++ - } - if langInsts.Sdk.Instrumentation != nil { - count++ - } - - return count == 1 -} - // Check if specific containers are provided for configured instrumentation. -func (langInsts languageInstrumentations) areContainerNamesConfiguredForMultipleInstrumentations() (bool, error) { +func (langInsts languageInstrumentations) areInstrumentedContainersCorrect() (bool, error) { var instrWithoutContainers int var instrWithContainers int var allContainers []string + var instrumentationWithNoContainers bool // Check for instrumentations with and without containers. if langInsts.Java.Instrumentation != nil { instrWithContainers += isInstrWithContainers(langInsts.Java) instrWithoutContainers += isInstrWithoutContainers(langInsts.Java) - allContainers = append(allContainers, langInsts.Java.Containers) + allContainers = append(allContainers, langInsts.Java.Containers...) + if len(langInsts.Java.Containers) == 0 { + instrumentationWithNoContainers = true + } } if langInsts.NodeJS.Instrumentation != nil { instrWithContainers += isInstrWithContainers(langInsts.NodeJS) instrWithoutContainers += isInstrWithoutContainers(langInsts.NodeJS) - allContainers = append(allContainers, langInsts.NodeJS.Containers) + allContainers = append(allContainers, langInsts.NodeJS.Containers...) + if len(langInsts.NodeJS.Containers) == 0 { + instrumentationWithNoContainers = true + } } if langInsts.Python.Instrumentation != nil { instrWithContainers += isInstrWithContainers(langInsts.Python) instrWithoutContainers += isInstrWithoutContainers(langInsts.Python) - allContainers = append(allContainers, langInsts.Python.Containers) + allContainers = append(allContainers, langInsts.Python.Containers...) + if len(langInsts.Python.Containers) == 0 { + instrumentationWithNoContainers = true + } } if langInsts.DotNet.Instrumentation != nil { instrWithContainers += isInstrWithContainers(langInsts.DotNet) instrWithoutContainers += isInstrWithoutContainers(langInsts.DotNet) - allContainers = append(allContainers, langInsts.DotNet.Containers) + allContainers = append(allContainers, langInsts.DotNet.Containers...) + if len(langInsts.DotNet.Containers) == 0 { + instrumentationWithNoContainers = true + } } if langInsts.ApacheHttpd.Instrumentation != nil { instrWithContainers += isInstrWithContainers(langInsts.ApacheHttpd) instrWithoutContainers += isInstrWithoutContainers(langInsts.ApacheHttpd) - allContainers = append(allContainers, langInsts.ApacheHttpd.Containers) + allContainers = append(allContainers, langInsts.ApacheHttpd.Containers...) + if len(langInsts.ApacheHttpd.Containers) == 0 { + instrumentationWithNoContainers = true + } } if langInsts.Nginx.Instrumentation != nil { instrWithContainers += isInstrWithContainers(langInsts.Nginx) instrWithoutContainers += isInstrWithoutContainers(langInsts.Nginx) - allContainers = append(allContainers, langInsts.Nginx.Containers) + allContainers = append(allContainers, langInsts.Nginx.Containers...) + if len(langInsts.Nginx.Containers) == 0 { + instrumentationWithNoContainers = true + } } if langInsts.Go.Instrumentation != nil { instrWithContainers += isInstrWithContainers(langInsts.Go) instrWithoutContainers += isInstrWithoutContainers(langInsts.Go) - allContainers = append(allContainers, langInsts.Go.Containers) + allContainers = append(allContainers, langInsts.Go.Containers...) + if len(langInsts.Go.Containers) == 0 { + instrumentationWithNoContainers = true + } } if langInsts.Sdk.Instrumentation != nil { instrWithContainers += isInstrWithContainers(langInsts.Sdk) instrWithoutContainers += isInstrWithoutContainers(langInsts.Sdk) - allContainers = append(allContainers, langInsts.Sdk.Containers) + allContainers = append(allContainers, langInsts.Sdk.Containers...) + if len(langInsts.Sdk.Containers) == 0 { + instrumentationWithNoContainers = true + } } // Look for duplicated containers. @@ -161,11 +155,29 @@ func (langInsts languageInstrumentations) areContainerNamesConfiguredForMultiple return false, fmt.Errorf("instrumentation configuration not provided") } + enabledInstrumentations := instrWithContainers + instrWithoutContainers + + if enabledInstrumentations > 1 && instrumentationWithNoContainers { + return false, fmt.Errorf("incorrect instrumentation configuration - please provide container names for all instrumentations") + } + return true, nil } // Set containers for configured instrumentation. -func (langInsts *languageInstrumentations) setInstrumentationLanguageContainers(containers string) { +func (langInsts *languageInstrumentations) setCommonInstrumentedContainers(ns corev1.Namespace, pod corev1.Pod) error { + containersAnnotation := annotationValue(ns.ObjectMeta, pod.ObjectMeta, annotationInjectContainerName) + if err := isValidContainersAnnotation(containersAnnotation); err != nil { + return err + } + + var containers []string + if containersAnnotation == "" { + return nil + } else { + containers = strings.Split(containersAnnotation, ",") + } + if langInsts.Java.Instrumentation != nil { langInsts.Java.Containers = containers } @@ -190,6 +202,55 @@ func (langInsts *languageInstrumentations) setInstrumentationLanguageContainers( if langInsts.Sdk.Instrumentation != nil { langInsts.Sdk.Containers = containers } + return nil +} + +func (langInsts *languageInstrumentations) setLanguageSpecificContainers(ns metav1.ObjectMeta, pod metav1.ObjectMeta) error { + inst := []struct { + iwc *instrumentationWithContainers + annotation string + }{ + { + iwc: &langInsts.Java, + annotation: annotationInjectJavaContainersName, + }, + { + iwc: &langInsts.NodeJS, + annotation: annotationInjectNodeJSContainersName, + }, + { + iwc: &langInsts.Python, + annotation: annotationInjectPythonContainersName, + }, + { + iwc: &langInsts.DotNet, + annotation: annotationInjectDotnetContainersName, + }, + { + iwc: &langInsts.Go, + annotation: annotationInjectGoContainersName, + }, + { + iwc: &langInsts.ApacheHttpd, + annotation: annotationInjectApacheHttpd, + }, + { + iwc: &langInsts.Nginx, + annotation: annotationInjectNginx, + }, + { + iwc: &langInsts.Sdk, + annotation: annotationInjectSdk, + }, + } + + for _, i := range inst { + i := i + if err := setContainersFromAnnotation(i.iwc, i.annotation, ns, pod); err != nil { + return err + } + } + return nil } var _ podmutation.PodMutator = (*instPodMutator)(nil) @@ -329,36 +390,24 @@ func (pm *instPodMutator) Mutate(ctx context.Context, ns corev1.Namespace, pod c return pod, nil } + err = insts.setCommonInstrumentedContainers(ns, pod) + if err != nil { + return pod, err + } + // We retrieve the annotation for podname if pm.config.EnableMultiInstrumentation() { - // We use annotations specific for instrumentation language - insts.Java.Containers = annotationValue(ns.ObjectMeta, pod.ObjectMeta, annotationInjectJavaContainersName) - insts.NodeJS.Containers = annotationValue(ns.ObjectMeta, pod.ObjectMeta, annotationInjectNodeJSContainersName) - insts.Python.Containers = annotationValue(ns.ObjectMeta, pod.ObjectMeta, annotationInjectPythonContainersName) - insts.DotNet.Containers = annotationValue(ns.ObjectMeta, pod.ObjectMeta, annotationInjectDotnetContainersName) - insts.Go.Containers = annotationValue(ns.ObjectMeta, pod.ObjectMeta, annotationInjectGoContainersName) - insts.ApacheHttpd.Containers = annotationValue(ns.ObjectMeta, pod.ObjectMeta, annotationInjectApacheHttpdContainersName) - insts.Nginx.Containers = annotationValue(ns.ObjectMeta, pod.ObjectMeta, annotationInjectNginxContainersName) - insts.Sdk.Containers = annotationValue(ns.ObjectMeta, pod.ObjectMeta, annotationInjectSdkContainersName) + err = insts.setLanguageSpecificContainers(ns.ObjectMeta, pod.ObjectMeta) + if err != nil { + return pod, err + } // We check if provided annotations and instrumentations are valid - ok, msg := insts.areContainerNamesConfiguredForMultipleInstrumentations() + ok, msg := insts.areInstrumentedContainersCorrect() if !ok { logger.V(1).Error(msg, "skipping instrumentation injection") return pod, nil } - } else { - // We use general annotation for container names - // only when multi instrumentation is disabled - singleInstrEnabled := insts.isSingleInstrumentationEnabled() - if singleInstrEnabled { - generalContainerNames := annotationValue(ns.ObjectMeta, pod.ObjectMeta, annotationInjectContainerName) - insts.setInstrumentationLanguageContainers(generalContainerNames) - } else { - logger.V(1).Error(fmt.Errorf("multiple injection annotations present"), "skipping instrumentation injection") - return pod, nil - } - } // once it's been determined that instrumentation is desired, none exists yet, and we know which instance it should talk to, diff --git a/pkg/instrumentation/podmutator_test.go b/pkg/instrumentation/podmutator_test.go index b1bdb81c95..2eddd045f3 100644 --- a/pkg/instrumentation/podmutator_test.go +++ b/pkg/instrumentation/podmutator_test.go @@ -4185,789 +4185,6 @@ func TestMutatePod(t *testing.T) { config.WithEnableNodeJSInstrumentation(true), ), }, - { - name: "multi instrumentation for multiple containers feature gate enabled, container-names not used", - ns: corev1.Namespace{ - ObjectMeta: metav1.ObjectMeta{ - Name: "multi-instrumentation-multi-containers-cn", - }, - }, - inst: v1alpha1.Instrumentation{ - ObjectMeta: metav1.ObjectMeta{ - Name: "example-inst", - Namespace: "multi-instrumentation-multi-containers-cn", - }, - Spec: v1alpha1.InstrumentationSpec{ - DotNet: v1alpha1.DotNet{ - Image: "otel/dotnet:1", - Env: []corev1.EnvVar{ - { - Name: "OTEL_LOG_LEVEL", - Value: "debug", - }, - }, - }, - Java: v1alpha1.Java{ - Image: "otel/java:1", - Env: []corev1.EnvVar{ - { - Name: "OTEL_LOG_LEVEL", - Value: "debug", - }, - }, - }, - NodeJS: v1alpha1.NodeJS{ - Image: "otel/nodejs:1", - Env: []corev1.EnvVar{ - { - Name: "OTEL_LOG_LEVEL", - Value: "debug", - }, - }, - }, - Python: v1alpha1.Python{ - Image: "otel/python:1", - Env: []corev1.EnvVar{ - { - Name: "OTEL_LOG_LEVEL", - Value: "debug", - }, - }, - }, - Exporter: v1alpha1.Exporter{ - Endpoint: "http://collector:12345", - }, - }, - }, - pod: corev1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Annotations: map[string]string{ - annotationInjectDotNet: "true", - annotationInjectJava: "true", - annotationInjectNodeJS: "true", - annotationInjectPython: "true", - annotationInjectDotnetContainersName: "dotnet1,dotnet2", - annotationInjectJavaContainersName: "java1,java2", - annotationInjectNodeJSContainersName: "nodejs1,nodejs2", - annotationInjectPythonContainersName: "python1,python2", - annotationInjectContainerName: "should-not-be-instrumented1,should-not-be-instrumented2", - }, - }, - Spec: corev1.PodSpec{ - Containers: []corev1.Container{ - { - Name: "dotnet1", - }, - { - Name: "dotnet2", - }, - { - Name: "java1", - }, - { - Name: "java2", - }, - { - Name: "nodejs1", - }, - { - Name: "nodejs2", - }, - { - Name: "python1", - }, - { - Name: "python2", - }, - { - Name: "should-not-be-instrumented1", - }, - { - Name: "should-not-be-instrumented2", - }, - }, - }, - }, - expected: corev1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - Annotations: map[string]string{ - annotationInjectDotNet: "true", - annotationInjectJava: "true", - annotationInjectNodeJS: "true", - annotationInjectPython: "true", - annotationInjectDotnetContainersName: "dotnet1,dotnet2", - annotationInjectJavaContainersName: "java1,java2", - annotationInjectNodeJSContainersName: "nodejs1,nodejs2", - annotationInjectPythonContainersName: "python1,python2", - annotationInjectContainerName: "should-not-be-instrumented1,should-not-be-instrumented2", - }, - }, - Spec: corev1.PodSpec{ - Volumes: []corev1.Volume{ - { - Name: javaVolumeName, - VolumeSource: corev1.VolumeSource{ - EmptyDir: &corev1.EmptyDirVolumeSource{ - SizeLimit: &defaultVolumeLimitSize, - }, - }, - }, - { - Name: nodejsVolumeName, - VolumeSource: corev1.VolumeSource{ - EmptyDir: &corev1.EmptyDirVolumeSource{ - SizeLimit: &defaultVolumeLimitSize, - }, - }, - }, - { - Name: pythonVolumeName, - VolumeSource: corev1.VolumeSource{ - EmptyDir: &corev1.EmptyDirVolumeSource{ - SizeLimit: &defaultVolumeLimitSize, - }, - }, - }, - { - Name: dotnetVolumeName, - VolumeSource: corev1.VolumeSource{ - EmptyDir: &corev1.EmptyDirVolumeSource{ - SizeLimit: &defaultVolumeLimitSize, - }, - }, - }, - }, - InitContainers: []corev1.Container{ - { - Name: javaInitContainerName, - Image: "otel/java:1", - Command: []string{"cp", "/javaagent.jar", javaInstrMountPath + "/javaagent.jar"}, - VolumeMounts: []corev1.VolumeMount{{ - Name: javaVolumeName, - MountPath: javaInstrMountPath, - }}, - }, - { - Name: nodejsInitContainerName, - Image: "otel/nodejs:1", - Command: []string{"cp", "-r", "/autoinstrumentation/.", nodejsInstrMountPath}, - VolumeMounts: []corev1.VolumeMount{{ - Name: nodejsVolumeName, - MountPath: nodejsInstrMountPath, - }}, - }, - { - Name: pythonInitContainerName, - Image: "otel/python:1", - Command: []string{"cp", "-r", "/autoinstrumentation/.", pythonInstrMountPath}, - VolumeMounts: []corev1.VolumeMount{{ - Name: pythonVolumeName, - MountPath: pythonInstrMountPath, - }}, - }, - { - Name: dotnetInitContainerName, - Image: "otel/dotnet:1", - Command: []string{"cp", "-r", "/autoinstrumentation/.", dotnetInstrMountPath}, - VolumeMounts: []corev1.VolumeMount{{ - Name: dotnetVolumeName, - MountPath: dotnetInstrMountPath, - }}, - }, - }, - Containers: []corev1.Container{ - { - Name: "dotnet1", - Env: []corev1.EnvVar{ - { - Name: "OTEL_NODE_IP", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "status.hostIP", - }, - }, - }, - { - Name: "OTEL_POD_IP", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "status.podIP", - }, - }, - }, - { - Name: "OTEL_LOG_LEVEL", - Value: "debug", - }, - { - Name: envDotNetCoreClrEnableProfiling, - Value: dotNetCoreClrEnableProfilingEnabled, - }, - { - Name: envDotNetCoreClrProfiler, - Value: dotNetCoreClrProfilerID, - }, - { - Name: envDotNetCoreClrProfilerPath, - Value: dotNetCoreClrProfilerGlibcPath, - }, - { - Name: envDotNetStartupHook, - Value: dotNetStartupHookPath, - }, - { - Name: envDotNetAdditionalDeps, - Value: dotNetAdditionalDepsPath, - }, - { - Name: envDotNetOTelAutoHome, - Value: dotNetOTelAutoHomePath, - }, - { - Name: envDotNetSharedStore, - Value: dotNetSharedStorePath, - }, - { - Name: "OTEL_SERVICE_NAME", - Value: "dotnet1", - }, - { - Name: "OTEL_EXPORTER_OTLP_ENDPOINT", - Value: "http://collector:12345", - }, - { - Name: "OTEL_RESOURCE_ATTRIBUTES_POD_NAME", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "metadata.name", - }, - }, - }, - { - Name: "OTEL_RESOURCE_ATTRIBUTES_NODE_NAME", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "spec.nodeName", - }, - }, - }, - { - Name: "OTEL_RESOURCE_ATTRIBUTES", - Value: "k8s.container.name=dotnet1,k8s.namespace.name=multi-instrumentation-multi-containers-cn,k8s.node.name=$(OTEL_RESOURCE_ATTRIBUTES_NODE_NAME),k8s.pod.name=$(OTEL_RESOURCE_ATTRIBUTES_POD_NAME),service.instance.id=multi-instrumentation-multi-containers-cn.$(OTEL_RESOURCE_ATTRIBUTES_POD_NAME).dotnet1", - }, - }, - VolumeMounts: []corev1.VolumeMount{ - { - Name: dotnetVolumeName, - MountPath: dotnetInstrMountPath, - }, - }, - }, - { - Name: "dotnet2", - Env: []corev1.EnvVar{ - { - Name: "OTEL_NODE_IP", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "status.hostIP", - }, - }, - }, - { - Name: "OTEL_POD_IP", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "status.podIP", - }, - }, - }, - { - Name: "OTEL_LOG_LEVEL", - Value: "debug", - }, - { - Name: envDotNetCoreClrEnableProfiling, - Value: dotNetCoreClrEnableProfilingEnabled, - }, - { - Name: envDotNetCoreClrProfiler, - Value: dotNetCoreClrProfilerID, - }, - { - Name: envDotNetCoreClrProfilerPath, - Value: dotNetCoreClrProfilerGlibcPath, - }, - { - Name: envDotNetStartupHook, - Value: dotNetStartupHookPath, - }, - { - Name: envDotNetAdditionalDeps, - Value: dotNetAdditionalDepsPath, - }, - { - Name: envDotNetOTelAutoHome, - Value: dotNetOTelAutoHomePath, - }, - { - Name: envDotNetSharedStore, - Value: dotNetSharedStorePath, - }, - { - Name: "OTEL_SERVICE_NAME", - Value: "dotnet2", - }, - { - Name: "OTEL_EXPORTER_OTLP_ENDPOINT", - Value: "http://collector:12345", - }, - { - Name: "OTEL_RESOURCE_ATTRIBUTES_POD_NAME", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "metadata.name", - }, - }, - }, - { - Name: "OTEL_RESOURCE_ATTRIBUTES_NODE_NAME", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "spec.nodeName", - }, - }, - }, - { - Name: "OTEL_RESOURCE_ATTRIBUTES", - Value: "k8s.container.name=dotnet2,k8s.namespace.name=multi-instrumentation-multi-containers-cn,k8s.node.name=$(OTEL_RESOURCE_ATTRIBUTES_NODE_NAME),k8s.pod.name=$(OTEL_RESOURCE_ATTRIBUTES_POD_NAME),service.instance.id=multi-instrumentation-multi-containers-cn.$(OTEL_RESOURCE_ATTRIBUTES_POD_NAME).dotnet2", - }, - }, - VolumeMounts: []corev1.VolumeMount{ - { - Name: dotnetVolumeName, - MountPath: dotnetInstrMountPath, - }, - }, - }, - { - Name: "java1", - Env: []corev1.EnvVar{ - { - Name: "OTEL_NODE_IP", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "status.hostIP", - }, - }, - }, - { - Name: "OTEL_POD_IP", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "status.podIP", - }, - }, - }, - { - Name: "OTEL_LOG_LEVEL", - Value: "debug", - }, - { - Name: "JAVA_TOOL_OPTIONS", - Value: javaAgent, - }, - { - Name: "OTEL_SERVICE_NAME", - Value: "java1", - }, - { - Name: "OTEL_EXPORTER_OTLP_ENDPOINT", - Value: "http://collector:12345", - }, - { - Name: "OTEL_RESOURCE_ATTRIBUTES_POD_NAME", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "metadata.name", - }, - }, - }, - { - Name: "OTEL_RESOURCE_ATTRIBUTES_NODE_NAME", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "spec.nodeName", - }, - }, - }, - { - Name: "OTEL_RESOURCE_ATTRIBUTES", - Value: "k8s.container.name=java1,k8s.namespace.name=multi-instrumentation-multi-containers-cn,k8s.node.name=$(OTEL_RESOURCE_ATTRIBUTES_NODE_NAME),k8s.pod.name=$(OTEL_RESOURCE_ATTRIBUTES_POD_NAME),service.instance.id=multi-instrumentation-multi-containers-cn.$(OTEL_RESOURCE_ATTRIBUTES_POD_NAME).java1", - }, - }, - VolumeMounts: []corev1.VolumeMount{ - { - Name: javaVolumeName, - MountPath: javaInstrMountPath, - }, - }, - }, - { - Name: "java2", - Env: []corev1.EnvVar{ - { - Name: "OTEL_NODE_IP", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "status.hostIP", - }, - }, - }, - { - Name: "OTEL_POD_IP", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "status.podIP", - }, - }, - }, - { - Name: "OTEL_LOG_LEVEL", - Value: "debug", - }, - { - Name: "JAVA_TOOL_OPTIONS", - Value: javaAgent, - }, - { - Name: "OTEL_SERVICE_NAME", - Value: "java2", - }, - { - Name: "OTEL_EXPORTER_OTLP_ENDPOINT", - Value: "http://collector:12345", - }, - { - Name: "OTEL_RESOURCE_ATTRIBUTES_POD_NAME", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "metadata.name", - }, - }, - }, - { - Name: "OTEL_RESOURCE_ATTRIBUTES_NODE_NAME", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "spec.nodeName", - }, - }, - }, - { - Name: "OTEL_RESOURCE_ATTRIBUTES", - Value: "k8s.container.name=java2,k8s.namespace.name=multi-instrumentation-multi-containers-cn,k8s.node.name=$(OTEL_RESOURCE_ATTRIBUTES_NODE_NAME),k8s.pod.name=$(OTEL_RESOURCE_ATTRIBUTES_POD_NAME),service.instance.id=multi-instrumentation-multi-containers-cn.$(OTEL_RESOURCE_ATTRIBUTES_POD_NAME).java2", - }, - }, - VolumeMounts: []corev1.VolumeMount{ - { - Name: javaVolumeName, - MountPath: javaInstrMountPath, - }, - }, - }, - { - Name: "nodejs1", - Env: []corev1.EnvVar{ - { - Name: "OTEL_NODE_IP", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "status.hostIP", - }, - }, - }, - { - Name: "OTEL_POD_IP", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "status.podIP", - }, - }, - }, - { - Name: "OTEL_LOG_LEVEL", - Value: "debug", - }, - { - Name: "NODE_OPTIONS", - Value: nodeRequireArgument, - }, - { - Name: "OTEL_SERVICE_NAME", - Value: "nodejs1", - }, - { - Name: "OTEL_EXPORTER_OTLP_ENDPOINT", - Value: "http://collector:12345", - }, - { - Name: "OTEL_RESOURCE_ATTRIBUTES_POD_NAME", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "metadata.name", - }, - }, - }, - { - Name: "OTEL_RESOURCE_ATTRIBUTES_NODE_NAME", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "spec.nodeName", - }, - }, - }, - { - Name: "OTEL_RESOURCE_ATTRIBUTES", - Value: "k8s.container.name=nodejs1,k8s.namespace.name=multi-instrumentation-multi-containers-cn,k8s.node.name=$(OTEL_RESOURCE_ATTRIBUTES_NODE_NAME),k8s.pod.name=$(OTEL_RESOURCE_ATTRIBUTES_POD_NAME),service.instance.id=multi-instrumentation-multi-containers-cn.$(OTEL_RESOURCE_ATTRIBUTES_POD_NAME).nodejs1", - }, - }, - VolumeMounts: []corev1.VolumeMount{ - { - Name: nodejsVolumeName, - MountPath: nodejsInstrMountPath, - }, - }, - }, - { - Name: "nodejs2", - Env: []corev1.EnvVar{ - { - Name: "OTEL_NODE_IP", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "status.hostIP", - }, - }, - }, - { - Name: "OTEL_POD_IP", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "status.podIP", - }, - }, - }, - { - Name: "OTEL_LOG_LEVEL", - Value: "debug", - }, - { - Name: "NODE_OPTIONS", - Value: nodeRequireArgument, - }, - { - Name: "OTEL_SERVICE_NAME", - Value: "nodejs2", - }, - { - Name: "OTEL_EXPORTER_OTLP_ENDPOINT", - Value: "http://collector:12345", - }, - { - Name: "OTEL_RESOURCE_ATTRIBUTES_POD_NAME", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "metadata.name", - }, - }, - }, - { - Name: "OTEL_RESOURCE_ATTRIBUTES_NODE_NAME", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "spec.nodeName", - }, - }, - }, - { - Name: "OTEL_RESOURCE_ATTRIBUTES", - Value: "k8s.container.name=nodejs2,k8s.namespace.name=multi-instrumentation-multi-containers-cn,k8s.node.name=$(OTEL_RESOURCE_ATTRIBUTES_NODE_NAME),k8s.pod.name=$(OTEL_RESOURCE_ATTRIBUTES_POD_NAME),service.instance.id=multi-instrumentation-multi-containers-cn.$(OTEL_RESOURCE_ATTRIBUTES_POD_NAME).nodejs2", - }, - }, - VolumeMounts: []corev1.VolumeMount{ - { - Name: nodejsVolumeName, - MountPath: nodejsInstrMountPath, - }, - }, - }, - { - Name: "python1", - Env: []corev1.EnvVar{ - { - Name: "OTEL_NODE_IP", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "status.hostIP", - }, - }, - }, - { - Name: "OTEL_POD_IP", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "status.podIP", - }, - }, - }, - { - Name: "OTEL_LOG_LEVEL", - Value: "debug", - }, - { - Name: "PYTHONPATH", - Value: fmt.Sprintf("%s:%s", pythonPathPrefix, pythonPathSuffix), - }, - { - Name: "OTEL_EXPORTER_OTLP_PROTOCOL", - Value: "http/protobuf", - }, - { - Name: "OTEL_TRACES_EXPORTER", - Value: "otlp", - }, - { - Name: "OTEL_METRICS_EXPORTER", - Value: "otlp", - }, - { - Name: "OTEL_SERVICE_NAME", - Value: "python1", - }, - { - Name: "OTEL_EXPORTER_OTLP_ENDPOINT", - Value: "http://collector:12345", - }, - { - Name: "OTEL_RESOURCE_ATTRIBUTES_POD_NAME", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "metadata.name", - }, - }, - }, - { - Name: "OTEL_RESOURCE_ATTRIBUTES_NODE_NAME", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "spec.nodeName", - }, - }, - }, - { - Name: "OTEL_RESOURCE_ATTRIBUTES", - Value: "k8s.container.name=python1,k8s.namespace.name=multi-instrumentation-multi-containers-cn,k8s.node.name=$(OTEL_RESOURCE_ATTRIBUTES_NODE_NAME),k8s.pod.name=$(OTEL_RESOURCE_ATTRIBUTES_POD_NAME),service.instance.id=multi-instrumentation-multi-containers-cn.$(OTEL_RESOURCE_ATTRIBUTES_POD_NAME).python1", - }, - }, - VolumeMounts: []corev1.VolumeMount{ - { - Name: pythonVolumeName, - MountPath: pythonInstrMountPath, - }, - }, - }, - { - Name: "python2", - Env: []corev1.EnvVar{ - { - Name: "OTEL_NODE_IP", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "status.hostIP", - }, - }, - }, - { - Name: "OTEL_POD_IP", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "status.podIP", - }, - }, - }, - { - Name: "OTEL_LOG_LEVEL", - Value: "debug", - }, - { - Name: "PYTHONPATH", - Value: fmt.Sprintf("%s:%s", pythonPathPrefix, pythonPathSuffix), - }, - { - Name: "OTEL_EXPORTER_OTLP_PROTOCOL", - Value: "http/protobuf", - }, - { - Name: "OTEL_TRACES_EXPORTER", - Value: "otlp", - }, - { - Name: "OTEL_METRICS_EXPORTER", - Value: "otlp", - }, - { - Name: "OTEL_SERVICE_NAME", - Value: "python2", - }, - { - Name: "OTEL_EXPORTER_OTLP_ENDPOINT", - Value: "http://collector:12345", - }, - { - Name: "OTEL_RESOURCE_ATTRIBUTES_POD_NAME", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "metadata.name", - }, - }, - }, - { - Name: "OTEL_RESOURCE_ATTRIBUTES_NODE_NAME", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{ - FieldPath: "spec.nodeName", - }, - }, - }, - { - Name: "OTEL_RESOURCE_ATTRIBUTES", - Value: "k8s.container.name=python2,k8s.namespace.name=multi-instrumentation-multi-containers-cn,k8s.node.name=$(OTEL_RESOURCE_ATTRIBUTES_NODE_NAME),k8s.pod.name=$(OTEL_RESOURCE_ATTRIBUTES_POD_NAME),service.instance.id=multi-instrumentation-multi-containers-cn.$(OTEL_RESOURCE_ATTRIBUTES_POD_NAME).python2", - }, - }, - VolumeMounts: []corev1.VolumeMount{ - { - Name: pythonVolumeName, - MountPath: pythonInstrMountPath, - }, - }, - }, - { - Name: "should-not-be-instrumented1", - }, - { - Name: "should-not-be-instrumented2", - }, - }, - }, - }, - config: config.New( - config.WithEnableMultiInstrumentation(true), - config.WithEnableDotNetInstrumentation(true), - config.WithEnablePythonInstrumentation(true), - config.WithEnableNodeJSInstrumentation(true), - ), - }, { name: "multi instrumentation for multiple containers feature gate disabled, multiple instrumentation annotations set", ns: corev1.Namespace{ @@ -5598,50 +4815,6 @@ func TestMutatePod(t *testing.T) { } } -func TestSingleInstrumentationEnabled(t *testing.T) { - tests := []struct { - name string - instrumentations languageInstrumentations - expectedStatus bool - expectedMsg string - }{ - { - name: "Single instrumentation enabled", - instrumentations: languageInstrumentations{ - Java: instrumentationWithContainers{Instrumentation: &v1alpha1.Instrumentation{}}, - NodeJS: instrumentationWithContainers{Instrumentation: nil}, - }, - expectedStatus: true, - expectedMsg: "Java", - }, - { - name: "Multiple instrumentations enabled", - instrumentations: languageInstrumentations{ - Java: instrumentationWithContainers{Instrumentation: &v1alpha1.Instrumentation{}}, - NodeJS: instrumentationWithContainers{Instrumentation: &v1alpha1.Instrumentation{}}, - }, - expectedStatus: false, - expectedMsg: "", - }, - { - name: "Instrumentations disabled", - instrumentations: languageInstrumentations{ - Java: instrumentationWithContainers{Instrumentation: nil}, - NodeJS: instrumentationWithContainers{Instrumentation: nil}, - }, - expectedStatus: false, - expectedMsg: "", - }, - } - - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - ok := test.instrumentations.isSingleInstrumentationEnabled() - assert.Equal(t, test.expectedStatus, ok) - }) - } -} - func TestContainerNamesConfiguredForMultipleInstrumentations(t *testing.T) { tests := []struct { name string @@ -5661,8 +4834,8 @@ func TestContainerNamesConfiguredForMultipleInstrumentations(t *testing.T) { { name: "Multiple instrumentations enabled with containers", instrumentations: languageInstrumentations{ - Java: instrumentationWithContainers{Instrumentation: &v1alpha1.Instrumentation{}, Containers: "java"}, - NodeJS: instrumentationWithContainers{Instrumentation: &v1alpha1.Instrumentation{}, Containers: "nodejs"}, + Java: instrumentationWithContainers{Instrumentation: &v1alpha1.Instrumentation{}, Containers: []string{"java"}}, + NodeJS: instrumentationWithContainers{Instrumentation: &v1alpha1.Instrumentation{}, Containers: []string{"nodejs"}}, }, expectedStatus: true, expectedMsg: nil, @@ -5679,7 +4852,7 @@ func TestContainerNamesConfiguredForMultipleInstrumentations(t *testing.T) { { name: "Multiple instrumentations enabled with containers for single instrumentation", instrumentations: languageInstrumentations{ - Java: instrumentationWithContainers{Instrumentation: &v1alpha1.Instrumentation{}, Containers: "test"}, + Java: instrumentationWithContainers{Instrumentation: &v1alpha1.Instrumentation{}, Containers: []string{"test"}}, NodeJS: instrumentationWithContainers{Instrumentation: &v1alpha1.Instrumentation{}}, }, expectedStatus: false, @@ -5696,8 +4869,8 @@ func TestContainerNamesConfiguredForMultipleInstrumentations(t *testing.T) { { name: "Multiple instrumentations enabled with duplicated containers", instrumentations: languageInstrumentations{ - Java: instrumentationWithContainers{Instrumentation: &v1alpha1.Instrumentation{}, Containers: "app,app1,java"}, - NodeJS: instrumentationWithContainers{Instrumentation: &v1alpha1.Instrumentation{}, Containers: "app1,app,nodejs"}, + Java: instrumentationWithContainers{Instrumentation: &v1alpha1.Instrumentation{}, Containers: []string{"app", "app1", "java"}}, + NodeJS: instrumentationWithContainers{Instrumentation: &v1alpha1.Instrumentation{}, Containers: []string{"app1", "app", "nodejs"}}, }, expectedStatus: false, expectedMsg: fmt.Errorf("duplicated container names detected: [app app1]"), @@ -5705,8 +4878,8 @@ func TestContainerNamesConfiguredForMultipleInstrumentations(t *testing.T) { { name: "Multiple instrumentations enabled with duplicated containers for single instrumentation", instrumentations: languageInstrumentations{ - Java: instrumentationWithContainers{Instrumentation: &v1alpha1.Instrumentation{}, Containers: "app,app,java"}, - NodeJS: instrumentationWithContainers{Instrumentation: &v1alpha1.Instrumentation{}, Containers: "nodejs"}, + Java: instrumentationWithContainers{Instrumentation: &v1alpha1.Instrumentation{}, Containers: []string{"app", "app", "java"}}, + NodeJS: instrumentationWithContainers{Instrumentation: &v1alpha1.Instrumentation{}, Containers: []string{"nodejs"}}, }, expectedStatus: false, expectedMsg: fmt.Errorf("duplicated container names detected: [app]"), @@ -5715,7 +4888,7 @@ func TestContainerNamesConfiguredForMultipleInstrumentations(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { - ok, msg := test.instrumentations.areContainerNamesConfiguredForMultipleInstrumentations() + ok, msg := test.instrumentations.areInstrumentedContainersCorrect() assert.Equal(t, test.expectedStatus, ok) assert.Equal(t, test.expectedMsg, msg) }) @@ -5727,6 +4900,8 @@ func TestInstrumentationLanguageContainersSet(t *testing.T) { name string instrumentations languageInstrumentations containers string + pod corev1.Pod + ns corev1.Namespace expectedInstrumentations languageInstrumentations }{ { @@ -5735,23 +4910,37 @@ func TestInstrumentationLanguageContainersSet(t *testing.T) { NodeJS: instrumentationWithContainers{Instrumentation: nil}, Python: instrumentationWithContainers{Instrumentation: &v1alpha1.Instrumentation{}}, }, - containers: "python,python1", + pod: corev1.Pod{ + ObjectMeta: metav1.ObjectMeta{ + Annotations: map[string]string{ + annotationInjectContainerName: "python,python1", + }, + }, + }, + ns: corev1.Namespace{}, expectedInstrumentations: languageInstrumentations{ NodeJS: instrumentationWithContainers{Instrumentation: nil}, - Python: instrumentationWithContainers{Instrumentation: &v1alpha1.Instrumentation{}, Containers: "python,python1"}, + Python: instrumentationWithContainers{Instrumentation: &v1alpha1.Instrumentation{}, Containers: []string{"python", "python1"}}, }, }, { - name: "Set containers when all instrumentations disabled", - instrumentations: languageInstrumentations{}, - containers: "python,python1", + name: "Set containers when all instrumentations disabled", + instrumentations: languageInstrumentations{}, + pod: corev1.Pod{ + ObjectMeta: metav1.ObjectMeta{ + Annotations: map[string]string{ + annotationInjectContainerName: "python,python1", + }, + }, + }, expectedInstrumentations: languageInstrumentations{}, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { - test.instrumentations.setInstrumentationLanguageContainers(test.containers) + err := test.instrumentations.setCommonInstrumentedContainers(test.ns, test.pod) + assert.NoError(t, err) assert.Equal(t, test.expectedInstrumentations, test.instrumentations) }) } diff --git a/pkg/instrumentation/sdk.go b/pkg/instrumentation/sdk.go index 16e1cbf9fe..c9ae3fb09b 100644 --- a/pkg/instrumentation/sdk.go +++ b/pkg/instrumentation/sdk.go @@ -62,9 +62,11 @@ func (i *sdkInjector) inject(ctx context.Context, insts languageInstrumentations var err error i.logger.V(1).Info("injecting Java instrumentation into pod", "otelinst-namespace", otelinst.Namespace, "otelinst-name", otelinst.Name) - javaContainers := insts.Java.Containers + if len(insts.Java.Containers) == 0 { + insts.Java.Containers = []string{pod.Spec.Containers[0].Name} + } - for _, container := range strings.Split(javaContainers, ",") { + for _, container := range insts.Java.Containers { index := getContainerIndex(container, pod) pod, err = injectJavaagent(otelinst.Spec.Java, pod, index) if err != nil { @@ -81,9 +83,11 @@ func (i *sdkInjector) inject(ctx context.Context, insts languageInstrumentations var err error i.logger.V(1).Info("injecting NodeJS instrumentation into pod", "otelinst-namespace", otelinst.Namespace, "otelinst-name", otelinst.Name) - nodejsContainers := insts.NodeJS.Containers + if len(insts.NodeJS.Containers) == 0 { + insts.NodeJS.Containers = []string{pod.Spec.Containers[0].Name} + } - for _, container := range strings.Split(nodejsContainers, ",") { + for _, container := range insts.NodeJS.Containers { index := getContainerIndex(container, pod) pod, err = injectNodeJSSDK(otelinst.Spec.NodeJS, pod, index) if err != nil { @@ -100,9 +104,11 @@ func (i *sdkInjector) inject(ctx context.Context, insts languageInstrumentations var err error i.logger.V(1).Info("injecting Python instrumentation into pod", "otelinst-namespace", otelinst.Namespace, "otelinst-name", otelinst.Name) - pythonContainers := insts.Python.Containers + if len(insts.Python.Containers) == 0 { + insts.Python.Containers = []string{pod.Spec.Containers[0].Name} + } - for _, container := range strings.Split(pythonContainers, ",") { + for _, container := range insts.Python.Containers { index := getContainerIndex(container, pod) pod, err = injectPythonSDK(otelinst.Spec.Python, pod, index) if err != nil { @@ -119,9 +125,11 @@ func (i *sdkInjector) inject(ctx context.Context, insts languageInstrumentations var err error i.logger.V(1).Info("injecting DotNet instrumentation into pod", "otelinst-namespace", otelinst.Namespace, "otelinst-name", otelinst.Name) - dotnetContainers := insts.DotNet.Containers + if len(insts.DotNet.Containers) == 0 { + insts.DotNet.Containers = []string{pod.Spec.Containers[0].Name} + } - for _, container := range strings.Split(dotnetContainers, ",") { + for _, container := range insts.DotNet.Containers { index := getContainerIndex(container, pod) pod, err = injectDotNetSDK(otelinst.Spec.DotNet, pod, index, insts.DotNet.AdditionalAnnotations[annotationDotNetRuntime]) if err != nil { @@ -139,10 +147,12 @@ func (i *sdkInjector) inject(ctx context.Context, insts languageInstrumentations var err error i.logger.V(1).Info("injecting Go instrumentation into pod", "otelinst-namespace", otelinst.Namespace, "otelinst-name", otelinst.Name) - goContainers := insts.Go.Containers + if len(insts.Go.Containers) == 0 { + insts.Go.Containers = []string{pod.Spec.Containers[0].Name} + } // Go instrumentation supports only single container instrumentation. - index := getContainerIndex(goContainers, pod) + index := getContainerIndex(insts.Go.Containers[0], pod) pod, err = injectGoSDK(otelinst.Spec.Go, pod, cfg) if err != nil { i.logger.Info("Skipping Go SDK injection", "reason", err.Error(), "container", pod.Spec.Containers[index].Name) @@ -163,9 +173,11 @@ func (i *sdkInjector) inject(ctx context.Context, insts languageInstrumentations otelinst := *insts.ApacheHttpd.Instrumentation i.logger.V(1).Info("injecting Apache Httpd instrumentation into pod", "otelinst-namespace", otelinst.Namespace, "otelinst-name", otelinst.Name) - apacheHttpdContainers := insts.ApacheHttpd.Containers + if len(insts.ApacheHttpd.Containers) == 0 { + insts.ApacheHttpd.Containers = []string{pod.Spec.Containers[0].Name} + } - for _, container := range strings.Split(apacheHttpdContainers, ",") { + for _, container := range insts.ApacheHttpd.Containers { index := getContainerIndex(container, pod) // Apache agent is configured via config files rather than env vars. // Therefore, service name, otlp endpoint and other attributes are passed to the agent injection method @@ -181,9 +193,11 @@ func (i *sdkInjector) inject(ctx context.Context, insts languageInstrumentations otelinst := *insts.Nginx.Instrumentation i.logger.V(1).Info("injecting Nginx instrumentation into pod", "otelinst-namespace", otelinst.Namespace, "otelinst-name", otelinst.Name) - nginxContainers := insts.Nginx.Containers + if len(insts.Nginx.Containers) == 0 { + insts.Nginx.Containers = []string{pod.Spec.Containers[0].Name} + } - for _, container := range strings.Split(nginxContainers, ",") { + for _, container := range insts.Nginx.Containers { index := getContainerIndex(container, pod) // Nginx agent is configured via config files rather than env vars. // Therefore, service name, otlp endpoint and other attributes are passed to the agent injection method @@ -197,9 +211,11 @@ func (i *sdkInjector) inject(ctx context.Context, insts languageInstrumentations otelinst := *insts.Sdk.Instrumentation i.logger.V(1).Info("injecting sdk-only instrumentation into pod", "otelinst-namespace", otelinst.Namespace, "otelinst-name", otelinst.Name) - sdkContainers := insts.Sdk.Containers + if len(insts.Sdk.Containers) == 0 { + insts.Sdk.Containers = []string{pod.Spec.Containers[0].Name} + } - for _, container := range strings.Split(sdkContainers, ",") { + for _, container := range insts.Sdk.Containers { index := getContainerIndex(container, pod) pod = i.injectCommonEnvVar(otelinst, pod, index) pod = i.injectCommonSDKConfig(ctx, otelinst, ns, pod, index, index) diff --git a/pkg/instrumentation/sdk_test.go b/pkg/instrumentation/sdk_test.go index 84859d3bc1..393f9e9fe2 100644 --- a/pkg/instrumentation/sdk_test.go +++ b/pkg/instrumentation/sdk_test.go @@ -650,7 +650,10 @@ func TestInjectJava(t *testing.T) { }, } insts := languageInstrumentations{ - Java: instrumentationWithContainers{Instrumentation: &inst, Containers: ""}, + Java: instrumentationWithContainers{ + Instrumentation: &inst, + Containers: []string{"app"}, + }, } inj := sdkInjector{ logger: logr.Discard(), @@ -771,7 +774,10 @@ func TestInjectNodeJS(t *testing.T) { }, } insts := languageInstrumentations{ - NodeJS: instrumentationWithContainers{Instrumentation: &inst, Containers: ""}, + NodeJS: instrumentationWithContainers{ + Instrumentation: &inst, + Containers: []string{"app"}, + }, } inj := sdkInjector{ logger: logr.Discard(), @@ -891,7 +897,10 @@ func TestInjectPython(t *testing.T) { }, } insts := languageInstrumentations{ - Python: instrumentationWithContainers{Instrumentation: &inst, Containers: ""}, + Python: instrumentationWithContainers{ + Instrumentation: &inst, + Containers: []string{"app"}, + }, } inj := sdkInjector{ @@ -1023,7 +1032,10 @@ func TestInjectDotNet(t *testing.T) { }, } insts := languageInstrumentations{ - DotNet: instrumentationWithContainers{Instrumentation: &inst, Containers: ""}, + DotNet: instrumentationWithContainers{ + Instrumentation: &inst, + Containers: []string{"app"}, + }, } inj := sdkInjector{ logger: logr.Discard(), @@ -1169,14 +1181,16 @@ func TestInjectGo(t *testing.T) { { name: "shared process namespace disabled", insts: languageInstrumentations{ - Go: instrumentationWithContainers{Instrumentation: &v1alpha1.Instrumentation{ - Spec: v1alpha1.InstrumentationSpec{ - Go: v1alpha1.Go{ - Image: "otel/go:1", + Go: instrumentationWithContainers{ + Containers: []string{"app"}, + Instrumentation: &v1alpha1.Instrumentation{ + Spec: v1alpha1.InstrumentationSpec{ + Go: v1alpha1.Go{ + Image: "otel/go:1", + }, }, }, }, - }, }, pod: corev1.Pod{ Spec: corev1.PodSpec{ @@ -1202,14 +1216,16 @@ func TestInjectGo(t *testing.T) { { name: "OTEL_GO_AUTO_TARGET_EXE not set", insts: languageInstrumentations{ - Go: instrumentationWithContainers{Instrumentation: &v1alpha1.Instrumentation{ - Spec: v1alpha1.InstrumentationSpec{ - Go: v1alpha1.Go{ - Image: "otel/go:1", + Go: instrumentationWithContainers{ + Containers: []string{"app"}, + Instrumentation: &v1alpha1.Instrumentation{ + Spec: v1alpha1.InstrumentationSpec{ + Go: v1alpha1.Go{ + Image: "otel/go:1", + }, }, }, }, - }, }, pod: corev1.Pod{ Spec: corev1.PodSpec{ @@ -1233,20 +1249,22 @@ func TestInjectGo(t *testing.T) { { name: "OTEL_GO_AUTO_TARGET_EXE set by inst", insts: languageInstrumentations{ - Go: instrumentationWithContainers{Instrumentation: &v1alpha1.Instrumentation{ - Spec: v1alpha1.InstrumentationSpec{ - Go: v1alpha1.Go{ - Image: "otel/go:1", - Env: []corev1.EnvVar{ - { - Name: "OTEL_GO_AUTO_TARGET_EXE", - Value: "foo", + Go: instrumentationWithContainers{ + Containers: []string{"app"}, + Instrumentation: &v1alpha1.Instrumentation{ + Spec: v1alpha1.InstrumentationSpec{ + Go: v1alpha1.Go{ + Image: "otel/go:1", + Env: []corev1.EnvVar{ + { + Name: "OTEL_GO_AUTO_TARGET_EXE", + Value: "foo", + }, }, }, }, }, }, - }, }, pod: corev1.Pod{ Spec: corev1.PodSpec{ @@ -1345,7 +1363,7 @@ func TestInjectGo(t *testing.T) { name: "OTEL_GO_AUTO_TARGET_EXE set by annotation", insts: languageInstrumentations{ Go: instrumentationWithContainers{ - Containers: "", + Containers: []string{"app"}, Instrumentation: &v1alpha1.Instrumentation{ Spec: v1alpha1.InstrumentationSpec{ Go: v1alpha1.Go{ @@ -1494,7 +1512,7 @@ func TestInjectApacheHttpd(t *testing.T) { }, }, }, - Containers: "", + Containers: []string{"app"}, }, }, pod: corev1.Pod{ @@ -1672,7 +1690,7 @@ func TestInjectNginx(t *testing.T) { }, }, }, - Containers: "", + Containers: []string{"app"}, }, }, pod: corev1.Pod{ @@ -1841,7 +1859,7 @@ func TestInjectSdkOnly(t *testing.T) { }, } insts := languageInstrumentations{ - Sdk: instrumentationWithContainers{Instrumentation: &inst, Containers: ""}, + Sdk: instrumentationWithContainers{Instrumentation: &inst, Containers: []string{"app"}}, } inj := sdkInjector{ diff --git a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/01-assert.yaml b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/01-assert.yaml index 89ad0aa61e..ce304aa78a 100644 --- a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/01-assert.yaml +++ b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/01-assert.yaml @@ -2,7 +2,6 @@ apiVersion: v1 kind: Pod metadata: annotations: - instrumentation.opentelemetry.io/container-names: shouldnt-be-instrumented instrumentation.opentelemetry.io/dotnet-container-names: dotnetapp instrumentation.opentelemetry.io/inject-dotnet: "true" instrumentation.opentelemetry.io/inject-java: "true" @@ -195,13 +194,6 @@ spec: readOnly: true - mountPath: /otel-auto-instrumentation-python name: opentelemetry-auto-instrumentation-python - - env: - - name: TEST - value: test - name: shouldnt-be-instrumented - volumeMounts: - - mountPath: /var/run/secrets/kubernetes.io/serviceaccount - readOnly: true - args: - --feature-gates=-component.UseLocalHostAsDefaultHost - --config=env:OTEL_CONFIG @@ -248,9 +240,6 @@ status: - name: pythonapp ready: true started: true - - name: shouldnt-be-instrumented - ready: true - started: true initContainerStatuses: - name: opentelemetry-auto-instrumentation-java ready: true diff --git a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/01-install-app.yaml b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/01-install-app.yaml index 32f0b4658c..88d8f7a564 100644 --- a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/01-install-app.yaml +++ b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/01-install-app.yaml @@ -12,7 +12,6 @@ spec: labels: app: pod-with-multi-instrumentation annotations: - instrumentation.opentelemetry.io/container-names: "shouldnt-be-instrumented" instrumentation.opentelemetry.io/dotnet-container-names: "dotnetapp" instrumentation.opentelemetry.io/inject-dotnet: "true" instrumentation.opentelemetry.io/inject-java: "true" @@ -59,12 +58,4 @@ spec: allowPrivilegeEscalation: false capabilities: drop: ["ALL"] - - name: shouldnt-be-instrumented - image: rabbitmq:3 - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: ["ALL"] - env: - - name: TEST - value: test + diff --git a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/02-assert.yaml b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/02-assert.yaml new file mode 100644 index 0000000000..5c9ccd6f37 --- /dev/null +++ b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/02-assert.yaml @@ -0,0 +1,82 @@ +apiVersion: v1 +kind: Pod +metadata: + annotations: + instrumentation.opentelemetry.io/container-names: "dotnetapp" + instrumentation.opentelemetry.io/inject-dotnet: "true" + sidecar.opentelemetry.io/inject: "true" + labels: + app: pod-with-multi-instrumentation2 +spec: + containers: + - env: + - name: OTEL_NODE_IP + valueFrom: + fieldRef: + fieldPath: status.hostIP + - name: OTEL_POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + - name: ASPNETCORE_URLS + value: http://+:8083 + - name: OTEL_SERVICE_NAME + value: dotnetapp + - name: CORECLR_ENABLE_PROFILING + value: "1" + - name: CORECLR_PROFILER + value: '{918728DD-259F-4A6A-AC2B-B85E1B658318}' + - name: CORECLR_PROFILER_PATH + value: /otel-auto-instrumentation-dotnet/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so + - name: DOTNET_STARTUP_HOOKS + value: /otel-auto-instrumentation-dotnet/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll + - name: DOTNET_ADDITIONAL_DEPS + value: /otel-auto-instrumentation-dotnet/AdditionalDeps + - name: OTEL_DOTNET_AUTO_HOME + value: /otel-auto-instrumentation-dotnet + - name: DOTNET_SHARED_STORE + value: /otel-auto-instrumentation-dotnet/store + - name: OTEL_TRACES_SAMPLER + value: parentbased_traceidratio + - name: OTEL_TRACES_SAMPLER_ARG + value: "0.85" + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: http://localhost:4317 + - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: OTEL_PROPAGATORS + value: jaeger,b3 + - name: OTEL_RESOURCE_ATTRIBUTES + name: dotnetapp + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true + - mountPath: /otel-auto-instrumentation-dotnet + name: opentelemetry-auto-instrumentation-dotnet + - name: javaapp + - name: otc-container + initContainers: + - name: opentelemetry-auto-instrumentation-dotnet +status: + containerStatuses: + - name: dotnetapp + ready: true + started: true + - name: javaapp + ready: true + started: true + - name: otc-container + ready: true + started: true + initContainerStatuses: + - name: opentelemetry-auto-instrumentation-dotnet + ready: true + phase: Running diff --git a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/02-error.yaml b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/02-error.yaml new file mode 100644 index 0000000000..9be0c047f1 --- /dev/null +++ b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/02-error.yaml @@ -0,0 +1,114 @@ +apiVersion: v1 +kind: Pod +metadata: + annotations: + instrumentation.opentelemetry.io/container-names: "dotnetapp" + instrumentation.opentelemetry.io/inject-dotnet: "true" + sidecar.opentelemetry.io/inject: "true" + labels: + app: pod-with-multi-instrumentation2 +spec: + containers: + - env: + - name: OTEL_NODE_IP + valueFrom: + fieldRef: + fieldPath: status.hostIP + - name: OTEL_POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + - name: ASPNETCORE_URLS + value: http://+:8083 + - name: OTEL_SERVICE_NAME + value: dotnetapp + - name: CORECLR_ENABLE_PROFILING + value: "1" + - name: CORECLR_PROFILER + value: '{918728DD-259F-4A6A-AC2B-B85E1B658318}' + - name: CORECLR_PROFILER_PATH + value: /otel-auto-instrumentation-dotnet/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so + - name: DOTNET_STARTUP_HOOKS + value: /otel-auto-instrumentation-dotnet/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll + - name: DOTNET_ADDITIONAL_DEPS + value: /otel-auto-instrumentation-dotnet/AdditionalDeps + - name: OTEL_DOTNET_AUTO_HOME + value: /otel-auto-instrumentation-dotnet + - name: DOTNET_SHARED_STORE + value: /otel-auto-instrumentation-dotnet/store + - name: OTEL_TRACES_SAMPLER + value: parentbased_traceidratio + - name: OTEL_TRACES_SAMPLER_ARG + value: "0.85" + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: http://localhost:4317 + - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: OTEL_PROPAGATORS + value: jaeger,b3 + - name: OTEL_RESOURCE_ATTRIBUTES + name: dotnetapp + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + readOnly: true + - mountPath: /otel-auto-instrumentation-dotnet + name: opentelemetry-auto-instrumentation-dotnet + - env: + - name: OTEL_NODE_IP + valueFrom: + fieldRef: + fieldPath: status.hostIP + - name: OTEL_POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + - name: OTEL_SERVICE_NAME + value: javaapp + - name: JAVA_TOOL_OPTIONS + value: ' -javaagent:/otel-auto-instrumentation-java/javaagent.jar' + - name: OTEL_TRACES_SAMPLER + value: parentbased_traceidratio + - name: OTEL_TRACES_SAMPLER_ARG + value: "0.85" + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: http://localhost:4317 + - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: OTEL_PROPAGATORS + value: jaeger,b3 + - name: OTEL_RESOURCE_ATTRIBUTES + name: javaapp + - name: otc-container + initContainers: + - name: opentelemetry-auto-instrumentation-dotnet +status: + containerStatuses: + - name: dotnetapp + ready: true + started: true + - name: javaapp + ready: true + started: true + - name: otc-container + ready: true + started: true + initContainerStatuses: + - name: opentelemetry-auto-instrumentation-dotnet + ready: true + phase: Running diff --git a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/02-install-app.yaml b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/02-install-app.yaml new file mode 100644 index 0000000000..f203cf0b8e --- /dev/null +++ b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/02-install-app.yaml @@ -0,0 +1,38 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: deployment-with-multi-instrumentation2 +spec: + selector: + matchLabels: + app: pod-with-multi-instrumentation2 + replicas: 1 + template: + metadata: + labels: + app: pod-with-multi-instrumentation2 + annotations: + instrumentation.opentelemetry.io/container-names: "dotnetapp" + instrumentation.opentelemetry.io/inject-dotnet: "true" + sidecar.opentelemetry.io/inject: "true" + spec: + securityContext: + runAsUser: 1000 + runAsGroup: 3000 + fsGroup: 3000 + containers: + - name: dotnetapp + image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-dotnet:main + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] + env: + - name: ASPNETCORE_URLS + value: "http://+:8083" + - name: javaapp + image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-java:main + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: ["ALL"] From 4540ce1dcf3b63e6ccb79f02de227edf66b7afd7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 09:13:48 +0200 Subject: [PATCH 17/41] Bump github.com/operator-framework/operator-lib from 0.14.0 to 0.15.0 (#3256) Bumps [github.com/operator-framework/operator-lib](https://github.com/operator-framework/operator-lib) from 0.14.0 to 0.15.0. - [Release notes](https://github.com/operator-framework/operator-lib/releases) - [Commits](https://github.com/operator-framework/operator-lib/compare/v0.14.0...v0.15.0) --- updated-dependencies: - dependency-name: github.com/operator-framework/operator-lib dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 357cc726d4..d07662fbc0 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/oklog/run v1.1.0 github.com/open-telemetry/opamp-go v0.15.0 github.com/openshift/api v0.0.0-20240124164020-e2ce40831f2e - github.com/operator-framework/operator-lib v0.14.0 + github.com/operator-framework/operator-lib v0.15.0 github.com/prometheus-operator/prometheus-operator v0.76.0 github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.76.0 github.com/prometheus-operator/prometheus-operator/pkg/client v0.76.0 diff --git a/go.sum b/go.sum index 05a459a231..7b98558e3c 100644 --- a/go.sum +++ b/go.sum @@ -232,7 +232,6 @@ github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaC github.com/go-resty/resty/v2 v2.13.1 h1:x+LHXBI2nMB1vqndymf26quycC4aggYJ7DECYbiz03g= github.com/go-resty/resty/v2 v2.13.1/go.mod h1:GznXlLxkq6Nh4sU59rPmUw3VtgpO3aS96ORAI6Q7d+0= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/go-zookeeper/zk v1.0.3 h1:7M2kwOsc//9VeeFiPtf+uSJlVpU66x9Ba5+8XK7/TDg= @@ -495,8 +494,8 @@ github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/onsi/ginkgo/v2 v2.20.0 h1:PE84V2mHqoT1sglvHc8ZdQtPcwmvvt29WLEEO3xmdZw= -github.com/onsi/ginkgo/v2 v2.20.0/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI= +github.com/onsi/ginkgo/v2 v2.20.1 h1:YlVIbqct+ZmnEph770q9Q7NVAz4wwIiVNahee6JyUzo= +github.com/onsi/ginkgo/v2 v2.20.1/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI= github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k= github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY= github.com/open-telemetry/opamp-go v0.15.0 h1:X2TWhEsGQ8GP7Uos3Ic9v/1aFUqoECZXKS7xAF5HqsA= @@ -509,8 +508,8 @@ github.com/openshift/api v0.0.0-20240124164020-e2ce40831f2e h1:cxgCNo/R769CO23AK github.com/openshift/api v0.0.0-20240124164020-e2ce40831f2e/go.mod h1:CxgbWAlvu2iQB0UmKTtRu1YfepRg1/vJ64n2DlIEVz4= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= -github.com/operator-framework/operator-lib v0.14.0 h1:er+BgZymZD1im2wytLJiPLZpGALAX6N0gXaHx3PKbO4= -github.com/operator-framework/operator-lib v0.14.0/go.mod h1:wUu4Xb9xzXnIpglvaZ3yucTMSlqGXHIoUEH9+5gWiu0= +github.com/operator-framework/operator-lib v0.15.0 h1:0QeRM4PMtThqINpcFGCEBnIV3Z8u7/8fYLEx6mUtdcM= +github.com/operator-framework/operator-lib v0.15.0/go.mod h1:ZxLvFuQ7bRWiTNBOqodbuNvcsy/Iq0kOygdxhlbNdI0= github.com/ovh/go-ovh v1.6.0 h1:ixLOwxQdzYDx296sXcgS35TOPEahJkpjMGtzPadCjQI= github.com/ovh/go-ovh v1.6.0/go.mod h1:cTVDnl94z4tl8pP1uZ/8jlVxntjSIf09bNcQ5TJSC7c= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= From 549528f4c061631d971e2932a91a10a0b74eb189 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 09:14:47 +0200 Subject: [PATCH 18/41] Bump github.com/Masterminds/semver/v3 from 3.2.1 to 3.3.0 (#3255) Bumps [github.com/Masterminds/semver/v3](https://github.com/Masterminds/semver) from 3.2.1 to 3.3.0. - [Release notes](https://github.com/Masterminds/semver/releases) - [Changelog](https://github.com/Masterminds/semver/blob/master/CHANGELOG.md) - [Commits](https://github.com/Masterminds/semver/compare/v3.2.1...v3.3.0) --- updated-dependencies: - dependency-name: github.com/Masterminds/semver/v3 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index d07662fbc0..d05d45a9d8 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ retract v1.51.0 require ( dario.cat/mergo v1.0.1 - github.com/Masterminds/semver/v3 v3.2.1 + github.com/Masterminds/semver/v3 v3.3.0 github.com/blang/semver/v4 v4.0.0 github.com/buraksezer/consistent v0.10.0 github.com/cespare/xxhash/v2 v2.3.0 diff --git a/go.sum b/go.sum index 7b98558e3c..30b956d73d 100644 --- a/go.sum +++ b/go.sum @@ -63,8 +63,8 @@ github.com/Code-Hex/go-generics-cache v1.5.1 h1:6vhZGc5M7Y/YD8cIUcY8kcuQLB4cHR7U github.com/Code-Hex/go-generics-cache v1.5.1/go.mod h1:qxcC9kRVrct9rHeiYpFWSoW1vxyillCVzX13KZG8dl4= github.com/DATA-DOG/go-sqlmock v1.4.1/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= -github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= +github.com/Masterminds/semver/v3 v3.3.0 h1:B8LGeaivUe71a5qox1ICM/JLl0NqZSW5CHyL+hmvYS0= +github.com/Masterminds/semver/v3 v3.3.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= From 8bf48945c618878195ef186d48053d5ccc30d45f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 09:16:14 +0200 Subject: [PATCH 19/41] Bump github.com/prometheus/common from 0.55.0 to 0.57.0 (#3253) Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.55.0 to 0.57.0. - [Release notes](https://github.com/prometheus/common/releases) - [Changelog](https://github.com/prometheus/common/blob/main/RELEASE.md) - [Commits](https://github.com/prometheus/common/compare/v0.55.0...v0.57.0) --- updated-dependencies: - dependency-name: github.com/prometheus/common dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index d05d45a9d8..4bf12186d5 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,7 @@ require ( github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.76.0 github.com/prometheus-operator/prometheus-operator/pkg/client v0.76.0 github.com/prometheus/client_golang v1.20.2 - github.com/prometheus/common v0.55.0 + github.com/prometheus/common v0.57.0 github.com/prometheus/prometheus v0.54.0 github.com/shirou/gopsutil v3.21.11+incompatible github.com/spf13/pflag v1.0.5 diff --git a/go.sum b/go.sum index 30b956d73d..09cc4d3500 100644 --- a/go.sum +++ b/go.sum @@ -557,8 +557,8 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/common/sigv4 v0.1.0 h1:qoVebwtwwEhS85Czm2dSROY5fTo2PAPEVdDeppTwGX4= github.com/prometheus/common/sigv4 v0.1.0/go.mod h1:2Jkxxk9yYvCkE5G1sQT7GuEXm57JrvHu9k5YwTjsNtI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= From c13938a71d73cb4ae30a570384219ed65d6e9a01 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 09:17:34 +0200 Subject: [PATCH 20/41] Bump go.opentelemetry.io/collector/featuregate from 1.13.0 to 1.14.1 (#3254) Bumps [go.opentelemetry.io/collector/featuregate](https://github.com/open-telemetry/opentelemetry-collector) from 1.13.0 to 1.14.1. - [Release notes](https://github.com/open-telemetry/opentelemetry-collector/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-collector/blob/main/CHANGELOG-API.md) - [Commits](https://github.com/open-telemetry/opentelemetry-collector/compare/pdata/v1.13.0...pdata/v1.14.1) --- updated-dependencies: - dependency-name: go.opentelemetry.io/collector/featuregate dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 4bf12186d5..960e3f07b3 100644 --- a/go.mod +++ b/go.mod @@ -30,7 +30,7 @@ require ( github.com/shirou/gopsutil v3.21.11+incompatible github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/featuregate v1.13.0 + go.opentelemetry.io/collector/featuregate v1.14.1 go.opentelemetry.io/otel v1.29.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.29.0 go.opentelemetry.io/otel/exporters/prometheus v0.51.0 diff --git a/go.sum b/go.sum index 09cc4d3500..37c0ff1d08 100644 --- a/go.sum +++ b/go.sum @@ -639,8 +639,8 @@ go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/collector/featuregate v1.13.0 h1:rc84eCf5hesXQ8/bP6Zc15wqthbomfLBHmox5tT7AwM= -go.opentelemetry.io/collector/featuregate v1.13.0/go.mod h1:PsOINaGgTiFc+Tzu2K/X2jP+Ngmlp7YKGV1XrnBkH7U= +go.opentelemetry.io/collector/featuregate v1.14.1 h1:5jvlRe1b5FqhGsyYtuwrzNhFLthGCfm98b3PsCRgXDA= +go.opentelemetry.io/collector/featuregate v1.14.1/go.mod h1:47xrISO71vJ83LSMm8+yIDsUbKktUp48Ovt7RR6VbRs= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw= From c0d353525d87b7bc6b489a04742eed9091b81f67 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 10:51:06 +0200 Subject: [PATCH 21/41] Bump github.com/prometheus/prometheus in the prometheus group (#3252) Bumps the prometheus group with 1 update: [github.com/prometheus/prometheus](https://github.com/prometheus/prometheus). Updates `github.com/prometheus/prometheus` from 0.54.0 to 0.54.1 - [Release notes](https://github.com/prometheus/prometheus/releases) - [Changelog](https://github.com/prometheus/prometheus/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus/prometheus/compare/v0.54.0...v0.54.1) --- updated-dependencies: - dependency-name: github.com/prometheus/prometheus dependency-type: direct:production update-type: version-update:semver-patch dependency-group: prometheus ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 960e3f07b3..569f5081a6 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/prometheus-operator/prometheus-operator/pkg/client v0.76.0 github.com/prometheus/client_golang v1.20.2 github.com/prometheus/common v0.57.0 - github.com/prometheus/prometheus v0.54.0 + github.com/prometheus/prometheus v0.54.1 github.com/shirou/gopsutil v3.21.11+incompatible github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.9.0 diff --git a/go.sum b/go.sum index 37c0ff1d08..d102c645c6 100644 --- a/go.sum +++ b/go.sum @@ -568,8 +568,8 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= -github.com/prometheus/prometheus v0.54.0 h1:6+VmEkohHcofl3W5LyRlhw1Lfm575w/aX6ZFyVAmzM0= -github.com/prometheus/prometheus v0.54.0/go.mod h1:xlLByHhk2g3ycakQGrMaU8K7OySZx98BzeCR99991NY= +github.com/prometheus/prometheus v0.54.1 h1:vKuwQNjnYN2/mDoWfHXDhAsz/68q/dQDb+YbcEqU7MQ= +github.com/prometheus/prometheus v0.54.1/go.mod h1:xlLByHhk2g3ycakQGrMaU8K7OySZx98BzeCR99991NY= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= From 629aed56e6352728c1f482d099a35fb9494819b7 Mon Sep 17 00:00:00 2001 From: David Haja Date: Tue, 3 Sep 2024 14:47:42 +0200 Subject: [PATCH 22/41] Retry failed namespace informer creation in promOperator CRD watcher (#3244) --- ...-ta-retry-namespace-informer-creation.yaml | 16 +++++++++++++ cmd/otel-allocator/watcher/promOperator.go | 24 +++++++++++++------ 2 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 .chloggen/3216-ta-retry-namespace-informer-creation.yaml diff --git a/.chloggen/3216-ta-retry-namespace-informer-creation.yaml b/.chloggen/3216-ta-retry-namespace-informer-creation.yaml new file mode 100644 index 0000000000..2db25c9caa --- /dev/null +++ b/.chloggen/3216-ta-retry-namespace-informer-creation.yaml @@ -0,0 +1,16 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) +component: target allocator + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Retrying failed namespace informer creation in promOperator CRD watcher, then exit if creation issue cannot be resolved" + +# One or more tracking issues related to the change +issues: [3216] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/cmd/otel-allocator/watcher/promOperator.go b/cmd/otel-allocator/watcher/promOperator.go index aa066a7468..ae2ddcb68e 100644 --- a/cmd/otel-allocator/watcher/promOperator.go +++ b/cmd/otel-allocator/watcher/promOperator.go @@ -42,6 +42,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/cache" + "k8s.io/client-go/util/retry" allocatorconfig "github.com/open-telemetry/opentelemetry-operator/cmd/otel-allocator/config" ) @@ -101,14 +102,23 @@ func NewPrometheusCRWatcher(ctx context.Context, logger logr.Logger, cfg allocat eventRecorderFactory := operator.NewEventRecorderFactory(false) eventRecorder := eventRecorderFactory(clientset, "target-allocator") - nsMonInf, err := getNamespaceInformer(ctx, map[string]struct{}{v1.NamespaceAll: {}}, promOperatorLogger, clientset, operatorMetrics) + var nsMonInf cache.SharedIndexInformer + getNamespaceInformerErr := retry.OnError(retry.DefaultRetry, + func(err error) bool { + logger.Error(err, "Retrying namespace informer creation in promOperator CRD watcher") + return true + }, func() error { + nsMonInf, err = getNamespaceInformer(ctx, map[string]struct{}{v1.NamespaceAll: {}}, promOperatorLogger, clientset, operatorMetrics) + return err + }) + if getNamespaceInformerErr != nil { + logger.Error(getNamespaceInformerErr, "Failed to create namespace informer in promOperator CRD watcher") + return nil, getNamespaceInformerErr + } + + resourceSelector, err = prometheus.NewResourceSelector(promOperatorSlogLogger, prom, store, nsMonInf, operatorMetrics, eventRecorder) if err != nil { - logger.Error(err, "Failed to create namespace informer in promOperator CRD watcher") - } else { - resourceSelector, err = prometheus.NewResourceSelector(promOperatorSlogLogger, prom, store, nsMonInf, operatorMetrics, eventRecorder) - if err != nil { - logger.Error(err, "Failed to create resource selector in promOperator CRD watcher") - } + logger.Error(err, "Failed to create resource selector in promOperator CRD watcher") } return &PrometheusCRWatcher{ From 7a8c9c84a5a7239baea43bcb6651db5ca853b0dd Mon Sep 17 00:00:00 2001 From: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com> Date: Tue, 3 Sep 2024 14:38:23 -0600 Subject: [PATCH 23/41] [chore] Remove references to the logging exporter (#3259) * Remove references to the logging exporter * Fix test * Update sha256s * Update sha256s --- ...emetry-operator.clusterserviceversion.yaml | 4 +-- ...emetry-operator.clusterserviceversion.yaml | 4 +-- .../config/config_test.go | 2 +- .../testdata/agentbasiccomponentsallowed.yaml | 2 +- cmd/otel-allocator/README.md | 4 +-- config/samples/_v1alpha1_opampbridge.yaml | 2 +- controllers/builder_test.go | 34 +++++++++---------- controllers/suite_test.go | 2 +- controllers/testdata/test.yaml | 4 +-- controllers/testdata/test_ta_update.yaml | 4 +-- .../collector/testdata/ingress_testdata.yaml | 4 +-- .../manifests/opampbridge/configmap_test.go | 4 +-- 12 files changed, 35 insertions(+), 35 deletions(-) diff --git a/bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml b/bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml index 037171d74a..6875f49a6c 100644 --- a/bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml +++ b/bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml @@ -38,7 +38,7 @@ metadata: }, "componentsAllowed": { "exporters": [ - "logging" + "debug" ], "processors": [ "memory_limiter" @@ -99,7 +99,7 @@ metadata: categories: Logging & Tracing,Monitoring certified: "false" containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator - createdAt: "2024-08-27T07:26:20Z" + createdAt: "2024-09-03T20:25:40Z" description: Provides the OpenTelemetry components, including the Collector operators.operatorframework.io/builder: operator-sdk-v1.29.0 operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 diff --git a/bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml b/bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml index 96927cf2be..b6ec3f9ac0 100644 --- a/bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml +++ b/bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml @@ -38,7 +38,7 @@ metadata: }, "componentsAllowed": { "exporters": [ - "logging" + "debug" ], "processors": [ "memory_limiter" @@ -99,7 +99,7 @@ metadata: categories: Logging & Tracing,Monitoring certified: "false" containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator - createdAt: "2024-08-27T07:26:23Z" + createdAt: "2024-09-03T20:25:47Z" description: Provides the OpenTelemetry components, including the Collector operators.operatorframework.io/builder: operator-sdk-v1.29.0 operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 diff --git a/cmd/operator-opamp-bridge/config/config_test.go b/cmd/operator-opamp-bridge/config/config_test.go index abcc4fcae7..0866d470fb 100644 --- a/cmd/operator-opamp-bridge/config/config_test.go +++ b/cmd/operator-opamp-bridge/config/config_test.go @@ -118,7 +118,7 @@ func TestLoad(t *testing.T) { "batch", }, "exporters": { - "logging", + "debug", }, }, }, diff --git a/cmd/operator-opamp-bridge/config/testdata/agentbasiccomponentsallowed.yaml b/cmd/operator-opamp-bridge/config/testdata/agentbasiccomponentsallowed.yaml index 73d5683a3d..c994ad122b 100644 --- a/cmd/operator-opamp-bridge/config/testdata/agentbasiccomponentsallowed.yaml +++ b/cmd/operator-opamp-bridge/config/testdata/agentbasiccomponentsallowed.yaml @@ -19,4 +19,4 @@ componentsAllowed: - memory_limiter - batch exporters: - - logging + - debug diff --git a/cmd/otel-allocator/README.md b/cmd/otel-allocator/README.md index 230ec8f269..0b10a85614 100644 --- a/cmd/otel-allocator/README.md +++ b/cmd/otel-allocator/README.md @@ -109,13 +109,13 @@ spec: - targets: [ '0.0.0.0:8888' ] exporters: - logging: {} + debug: {} service: pipelines: metrics: receivers: [prometheus] - exporters: [logging] + exporters: [debug] ``` In essence, Prometheus Receiver configs are overridden with a `http_sd_config` directive that points to the diff --git a/config/samples/_v1alpha1_opampbridge.yaml b/config/samples/_v1alpha1_opampbridge.yaml index 7e18e320f4..b4cfa27e0f 100644 --- a/config/samples/_v1alpha1_opampbridge.yaml +++ b/config/samples/_v1alpha1_opampbridge.yaml @@ -22,4 +22,4 @@ spec: processors: - memory_limiter exporters: - - logging + - debug diff --git a/controllers/builder_test.go b/controllers/builder_test.go index 2c5070fa84..da3e4874f1 100644 --- a/controllers/builder_test.go +++ b/controllers/builder_test.go @@ -77,12 +77,12 @@ func TestBuildCollector(t *testing.T) { examplereceiver: endpoint: "0.0.0.0:12345" exporters: - logging: + debug: service: pipelines: metrics: receivers: [examplereceiver] - exporters: [logging] + exporters: [debug] ` goodConfig := v1beta1.Config{} @@ -152,7 +152,7 @@ service: "app.kubernetes.io/version": "latest", }, Annotations: map[string]string{ - "opentelemetry-operator-config/sha256": "6f6f11da374b2c1e42fc78fbe55e2d9bcc2f5998ab63a631b49c478e8c0f6af8", + "opentelemetry-operator-config/sha256": "2d266e55025628659355f1271b689d6fb53648ef6cd5595831f5835d18e59a25", "prometheus.io/path": "/metrics", "prometheus.io/port": "8888", "prometheus.io/scrape": "true", @@ -270,7 +270,7 @@ service: Annotations: map[string]string{}, }, Data: map[string]string{ - "collector.yaml": "receivers:\n examplereceiver:\n endpoint: 0.0.0.0:12345\nexporters:\n logging: null\nservice:\n pipelines:\n metrics:\n exporters:\n - logging\n receivers:\n - examplereceiver\n", + "collector.yaml": "receivers:\n examplereceiver:\n endpoint: 0.0.0.0:12345\nexporters:\n debug: null\nservice:\n pipelines:\n metrics:\n exporters:\n - debug\n receivers:\n - examplereceiver\n", }, }, &corev1.ServiceAccount{ @@ -430,7 +430,7 @@ service: "app.kubernetes.io/version": "latest", }, Annotations: map[string]string{ - "opentelemetry-operator-config/sha256": "6f6f11da374b2c1e42fc78fbe55e2d9bcc2f5998ab63a631b49c478e8c0f6af8", + "opentelemetry-operator-config/sha256": "2d266e55025628659355f1271b689d6fb53648ef6cd5595831f5835d18e59a25", "prometheus.io/path": "/metrics", "prometheus.io/port": "8888", "prometheus.io/scrape": "true", @@ -548,7 +548,7 @@ service: Annotations: map[string]string{}, }, Data: map[string]string{ - "collector.yaml": "receivers:\n examplereceiver:\n endpoint: 0.0.0.0:12345\nexporters:\n logging: null\nservice:\n pipelines:\n metrics:\n exporters:\n - logging\n receivers:\n - examplereceiver\n", + "collector.yaml": "receivers:\n examplereceiver:\n endpoint: 0.0.0.0:12345\nexporters:\n debug: null\nservice:\n pipelines:\n metrics:\n exporters:\n - debug\n receivers:\n - examplereceiver\n", }, }, &corev1.ServiceAccount{ @@ -744,7 +744,7 @@ service: "app.kubernetes.io/version": "latest", }, Annotations: map[string]string{ - "opentelemetry-operator-config/sha256": "6f6f11da374b2c1e42fc78fbe55e2d9bcc2f5998ab63a631b49c478e8c0f6af8", + "opentelemetry-operator-config/sha256": "2d266e55025628659355f1271b689d6fb53648ef6cd5595831f5835d18e59a25", "prometheus.io/path": "/metrics", "prometheus.io/port": "8888", "prometheus.io/scrape": "true", @@ -862,7 +862,7 @@ service: Annotations: map[string]string{}, }, Data: map[string]string{ - "collector.yaml": "receivers:\n examplereceiver:\n endpoint: 0.0.0.0:12345\nexporters:\n logging: null\nservice:\n pipelines:\n metrics:\n exporters:\n - logging\n receivers:\n - examplereceiver\n", + "collector.yaml": "receivers:\n examplereceiver:\n endpoint: 0.0.0.0:12345\nexporters:\n debug: null\nservice:\n pipelines:\n metrics:\n exporters:\n - debug\n receivers:\n - examplereceiver\n", }, }, &corev1.Service{ @@ -1010,7 +1010,7 @@ func TestBuildAll_OpAMPBridge(t *testing.T) { v1alpha1.OpAMPBridgeCapabilityReportsHealth: true, v1alpha1.OpAMPBridgeCapabilityReportsRemoteConfig: true, }, - ComponentsAllowed: map[string][]string{"receivers": {"otlp"}, "processors": {"memory_limiter"}, "exporters": {"logging"}}, + ComponentsAllowed: map[string][]string{"receivers": {"otlp"}, "processors": {"memory_limiter"}, "exporters": {"debug"}}, }, }, }, @@ -1029,7 +1029,7 @@ func TestBuildAll_OpAMPBridge(t *testing.T) { "app.kubernetes.io/version": "latest", }, Annotations: map[string]string{ - "opentelemetry-opampbridge-config/hash": "bd5cfc0df684966e25597a2847d5a3bae2c2b037d8bf10e7ea402ebe4d41c9f0", + "opentelemetry-opampbridge-config/hash": "05e1dc681267a9bc28fc2877ab464a98b9bd043843f14ffc0b4a394b5c86ba9f", }, }, Spec: appsv1.DeploymentSpec{ @@ -1125,7 +1125,7 @@ func TestBuildAll_OpAMPBridge(t *testing.T) { ReportsStatus: true componentsAllowed: exporters: - - logging + - debug processors: - memory_limiter receivers: @@ -1218,12 +1218,12 @@ receivers: target_label: 'job' replacement: '$$1_$2' exporters: - logging: + debug: service: pipelines: metrics: receivers: [prometheus] - exporters: [logging] + exporters: [debug] ` goodConfig := v1beta1.Config{} @@ -1303,7 +1303,7 @@ service: "app.kubernetes.io/version": "latest", }, Annotations: map[string]string{ - "opentelemetry-operator-config/sha256": "39cae697770f9d7e183e8fa9ba56043315b62e19c7231537870acfaaabc30a43", + "opentelemetry-operator-config/sha256": "42773025f65feaf30df59a306a9e38f1aaabe94c8310983beaddb7f648d699b0", "prometheus.io/path": "/metrics", "prometheus.io/port": "8888", "prometheus.io/scrape": "true", @@ -1421,7 +1421,7 @@ service: Annotations: map[string]string{}, }, Data: map[string]string{ - "collector.yaml": "exporters:\n logging: null\nreceivers:\n prometheus:\n config: {}\n target_allocator:\n collector_id: ${POD_NAME}\n endpoint: http://test-targetallocator.test.svc.cluster.local:80\n interval: 30s\nservice:\n pipelines:\n metrics:\n exporters:\n - logging\n receivers:\n - prometheus\n", + "collector.yaml": "exporters:\n debug: null\nreceivers:\n prometheus:\n config: {}\n target_allocator:\n collector_id: ${POD_NAME}\n endpoint: http://test-targetallocator.test.svc.cluster.local:80\n interval: 30s\nservice:\n pipelines:\n metrics:\n exporters:\n - debug\n receivers:\n - prometheus\n", }, }, &corev1.ServiceAccount{ @@ -1760,7 +1760,7 @@ prometheus_cr: "app.kubernetes.io/version": "latest", }, Annotations: map[string]string{ - "opentelemetry-operator-config/sha256": "39cae697770f9d7e183e8fa9ba56043315b62e19c7231537870acfaaabc30a43", + "opentelemetry-operator-config/sha256": "42773025f65feaf30df59a306a9e38f1aaabe94c8310983beaddb7f648d699b0", "prometheus.io/path": "/metrics", "prometheus.io/port": "8888", "prometheus.io/scrape": "true", @@ -1878,7 +1878,7 @@ prometheus_cr: Annotations: map[string]string{}, }, Data: map[string]string{ - "collector.yaml": "exporters:\n logging: null\nreceivers:\n prometheus:\n config: {}\n target_allocator:\n collector_id: ${POD_NAME}\n endpoint: http://test-targetallocator.test.svc.cluster.local:80\n interval: 30s\nservice:\n pipelines:\n metrics:\n exporters:\n - logging\n receivers:\n - prometheus\n", + "collector.yaml": "exporters:\n debug: null\nreceivers:\n prometheus:\n config: {}\n target_allocator:\n collector_id: ${POD_NAME}\n endpoint: http://test-targetallocator.test.svc.cluster.local:80\n interval: 30s\nservice:\n pipelines:\n metrics:\n exporters:\n - debug\n receivers:\n - prometheus\n", }, }, &corev1.ServiceAccount{ diff --git a/controllers/suite_test.go b/controllers/suite_test.go index 219043c4a8..0836809719 100644 --- a/controllers/suite_test.go +++ b/controllers/suite_test.go @@ -463,7 +463,7 @@ func opampBridgeParams() manifests.Params { v1alpha1.OpAMPBridgeCapabilityReportsHealth: true, v1alpha1.OpAMPBridgeCapabilityReportsRemoteConfig: true, }, - ComponentsAllowed: map[string][]string{"receivers": {"otlp"}, "processors": {"memory_limiter"}, "exporters": {"logging"}}, + ComponentsAllowed: map[string][]string{"receivers": {"otlp"}, "processors": {"memory_limiter"}, "exporters": {"debug"}}, }, }, Scheme: testScheme, diff --git a/controllers/testdata/test.yaml b/controllers/testdata/test.yaml index d23cad6f44..09908dd95c 100644 --- a/controllers/testdata/test.yaml +++ b/controllers/testdata/test.yaml @@ -12,10 +12,10 @@ receivers: - targets: [ '0.0.0.0:8888', '0.0.0.0:9999' ] exporters: - logging: + debug: service: pipelines: metrics: receivers: [prometheus, jaeger] - exporters: [logging] \ No newline at end of file + exporters: [debug] \ No newline at end of file diff --git a/controllers/testdata/test_ta_update.yaml b/controllers/testdata/test_ta_update.yaml index 57677928d5..3ec21812c5 100644 --- a/controllers/testdata/test_ta_update.yaml +++ b/controllers/testdata/test_ta_update.yaml @@ -12,10 +12,10 @@ receivers: - targets: [ '0.0.0.0:8888', '0.0.0.0:9999', '0.0.0.0:10100' ] exporters: - logging: + debug: service: pipelines: metrics: receivers: [prometheus, jaeger] - exporters: [logging] \ No newline at end of file + exporters: [debug] \ No newline at end of file diff --git a/internal/manifests/collector/testdata/ingress_testdata.yaml b/internal/manifests/collector/testdata/ingress_testdata.yaml index 715d16520a..1d82e586e6 100644 --- a/internal/manifests/collector/testdata/ingress_testdata.yaml +++ b/internal/manifests/collector/testdata/ingress_testdata.yaml @@ -9,8 +9,8 @@ receivers: grpc: endpoint: 0.0.0.0:98765 exporters: - logging: - loglevel: debug + debug: + verbosity: detailed service: pipelines: diff --git a/internal/manifests/opampbridge/configmap_test.go b/internal/manifests/opampbridge/configmap_test.go index b38ca6bea3..91ee5dba91 100644 --- a/internal/manifests/opampbridge/configmap_test.go +++ b/internal/manifests/opampbridge/configmap_test.go @@ -52,7 +52,7 @@ func TestDesiredConfigMap(t *testing.T) { ReportsStatus: true componentsAllowed: exporters: - - logging + - debug processors: - memory_limiter receivers: @@ -109,7 +109,7 @@ headers: v1alpha1.OpAMPBridgeCapabilityReportsHealth: true, v1alpha1.OpAMPBridgeCapabilityReportsRemoteConfig: true, }, - ComponentsAllowed: map[string][]string{"receivers": {"otlp"}, "processors": {"memory_limiter"}, "exporters": {"logging"}}, + ComponentsAllowed: map[string][]string{"receivers": {"otlp"}, "processors": {"memory_limiter"}, "exporters": {"debug"}}, }, } From ba2eba68196349a390d56904ff6afbfa79b38af4 Mon Sep 17 00:00:00 2001 From: David Haja Date: Wed, 4 Sep 2024 19:51:38 +0200 Subject: [PATCH 24/41] Allow autoscaler targetCPUUtilization and TargetMemoryUtilization to be greater than 99 (#3260) --- ...8-autoscaler-utilization-greater-than-99.yaml | 16 ++++++++++++++++ apis/v1beta1/collector_webhook.go | 8 ++++---- apis/v1beta1/collector_webhook_test.go | 14 +++++++++++++- 3 files changed, 33 insertions(+), 5 deletions(-) create mode 100755 .chloggen/3258-autoscaler-utilization-greater-than-99.yaml diff --git a/.chloggen/3258-autoscaler-utilization-greater-than-99.yaml b/.chloggen/3258-autoscaler-utilization-greater-than-99.yaml new file mode 100755 index 0000000000..f32bb996bd --- /dev/null +++ b/.chloggen/3258-autoscaler-utilization-greater-than-99.yaml @@ -0,0 +1,16 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) +component: collector + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Allow autoscaler targetCPUUtilization and TargetMemoryUtilization to be greater than 99" + +# One or more tracking issues related to the change +issues: [3258] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/apis/v1beta1/collector_webhook.go b/apis/v1beta1/collector_webhook.go index 92c91e8360..eed59a10b8 100644 --- a/apis/v1beta1/collector_webhook.go +++ b/apis/v1beta1/collector_webhook.go @@ -378,11 +378,11 @@ func checkAutoscalerSpec(autoscaler *AutoscalerSpec) error { return fmt.Errorf("the OpenTelemetry Spec autoscale configuration is incorrect, scaleUp should be one or more") } } - if autoscaler.TargetCPUUtilization != nil && (*autoscaler.TargetCPUUtilization < int32(1) || *autoscaler.TargetCPUUtilization > int32(99)) { - return fmt.Errorf("the OpenTelemetry Spec autoscale configuration is incorrect, targetCPUUtilization should be greater than 0 and less than 100") + if autoscaler.TargetCPUUtilization != nil && *autoscaler.TargetCPUUtilization < int32(1) { + return fmt.Errorf("the OpenTelemetry Spec autoscale configuration is incorrect, targetCPUUtilization should be greater than 0") } - if autoscaler.TargetMemoryUtilization != nil && (*autoscaler.TargetMemoryUtilization < int32(1) || *autoscaler.TargetMemoryUtilization > int32(99)) { - return fmt.Errorf("the OpenTelemetry Spec autoscale configuration is incorrect, targetMemoryUtilization should be greater than 0 and less than 100") + if autoscaler.TargetMemoryUtilization != nil && *autoscaler.TargetMemoryUtilization < int32(1) { + return fmt.Errorf("the OpenTelemetry Spec autoscale configuration is incorrect, targetMemoryUtilization should be greater than 0") } for _, metric := range autoscaler.Metrics { diff --git a/apis/v1beta1/collector_webhook_test.go b/apis/v1beta1/collector_webhook_test.go index 805861aea0..28cfb28d7c 100644 --- a/apis/v1beta1/collector_webhook_test.go +++ b/apis/v1beta1/collector_webhook_test.go @@ -859,7 +859,19 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, }, }, - expectedErr: "targetCPUUtilization should be greater than 0 and less than 100", + expectedErr: "targetCPUUtilization should be greater than 0", + }, + { + name: "invalid autoscaler target memory utilization", + otelcol: OpenTelemetryCollector{ + Spec: OpenTelemetryCollectorSpec{ + Autoscaler: &AutoscalerSpec{ + MaxReplicas: &three, + TargetMemoryUtilization: &zero, + }, + }, + }, + expectedErr: "targetMemoryUtilization should be greater than 0", }, { name: "autoscaler minReplicas is less than maxReplicas", From 88ca1af1e2dc95616241b0cdf0fc956553f71f21 Mon Sep 17 00:00:00 2001 From: Jeffrey Holm Date: Thu, 5 Sep 2024 07:35:13 -0400 Subject: [PATCH 25/41] Default to UDP protocol for xray receiver (#3263) * awsxray: set defaultPort on receiver to udp * awsxray: set defaultPort on receiver to udp * add changelog entry * revert xray receiver parser changes --- .chloggen/xray-receiver-udp-port.yaml | 16 ++++++++++++++++ internal/components/receivers/helpers.go | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100755 .chloggen/xray-receiver-udp-port.yaml diff --git a/.chloggen/xray-receiver-udp-port.yaml b/.chloggen/xray-receiver-udp-port.yaml new file mode 100755 index 0000000000..3bc036e841 --- /dev/null +++ b/.chloggen/xray-receiver-udp-port.yaml @@ -0,0 +1,16 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) +component: awsxray-receiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Switched the protocol of awsxray-receiver to UDP from TCP + +# One or more tracking issues related to the change +issues: [3261] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/internal/components/receivers/helpers.go b/internal/components/receivers/helpers.go index 69de71ed9c..6802f3a038 100644 --- a/internal/components/receivers/helpers.go +++ b/internal/components/receivers/helpers.go @@ -101,7 +101,7 @@ var ( components.WithAppProtocol(&components.HttpProtocol), ), ), - components.NewSinglePortParser("awsxray", 2000, components.WithTargetPort(2000)), + components.NewSinglePortParser("awsxray", 2000, components.WithProtocol(corev1.ProtocolUDP), components.WithTargetPort(2000)), components.NewSinglePortParser("carbon", 2003, components.WithTargetPort(2003)), components.NewSinglePortParser("collectd", 8081, components.WithTargetPort(8081)), components.NewSinglePortParser("fluentforward", 8006, components.WithTargetPort(8006)), From 09d07582bdab36e03e756ac0bcc5fe6e50c7722f Mon Sep 17 00:00:00 2001 From: Jacob Aronoff Date: Thu, 5 Sep 2024 08:00:47 -0400 Subject: [PATCH 26/41] Remove unnecessary instances of app.kubernetes.io/managed-by (#3074) * remove unnecessary instances of app.kubernetes.io/managed-by for user applied resources * chlog * fix upgrade issue * Fix lint * Fix test * repro * fix upgrade * duplication * revert change * chlog entry * another chlog entry --- .chloggen/fix-managed-by-gross-2.yaml | 20 ++++++ .chloggen/fix-managed-by-gross.yaml | 18 ++++++ apis/v1alpha1/instrumentation_webhook.go | 4 -- apis/v1alpha1/opampbridge_webhook.go | 18 ++---- apis/v1alpha1/opampbridge_webhook_test.go | 12 +--- apis/v1beta1/collector_webhook.go | 3 - apis/v1beta1/collector_webhook_test.go | 40 +++--------- apis/v1beta1/metrics.go | 7 +- main.go | 3 +- pkg/collector/upgrade/upgrade.go | 53 +++++++-------- pkg/collector/upgrade/upgrade_test.go | 79 +++++++++++++++++++++++ pkg/collector/upgrade/v0_105_0.go | 2 +- pkg/instrumentation/upgrade/upgrade.go | 8 +-- 13 files changed, 164 insertions(+), 103 deletions(-) create mode 100755 .chloggen/fix-managed-by-gross-2.yaml create mode 100755 .chloggen/fix-managed-by-gross.yaml diff --git a/.chloggen/fix-managed-by-gross-2.yaml b/.chloggen/fix-managed-by-gross-2.yaml new file mode 100755 index 0000000000..b06808183e --- /dev/null +++ b/.chloggen/fix-managed-by-gross-2.yaml @@ -0,0 +1,20 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) +component: auto-instrumentation + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Fixes a bug that was preventing auto instrumentation from getting correct images. + +# One or more tracking issues related to the change +issues: [3014] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: | + This PR removes the restriction on the operator to only upgrade manually applied CRDs. This meant + that resources applied by helm were not upgraded at all. The solution was to remove the restriction + we had on querying the label app.kubernetes.io/managed-by=opentelemetry-operator, thereby upgrading + ALL CRDs in the cluster. diff --git a/.chloggen/fix-managed-by-gross.yaml b/.chloggen/fix-managed-by-gross.yaml new file mode 100755 index 0000000000..d733674d9d --- /dev/null +++ b/.chloggen/fix-managed-by-gross.yaml @@ -0,0 +1,18 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) +component: collector + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Fixes a bug that was preventing upgrade patches from reliably applying. + +# One or more tracking issues related to the change +issues: [3074] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: | + A bug was discovered in the process of testing the PR that was failing to remove the environment + variables introduced in the 0.104.0 upgrade. The fix was to take a deepcopy of the object and update that. diff --git a/apis/v1alpha1/instrumentation_webhook.go b/apis/v1alpha1/instrumentation_webhook.go index d2b4a5a74d..004992f795 100644 --- a/apis/v1alpha1/instrumentation_webhook.go +++ b/apis/v1alpha1/instrumentation_webhook.go @@ -91,10 +91,6 @@ func (w InstrumentationWebhook) defaulter(r *Instrumentation) error { if r.Labels == nil { r.Labels = map[string]string{} } - if r.Labels["app.kubernetes.io/managed-by"] == "" { - r.Labels["app.kubernetes.io/managed-by"] = "opentelemetry-operator" - } - if r.Spec.Java.Image == "" { r.Spec.Java.Image = w.cfg.AutoInstrumentationJavaImage() } diff --git a/apis/v1alpha1/opampbridge_webhook.go b/apis/v1alpha1/opampbridge_webhook.go index 1fbbcf75c0..b27c9bd989 100644 --- a/apis/v1alpha1/opampbridge_webhook.go +++ b/apis/v1alpha1/opampbridge_webhook.go @@ -52,23 +52,23 @@ func (o *OpAMPBridgeWebhook) Default(ctx context.Context, obj runtime.Object) er return o.defaulter(opampBridge) } -func (c OpAMPBridgeWebhook) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) { +func (o *OpAMPBridgeWebhook) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) { opampBridge, ok := obj.(*OpAMPBridge) if !ok { return nil, fmt.Errorf("expected an OpAMPBridge, received %T", obj) } - return c.validate(opampBridge) + return o.validate(opampBridge) } -func (c OpAMPBridgeWebhook) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) (admission.Warnings, error) { +func (o *OpAMPBridgeWebhook) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) (admission.Warnings, error) { opampBridge, ok := newObj.(*OpAMPBridge) if !ok { return nil, fmt.Errorf("expected an OpAMPBridge, received %T", newObj) } - return c.validate(opampBridge) + return o.validate(opampBridge) } -func (o OpAMPBridgeWebhook) ValidateDelete(ctx context.Context, obj runtime.Object) (admission.Warnings, error) { +func (o *OpAMPBridgeWebhook) ValidateDelete(ctx context.Context, obj runtime.Object) (admission.Warnings, error) { opampBridge, ok := obj.(*OpAMPBridge) if !ok || opampBridge == nil { return nil, fmt.Errorf("expected an OpAMPBridge, received %T", obj) @@ -76,7 +76,7 @@ func (o OpAMPBridgeWebhook) ValidateDelete(ctx context.Context, obj runtime.Obje return o.validate(opampBridge) } -func (o OpAMPBridgeWebhook) defaulter(r *OpAMPBridge) error { +func (o *OpAMPBridgeWebhook) defaulter(r *OpAMPBridge) error { if len(r.Spec.UpgradeStrategy) == 0 { r.Spec.UpgradeStrategy = UpgradeStrategyAutomatic } @@ -84,10 +84,6 @@ func (o OpAMPBridgeWebhook) defaulter(r *OpAMPBridge) error { if r.Labels == nil { r.Labels = map[string]string{} } - if r.Labels["app.kubernetes.io/managed-by"] == "" { - r.Labels["app.kubernetes.io/managed-by"] = "opentelemetry-operator" - } - one := int32(1) if r.Spec.Replicas == nil { r.Spec.Replicas = &one @@ -104,7 +100,7 @@ func (o OpAMPBridgeWebhook) defaulter(r *OpAMPBridge) error { return nil } -func (o OpAMPBridgeWebhook) validate(r *OpAMPBridge) (admission.Warnings, error) { +func (o *OpAMPBridgeWebhook) validate(r *OpAMPBridge) (admission.Warnings, error) { warnings := admission.Warnings{} // validate OpAMP server endpoint diff --git a/apis/v1alpha1/opampbridge_webhook_test.go b/apis/v1alpha1/opampbridge_webhook_test.go index 34d667b04d..335e055ceb 100644 --- a/apis/v1alpha1/opampbridge_webhook_test.go +++ b/apis/v1alpha1/opampbridge_webhook_test.go @@ -50,9 +50,7 @@ func TestOpAMPBridgeDefaultingWebhook(t *testing.T) { opampBridge: OpAMPBridge{}, expected: OpAMPBridge{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{ - "app.kubernetes.io/managed-by": "opentelemetry-operator", - }, + Labels: map[string]string{}, }, Spec: OpAMPBridgeSpec{ Replicas: &one, @@ -71,9 +69,7 @@ func TestOpAMPBridgeDefaultingWebhook(t *testing.T) { }, expected: OpAMPBridge{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{ - "app.kubernetes.io/managed-by": "opentelemetry-operator", - }, + Labels: map[string]string{}, }, Spec: OpAMPBridgeSpec{ Replicas: &five, @@ -93,9 +89,7 @@ func TestOpAMPBridgeDefaultingWebhook(t *testing.T) { }, expected: OpAMPBridge{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{ - "app.kubernetes.io/managed-by": "opentelemetry-operator", - }, + Labels: map[string]string{}, }, Spec: OpAMPBridgeSpec{ Replicas: &one, diff --git a/apis/v1beta1/collector_webhook.go b/apis/v1beta1/collector_webhook.go index eed59a10b8..c44f9f48ab 100644 --- a/apis/v1beta1/collector_webhook.go +++ b/apis/v1beta1/collector_webhook.go @@ -64,9 +64,6 @@ func (c CollectorWebhook) Default(_ context.Context, obj runtime.Object) error { if otelcol.Labels == nil { otelcol.Labels = map[string]string{} } - if otelcol.Labels["app.kubernetes.io/managed-by"] == "" { - otelcol.Labels["app.kubernetes.io/managed-by"] = "opentelemetry-operator" - } // We can default to one because dependent objects Deployment and HorizontalPodAutoScaler // default to 1 as well. diff --git a/apis/v1beta1/collector_webhook_test.go b/apis/v1beta1/collector_webhook_test.go index 28cfb28d7c..112a782488 100644 --- a/apis/v1beta1/collector_webhook_test.go +++ b/apis/v1beta1/collector_webhook_test.go @@ -111,9 +111,7 @@ func TestCollectorDefaultingWebhook(t *testing.T) { otelcol: OpenTelemetryCollector{}, expected: OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{ - "app.kubernetes.io/managed-by": "opentelemetry-operator", - }, + Labels: map[string]string{}, }, Spec: OpenTelemetryCollectorSpec{ OpenTelemetryCommonFields: OpenTelemetryCommonFields{ @@ -139,9 +137,7 @@ func TestCollectorDefaultingWebhook(t *testing.T) { }, expected: OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{ - "app.kubernetes.io/managed-by": "opentelemetry-operator", - }, + Labels: map[string]string{}, }, Spec: OpenTelemetryCollectorSpec{ Mode: ModeSidecar, @@ -168,9 +164,7 @@ func TestCollectorDefaultingWebhook(t *testing.T) { }, expected: OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{ - "app.kubernetes.io/managed-by": "opentelemetry-operator", - }, + Labels: map[string]string{}, }, Spec: OpenTelemetryCollectorSpec{ Mode: ModeSidecar, @@ -195,9 +189,7 @@ func TestCollectorDefaultingWebhook(t *testing.T) { }, expected: OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{ - "app.kubernetes.io/managed-by": "opentelemetry-operator", - }, + Labels: map[string]string{}, }, Spec: OpenTelemetryCollectorSpec{ Mode: ModeDeployment, @@ -227,9 +219,7 @@ func TestCollectorDefaultingWebhook(t *testing.T) { }, expected: OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{ - "app.kubernetes.io/managed-by": "opentelemetry-operator", - }, + Labels: map[string]string{}, }, Spec: OpenTelemetryCollectorSpec{ Mode: ModeDeployment, @@ -265,9 +255,7 @@ func TestCollectorDefaultingWebhook(t *testing.T) { }, expected: OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{ - "app.kubernetes.io/managed-by": "opentelemetry-operator", - }, + Labels: map[string]string{}, }, Spec: OpenTelemetryCollectorSpec{ Mode: ModeDeployment, @@ -305,9 +293,7 @@ func TestCollectorDefaultingWebhook(t *testing.T) { }, expected: OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{ - "app.kubernetes.io/managed-by": "opentelemetry-operator", - }, + Labels: map[string]string{}, }, Spec: OpenTelemetryCollectorSpec{ Mode: ModeDeployment, @@ -350,9 +336,7 @@ func TestCollectorDefaultingWebhook(t *testing.T) { }, expected: OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{ - "app.kubernetes.io/managed-by": "opentelemetry-operator", - }, + Labels: map[string]string{}, }, Spec: OpenTelemetryCollectorSpec{ Mode: ModeDeployment, @@ -390,9 +374,7 @@ func TestCollectorDefaultingWebhook(t *testing.T) { }, expected: OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{ - "app.kubernetes.io/managed-by": "opentelemetry-operator", - }, + Labels: map[string]string{}, }, Spec: OpenTelemetryCollectorSpec{ Mode: ModeDeployment, @@ -423,9 +405,7 @@ func TestCollectorDefaultingWebhook(t *testing.T) { }, expected: OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{ - "app.kubernetes.io/managed-by": "opentelemetry-operator", - }, + Labels: map[string]string{}, }, Spec: OpenTelemetryCollectorSpec{ Mode: ModeDeployment, diff --git a/apis/v1beta1/metrics.go b/apis/v1beta1/metrics.go index 3c0e27825f..537a6fb97f 100644 --- a/apis/v1beta1/metrics.go +++ b/apis/v1beta1/metrics.go @@ -121,13 +121,8 @@ func NewMetrics(prv metric.MeterProvider, ctx context.Context, cl client.Reader) // Init metrics from the first time the operator starts. func (m *Metrics) init(ctx context.Context, cl client.Reader) error { - opts := []client.ListOption{ - client.MatchingLabels(map[string]string{ - "app.kubernetes.io/managed-by": "opentelemetry-operator", - }), - } list := &OpenTelemetryCollectorList{} - if err := cl.List(ctx, list, opts...); err != nil { + if err := cl.List(ctx, list); err != nil { return fmt.Errorf("failed to list: %w", err) } diff --git a/main.go b/main.go index 8868b1ff03..fbfca13ffe 100644 --- a/main.go +++ b/main.go @@ -36,7 +36,6 @@ import ( "k8s.io/client-go/kubernetes" clientgoscheme "k8s.io/client-go/kubernetes/scheme" _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" - "k8s.io/client-go/tools/record" k8sapiflag "k8s.io/component-base/cli/flag" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/cache" @@ -454,7 +453,7 @@ func addDependencies(_ context.Context, mgr ctrl.Manager, cfg config.Config, v v Log: ctrl.Log.WithName("collector-upgrade"), Version: v, Client: mgr.GetClient(), - Recorder: record.NewFakeRecorder(collectorupgrade.RecordBufferSize), + Recorder: mgr.GetEventRecorderFor("opentelemetry-operator"), } return up.ManagedInstances(c) })) diff --git a/pkg/collector/upgrade/upgrade.go b/pkg/collector/upgrade/upgrade.go index 124b97071d..9a1f426747 100644 --- a/pkg/collector/upgrade/upgrade.go +++ b/pkg/collector/upgrade/upgrade.go @@ -42,14 +42,8 @@ const RecordBufferSize int = 100 // ManagedInstances finds all the otelcol instances for the current operator and upgrades them, if necessary. func (u VersionUpgrade) ManagedInstances(ctx context.Context) error { u.Log.Info("looking for managed instances to upgrade") - - opts := []client.ListOption{ - client.MatchingLabels(map[string]string{ - "app.kubernetes.io/managed-by": "opentelemetry-operator", - }), - } list := &v1beta1.OpenTelemetryCollectorList{} - if err := u.Client.List(ctx, list, opts...); err != nil { + if err := u.Client.List(ctx, list); err != nil { return fmt.Errorf("failed to list: %w", err) } @@ -73,7 +67,6 @@ func (u VersionUpgrade) ManagedInstances(ctx context.Context) error { u.Recorder.Event(&original, "Error", "Upgrade", msg) continue } - if !reflect.DeepEqual(upgraded, list.Items[i]) { // the resource update overrides the status, so, keep it so that we can reset it later st := upgraded.Status @@ -89,7 +82,6 @@ func (u VersionUpgrade) ManagedInstances(ctx context.Context) error { itemLogger.Error(err, "failed to apply changes to instance's status object") continue } - itemLogger.Info("instance upgraded", "version", upgraded.Status.Version) } } @@ -114,60 +106,61 @@ func (u VersionUpgrade) ManagedInstance(_ context.Context, otelcol v1beta1.OpenT return otelcol, err } + updated := *(otelcol.DeepCopy()) if instanceV.GreaterThan(&Latest.Version) { // Update with the latest known version, which is what we have from versions.txt - u.Log.V(4).Info("no upgrade routines are needed for the OpenTelemetry instance", "name", otelcol.Name, "namespace", otelcol.Namespace, "version", otelcol.Status.Version, "latest", Latest.Version.String()) + u.Log.V(4).Info("no upgrade routines are needed for the OpenTelemetry instance", "name", updated.Name, "namespace", updated.Namespace, "version", updated.Status.Version, "latest", Latest.Version.String()) otelColV, err := semver.NewVersion(u.Version.OpenTelemetryCollector) if err != nil { - return otelcol, err + return updated, err } if instanceV.LessThan(otelColV) { - u.Log.Info("upgraded OpenTelemetry Collector version", "name", otelcol.Name, "namespace", otelcol.Namespace, "version", otelcol.Status.Version) - otelcol.Status.Version = u.Version.OpenTelemetryCollector + u.Log.Info("upgraded OpenTelemetry Collector version", "name", updated.Name, "namespace", updated.Namespace, "version", updated.Status.Version) + updated.Status.Version = u.Version.OpenTelemetryCollector } else { - u.Log.V(4).Info("skipping upgrade for OpenTelemetry Collector instance", "name", otelcol.Name, "namespace", otelcol.Namespace) + u.Log.V(4).Info("skipping upgrade for OpenTelemetry Collector instance", "name", updated.Name, "namespace", updated.Namespace) } - return otelcol, nil + return updated, nil } for _, available := range versions { if available.GreaterThan(instanceV) { if available.upgrade != nil { otelcolV1alpha1 := &v1alpha1.OpenTelemetryCollector{} - if err := otelcolV1alpha1.ConvertFrom(&otelcol); err != nil { - return otelcol, err + if err := otelcolV1alpha1.ConvertFrom(&updated); err != nil { + return updated, err } upgradedV1alpha1, err := available.upgrade(u, otelcolV1alpha1) if err != nil { - u.Log.Error(err, "failed to upgrade managed otelcol instances", "name", otelcol.Name, "namespace", otelcol.Namespace) - return otelcol, err + u.Log.Error(err, "failed to upgrade managed otelcol instances", "name", updated.Name, "namespace", updated.Namespace) + return updated, err } upgradedV1alpha1.Status.Version = available.String() - if err := upgradedV1alpha1.ConvertTo(&otelcol); err != nil { - return otelcol, err + if err := upgradedV1alpha1.ConvertTo(&updated); err != nil { + return updated, err } - u.Log.V(1).Info("step upgrade", "name", otelcol.Name, "namespace", otelcol.Namespace, "version", available.String()) + u.Log.V(1).Info("step upgrade", "name", updated.Name, "namespace", updated.Namespace, "version", available.String()) } else { - upgraded, err := available.upgradeV1beta1(u, &otelcol) //available.upgrade(params., &otelcol) + upgraded, err := available.upgradeV1beta1(u, &updated) //available.upgrade(params., &updated) if err != nil { - u.Log.Error(err, "failed to upgrade managed otelcol instances", "name", otelcol.Name, "namespace", otelcol.Namespace) - return otelcol, err + u.Log.Error(err, "failed to upgrade managed otelcol instances", "name", updated.Name, "namespace", updated.Namespace) + return updated, err } - u.Log.V(1).Info("step upgrade", "name", otelcol.Name, "namespace", otelcol.Namespace, "version", available.String()) + u.Log.V(1).Info("step upgrade", "name", updated.Name, "namespace", updated.Namespace, "version", available.String()) upgraded.Status.Version = available.String() - otelcol = *upgraded + updated = *upgraded } } } // Update with the latest known version, which is what we have from versions.txt - otelcol.Status.Version = u.Version.OpenTelemetryCollector + updated.Status.Version = u.Version.OpenTelemetryCollector - u.Log.V(1).Info("final version", "name", otelcol.Name, "namespace", otelcol.Namespace, "version", otelcol.Status.Version) - return otelcol, nil + u.Log.V(1).Info("final version", "name", updated.Name, "namespace", updated.Namespace, "version", updated.Status.Version) + return updated, nil } diff --git a/pkg/collector/upgrade/upgrade_test.go b/pkg/collector/upgrade/upgrade_test.go index 640ccb923a..40e6282f8e 100644 --- a/pkg/collector/upgrade/upgrade_test.go +++ b/pkg/collector/upgrade/upgrade_test.go @@ -84,6 +84,85 @@ func TestShouldUpgradeAllToLatestBasedOnUpgradeStrategy(t *testing.T) { } } +func TestEnvVarUpdates(t *testing.T) { + nsn := types.NamespacedName{Name: "my-instance", Namespace: "default"} + collectorInstance := v1beta1.OpenTelemetryCollector{ + TypeMeta: metav1.TypeMeta{ + Kind: "OpenTelemetryCollector", + APIVersion: "v1beta1", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: nsn.Name, + Namespace: nsn.Namespace, + }, + Status: v1beta1.OpenTelemetryCollectorStatus{ + Version: "0.104.0", + }, + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ + Args: map[string]string{ + "foo": "bar", + "feature-gates": "+baz,-confmap.unifyEnvVarExpansion", + }, + }, + Config: v1beta1.Config{ + Receivers: v1beta1.AnyConfig{ + Object: map[string]interface{}{ + "prometheus": []interface{}{}, + }, + }, + Exporters: v1beta1.AnyConfig{ + Object: map[string]interface{}{ + "debug": []interface{}{}, + }, + }, + Service: v1beta1.Service{ + Pipelines: map[string]*v1beta1.Pipeline{ + "metrics": { + Exporters: []string{"debug"}, + Processors: nil, + Receivers: []string{"prometheus"}, + }, + }, + }, + }, + }, + } + err := k8sClient.Create(context.Background(), &collectorInstance) + require.NoError(t, err) + + collectorInstance.Status.Version = "0.104.0" + err = k8sClient.Status().Update(context.Background(), &collectorInstance) + require.NoError(t, err) + // sanity check + persisted := &v1beta1.OpenTelemetryCollector{} + err = k8sClient.Get(context.Background(), nsn, persisted) + require.NoError(t, err) + require.Equal(t, collectorInstance.Status.Version, persisted.Status.Version) + + currentV := version.Get() + currentV.OpenTelemetryCollector = "0.105.0" + up := &upgrade.VersionUpgrade{ + Log: logger, + Version: currentV, + Client: k8sClient, + Recorder: record.NewFakeRecorder(upgrade.RecordBufferSize), + } + + // test + err = up.ManagedInstances(context.Background()) + assert.NoError(t, err) + + // verify + err = k8sClient.Get(context.Background(), nsn, persisted) + assert.NoError(t, err) + assert.Equal(t, upgrade.Latest.String(), persisted.Status.Version) + assert.NotContainsf(t, persisted.Spec.Args["feature-gates"], "-confmap.unifyEnvVarExpansion", "still has env var") + + // cleanup + assert.NoError(t, k8sClient.Delete(context.Background(), &collectorInstance)) +} + func TestUpgradeUpToLatestKnownVersion(t *testing.T) { for _, tt := range []struct { desc string diff --git a/pkg/collector/upgrade/v0_105_0.go b/pkg/collector/upgrade/v0_105_0.go index 3f497ce6a7..daa5795590 100644 --- a/pkg/collector/upgrade/v0_105_0.go +++ b/pkg/collector/upgrade/v0_105_0.go @@ -34,7 +34,7 @@ func upgrade0_105_0(_ VersionUpgrade, otelcol *v1beta1.OpenTelemetryCollector) ( } envVarExpansionFeatureFlag := "-confmap.unifyEnvVarExpansion" - otelcol.Spec.Args = RemoveFeatureGate(otelcol.Spec.Args, envVarExpansionFeatureFlag) + otelcol.Spec.OpenTelemetryCommonFields.Args = RemoveFeatureGate(otelcol.Spec.OpenTelemetryCommonFields.Args, envVarExpansionFeatureFlag) return otelcol, nil } diff --git a/pkg/instrumentation/upgrade/upgrade.go b/pkg/instrumentation/upgrade/upgrade.go index 948a8e7288..f4b963f1c9 100644 --- a/pkg/instrumentation/upgrade/upgrade.go +++ b/pkg/instrumentation/upgrade/upgrade.go @@ -79,14 +79,8 @@ func NewInstrumentationUpgrade(client client.Client, logger logr.Logger, recorde // ManagedInstances upgrades managed instances by the opentelemetry-operator. func (u *InstrumentationUpgrade) ManagedInstances(ctx context.Context) error { u.Logger.Info("looking for managed Instrumentation instances to upgrade") - - opts := []client.ListOption{ - client.MatchingLabels(map[string]string{ - "app.kubernetes.io/managed-by": "opentelemetry-operator", - }), - } list := &v1alpha1.InstrumentationList{} - if err := u.Client.List(ctx, list, opts...); err != nil { + if err := u.Client.List(ctx, list); err != nil { return fmt.Errorf("failed to list: %w", err) } From dfbf0b897255250d9a6f3ba7f00883717db4dad5 Mon Sep 17 00:00:00 2001 From: Andrew O'Neill Date: Thu, 5 Sep 2024 08:03:22 -0700 Subject: [PATCH 27/41] Rollback 3187 (#3248) # Conflicts: # controllers/builder_test.go --- .chloggen/3242-rollback-of-3187.yaml | 16 ++++++++++++++++ controllers/builder_test.go | 4 ++-- internal/manifests/collector/config_replace.go | 2 +- .../manifests/collector/config_replace_test.go | 4 ++-- internal/manifests/collector/configmap_test.go | 2 +- .../config_expected_targetallocator.yaml | 2 +- .../relabel_config_expected_with_sd_config.yaml | 2 +- .../adapters/config_to_prom_config.go | 8 ++++---- .../adapters/config_to_prom_config_test.go | 12 ++++++------ .../targetallocator-kubernetessd/00-assert.yaml | 2 +- .../chainsaw-test.yaml | 1 - .../targetallocator-prometheuscr/00-assert.yaml | 2 +- .../chainsaw-test.yaml | 1 - tests/e2e/smoke-targetallocator/00-assert.yaml | 2 +- .../e2e/smoke-targetallocator/chainsaw-test.yaml | 1 - 15 files changed, 37 insertions(+), 24 deletions(-) create mode 100644 .chloggen/3242-rollback-of-3187.yaml diff --git a/.chloggen/3242-rollback-of-3187.yaml b/.chloggen/3242-rollback-of-3187.yaml new file mode 100644 index 0000000000..1fd2ea2f95 --- /dev/null +++ b/.chloggen/3242-rollback-of-3187.yaml @@ -0,0 +1,16 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) +component: target allocator + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Rollback 3187 + +# One or more tracking issues related to the change +issues: [3242] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: This Rollsback 3187 which breaks TargetAllocator config for clusters with custom domains. diff --git a/controllers/builder_test.go b/controllers/builder_test.go index da3e4874f1..e3b495e00a 100644 --- a/controllers/builder_test.go +++ b/controllers/builder_test.go @@ -1421,7 +1421,7 @@ service: Annotations: map[string]string{}, }, Data: map[string]string{ - "collector.yaml": "exporters:\n debug: null\nreceivers:\n prometheus:\n config: {}\n target_allocator:\n collector_id: ${POD_NAME}\n endpoint: http://test-targetallocator.test.svc.cluster.local:80\n interval: 30s\nservice:\n pipelines:\n metrics:\n exporters:\n - debug\n receivers:\n - prometheus\n", + "collector.yaml": "exporters:\n debug: null\nreceivers:\n prometheus:\n config: {}\n target_allocator:\n collector_id: ${POD_NAME}\n endpoint: http://test-targetallocator:80\n interval: 30s\nservice:\n pipelines:\n metrics:\n exporters:\n - debug\n receivers:\n - prometheus\n", }, }, &corev1.ServiceAccount{ @@ -1878,7 +1878,7 @@ prometheus_cr: Annotations: map[string]string{}, }, Data: map[string]string{ - "collector.yaml": "exporters:\n debug: null\nreceivers:\n prometheus:\n config: {}\n target_allocator:\n collector_id: ${POD_NAME}\n endpoint: http://test-targetallocator.test.svc.cluster.local:80\n interval: 30s\nservice:\n pipelines:\n metrics:\n exporters:\n - debug\n receivers:\n - prometheus\n", + "collector.yaml": "exporters:\n debug: null\nreceivers:\n prometheus:\n config: {}\n target_allocator:\n collector_id: ${POD_NAME}\n endpoint: http://test-targetallocator:80\n interval: 30s\nservice:\n pipelines:\n metrics:\n exporters:\n - debug\n receivers:\n - prometheus\n", }, }, &corev1.ServiceAccount{ diff --git a/internal/manifests/collector/config_replace.go b/internal/manifests/collector/config_replace.go index cc21aa29e5..6ea55dc44d 100644 --- a/internal/manifests/collector/config_replace.go +++ b/internal/manifests/collector/config_replace.go @@ -71,7 +71,7 @@ func ReplaceConfig(otelcol v1beta1.OpenTelemetryCollector, targetAllocator *v1al // To avoid issues caused by Prometheus validation logic, which fails regex validation when it encounters // $$ in the prom config, we update the YAML file directly without marshaling and unmarshalling. - updPromCfgMap, getCfgPromErr := ta.AddTAConfigToPromConfig(promCfgMap, naming.TAService(targetAllocator.Name), targetAllocator.Namespace) + updPromCfgMap, getCfgPromErr := ta.AddTAConfigToPromConfig(promCfgMap, naming.TAService(targetAllocator.Name)) if getCfgPromErr != nil { return "", getCfgPromErr } diff --git a/internal/manifests/collector/config_replace_test.go b/internal/manifests/collector/config_replace_test.go index bcc55d9d0b..c57c95efec 100644 --- a/internal/manifests/collector/config_replace_test.go +++ b/internal/manifests/collector/config_replace_test.go @@ -43,7 +43,7 @@ func TestPrometheusParser(t *testing.T) { assert.NotContains(t, prometheusConfig, "scrape_configs") expectedTAConfig := map[interface{}]interface{}{ - "endpoint": "http://test-targetallocator.default.svc.cluster.local:80", + "endpoint": "http://test-targetallocator:80", "interval": "30s", "collector_id": "${POD_NAME}", } @@ -68,7 +68,7 @@ func TestPrometheusParser(t *testing.T) { assert.NotContains(t, prometheusConfig, "scrape_configs") expectedTAConfig := map[interface{}]interface{}{ - "endpoint": "http://test-targetallocator.default.svc.cluster.local:80", + "endpoint": "http://test-targetallocator:80", "interval": "30s", "collector_id": "${POD_NAME}", } diff --git a/internal/manifests/collector/configmap_test.go b/internal/manifests/collector/configmap_test.go index 7236ef1f1c..fc66cf3794 100644 --- a/internal/manifests/collector/configmap_test.go +++ b/internal/manifests/collector/configmap_test.go @@ -84,7 +84,7 @@ receivers: config: {} target_allocator: collector_id: ${POD_NAME} - endpoint: http://test-targetallocator.default.svc.cluster.local:80 + endpoint: http://test-targetallocator:80 interval: 30s service: pipelines: diff --git a/internal/manifests/collector/testdata/config_expected_targetallocator.yaml b/internal/manifests/collector/testdata/config_expected_targetallocator.yaml index af8d7b189f..a43a2bcc56 100644 --- a/internal/manifests/collector/testdata/config_expected_targetallocator.yaml +++ b/internal/manifests/collector/testdata/config_expected_targetallocator.yaml @@ -9,7 +9,7 @@ receivers: scrape_timeout: 10s target_allocator: collector_id: ${POD_NAME} - endpoint: http://test-targetallocator.default.svc.cluster.local:80 + endpoint: http://test-targetallocator:80 interval: 30s service: pipelines: diff --git a/internal/manifests/collector/testdata/relabel_config_expected_with_sd_config.yaml b/internal/manifests/collector/testdata/relabel_config_expected_with_sd_config.yaml index 25329ad5c3..439ec1e310 100644 --- a/internal/manifests/collector/testdata/relabel_config_expected_with_sd_config.yaml +++ b/internal/manifests/collector/testdata/relabel_config_expected_with_sd_config.yaml @@ -10,7 +10,7 @@ receivers: scrape_configs: - honor_labels: true http_sd_configs: - - url: http://test-targetallocator.default.svc.cluster.local:80/jobs/service-x/targets?collector_id=$POD_NAME + - url: http://test-targetallocator:80/jobs/service-x/targets?collector_id=$POD_NAME job_name: service-x metric_relabel_configs: - action: keep diff --git a/internal/manifests/targetallocator/adapters/config_to_prom_config.go b/internal/manifests/targetallocator/adapters/config_to_prom_config.go index 29200e05d7..e0d7cd38e2 100644 --- a/internal/manifests/targetallocator/adapters/config_to_prom_config.go +++ b/internal/manifests/targetallocator/adapters/config_to_prom_config.go @@ -196,7 +196,7 @@ func UnescapeDollarSignsInPromConfig(cfg string) (map[interface{}]interface{}, e // This function removes any existing service discovery configurations (e.g., `sd_configs`, `dns_sd_configs`, `file_sd_configs`, etc.) // from the `scrape_configs` section and adds a single `http_sd_configs` configuration. // The `http_sd_configs` points to the TA (Target Allocator) endpoint that provides the list of targets for the given job. -func AddHTTPSDConfigToPromConfig(prometheus map[interface{}]interface{}, taServiceName string, taNamespace string) (map[interface{}]interface{}, error) { +func AddHTTPSDConfigToPromConfig(prometheus map[interface{}]interface{}, taServiceName string) (map[interface{}]interface{}, error) { prometheusConfigProperty, ok := prometheus["config"] if !ok { return nil, errorNoComponent("prometheusConfig") @@ -249,7 +249,7 @@ func AddHTTPSDConfigToPromConfig(prometheus map[interface{}]interface{}, taServi escapedJob := url.QueryEscape(jobName) scrapeConfig["http_sd_configs"] = []interface{}{ map[string]interface{}{ - "url": fmt.Sprintf("http://%s.%s.svc.cluster.local:80/jobs/%s/targets?collector_id=$POD_NAME", taServiceName, taNamespace, escapedJob), + "url": fmt.Sprintf("http://%s:80/jobs/%s/targets?collector_id=$POD_NAME", taServiceName, escapedJob), }, } } @@ -260,7 +260,7 @@ func AddHTTPSDConfigToPromConfig(prometheus map[interface{}]interface{}, taServi // AddTAConfigToPromConfig adds or updates the target_allocator configuration in the Prometheus configuration. // If the `EnableTargetAllocatorRewrite` feature flag for the target allocator is enabled, this function // removes the existing scrape_configs from the collector's Prometheus configuration as it's not required. -func AddTAConfigToPromConfig(prometheus map[interface{}]interface{}, taServiceName string, taNamespace string) (map[interface{}]interface{}, error) { +func AddTAConfigToPromConfig(prometheus map[interface{}]interface{}, taServiceName string) (map[interface{}]interface{}, error) { prometheusConfigProperty, ok := prometheus["config"] if !ok { return nil, errorNoComponent("prometheusConfig") @@ -281,7 +281,7 @@ func AddTAConfigToPromConfig(prometheus map[interface{}]interface{}, taServiceNa return nil, errorNotAMap("target_allocator") } - targetAllocatorCfg["endpoint"] = fmt.Sprintf("http://%s.%s.svc.cluster.local:80", taServiceName, taNamespace) + targetAllocatorCfg["endpoint"] = fmt.Sprintf("http://%s:80", taServiceName) targetAllocatorCfg["interval"] = "30s" targetAllocatorCfg["collector_id"] = "${POD_NAME}" diff --git a/internal/manifests/targetallocator/adapters/config_to_prom_config_test.go b/internal/manifests/targetallocator/adapters/config_to_prom_config_test.go index 45bef4c082..2ad7b741c6 100644 --- a/internal/manifests/targetallocator/adapters/config_to_prom_config_test.go +++ b/internal/manifests/targetallocator/adapters/config_to_prom_config_test.go @@ -279,7 +279,7 @@ func TestAddHTTPSDConfigToPromConfig(t *testing.T) { "job_name": "test_job", "http_sd_configs": []interface{}{ map[string]interface{}{ - "url": fmt.Sprintf("http://%s.default.svc.cluster.local:80/jobs/%s/targets?collector_id=$POD_NAME", taServiceName, url.QueryEscape("test_job")), + "url": fmt.Sprintf("http://%s:80/jobs/%s/targets?collector_id=$POD_NAME", taServiceName, url.QueryEscape("test_job")), }, }, }, @@ -287,7 +287,7 @@ func TestAddHTTPSDConfigToPromConfig(t *testing.T) { }, } - actualCfg, err := ta.AddHTTPSDConfigToPromConfig(cfg, taServiceName, "default") + actualCfg, err := ta.AddHTTPSDConfigToPromConfig(cfg, taServiceName) assert.NoError(t, err) assert.Equal(t, expectedCfg, actualCfg) }) @@ -308,7 +308,7 @@ func TestAddHTTPSDConfigToPromConfig(t *testing.T) { taServiceName := "test-service" - _, err := ta.AddHTTPSDConfigToPromConfig(cfg, taServiceName, "default") + _, err := ta.AddHTTPSDConfigToPromConfig(cfg, taServiceName) assert.Error(t, err) assert.EqualError(t, err, "no scrape_configs available as part of the configuration") }) @@ -338,13 +338,13 @@ func TestAddTAConfigToPromConfig(t *testing.T) { expectedResult := map[interface{}]interface{}{ "config": map[interface{}]interface{}{}, "target_allocator": map[interface{}]interface{}{ - "endpoint": "http://test-targetallocator.default.svc.cluster.local:80", + "endpoint": "http://test-targetallocator:80", "interval": "30s", "collector_id": "${POD_NAME}", }, } - result, err := ta.AddTAConfigToPromConfig(cfg, taServiceName, "default") + result, err := ta.AddTAConfigToPromConfig(cfg, taServiceName) assert.NoError(t, err) assert.Equal(t, expectedResult, result) @@ -374,7 +374,7 @@ func TestAddTAConfigToPromConfig(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - _, err := ta.AddTAConfigToPromConfig(tc.cfg, taServiceName, "default") + _, err := ta.AddTAConfigToPromConfig(tc.cfg, taServiceName) assert.Error(t, err) assert.EqualError(t, err, tc.errText) diff --git a/tests/e2e-targetallocator/targetallocator-kubernetessd/00-assert.yaml b/tests/e2e-targetallocator/targetallocator-kubernetessd/00-assert.yaml index 267d76ed37..93f7e176a2 100644 --- a/tests/e2e-targetallocator/targetallocator-kubernetessd/00-assert.yaml +++ b/tests/e2e-targetallocator/targetallocator-kubernetessd/00-assert.yaml @@ -26,7 +26,7 @@ data: config: {} target_allocator: collector_id: ${POD_NAME} - endpoint: http://prometheus-kubernetessd-targetallocator.chainsaw-targetallocator-kubernetessd.svc.cluster.local:80 + endpoint: http://prometheus-kubernetessd-targetallocator:80 interval: 30s service: pipelines: diff --git a/tests/e2e-targetallocator/targetallocator-kubernetessd/chainsaw-test.yaml b/tests/e2e-targetallocator/targetallocator-kubernetessd/chainsaw-test.yaml index e6cdf4bfcd..8e5aae1b58 100755 --- a/tests/e2e-targetallocator/targetallocator-kubernetessd/chainsaw-test.yaml +++ b/tests/e2e-targetallocator/targetallocator-kubernetessd/chainsaw-test.yaml @@ -5,7 +5,6 @@ metadata: creationTimestamp: null name: targetallocator-kubernetessd spec: - namespace: chainsaw-targetallocator-kubernetessd steps: - name: step-00 try: diff --git a/tests/e2e-targetallocator/targetallocator-prometheuscr/00-assert.yaml b/tests/e2e-targetallocator/targetallocator-prometheuscr/00-assert.yaml index 9a95fabc90..dd705e927b 100644 --- a/tests/e2e-targetallocator/targetallocator-prometheuscr/00-assert.yaml +++ b/tests/e2e-targetallocator/targetallocator-prometheuscr/00-assert.yaml @@ -31,7 +31,7 @@ data: config: {} target_allocator: collector_id: ${POD_NAME} - endpoint: http://prometheus-cr-targetallocator.chainsaw-targetallocator-prometheuscr.svc.cluster.local:80 + endpoint: http://prometheus-cr-targetallocator:80 interval: 30s service: pipelines: diff --git a/tests/e2e-targetallocator/targetallocator-prometheuscr/chainsaw-test.yaml b/tests/e2e-targetallocator/targetallocator-prometheuscr/chainsaw-test.yaml index e9591dd57d..c361477488 100755 --- a/tests/e2e-targetallocator/targetallocator-prometheuscr/chainsaw-test.yaml +++ b/tests/e2e-targetallocator/targetallocator-prometheuscr/chainsaw-test.yaml @@ -5,7 +5,6 @@ metadata: creationTimestamp: null name: targetallocator-prometheuscr spec: - namespace: chainsaw-targetallocator-prometheuscr steps: - name: step-00 try: diff --git a/tests/e2e/smoke-targetallocator/00-assert.yaml b/tests/e2e/smoke-targetallocator/00-assert.yaml index 095ea679d5..14e41f7002 100644 --- a/tests/e2e/smoke-targetallocator/00-assert.yaml +++ b/tests/e2e/smoke-targetallocator/00-assert.yaml @@ -40,7 +40,7 @@ data: - PrometheusText0.0.4 target_allocator: collector_id: ${POD_NAME} - endpoint: http://stateful-targetallocator.chainsaw-smoke-targetallocator.svc.cluster.local:80 + endpoint: http://stateful-targetallocator:80 interval: 30s service: pipelines: diff --git a/tests/e2e/smoke-targetallocator/chainsaw-test.yaml b/tests/e2e/smoke-targetallocator/chainsaw-test.yaml index aca5291cae..ea19c198f6 100755 --- a/tests/e2e/smoke-targetallocator/chainsaw-test.yaml +++ b/tests/e2e/smoke-targetallocator/chainsaw-test.yaml @@ -5,7 +5,6 @@ metadata: creationTimestamp: null name: smoke-targetallocator spec: - namespace: chainsaw-smoke-targetallocator steps: - name: step-00 try: From 02e68a2d554882b9166e77a9a606d93b92f850a6 Mon Sep 17 00:00:00 2001 From: Jared Tan Date: Thu, 5 Sep 2024 23:25:15 +0800 Subject: [PATCH 28/41] chore: update python auto-instrumentation dependencies 1.27.0/0.48b0 (#3257) --- autoinstrumentation/python/requirements.txt | 109 ++++++++++---------- 1 file changed, 55 insertions(+), 54 deletions(-) diff --git a/autoinstrumentation/python/requirements.txt b/autoinstrumentation/python/requirements.txt index 1f50e1a4a8..8f5a3b84dc 100644 --- a/autoinstrumentation/python/requirements.txt +++ b/autoinstrumentation/python/requirements.txt @@ -1,60 +1,61 @@ -opentelemetry-distro==0.47b0 +opentelemetry-distro==0.48b0 # We don't use the distro[otlp] option which automatically includes exporters since gRPC is not appropriate for # injected auto-instrumentation, where it has a strict dependency on the OS / Python version the artifact is built for. -opentelemetry-exporter-otlp-proto-http==1.26.0 -opentelemetry-exporter-prometheus==0.47b0 +opentelemetry-exporter-otlp-proto-http==1.27.0 +opentelemetry-exporter-prometheus==0.48b0 -opentelemetry-propagator-b3==1.26.0 -opentelemetry-propagator-jaeger==1.26.0 -opentelemetry-propagator-aws-xray==1.0.1 +opentelemetry-propagator-b3==1.27.0 +opentelemetry-propagator-jaeger==1.27.0 +opentelemetry-propagator-aws-xray==1.0.2 -opentelemetry-instrumentation==0.47b0 -opentelemetry-propagator-ot-trace==0.47b0 +opentelemetry-instrumentation==0.48b0 +opentelemetry-propagator-ot-trace==0.48b0 # Copied in from https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation -opentelemetry-instrumentation-aio-pika==0.47b0 -opentelemetry-instrumentation-aiohttp-client==0.47b0 -opentelemetry-instrumentation-aiohttp-server==0.47b0 -opentelemetry-instrumentation-aiopg==0.47b0 -opentelemetry-instrumentation-asgi==0.47b0 -opentelemetry-instrumentation-asyncio==0.47b0 -opentelemetry-instrumentation-asyncpg==0.47b0 -opentelemetry-instrumentation-boto==0.47b0 -opentelemetry-instrumentation-boto3sqs==0.47b0 -opentelemetry-instrumentation-botocore==0.47b0 -opentelemetry-instrumentation-cassandra==0.47b0 -opentelemetry-instrumentation-celery==0.47b0 -opentelemetry-instrumentation-confluent-kafka==0.47b0 -opentelemetry-instrumentation-dbapi==0.47b0 -opentelemetry-instrumentation-django==0.47b0 -opentelemetry-instrumentation-elasticsearch==0.47b0 -opentelemetry-instrumentation-falcon==0.47b0 -opentelemetry-instrumentation-fastapi==0.47b0 -opentelemetry-instrumentation-flask==0.47b0 -opentelemetry-instrumentation-grpc==0.47b0 -opentelemetry-instrumentation-httpx==0.47b0 -opentelemetry-instrumentation-jinja2==0.47b0 -opentelemetry-instrumentation-kafka-python==0.47b0 -opentelemetry-instrumentation-logging==0.47b0 -opentelemetry-instrumentation-mysql==0.47b0 -opentelemetry-instrumentation-mysqlclient==0.47b0 -opentelemetry-instrumentation-pika==0.47b0 -opentelemetry-instrumentation-psycopg==0.47b0 -opentelemetry-instrumentation-psycopg2==0.47b0 -opentelemetry-instrumentation-pymemcache==0.47b0 -opentelemetry-instrumentation-pymongo==0.47b0 -opentelemetry-instrumentation-pymysql==0.47b0 -opentelemetry-instrumentation-pyramid==0.47b0 -opentelemetry-instrumentation-redis==0.47b0 -opentelemetry-instrumentation-remoulade==0.47b0 -opentelemetry-instrumentation-requests==0.47b0 -opentelemetry-instrumentation-sqlalchemy==0.47b0 -opentelemetry-instrumentation-sqlite3==0.47b0 -opentelemetry-instrumentation-starlette==0.47b0 -opentelemetry-instrumentation-system-metrics==0.47b0 -opentelemetry-instrumentation-threading==0.47b0 -opentelemetry-instrumentation-tornado==0.47b0 -opentelemetry-instrumentation-tortoiseorm==0.47b0 -opentelemetry-instrumentation-urllib==0.47b0 -opentelemetry-instrumentation-urllib3==0.47b0 -opentelemetry-instrumentation-wsgi==0.47b0 +opentelemetry-instrumentation-aio-pika==0.48b0 +opentelemetry-instrumentation-aiohttp-client==0.48b0 +opentelemetry-instrumentation-aiohttp-server==0.48b0 +opentelemetry-instrumentation-aiopg==0.48b0 +opentelemetry-instrumentation-asgi==0.48b0 +opentelemetry-instrumentation-asyncio==0.48b0 +opentelemetry-instrumentation-asyncpg==0.48b0 +opentelemetry-instrumentation-aws-lambda==0.48b0 +opentelemetry-instrumentation-boto==0.48b0 +opentelemetry-instrumentation-boto3sqs==0.48b0 +opentelemetry-instrumentation-botocore==0.48b0 +opentelemetry-instrumentation-cassandra==0.48b0 +opentelemetry-instrumentation-celery==0.48b0 +opentelemetry-instrumentation-confluent-kafka==0.48b0 +opentelemetry-instrumentation-dbapi==0.48b0 +opentelemetry-instrumentation-django==0.48b0 +opentelemetry-instrumentation-elasticsearch==0.48b0 +opentelemetry-instrumentation-falcon==0.48b0 +opentelemetry-instrumentation-fastapi==0.48b0 +opentelemetry-instrumentation-flask==0.48b0 +opentelemetry-instrumentation-grpc==0.48b0 +opentelemetry-instrumentation-httpx==0.48b0 +opentelemetry-instrumentation-jinja2==0.48b0 +opentelemetry-instrumentation-kafka-python==0.48b0 +opentelemetry-instrumentation-logging==0.48b0 +opentelemetry-instrumentation-mysql==0.48b0 +opentelemetry-instrumentation-mysqlclient==0.48b0 +opentelemetry-instrumentation-pika==0.48b0 +opentelemetry-instrumentation-psycopg==0.48b0 +opentelemetry-instrumentation-psycopg2==0.48b0 +opentelemetry-instrumentation-pymemcache==0.48b0 +opentelemetry-instrumentation-pymongo==0.48b0 +opentelemetry-instrumentation-pymysql==0.48b0 +opentelemetry-instrumentation-pyramid==0.48b0 +opentelemetry-instrumentation-redis==0.48b0 +opentelemetry-instrumentation-remoulade==0.48b0 +opentelemetry-instrumentation-requests==0.48b0 +opentelemetry-instrumentation-sqlalchemy==0.48b0 +opentelemetry-instrumentation-sqlite3==0.48b0 +opentelemetry-instrumentation-starlette==0.48b0 +opentelemetry-instrumentation-system-metrics==0.48b0 +opentelemetry-instrumentation-threading==0.48b0 +opentelemetry-instrumentation-tornado==0.48b0 +opentelemetry-instrumentation-tortoiseorm==0.48b0 +opentelemetry-instrumentation-urllib==0.48b0 +opentelemetry-instrumentation-urllib3==0.48b0 +opentelemetry-instrumentation-wsgi==0.48b0 From e0237056145b67de64ca9788383ecb753b12411d Mon Sep 17 00:00:00 2001 From: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com> Date: Thu, 5 Sep 2024 11:09:55 -0600 Subject: [PATCH 29/41] [chore] prepare v0.108.0 release (#3265) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * prepare v0.108.0 release * Update max kube version * Apply suggestions from code review Co-authored-by: Mikołaj Świątek --------- Co-authored-by: Mikołaj Świątek --- ...26-non-root-nginx-autoinstrumentation.yaml | 16 -------- .../3165-python-otlp-protocol-env-var.yaml | 16 -------- ...-ta-retry-namespace-informer-creation.yaml | 16 -------- .chloggen/3242-rollback-of-3187.yaml | 16 -------- ...utoscaler-utilization-greater-than-99.yaml | 16 -------- .chloggen/feature_3090.yaml | 16 -------- .chloggen/fix-managed-by-gross-2.yaml | 20 --------- .chloggen/fix-managed-by-gross.yaml | 18 -------- .chloggen/fix_dont-own-volumes.yaml | 16 -------- .chloggen/operator31.yaml | 16 -------- .../propagate-global-scrape-protocols.yaml | 16 -------- .chloggen/xray-receiver-udp-port.yaml | 16 -------- CHANGELOG.md | 41 +++++++++++++++++++ README.md | 2 +- RELEASE.md | 16 ++++---- ...emetry-operator.clusterserviceversion.yaml | 8 ++-- ...emetry-operator.clusterserviceversion.yaml | 8 ++-- versions.txt | 10 ++--- 18 files changed, 63 insertions(+), 220 deletions(-) delete mode 100755 .chloggen/2726-non-root-nginx-autoinstrumentation.yaml delete mode 100755 .chloggen/3165-python-otlp-protocol-env-var.yaml delete mode 100644 .chloggen/3216-ta-retry-namespace-informer-creation.yaml delete mode 100644 .chloggen/3242-rollback-of-3187.yaml delete mode 100755 .chloggen/3258-autoscaler-utilization-greater-than-99.yaml delete mode 100755 .chloggen/feature_3090.yaml delete mode 100755 .chloggen/fix-managed-by-gross-2.yaml delete mode 100755 .chloggen/fix-managed-by-gross.yaml delete mode 100755 .chloggen/fix_dont-own-volumes.yaml delete mode 100644 .chloggen/operator31.yaml delete mode 100755 .chloggen/propagate-global-scrape-protocols.yaml delete mode 100755 .chloggen/xray-receiver-udp-port.yaml diff --git a/.chloggen/2726-non-root-nginx-autoinstrumentation.yaml b/.chloggen/2726-non-root-nginx-autoinstrumentation.yaml deleted file mode 100755 index 04310f0375..0000000000 --- a/.chloggen/2726-non-root-nginx-autoinstrumentation.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' -change_type: 'bug_fix' - -# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) -component: auto-instrumentation - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: "Fix file copy for NGINX auto-instrumentation for non-root workloads." - -# One or more tracking issues related to the change -issues: [2726] - -# (Optional) One or more lines of additional information to render under the primary note. -# These lines will be padded with 2 spaces and then inserted directly into the document. -# Use pipe (|) for multiline entries. -subtext: diff --git a/.chloggen/3165-python-otlp-protocol-env-var.yaml b/.chloggen/3165-python-otlp-protocol-env-var.yaml deleted file mode 100755 index cba8188516..0000000000 --- a/.chloggen/3165-python-otlp-protocol-env-var.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' -change_type: enhancement - -# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) -component: auto-instrumentation - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: set OTEL_EXPORTER_OTLP_PROTOCOL instead of signal specific env vars in python instrumentation - -# One or more tracking issues related to the change -issues: [3165] - -# (Optional) One or more lines of additional information to render under the primary note. -# These lines will be padded with 2 spaces and then inserted directly into the document. -# Use pipe (|) for multiline entries. -subtext: diff --git a/.chloggen/3216-ta-retry-namespace-informer-creation.yaml b/.chloggen/3216-ta-retry-namespace-informer-creation.yaml deleted file mode 100644 index 2db25c9caa..0000000000 --- a/.chloggen/3216-ta-retry-namespace-informer-creation.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' -change_type: bug_fix - -# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) -component: target allocator - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: "Retrying failed namespace informer creation in promOperator CRD watcher, then exit if creation issue cannot be resolved" - -# One or more tracking issues related to the change -issues: [3216] - -# (Optional) One or more lines of additional information to render under the primary note. -# These lines will be padded with 2 spaces and then inserted directly into the document. -# Use pipe (|) for multiline entries. -subtext: diff --git a/.chloggen/3242-rollback-of-3187.yaml b/.chloggen/3242-rollback-of-3187.yaml deleted file mode 100644 index 1fd2ea2f95..0000000000 --- a/.chloggen/3242-rollback-of-3187.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' -change_type: bug_fix - -# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) -component: target allocator - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Rollback 3187 - -# One or more tracking issues related to the change -issues: [3242] - -# (Optional) One or more lines of additional information to render under the primary note. -# These lines will be padded with 2 spaces and then inserted directly into the document. -# Use pipe (|) for multiline entries. -subtext: This Rollsback 3187 which breaks TargetAllocator config for clusters with custom domains. diff --git a/.chloggen/3258-autoscaler-utilization-greater-than-99.yaml b/.chloggen/3258-autoscaler-utilization-greater-than-99.yaml deleted file mode 100755 index f32bb996bd..0000000000 --- a/.chloggen/3258-autoscaler-utilization-greater-than-99.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' -change_type: enhancement - -# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) -component: collector - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: "Allow autoscaler targetCPUUtilization and TargetMemoryUtilization to be greater than 99" - -# One or more tracking issues related to the change -issues: [3258] - -# (Optional) One or more lines of additional information to render under the primary note. -# These lines will be padded with 2 spaces and then inserted directly into the document. -# Use pipe (|) for multiline entries. -subtext: diff --git a/.chloggen/feature_3090.yaml b/.chloggen/feature_3090.yaml deleted file mode 100755 index ad1f98094d..0000000000 --- a/.chloggen/feature_3090.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' -change_type: 'enhancement' - -# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) -component: auto-instrumentation - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: "Not ignore the `instrumentation.opentelemetry.io/container-names` annotation when the multi-instrumentation is enabled" - -# One or more tracking issues related to the change -issues: [3090] - -# (Optional) One or more lines of additional information to render under the primary note. -# These lines will be padded with 2 spaces and then inserted directly into the document. -# Use pipe (|) for multiline entries. -subtext: diff --git a/.chloggen/fix-managed-by-gross-2.yaml b/.chloggen/fix-managed-by-gross-2.yaml deleted file mode 100755 index b06808183e..0000000000 --- a/.chloggen/fix-managed-by-gross-2.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' -change_type: bug_fix - -# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) -component: auto-instrumentation - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Fixes a bug that was preventing auto instrumentation from getting correct images. - -# One or more tracking issues related to the change -issues: [3014] - -# (Optional) One or more lines of additional information to render under the primary note. -# These lines will be padded with 2 spaces and then inserted directly into the document. -# Use pipe (|) for multiline entries. -subtext: | - This PR removes the restriction on the operator to only upgrade manually applied CRDs. This meant - that resources applied by helm were not upgraded at all. The solution was to remove the restriction - we had on querying the label app.kubernetes.io/managed-by=opentelemetry-operator, thereby upgrading - ALL CRDs in the cluster. diff --git a/.chloggen/fix-managed-by-gross.yaml b/.chloggen/fix-managed-by-gross.yaml deleted file mode 100755 index d733674d9d..0000000000 --- a/.chloggen/fix-managed-by-gross.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' -change_type: bug_fix - -# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) -component: collector - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Fixes a bug that was preventing upgrade patches from reliably applying. - -# One or more tracking issues related to the change -issues: [3074] - -# (Optional) One or more lines of additional information to render under the primary note. -# These lines will be padded with 2 spaces and then inserted directly into the document. -# Use pipe (|) for multiline entries. -subtext: | - A bug was discovered in the process of testing the PR that was failing to remove the environment - variables introduced in the 0.104.0 upgrade. The fix was to take a deepcopy of the object and update that. diff --git a/.chloggen/fix_dont-own-volumes.yaml b/.chloggen/fix_dont-own-volumes.yaml deleted file mode 100755 index 5430eaa680..0000000000 --- a/.chloggen/fix_dont-own-volumes.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' -change_type: bug_fix - -# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) -component: collector - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Don't unnecessarily take ownership of PersistentVolumes and PersistentVolumeClaims - -# One or more tracking issues related to the change -issues: [3042] - -# (Optional) One or more lines of additional information to render under the primary note. -# These lines will be padded with 2 spaces and then inserted directly into the document. -# Use pipe (|) for multiline entries. -subtext: diff --git a/.chloggen/operator31.yaml b/.chloggen/operator31.yaml deleted file mode 100644 index 0e52ea95cb..0000000000 --- a/.chloggen/operator31.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' -change_type: 'enhancement' - -# The name of the component, or a single word describing the area of concern, (e.g. operator, target allocator, github action) -component: operator - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Support for Kubernetes `1.31` version. - -# One or more tracking issues related to the change -issues: [3247] - -# (Optional) One or more lines of additional information to render under the primary note. -# These lines will be padded with 2 spaces and then inserted directly into the document. -# Use pipe (|) for multiline entries. -subtext: diff --git a/.chloggen/propagate-global-scrape-protocols.yaml b/.chloggen/propagate-global-scrape-protocols.yaml deleted file mode 100755 index c9606ca18a..0000000000 --- a/.chloggen/propagate-global-scrape-protocols.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' -change_type: enhancement - -# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) -component: target allocator - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: introduces the global field in the TA config to allow for setting scrape protocols - -# One or more tracking issues related to the change -issues: [3160] - -# (Optional) One or more lines of additional information to render under the primary note. -# These lines will be padded with 2 spaces and then inserted directly into the document. -# Use pipe (|) for multiline entries. -subtext: diff --git a/.chloggen/xray-receiver-udp-port.yaml b/.chloggen/xray-receiver-udp-port.yaml deleted file mode 100755 index 3bc036e841..0000000000 --- a/.chloggen/xray-receiver-udp-port.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' -change_type: bug_fix - -# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) -component: awsxray-receiver - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Switched the protocol of awsxray-receiver to UDP from TCP - -# One or more tracking issues related to the change -issues: [3261] - -# (Optional) One or more lines of additional information to render under the primary note. -# These lines will be padded with 2 spaces and then inserted directly into the document. -# Use pipe (|) for multiline entries. -subtext: diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fc4a7db93..02547f0fbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,47 @@ +## 0.108.0 + +### 💡 Enhancements 💡 + +- `auto-instrumentation`: set OTEL_EXPORTER_OTLP_PROTOCOL instead of signal specific env vars in python instrumentation (#3165) +- `collector`: Allow autoscaler targetCPUUtilization and TargetMemoryUtilization to be greater than 99 (#3258) +- `auto-instrumentation`: Not ignore the `instrumentation.opentelemetry.io/container-names` annotation when the multi-instrumentation is enabled (#3090) +- `operator`: Support for Kubernetes `1.31` version. (#3247) +- `target allocator`: introduces the global field in the TA config to allow for setting scrape protocols (#3160) + +### 🧰 Bug fixes 🧰 + +- `auto-instrumentation`: Fix file copy for NGINX auto-instrumentation for non-root workloads. (#2726) +- `target allocator`: Retrying failed namespace informer creation in promOperator CRD watcher, then exit if creation issue cannot be resolved (#3216) +- `target allocator`: Rollback #3187 (#3242) + This Rollsback 3187 which breaks TargetAllocator config for clusters with custom domains. +- `auto-instrumentation`: Fixes a bug that was preventing auto instrumentation from getting correct images. (#3014) + This PR removes the restriction on the operator to only upgrade manually applied CRDs. This meant + that resources applied by helm were not upgraded at all. The solution was to remove the restriction + we had on querying the label app.kubernetes.io/managed-by=opentelemetry-operator, thereby upgrading + ALL CRDs in the cluster. + +- `collector`: Fixes a bug that was preventing upgrade patches from reliably applying. (#3074) + A bug was discovered in the process of testing the PR that was failing to remove the environment + variables introduced in the 0.104.0 upgrade. The fix was to take a deepcopy of the object and update that. + +- `collector`: Don't unnecessarily take ownership of PersistentVolumes and PersistentVolumeClaims (#3042) +- `awsxray-receiver`: Switched the protocol of awsxray-receiver to UDP from TCP (#3261) + +### Components + +* [OpenTelemetry Collector - v0.108.0](https://github.com/open-telemetry/opentelemetry-collector/releases/tag/v0.108.0) +* [OpenTelemetry Contrib - v0.108.0](https://github.com/open-telemetry/opentelemetry-collector-contrib/releases/tag/v0.108.0) +* [Java auto-instrumentation - v1.33.5](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/tag/v1.33.5) +* [.NET auto-instrumentation - v1.2.0](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/tag/v1.2.0) +* [Node.JS - v0.52.1](https://github.com/open-telemetry/opentelemetry-js/releases/tag/experimental%2Fv0.52.1) +* [Python - v0.48b0](https://github.com/open-telemetry/opentelemetry-python-contrib/releases/tag/v0.48b0) +* [Go - v0.14.0-alpha](https://github.com/open-telemetry/opentelemetry-go-instrumentation/releases/tag/v0.14.0-alpha) +* [ApacheHTTPD - 1.0.4](https://github.com/open-telemetry/opentelemetry-cpp-contrib/releases/tag/webserver%2Fv1.0.4) +* [Nginx - 1.0.4](https://github.com/open-telemetry/opentelemetry-cpp-contrib/releases/tag/webserver%2Fv1.0.4) + ## 0.107.0 ### 💡 Enhancements 💡 diff --git a/README.md b/README.md index c1323ce287..ba115fbe5d 100644 --- a/README.md +++ b/README.md @@ -759,6 +759,7 @@ The OpenTelemetry Operator _might_ work on versions outside of the given range, | OpenTelemetry Operator | Kubernetes | Cert-Manager | Prometheus-Operator | |------------------------|----------------| ------------ |---------------------| +| v0.108.0 | v1.23 to v1.31 | v1 | v0.76.0 | | v0.107.0 | v1.23 to v1.30 | v1 | v0.75.0 | | v0.106.0 | v1.23 to v1.30 | v1 | v0.75.0 | | v0.105.0 | v1.23 to v1.30 | v1 | v0.74.0 | @@ -781,7 +782,6 @@ The OpenTelemetry Operator _might_ work on versions outside of the given range, | v0.88.0 | v1.23 to v1.28 | v1 | v0.68.0 | | v0.87.0 | v1.23 to v1.28 | v1 | v0.68.0 | | v0.86.0 | v1.23 to v1.28 | v1 | v0.68.0 | -| v0.85.0 | v1.19 to v1.28 | v1 | v0.67.1 | ## Contributing and Developing diff --git a/RELEASE.md b/RELEASE.md index c7c8fde3cd..4463902ce1 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -42,11 +42,11 @@ In order to have more people comfortable with the release process, and in order The operator should be released within a week after the [OpenTelemetry collector release](https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/release.md#release-schedule). -| Version | Release manager | -|-----------|-----------------| -| v0.108.0 | @TylerHelmuth | -| v0.109.0 | @jaronoff97 | -| v0.110.0 | @swiatekm | -| v0.111.0 | @frzifus | -| v0.112.0 | @yuriolisa | -| v0.113.0 | @pavolloffay | +| Version | Release manager | +|----------|-----------------| +| v0.109.0 | @jaronoff97 | +| v0.110.0 | @swiatekm | +| v0.111.0 | @frzifus | +| v0.112.0 | @yuriolisa | +| v0.113.0 | @pavolloffay | +| v0.114.0 | @TylerHelmuth | diff --git a/bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml b/bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml index 6875f49a6c..6737e75c56 100644 --- a/bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml +++ b/bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml @@ -99,13 +99,13 @@ metadata: categories: Logging & Tracing,Monitoring certified: "false" containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator - createdAt: "2024-09-03T20:25:40Z" + createdAt: "2024-09-05T15:16:50Z" description: Provides the OpenTelemetry components, including the Collector operators.operatorframework.io/builder: operator-sdk-v1.29.0 operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 repository: github.com/open-telemetry/opentelemetry-operator support: OpenTelemetry Community - name: opentelemetry-operator.v0.107.0 + name: opentelemetry-operator.v0.108.0 namespace: placeholder spec: apiservicedefinitions: {} @@ -479,7 +479,7 @@ spec: valueFrom: fieldRef: fieldPath: spec.serviceAccountName - image: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator:0.107.0 + image: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator:0.108.0 livenessProbe: httpGet: path: /healthz @@ -587,7 +587,7 @@ spec: minKubeVersion: 1.23.0 provider: name: OpenTelemetry Community - version: 0.107.0 + version: 0.108.0 webhookdefinitions: - admissionReviewVersions: - v1alpha1 diff --git a/bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml b/bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml index b6ec3f9ac0..89e840e466 100644 --- a/bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml +++ b/bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml @@ -99,13 +99,13 @@ metadata: categories: Logging & Tracing,Monitoring certified: "false" containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator - createdAt: "2024-09-03T20:25:47Z" + createdAt: "2024-09-05T15:16:58Z" description: Provides the OpenTelemetry components, including the Collector operators.operatorframework.io/builder: operator-sdk-v1.29.0 operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 repository: github.com/open-telemetry/opentelemetry-operator support: OpenTelemetry Community - name: opentelemetry-operator.v0.107.0 + name: opentelemetry-operator.v0.108.0 namespace: placeholder spec: apiservicedefinitions: {} @@ -483,7 +483,7 @@ spec: valueFrom: fieldRef: fieldPath: spec.serviceAccountName - image: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator:0.107.0 + image: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator:0.108.0 livenessProbe: httpGet: path: /healthz @@ -591,7 +591,7 @@ spec: minKubeVersion: 1.23.0 provider: name: OpenTelemetry Community - version: 0.107.0 + version: 0.108.0 webhookdefinitions: - admissionReviewVersions: - v1alpha1 diff --git a/versions.txt b/versions.txt index 6194fd3099..9842d16e59 100644 --- a/versions.txt +++ b/versions.txt @@ -2,16 +2,16 @@ # by default with the OpenTelemetry Operator. This would usually be the latest # stable OpenTelemetry version. When you update this file, make sure to update the # the docs as well. -opentelemetry-collector=0.107.0 +opentelemetry-collector=0.108.0 # Represents the current release of the OpenTelemetry Operator. -operator=0.107.0 +operator=0.108.0 # Represents the current release of the Target Allocator. -targetallocator=0.107.0 +targetallocator=0.108.0 # Represents the current release of the Operator OpAMP Bridge. -operator-opamp-bridge=0.107.0 +operator-opamp-bridge=0.108.0 # Represents the current release of Java instrumentation. # Should match autoinstrumentation/java/version.txt @@ -23,7 +23,7 @@ autoinstrumentation-nodejs=0.52.1 # Represents the current release of Python instrumentation. # Should match value in autoinstrumentation/python/requirements.txt -autoinstrumentation-python=0.47b0 +autoinstrumentation-python=0.48b0 # Represents the current release of DotNet instrumentation. # Should match autoinstrumentation/dotnet/version.txt From 5497a49a541ac49bc992403be14e06469cfb9d3a Mon Sep 17 00:00:00 2001 From: Tania Pham Date: Thu, 5 Sep 2024 11:22:00 -0700 Subject: [PATCH 30/41] Enhanced Webhook Reconciliation Errors (#3180) * initial commit * added enhanced reconciliation errors * tests * update * tests * add test * changelog * initial fixes * linting * changing to warnings * shadow declarations * fixing errors * kubebuilder test * kubebuilder testing * fixing file * unit test * initial changes * clean up * merge conflicts * Update apis/v1beta1/collector_webhook_test.go Co-authored-by: Israel Blancas * fixed test * fixed test * unneeded code * linting * linting and unit tests * reuse code * Update apis/v1beta1/collector_webhook.go Co-authored-by: Jacob Aronoff * revert to not use getParams * use config * linting * more linting * validate as anon func * linting * linting * testing without test * added back test * fix * make generate --------- Co-authored-by: Israel Blancas Co-authored-by: Jacob Aronoff Co-authored-by: Jacob Aronoff --- .chloggen/enhanced-webhook.yaml | 16 + apis/v1beta1/collector_webhook.go | 44 +- apis/v1beta1/collector_webhook_test.go | 766 ++++++++++-------- config/manager/kustomization.yaml | 1 - .../opentelemetrycollector_controller.go | 4 +- controllers/suite_test.go | 2 +- .../podmutation/webhookhandler_suite_test.go | 2 +- main.go | 24 +- pkg/collector/upgrade/suite_test.go | 2 +- 9 files changed, 518 insertions(+), 343 deletions(-) create mode 100644 .chloggen/enhanced-webhook.yaml diff --git a/.chloggen/enhanced-webhook.yaml b/.chloggen/enhanced-webhook.yaml new file mode 100644 index 0000000000..ddacb9ee1a --- /dev/null +++ b/.chloggen/enhanced-webhook.yaml @@ -0,0 +1,16 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. operator, target allocator, github action) +component: operator + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Added reconciliation errors for webhook events. The webhooks run the manifest generators to check for any errors. + +# One or more tracking issues related to the change +issues: [2399] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: \ No newline at end of file diff --git a/apis/v1beta1/collector_webhook.go b/apis/v1beta1/collector_webhook.go index c44f9f48ab..4e783a01df 100644 --- a/apis/v1beta1/collector_webhook.go +++ b/apis/v1beta1/collector_webhook.go @@ -47,6 +47,7 @@ type CollectorWebhook struct { scheme *runtime.Scheme reviewer *rbac.Reviewer metrics *Metrics + bv BuildValidator } func (c CollectorWebhook) Default(_ context.Context, obj runtime.Object) error { @@ -108,14 +109,17 @@ func (c CollectorWebhook) ValidateCreate(ctx context.Context, obj runtime.Object return nil, fmt.Errorf("expected an OpenTelemetryCollector, received %T", obj) } - warnings, err := c.validate(ctx, otelcol) + warnings, err := c.Validate(ctx, otelcol) if err != nil { return warnings, err } if c.metrics != nil { c.metrics.create(ctx, otelcol) } - + if c.bv != nil { + newWarnings := c.bv(*otelcol) + warnings = append(warnings, newWarnings...) + } return warnings, nil } @@ -133,7 +137,7 @@ func (c CollectorWebhook) ValidateUpdate(ctx context.Context, oldObj, newObj run if otelcolOld.Spec.Mode != otelcol.Spec.Mode { return admission.Warnings{}, fmt.Errorf("the OpenTelemetry Collector mode is set to %s, which does not support modification", otelcolOld.Spec.Mode) } - warnings, err := c.validate(ctx, otelcol) + warnings, err := c.Validate(ctx, otelcol) if err != nil { return warnings, err } @@ -142,6 +146,10 @@ func (c CollectorWebhook) ValidateUpdate(ctx context.Context, oldObj, newObj run c.metrics.update(ctx, otelcolOld, otelcol) } + if c.bv != nil { + newWarnings := c.bv(*otelcol) + warnings = append(warnings, newWarnings...) + } return warnings, nil } @@ -151,7 +159,7 @@ func (c CollectorWebhook) ValidateDelete(ctx context.Context, obj runtime.Object return nil, fmt.Errorf("expected an OpenTelemetryCollector, received %T", obj) } - warnings, err := c.validate(ctx, otelcol) + warnings, err := c.Validate(ctx, otelcol) if err != nil { return warnings, err } @@ -163,7 +171,7 @@ func (c CollectorWebhook) ValidateDelete(ctx context.Context, obj runtime.Object return warnings, nil } -func (c CollectorWebhook) validate(ctx context.Context, r *OpenTelemetryCollector) (admission.Warnings, error) { +func (c CollectorWebhook) Validate(ctx context.Context, r *OpenTelemetryCollector) (admission.Warnings, error) { warnings := admission.Warnings{} nullObjects := r.Spec.Config.nullObjects() @@ -404,14 +412,30 @@ func checkAutoscalerSpec(autoscaler *AutoscalerSpec) error { return nil } -func SetupCollectorWebhook(mgr ctrl.Manager, cfg config.Config, reviewer *rbac.Reviewer, metrics *Metrics) error { - cvw := &CollectorWebhook{ - reviewer: reviewer, - logger: mgr.GetLogger().WithValues("handler", "CollectorWebhook", "version", "v1beta1"), - scheme: mgr.GetScheme(), +// BuildValidator enables running the manifest generators for the collector reconciler +// +kubebuilder:object:generate=false +type BuildValidator func(c OpenTelemetryCollector) admission.Warnings + +func NewCollectorWebhook( + logger logr.Logger, + scheme *runtime.Scheme, + cfg config.Config, + reviewer *rbac.Reviewer, + metrics *Metrics, + bv BuildValidator, +) *CollectorWebhook { + return &CollectorWebhook{ + logger: logger, + scheme: scheme, cfg: cfg, + reviewer: reviewer, metrics: metrics, + bv: bv, } +} + +func SetupCollectorWebhook(mgr ctrl.Manager, cfg config.Config, reviewer *rbac.Reviewer, metrics *Metrics, bv BuildValidator) error { + cvw := NewCollectorWebhook(mgr.GetLogger().WithValues("handler", "CollectorWebhook", "version", "v1beta1"), mgr.GetScheme(), cfg, reviewer, metrics, bv) return ctrl.NewWebhookManagedBy(mgr). For(&OpenTelemetryCollector{}). WithValidator(cvw). diff --git a/apis/v1beta1/collector_webhook_test.go b/apis/v1beta1/collector_webhook_test.go index 112a782488..64ffff48ea 100644 --- a/apis/v1beta1/collector_webhook_test.go +++ b/apis/v1beta1/collector_webhook_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package v1beta1 +package v1beta1_test import ( "context" @@ -35,8 +35,12 @@ import ( "k8s.io/client-go/kubernetes/fake" "k8s.io/client-go/kubernetes/scheme" kubeTesting "k8s.io/client-go/testing" + "sigs.k8s.io/controller-runtime/pkg/webhook/admission" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" + "github.com/open-telemetry/opentelemetry-operator/internal/manifests" + collectorManifests "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector" "github.com/open-telemetry/opentelemetry-operator/internal/rbac" ) @@ -46,23 +50,24 @@ var ( func TestValidate(t *testing.T) { tests := []struct { - name string - collector OpenTelemetryCollector - warnings []string - err string + name string + collector v1beta1.OpenTelemetryCollector + warnings []string + err string + shouldFailSar bool }{ { name: "Test ", - collector: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Config: Config{ - Processors: &AnyConfig{ + collector: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Config: v1beta1.Config{ + Processors: &v1beta1.AnyConfig{ Object: map[string]interface{}{ "batch": nil, "foo": nil, }, }, - Extensions: &AnyConfig{ + Extensions: &v1beta1.AnyConfig{ Object: map[string]interface{}{ "foo": nil, }, @@ -76,11 +81,42 @@ func TestValidate(t *testing.T) { }, }, } + + bv := func(collector v1beta1.OpenTelemetryCollector) admission.Warnings { + var warnings admission.Warnings + cfg := config.New( + config.WithCollectorImage("default-collector"), + config.WithTargetAllocatorImage("default-ta-allocator"), + ) + params := manifests.Params{ + Log: logr.Discard(), + Config: cfg, + OtelCol: collector, + } + _, err := collectorManifests.Build(params) + if err != nil { + warnings = append(warnings, err.Error()) + return warnings + } + return nil + } + for _, tt := range tests { - webhook := CollectorWebhook{} + test := tt + webhook := v1beta1.NewCollectorWebhook( + logr.Discard(), + testScheme, + config.New( + config.WithCollectorImage("collector:v0.0.0"), + config.WithTargetAllocatorImage("ta:v0.0.0"), + ), + getReviewer(test.shouldFailSar), + nil, + bv, + ) t.Run(tt.name, func(t *testing.T) { tt := tt - warnings, err := webhook.validate(context.Background(), &tt.collector) + warnings, err := webhook.Validate(context.Background(), &tt.collector) if tt.err == "" { require.NoError(t, err) } else { @@ -96,110 +132,111 @@ func TestCollectorDefaultingWebhook(t *testing.T) { five := int32(5) defaultCPUTarget := int32(90) - if err := AddToScheme(testScheme); err != nil { + if err := v1beta1.AddToScheme(testScheme); err != nil { fmt.Printf("failed to register scheme: %v", err) os.Exit(1) } tests := []struct { - name string - otelcol OpenTelemetryCollector - expected OpenTelemetryCollector + name string + otelcol v1beta1.OpenTelemetryCollector + expected v1beta1.OpenTelemetryCollector + shouldFailSar bool }{ { name: "all fields default", - otelcol: OpenTelemetryCollector{}, - expected: OpenTelemetryCollector{ + otelcol: v1beta1.OpenTelemetryCollector{}, + expected: v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{}, }, - Spec: OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Args: map[string]string{"feature-gates": "-component.UseLocalHostAsDefaultHost"}, - ManagementState: ManagementStateManaged, + ManagementState: v1beta1.ManagementStateManaged, Replicas: &one, }, - Mode: ModeDeployment, - UpgradeStrategy: UpgradeStrategyAutomatic, + Mode: v1beta1.ModeDeployment, + UpgradeStrategy: v1beta1.UpgradeStrategyAutomatic, }, }, }, { name: "provided values in spec", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeSidecar, + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeSidecar, UpgradeStrategy: "adhoc", - OpenTelemetryCommonFields: OpenTelemetryCommonFields{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Replicas: &five, }, }, }, - expected: OpenTelemetryCollector{ + expected: v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{}, }, - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeSidecar, + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeSidecar, UpgradeStrategy: "adhoc", - OpenTelemetryCommonFields: OpenTelemetryCommonFields{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Args: map[string]string{"feature-gates": "-component.UseLocalHostAsDefaultHost"}, Replicas: &five, - ManagementState: ManagementStateManaged, + ManagementState: v1beta1.ManagementStateManaged, }, }, }, }, { name: "doesn't override unmanaged", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeSidecar, + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeSidecar, UpgradeStrategy: "adhoc", - OpenTelemetryCommonFields: OpenTelemetryCommonFields{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Replicas: &five, - ManagementState: ManagementStateUnmanaged, + ManagementState: v1beta1.ManagementStateUnmanaged, }, }, }, - expected: OpenTelemetryCollector{ + expected: v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{}, }, - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeSidecar, + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeSidecar, UpgradeStrategy: "adhoc", - OpenTelemetryCommonFields: OpenTelemetryCommonFields{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Args: map[string]string{"feature-gates": "-component.UseLocalHostAsDefaultHost"}, Replicas: &five, - ManagementState: ManagementStateUnmanaged, + ManagementState: v1beta1.ManagementStateUnmanaged, }, }, }, }, { name: "Setting Autoscaler MaxReplicas", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Autoscaler: &AutoscalerSpec{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Autoscaler: &v1beta1.AutoscalerSpec{ MaxReplicas: &five, MinReplicas: &one, }, }, }, - expected: OpenTelemetryCollector{ + expected: v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{}, }, - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeDeployment, - UpgradeStrategy: UpgradeStrategyAutomatic, - OpenTelemetryCommonFields: OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeDeployment, + UpgradeStrategy: v1beta1.UpgradeStrategyAutomatic, + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Args: map[string]string{"feature-gates": "-component.UseLocalHostAsDefaultHost"}, Replicas: &one, - ManagementState: ManagementStateManaged, + ManagementState: v1beta1.ManagementStateManaged, }, - Autoscaler: &AutoscalerSpec{ + Autoscaler: &v1beta1.AutoscalerSpec{ TargetCPUUtilization: &defaultCPUTarget, MaxReplicas: &five, MinReplicas: &one, @@ -209,42 +246,42 @@ func TestCollectorDefaultingWebhook(t *testing.T) { }, { name: "Missing route termination", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeDeployment, - Ingress: Ingress{ - Type: IngressTypeRoute, + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeDeployment, + Ingress: v1beta1.Ingress{ + Type: v1beta1.IngressTypeRoute, }, }, }, - expected: OpenTelemetryCollector{ + expected: v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{}, }, - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeDeployment, - OpenTelemetryCommonFields: OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeDeployment, + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Args: map[string]string{"feature-gates": "-component.UseLocalHostAsDefaultHost"}, - ManagementState: ManagementStateManaged, + ManagementState: v1beta1.ManagementStateManaged, Replicas: &one, }, - Ingress: Ingress{ - Type: IngressTypeRoute, - Route: OpenShiftRoute{ - Termination: TLSRouteTerminationTypeEdge, + Ingress: v1beta1.Ingress{ + Type: v1beta1.IngressTypeRoute, + Route: v1beta1.OpenShiftRoute{ + Termination: v1beta1.TLSRouteTerminationTypeEdge, }, }, - UpgradeStrategy: UpgradeStrategyAutomatic, + UpgradeStrategy: v1beta1.UpgradeStrategyAutomatic, }, }, }, { name: "Defined PDB for collector", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeDeployment, - OpenTelemetryCommonFields: OpenTelemetryCommonFields{ - PodDisruptionBudget: &PodDisruptionBudgetSpec{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeDeployment, + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ + PodDisruptionBudget: &v1beta1.PodDisruptionBudgetSpec{ MinAvailable: &intstr.IntOrString{ Type: intstr.String, StrVal: "10%", @@ -253,36 +290,36 @@ func TestCollectorDefaultingWebhook(t *testing.T) { }, }, }, - expected: OpenTelemetryCollector{ + expected: v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{}, }, - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeDeployment, - OpenTelemetryCommonFields: OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeDeployment, + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Args: map[string]string{"feature-gates": "-component.UseLocalHostAsDefaultHost"}, Replicas: &one, - ManagementState: ManagementStateManaged, - PodDisruptionBudget: &PodDisruptionBudgetSpec{ + ManagementState: v1beta1.ManagementStateManaged, + PodDisruptionBudget: &v1beta1.PodDisruptionBudgetSpec{ MinAvailable: &intstr.IntOrString{ Type: intstr.String, StrVal: "10%", }, }, }, - UpgradeStrategy: UpgradeStrategyAutomatic, + UpgradeStrategy: v1beta1.UpgradeStrategyAutomatic, }, }, }, { name: "Defined PDB for target allocator", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeDeployment, - TargetAllocator: TargetAllocatorEmbedded{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeDeployment, + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, - AllocationStrategy: TargetAllocatorAllocationStrategyConsistentHashing, - PodDisruptionBudget: &PodDisruptionBudgetSpec{ + AllocationStrategy: v1beta1.TargetAllocatorAllocationStrategyConsistentHashing, + PodDisruptionBudget: &v1beta1.PodDisruptionBudgetSpec{ MinAvailable: &intstr.IntOrString{ Type: intstr.String, StrVal: "10%", @@ -291,23 +328,23 @@ func TestCollectorDefaultingWebhook(t *testing.T) { }, }, }, - expected: OpenTelemetryCollector{ + expected: v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{}, }, - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeDeployment, - OpenTelemetryCommonFields: OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeDeployment, + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Args: map[string]string{"feature-gates": "-component.UseLocalHostAsDefaultHost"}, Replicas: &one, - ManagementState: ManagementStateManaged, + ManagementState: v1beta1.ManagementStateManaged, }, - UpgradeStrategy: UpgradeStrategyAutomatic, - TargetAllocator: TargetAllocatorEmbedded{ + UpgradeStrategy: v1beta1.UpgradeStrategyAutomatic, + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, Replicas: &one, - AllocationStrategy: TargetAllocatorAllocationStrategyConsistentHashing, - PodDisruptionBudget: &PodDisruptionBudgetSpec{ + AllocationStrategy: v1beta1.TargetAllocatorAllocationStrategyConsistentHashing, + PodDisruptionBudget: &v1beta1.PodDisruptionBudgetSpec{ MinAvailable: &intstr.IntOrString{ Type: intstr.String, StrVal: "10%", @@ -319,13 +356,13 @@ func TestCollectorDefaultingWebhook(t *testing.T) { }, { name: "Defined PDB for target allocator per-node", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeDeployment, - TargetAllocator: TargetAllocatorEmbedded{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeDeployment, + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, - AllocationStrategy: TargetAllocatorAllocationStrategyPerNode, - PodDisruptionBudget: &PodDisruptionBudgetSpec{ + AllocationStrategy: v1beta1.TargetAllocatorAllocationStrategyPerNode, + PodDisruptionBudget: &v1beta1.PodDisruptionBudgetSpec{ MinAvailable: &intstr.IntOrString{ Type: intstr.String, StrVal: "10%", @@ -334,23 +371,23 @@ func TestCollectorDefaultingWebhook(t *testing.T) { }, }, }, - expected: OpenTelemetryCollector{ + expected: v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{}, }, - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeDeployment, - OpenTelemetryCommonFields: OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeDeployment, + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Args: map[string]string{"feature-gates": "-component.UseLocalHostAsDefaultHost"}, Replicas: &one, - ManagementState: ManagementStateManaged, + ManagementState: v1beta1.ManagementStateManaged, }, - UpgradeStrategy: UpgradeStrategyAutomatic, - TargetAllocator: TargetAllocatorEmbedded{ + UpgradeStrategy: v1beta1.UpgradeStrategyAutomatic, + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, Replicas: &one, - AllocationStrategy: TargetAllocatorAllocationStrategyPerNode, - PodDisruptionBudget: &PodDisruptionBudgetSpec{ + AllocationStrategy: v1beta1.TargetAllocatorAllocationStrategyPerNode, + PodDisruptionBudget: &v1beta1.PodDisruptionBudgetSpec{ MinAvailable: &intstr.IntOrString{ Type: intstr.String, StrVal: "10%", @@ -362,80 +399,102 @@ func TestCollectorDefaultingWebhook(t *testing.T) { }, { name: "Undefined PDB for target allocator and consistent-hashing strategy", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeDeployment, - TargetAllocator: TargetAllocatorEmbedded{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeDeployment, + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, Replicas: &one, - AllocationStrategy: TargetAllocatorAllocationStrategyConsistentHashing, + AllocationStrategy: v1beta1.TargetAllocatorAllocationStrategyConsistentHashing, }, }, }, - expected: OpenTelemetryCollector{ + expected: v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{}, }, - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeDeployment, - OpenTelemetryCommonFields: OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeDeployment, + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Args: map[string]string{"feature-gates": "-component.UseLocalHostAsDefaultHost"}, Replicas: &one, - ManagementState: ManagementStateManaged, + ManagementState: v1beta1.ManagementStateManaged, }, - UpgradeStrategy: UpgradeStrategyAutomatic, - TargetAllocator: TargetAllocatorEmbedded{ + UpgradeStrategy: v1beta1.UpgradeStrategyAutomatic, + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, Replicas: &one, - AllocationStrategy: TargetAllocatorAllocationStrategyConsistentHashing, + AllocationStrategy: v1beta1.TargetAllocatorAllocationStrategyConsistentHashing, }, }, }, }, { name: "Undefined PDB for target allocator and not consistent-hashing strategy", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeDeployment, - TargetAllocator: TargetAllocatorEmbedded{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeDeployment, + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, - AllocationStrategy: TargetAllocatorAllocationStrategyLeastWeighted, + AllocationStrategy: v1beta1.TargetAllocatorAllocationStrategyLeastWeighted, }, }, }, - expected: OpenTelemetryCollector{ + expected: v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{}, }, - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeDeployment, - OpenTelemetryCommonFields: OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeDeployment, + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Args: map[string]string{"feature-gates": "-component.UseLocalHostAsDefaultHost"}, Replicas: &one, - ManagementState: ManagementStateManaged, + ManagementState: v1beta1.ManagementStateManaged, }, - UpgradeStrategy: UpgradeStrategyAutomatic, - TargetAllocator: TargetAllocatorEmbedded{ + UpgradeStrategy: v1beta1.UpgradeStrategyAutomatic, + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, Replicas: &one, - AllocationStrategy: TargetAllocatorAllocationStrategyLeastWeighted, + AllocationStrategy: v1beta1.TargetAllocatorAllocationStrategyLeastWeighted, }, }, }, }, } + bv := func(collector v1beta1.OpenTelemetryCollector) admission.Warnings { + var warnings admission.Warnings + cfg := config.New( + config.WithCollectorImage("default-collector"), + config.WithTargetAllocatorImage("default-ta-allocator"), + ) + params := manifests.Params{ + Log: logr.Discard(), + Config: cfg, + OtelCol: collector, + } + _, err := collectorManifests.Build(params) + if err != nil { + warnings = append(warnings, err.Error()) + return warnings + } + return nil + } + for _, test := range tests { test := test t.Run(test.name, func(t *testing.T) { - cvw := &CollectorWebhook{ - logger: logr.Discard(), - scheme: testScheme, - cfg: config.New( + cvw := v1beta1.NewCollectorWebhook( + logr.Discard(), + testScheme, + config.New( config.WithCollectorImage("collector:v0.0.0"), config.WithTargetAllocatorImage("ta:v0.0.0"), ), - } + getReviewer(test.shouldFailSar), + nil, + bv, + ) ctx := context.Background() err := cvw.Default(ctx, &test.otelcol) assert.NoError(t, err) @@ -468,29 +527,29 @@ func TestOTELColValidatingWebhook(t *testing.T) { three := int32(3) five := int32(5) - cfg := Config{} + cfg := v1beta1.Config{} err := yaml.Unmarshal([]byte(cfgYaml), &cfg) require.NoError(t, err) tests := []struct { //nolint:govet name string - otelcol OpenTelemetryCollector + otelcol v1beta1.OpenTelemetryCollector expectedErr string expectedWarnings []string shouldFailSar bool }{ { name: "valid empty spec", - otelcol: OpenTelemetryCollector{}, + otelcol: v1beta1.OpenTelemetryCollector{}, }, { name: "valid full spec", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeStatefulSet, - OpenTelemetryCommonFields: OpenTelemetryCommonFields{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeStatefulSet, + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Replicas: &three, - Ports: []PortsSpec{ + Ports: []v1beta1.PortsSpec{ { ServicePort: v1.ServicePort{ Name: "port1", @@ -506,7 +565,7 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, }, }, - Autoscaler: &AutoscalerSpec{ + Autoscaler: &v1beta1.AutoscalerSpec{ MinReplicas: &one, MaxReplicas: &five, Behavior: &autoscalingv2.HorizontalPodAutoscalerBehavior{ @@ -520,7 +579,7 @@ func TestOTELColValidatingWebhook(t *testing.T) { TargetCPUUtilization: &five, }, UpgradeStrategy: "adhoc", - TargetAllocator: TargetAllocatorEmbedded{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, }, Config: cfg, @@ -530,12 +589,12 @@ func TestOTELColValidatingWebhook(t *testing.T) { { name: "prom CR admissions warning", shouldFailSar: true, // force failure - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeStatefulSet, - OpenTelemetryCommonFields: OpenTelemetryCommonFields{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeStatefulSet, + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Replicas: &three, - Ports: []PortsSpec{ + Ports: []v1beta1.PortsSpec{ { ServicePort: v1.ServicePort{ Name: "port1", @@ -551,7 +610,7 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, }, }, - Autoscaler: &AutoscalerSpec{ + Autoscaler: &v1beta1.AutoscalerSpec{ MinReplicas: &one, MaxReplicas: &five, Behavior: &autoscalingv2.HorizontalPodAutoscalerBehavior{ @@ -565,9 +624,9 @@ func TestOTELColValidatingWebhook(t *testing.T) { TargetCPUUtilization: &five, }, UpgradeStrategy: "adhoc", - TargetAllocator: TargetAllocatorEmbedded{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, - PrometheusCR: TargetAllocatorPrometheusCR{Enabled: true}, + PrometheusCR: v1beta1.TargetAllocatorPrometheusCR{Enabled: true}, }, Config: cfg, }, @@ -590,13 +649,13 @@ func TestOTELColValidatingWebhook(t *testing.T) { { name: "prom CR no admissions warning", shouldFailSar: false, // force SAR okay - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeStatefulSet, + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeStatefulSet, UpgradeStrategy: "adhoc", - OpenTelemetryCommonFields: OpenTelemetryCommonFields{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Replicas: &three, - Ports: []PortsSpec{ + Ports: []v1beta1.PortsSpec{ { ServicePort: v1.ServicePort{ Name: "port1", @@ -612,7 +671,7 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, }, }, - Autoscaler: &AutoscalerSpec{ + Autoscaler: &v1beta1.AutoscalerSpec{ Behavior: &autoscalingv2.HorizontalPodAutoscalerBehavior{ ScaleDown: &autoscalingv2.HPAScalingRules{ StabilizationWindowSeconds: &three, @@ -623,9 +682,9 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, TargetCPUUtilization: &five, }, - TargetAllocator: TargetAllocatorEmbedded{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, - PrometheusCR: TargetAllocatorPrometheusCR{Enabled: true}, + PrometheusCR: v1beta1.TargetAllocatorPrometheusCR{Enabled: true}, }, Config: cfg, }, @@ -633,10 +692,10 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid mode with volume claim templates", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeSidecar, - StatefulSetCommonFields: StatefulSetCommonFields{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeSidecar, + StatefulSetCommonFields: v1beta1.StatefulSetCommonFields{ VolumeClaimTemplates: []v1.PersistentVolumeClaim{{}, {}}, }, }, @@ -645,10 +704,10 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid mode with tolerations", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeSidecar, - OpenTelemetryCommonFields: OpenTelemetryCommonFields{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeSidecar, + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Tolerations: []v1.Toleration{{}, {}}, }, }, @@ -657,10 +716,10 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid mode with target allocator", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeDeployment, - TargetAllocator: TargetAllocatorEmbedded{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeDeployment, + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, }, }, @@ -669,10 +728,10 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid target allocator config", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeStatefulSet, - TargetAllocator: TargetAllocatorEmbedded{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeStatefulSet, + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, }, }, @@ -681,12 +740,12 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid target allocation strategy", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeDaemonSet, - TargetAllocator: TargetAllocatorEmbedded{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeDaemonSet, + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, - AllocationStrategy: TargetAllocatorAllocationStrategyLeastWeighted, + AllocationStrategy: v1beta1.TargetAllocatorAllocationStrategyLeastWeighted, }, }, }, @@ -694,10 +753,10 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid port name", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: OpenTelemetryCommonFields{ - Ports: []PortsSpec{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ + Ports: []v1beta1.PortsSpec{ { ServicePort: v1.ServicePort{ // this port name contains a non alphanumeric character, which is invalid. @@ -714,10 +773,10 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid port name, too long", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: OpenTelemetryCommonFields{ - Ports: []PortsSpec{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ + Ports: []v1beta1.PortsSpec{ { ServicePort: v1.ServicePort{ Name: "aaaabbbbccccdddd", // len: 16, too long @@ -732,10 +791,10 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid port num", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: OpenTelemetryCommonFields{ - Ports: []PortsSpec{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ + Ports: []v1beta1.PortsSpec{ { ServicePort: v1.ServicePort{ Name: "aaaabbbbccccddd", // len: 15 @@ -750,9 +809,9 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid max replicas", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Autoscaler: &AutoscalerSpec{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Autoscaler: &v1beta1.AutoscalerSpec{ MaxReplicas: &zero, }, }, @@ -761,12 +820,12 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid replicas, greater than max", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: OpenTelemetryCommonFields{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Replicas: &five, }, - Autoscaler: &AutoscalerSpec{ + Autoscaler: &v1beta1.AutoscalerSpec{ MaxReplicas: &three, }, }, @@ -775,9 +834,9 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid min replicas, greater than max", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Autoscaler: &AutoscalerSpec{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Autoscaler: &v1beta1.AutoscalerSpec{ MaxReplicas: &three, MinReplicas: &five, }, @@ -787,9 +846,9 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid min replicas, lesser than 1", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Autoscaler: &AutoscalerSpec{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Autoscaler: &v1beta1.AutoscalerSpec{ MaxReplicas: &three, MinReplicas: &zero, }, @@ -799,9 +858,9 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid autoscaler scale down", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Autoscaler: &AutoscalerSpec{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Autoscaler: &v1beta1.AutoscalerSpec{ MaxReplicas: &three, Behavior: &autoscalingv2.HorizontalPodAutoscalerBehavior{ ScaleDown: &autoscalingv2.HPAScalingRules{ @@ -815,9 +874,9 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid autoscaler scale up", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Autoscaler: &AutoscalerSpec{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Autoscaler: &v1beta1.AutoscalerSpec{ MaxReplicas: &three, Behavior: &autoscalingv2.HorizontalPodAutoscalerBehavior{ ScaleUp: &autoscalingv2.HPAScalingRules{ @@ -831,9 +890,9 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid autoscaler target cpu utilization", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Autoscaler: &AutoscalerSpec{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Autoscaler: &v1beta1.AutoscalerSpec{ MaxReplicas: &three, TargetCPUUtilization: &zero, }, @@ -843,9 +902,9 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid autoscaler target memory utilization", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Autoscaler: &AutoscalerSpec{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Autoscaler: &v1beta1.AutoscalerSpec{ MaxReplicas: &three, TargetMemoryUtilization: &zero, }, @@ -855,9 +914,9 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "autoscaler minReplicas is less than maxReplicas", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Autoscaler: &AutoscalerSpec{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Autoscaler: &v1beta1.AutoscalerSpec{ MaxReplicas: &one, MinReplicas: &five, }, @@ -867,11 +926,11 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid autoscaler metric type", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Autoscaler: &AutoscalerSpec{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Autoscaler: &v1beta1.AutoscalerSpec{ MaxReplicas: &three, - Metrics: []MetricSpec{ + Metrics: []v1beta1.MetricSpec{ { Type: autoscalingv2.ResourceMetricSourceType, }, @@ -883,11 +942,11 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid pod metric average value", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Autoscaler: &AutoscalerSpec{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Autoscaler: &v1beta1.AutoscalerSpec{ MaxReplicas: &three, - Metrics: []MetricSpec{ + Metrics: []v1beta1.MetricSpec{ { Type: autoscalingv2.PodsMetricSourceType, Pods: &autoscalingv2.PodsMetricSource{ @@ -908,11 +967,11 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "utilization target is not valid with pod metrics", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Autoscaler: &AutoscalerSpec{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Autoscaler: &v1beta1.AutoscalerSpec{ MaxReplicas: &three, - Metrics: []MetricSpec{ + Metrics: []v1beta1.MetricSpec{ { Type: autoscalingv2.PodsMetricSourceType, Pods: &autoscalingv2.PodsMetricSource{ @@ -932,25 +991,23 @@ func TestOTELColValidatingWebhook(t *testing.T) { expectedErr: "the OpenTelemetry Spec autoscale configuration is incorrect, invalid pods target type", }, { - name: "invalid deployment mode incompabible with ingress settings", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeSidecar, - Ingress: Ingress{ - Type: IngressTypeIngress, + name: "invalid deployment mode incompatible with ingress settings", + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeSidecar, + Ingress: v1beta1.Ingress{ + Type: v1beta1.IngressTypeIngress, }, }, }, - expectedErr: fmt.Sprintf("Ingress can only be used in combination with the modes: %s, %s, %s", - ModeDeployment, ModeDaemonSet, ModeStatefulSet, - ), + expectedErr: fmt.Sprintf("Ingress can only be used in combination with the modes: %s, %s, %s", v1beta1.ModeDeployment, v1beta1.ModeDaemonSet, v1beta1.ModeStatefulSet), }, { name: "invalid mode with priorityClassName", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeSidecar, - OpenTelemetryCommonFields: OpenTelemetryCommonFields{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeSidecar, + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ PriorityClassName: "test-class", }, }, @@ -959,10 +1016,10 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid mode with affinity", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeSidecar, - OpenTelemetryCommonFields: OpenTelemetryCommonFields{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeSidecar, + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Affinity: &v1.Affinity{ NodeAffinity: &v1.NodeAffinity{ RequiredDuringSchedulingIgnoredDuringExecution: &v1.NodeSelector{ @@ -987,9 +1044,9 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid InitialDelaySeconds", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - LivenessProbe: &Probe{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + LivenessProbe: &v1beta1.Probe{ InitialDelaySeconds: &minusOne, }, }, @@ -998,9 +1055,9 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid InitialDelaySeconds readiness", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - ReadinessProbe: &Probe{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + ReadinessProbe: &v1beta1.Probe{ InitialDelaySeconds: &minusOne, }, }, @@ -1009,9 +1066,9 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid PeriodSeconds", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - LivenessProbe: &Probe{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + LivenessProbe: &v1beta1.Probe{ PeriodSeconds: &zero, }, }, @@ -1020,9 +1077,9 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid PeriodSeconds readiness", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - ReadinessProbe: &Probe{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + ReadinessProbe: &v1beta1.Probe{ PeriodSeconds: &zero, }, }, @@ -1031,9 +1088,9 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid TimeoutSeconds", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - LivenessProbe: &Probe{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + LivenessProbe: &v1beta1.Probe{ TimeoutSeconds: &zero, }, }, @@ -1042,9 +1099,9 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid TimeoutSeconds readiness", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - ReadinessProbe: &Probe{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + ReadinessProbe: &v1beta1.Probe{ TimeoutSeconds: &zero, }, }, @@ -1053,9 +1110,9 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid SuccessThreshold", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - LivenessProbe: &Probe{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + LivenessProbe: &v1beta1.Probe{ SuccessThreshold: &zero, }, }, @@ -1064,9 +1121,9 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid SuccessThreshold readiness", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - ReadinessProbe: &Probe{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + ReadinessProbe: &v1beta1.Probe{ SuccessThreshold: &zero, }, }, @@ -1075,9 +1132,9 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid FailureThreshold", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - LivenessProbe: &Probe{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + LivenessProbe: &v1beta1.Probe{ FailureThreshold: &zero, }, }, @@ -1086,9 +1143,9 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid FailureThreshold readiness", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - ReadinessProbe: &Probe{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + ReadinessProbe: &v1beta1.Probe{ FailureThreshold: &zero, }, }, @@ -1097,9 +1154,9 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid TerminationGracePeriodSeconds", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - LivenessProbe: &Probe{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + LivenessProbe: &v1beta1.Probe{ TerminationGracePeriodSeconds: &zero64, }, }, @@ -1108,9 +1165,9 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid TerminationGracePeriodSeconds readiness", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - ReadinessProbe: &Probe{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + ReadinessProbe: &v1beta1.Probe{ TerminationGracePeriodSeconds: &zero64, }, }, @@ -1119,10 +1176,10 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid AdditionalContainers", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeSidecar, - OpenTelemetryCommonFields: OpenTelemetryCommonFields{ + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeSidecar, + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ AdditionalContainers: []v1.Container{ { Name: "test", @@ -1135,10 +1192,10 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "missing ingress hostname for subdomain ruleType", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Ingress: Ingress{ - RuleType: IngressRuleTypeSubdomain, + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Ingress: v1beta1.Ingress{ + RuleType: v1beta1.IngressRuleTypeSubdomain, }, }, }, @@ -1146,9 +1203,9 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid updateStrategy for Deployment mode", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeDeployment, + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeDeployment, DaemonSetUpdateStrategy: appsv1.DaemonSetUpdateStrategy{ Type: "RollingUpdate", RollingUpdate: &appsv1.RollingUpdateDaemonSet{ @@ -1162,9 +1219,9 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, { name: "invalid updateStrategy for Statefulset mode", - otelcol: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{ - Mode: ModeStatefulSet, + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Mode: v1beta1.ModeStatefulSet, DeploymentUpdateStrategy: appsv1.DeploymentStrategy{ Type: "RollingUpdate", RollingUpdate: &appsv1.RollingUpdateDeployment{ @@ -1176,20 +1233,59 @@ func TestOTELColValidatingWebhook(t *testing.T) { }, expectedErr: "the OpenTelemetry Collector mode is set to statefulset, which does not support the attribute 'deploymentUpdateStrategy'", }, + { + name: "missing port for ingress type", + otelcol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ + Ports: []v1beta1.PortsSpec{ + { + ServicePort: v1.ServicePort{}, + }, + }, + }, + Ingress: v1beta1.Ingress{ + Type: v1beta1.IngressTypeIngress, + }, + }, + }, + expectedErr: "the OpenTelemetry Spec Ports configuration is incorrect", + }, + } + + bv := func(collector v1beta1.OpenTelemetryCollector) admission.Warnings { + var warnings admission.Warnings + cfg := config.New( + config.WithCollectorImage("default-collector"), + config.WithTargetAllocatorImage("default-ta-allocator"), + ) + params := manifests.Params{ + Log: logr.Discard(), + Config: cfg, + OtelCol: collector, + } + _, err := collectorManifests.Build(params) + if err != nil { + warnings = append(warnings, err.Error()) + return warnings + } + return nil } for _, test := range tests { test := test t.Run(test.name, func(t *testing.T) { - cvw := &CollectorWebhook{ - logger: logr.Discard(), - scheme: testScheme, - cfg: config.New( + cvw := v1beta1.NewCollectorWebhook( + logr.Discard(), + testScheme, + config.New( config.WithCollectorImage("collector:v0.0.0"), config.WithTargetAllocatorImage("ta:v0.0.0"), ), - reviewer: getReviewer(test.shouldFailSar), - } + getReviewer(test.shouldFailSar), + nil, + bv, + ) ctx := context.Background() warnings, err := cvw.ValidateCreate(ctx, &test.otelcol) if test.expectedErr == "" { @@ -1206,35 +1302,57 @@ func TestOTELColValidatingWebhook(t *testing.T) { func TestOTELColValidateUpdateWebhook(t *testing.T) { tests := []struct { //nolint:govet name string - otelcolOld OpenTelemetryCollector - otelcolNew OpenTelemetryCollector + otelcolOld v1beta1.OpenTelemetryCollector + otelcolNew v1beta1.OpenTelemetryCollector expectedErr string expectedWarnings []string shouldFailSar bool }{ { name: "mode should not be changed", - otelcolOld: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{Mode: ModeStatefulSet}, + otelcolOld: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{Mode: v1beta1.ModeStatefulSet}, }, - otelcolNew: OpenTelemetryCollector{ - Spec: OpenTelemetryCollectorSpec{Mode: ModeDeployment}, + otelcolNew: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{Mode: v1beta1.ModeDeployment}, }, expectedErr: "which does not support modification", }, } + + bv := func(collector v1beta1.OpenTelemetryCollector) admission.Warnings { + var warnings admission.Warnings + cfg := config.New( + config.WithCollectorImage("default-collector"), + config.WithTargetAllocatorImage("default-ta-allocator"), + ) + params := manifests.Params{ + Log: logr.Discard(), + Config: cfg, + OtelCol: collector, + } + _, err := collectorManifests.Build(params) + if err != nil { + warnings = append(warnings, err.Error()) + return warnings + } + return nil + } + for _, test := range tests { test := test t.Run(test.name, func(t *testing.T) { - cvw := &CollectorWebhook{ - logger: logr.Discard(), - scheme: testScheme, - cfg: config.New( + cvw := v1beta1.NewCollectorWebhook( + logr.Discard(), + testScheme, + config.New( config.WithCollectorImage("collector:v0.0.0"), config.WithTargetAllocatorImage("ta:v0.0.0"), ), - reviewer: getReviewer(test.shouldFailSar), - } + getReviewer(test.shouldFailSar), + nil, + bv, + ) ctx := context.Background() warnings, err := cvw.ValidateUpdate(ctx, &test.otelcolOld, &test.otelcolNew) if test.expectedErr == "" { diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 372a75ae43..5c5f0b84cb 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -1,3 +1,2 @@ resources: - manager.yaml - diff --git a/controllers/opentelemetrycollector_controller.go b/controllers/opentelemetrycollector_controller.go index be370ba795..8c616700a6 100644 --- a/controllers/opentelemetrycollector_controller.go +++ b/controllers/opentelemetrycollector_controller.go @@ -168,7 +168,7 @@ func (r *OpenTelemetryCollectorReconciler) getConfigMapsToRemove(configVersionsT return ownedConfigMaps } -func (r *OpenTelemetryCollectorReconciler) getParams(instance v1beta1.OpenTelemetryCollector) (manifests.Params, error) { +func (r *OpenTelemetryCollectorReconciler) GetParams(instance v1beta1.OpenTelemetryCollector) (manifests.Params, error) { p := manifests.Params{ Config: r.config, Client: r.Client, @@ -229,7 +229,7 @@ func (r *OpenTelemetryCollectorReconciler) Reconcile(ctx context.Context, req ct return ctrl.Result{}, client.IgnoreNotFound(err) } - params, err := r.getParams(instance) + params, err := r.GetParams(instance) if err != nil { log.Error(err, "Failed to create manifest.Params") return ctrl.Result{}, err diff --git a/controllers/suite_test.go b/controllers/suite_test.go index 0836809719..3e584f8f8a 100644 --- a/controllers/suite_test.go +++ b/controllers/suite_test.go @@ -178,7 +178,7 @@ func TestMain(m *testing.M) { } reviewer := rbac.NewReviewer(clientset) - if err = v1beta1.SetupCollectorWebhook(mgr, config.New(), reviewer, nil); err != nil { + if err = v1beta1.SetupCollectorWebhook(mgr, config.New(), reviewer, nil, nil); err != nil { fmt.Printf("failed to SetupWebhookWithManager: %v", err) os.Exit(1) } diff --git a/internal/webhook/podmutation/webhookhandler_suite_test.go b/internal/webhook/podmutation/webhookhandler_suite_test.go index 1336cab0e8..8448762f5d 100644 --- a/internal/webhook/podmutation/webhookhandler_suite_test.go +++ b/internal/webhook/podmutation/webhookhandler_suite_test.go @@ -105,7 +105,7 @@ func TestMain(m *testing.M) { } reviewer := rbac.NewReviewer(clientset) - if err = v1beta1.SetupCollectorWebhook(mgr, config.New(), reviewer, nil); err != nil { + if err = v1beta1.SetupCollectorWebhook(mgr, config.New(), reviewer, nil, nil); err != nil { fmt.Printf("failed to SetupWebhookWithManager: %v", err) os.Exit(1) } diff --git a/main.go b/main.go index fbfca13ffe..25913cd28f 100644 --- a/main.go +++ b/main.go @@ -53,6 +53,7 @@ import ( "github.com/open-telemetry/opentelemetry-operator/internal/autodetect/openshift" "github.com/open-telemetry/opentelemetry-operator/internal/autodetect/prometheus" "github.com/open-telemetry/opentelemetry-operator/internal/config" + collectorManifests "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector" openshiftDashboards "github.com/open-telemetry/opentelemetry-operator/internal/openshift/dashboards" "github.com/open-telemetry/opentelemetry-operator/internal/rbac" "github.com/open-telemetry/opentelemetry-operator/internal/version" @@ -365,13 +366,15 @@ func main() { os.Exit(1) } - if err = controllers.NewReconciler(controllers.Params{ + collectorReconciler := controllers.NewReconciler(controllers.Params{ Client: mgr.GetClient(), Log: ctrl.Log.WithName("controllers").WithName("OpenTelemetryCollector"), Scheme: mgr.GetScheme(), Config: cfg, Recorder: mgr.GetEventRecorderFor("opentelemetry-operator"), - }).SetupWithManager(mgr); err != nil { + }) + + if err = collectorReconciler.SetupWithManager(mgr); err != nil { setupLog.Error(err, "unable to create controller", "controller", "OpenTelemetryCollector") os.Exit(1) } @@ -403,7 +406,22 @@ func main() { } - if err = otelv1beta1.SetupCollectorWebhook(mgr, cfg, reviewer, crdMetrics); err != nil { + bv := func(collector otelv1beta1.OpenTelemetryCollector) admission.Warnings { + var warnings admission.Warnings + params, newErr := collectorReconciler.GetParams(collector) + if err != nil { + warnings = append(warnings, newErr.Error()) + return warnings + } + _, newErr = collectorManifests.Build(params) + if newErr != nil { + warnings = append(warnings, newErr.Error()) + return warnings + } + return warnings + } + + if err = otelv1beta1.SetupCollectorWebhook(mgr, cfg, reviewer, crdMetrics, bv); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "OpenTelemetryCollector") os.Exit(1) } diff --git a/pkg/collector/upgrade/suite_test.go b/pkg/collector/upgrade/suite_test.go index fdafdca245..89a56d8b40 100644 --- a/pkg/collector/upgrade/suite_test.go +++ b/pkg/collector/upgrade/suite_test.go @@ -105,7 +105,7 @@ func TestMain(m *testing.M) { } reviewer := rbac.NewReviewer(clientset) - if err = v1beta1.SetupCollectorWebhook(mgr, config.New(), reviewer, nil); err != nil { + if err = v1beta1.SetupCollectorWebhook(mgr, config.New(), reviewer, nil, nil); err != nil { fmt.Printf("failed to SetupWebhookWithManager: %v", err) os.Exit(1) } From 8136014faf237f96f95b36e225258ead913c15a0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 10:19:04 +0200 Subject: [PATCH 31/41] Bump kyverno/action-install-chainsaw from 0.2.8 to 0.2.9 (#3274) Bumps [kyverno/action-install-chainsaw](https://github.com/kyverno/action-install-chainsaw) from 0.2.8 to 0.2.9. - [Release notes](https://github.com/kyverno/action-install-chainsaw/releases) - [Commits](https://github.com/kyverno/action-install-chainsaw/compare/v0.2.8...v0.2.9) --- updated-dependencies: - dependency-name: kyverno/action-install-chainsaw dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/e2e.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 677b7b0806..40ac159045 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -57,7 +57,7 @@ jobs: path: bin key: ${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('Makefile') }}-${{ steps.setup-go.outputs.go-version }} - name: Install chainsaw - uses: kyverno/action-install-chainsaw@v0.2.8 + uses: kyverno/action-install-chainsaw@v0.2.9 - name: Install tools run: make install-tools - name: Prepare e2e tests From 789e2c23b526bc6e0aa8b2c367d1435fbac4ccc0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 10:19:30 +0200 Subject: [PATCH 32/41] Bump github.com/prometheus/client_golang from 1.20.2 to 1.20.3 (#3272) Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.20.2 to 1.20.3. - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/v1.20.3/CHANGELOG.md) - [Commits](https://github.com/prometheus/client_golang/compare/v1.20.2...v1.20.3) --- updated-dependencies: - dependency-name: github.com/prometheus/client_golang dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 569f5081a6..1ba90f5086 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,7 @@ require ( github.com/prometheus-operator/prometheus-operator v0.76.0 github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.76.0 github.com/prometheus-operator/prometheus-operator/pkg/client v0.76.0 - github.com/prometheus/client_golang v1.20.2 + github.com/prometheus/client_golang v1.20.3 github.com/prometheus/common v0.57.0 github.com/prometheus/prometheus v0.54.1 github.com/shirou/gopsutil v3.21.11+incompatible diff --git a/go.sum b/go.sum index d102c645c6..a2d64d36e6 100644 --- a/go.sum +++ b/go.sum @@ -544,8 +544,8 @@ github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3O github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= -github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.3 h1:oPksm4K8B+Vt35tUhw6GbSNSgVlVSBH0qELP/7u83l4= +github.com/prometheus/client_golang v1.20.3/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= From 9c60e70930d0eafb6599adf1c647e888f785801b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 10:44:00 +0200 Subject: [PATCH 33/41] Bump github.com/prometheus-operator/prometheus-operator/pkg/client (#3271) Bumps the prometheus group with 1 update: [github.com/prometheus-operator/prometheus-operator/pkg/client](https://github.com/prometheus-operator/prometheus-operator). Updates `github.com/prometheus-operator/prometheus-operator/pkg/client` from 0.76.0 to 0.76.1 - [Release notes](https://github.com/prometheus-operator/prometheus-operator/releases) - [Changelog](https://github.com/prometheus-operator/prometheus-operator/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus-operator/prometheus-operator/compare/v0.76.0...v0.76.1) --- updated-dependencies: - dependency-name: github.com/prometheus-operator/prometheus-operator/pkg/client dependency-type: direct:production update-type: version-update:semver-patch dependency-group: prometheus ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 1ba90f5086..c6f7f79f42 100644 --- a/go.mod +++ b/go.mod @@ -22,8 +22,8 @@ require ( github.com/openshift/api v0.0.0-20240124164020-e2ce40831f2e github.com/operator-framework/operator-lib v0.15.0 github.com/prometheus-operator/prometheus-operator v0.76.0 - github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.76.0 - github.com/prometheus-operator/prometheus-operator/pkg/client v0.76.0 + github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.76.1 + github.com/prometheus-operator/prometheus-operator/pkg/client v0.76.1 github.com/prometheus/client_golang v1.20.3 github.com/prometheus/common v0.57.0 github.com/prometheus/prometheus v0.54.1 diff --git a/go.sum b/go.sum index a2d64d36e6..9fe335a8c5 100644 --- a/go.sum +++ b/go.sum @@ -532,10 +532,10 @@ github.com/prometheus-community/prom-label-proxy v0.11.0 h1:IO02WiiFMfcIqvjhwMbC github.com/prometheus-community/prom-label-proxy v0.11.0/go.mod h1:lfvrG70XqsxWDrSh1843QXBG0fSg8EbIXmAo8xGsvw8= github.com/prometheus-operator/prometheus-operator v0.76.0 h1:EjGJiQVF3BUy/iygeRlN6iMBIAySMGZobEm7+7A95pI= github.com/prometheus-operator/prometheus-operator v0.76.0/go.mod h1:y4PxsSBsOBwK1vXIw9U8DGLi8EptquItyP2IpqUtTGs= -github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.76.0 h1:tRwEFYFg+To2TGnibGl8dHBCh8Z/BVNKnXj2O5Za/2M= -github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.76.0/go.mod h1:Rd8YnCqz+2FYsiGmE2DMlaLjQRB4v2jFNnzCt9YY4IM= -github.com/prometheus-operator/prometheus-operator/pkg/client v0.76.0 h1:bJhRd6R4kaYBZpH7cBrzbJpEKJjHx8cbVW1n3dxYnag= -github.com/prometheus-operator/prometheus-operator/pkg/client v0.76.0/go.mod h1:Nu6G9XLApnqXqunMwMYulcHlaxRwoveH4p4WnZsBHD8= +github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.76.1 h1:QU2cs0xxKYvF1JfibP/8vs+pFy6OvIpqNR2lYC4jYNU= +github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.76.1/go.mod h1:Rd8YnCqz+2FYsiGmE2DMlaLjQRB4v2jFNnzCt9YY4IM= +github.com/prometheus-operator/prometheus-operator/pkg/client v0.76.1 h1:wMPmeRdflJFu14F0YaIiOIYGkBDDKipkeWW0q53d2+s= +github.com/prometheus-operator/prometheus-operator/pkg/client v0.76.1/go.mod h1:7vND+IkdMpZyfSyRs6P5/uXz6BlFDaOj8olErODi8I0= github.com/prometheus/alertmanager v0.27.0 h1:V6nTa2J5V4s8TG4C4HtrBP/WNSebCCTYGGv4qecA/+I= github.com/prometheus/alertmanager v0.27.0/go.mod h1:8Ia/R3urPmbzJ8OsdvmZvIprDwvwmYCmUbwBL+jlPOE= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= From e203cbca25d83e3c14592ad3d30595704d8c0806 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 10:57:41 +0200 Subject: [PATCH 34/41] Bump github.com/prometheus/common from 0.57.0 to 0.59.1 (#3273) Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.57.0 to 0.59.1. - [Release notes](https://github.com/prometheus/common/releases) - [Changelog](https://github.com/prometheus/common/blob/main/RELEASE.md) - [Commits](https://github.com/prometheus/common/compare/v0.57.0...v0.59.1) --- updated-dependencies: - dependency-name: github.com/prometheus/common dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index c6f7f79f42..05e6f86a39 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,7 @@ require ( github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.76.1 github.com/prometheus-operator/prometheus-operator/pkg/client v0.76.1 github.com/prometheus/client_golang v1.20.3 - github.com/prometheus/common v0.57.0 + github.com/prometheus/common v0.59.1 github.com/prometheus/prometheus v0.54.1 github.com/shirou/gopsutil v3.21.11+incompatible github.com/spf13/pflag v1.0.5 diff --git a/go.sum b/go.sum index 9fe335a8c5..20c8ca9006 100644 --- a/go.sum +++ b/go.sum @@ -557,8 +557,8 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= -github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= +github.com/prometheus/common v0.59.1 h1:LXb1quJHWm1P6wq/U824uxYi4Sg0oGvNeUm1z5dJoX0= +github.com/prometheus/common v0.59.1/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0= github.com/prometheus/common/sigv4 v0.1.0 h1:qoVebwtwwEhS85Czm2dSROY5fTo2PAPEVdDeppTwGX4= github.com/prometheus/common/sigv4 v0.1.0/go.mod h1:2Jkxxk9yYvCkE5G1sQT7GuEXm57JrvHu9k5YwTjsNtI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= From 2a53c4e792e198ba3614fcf65956e770ea71b72a Mon Sep 17 00:00:00 2001 From: David Haja Date: Thu, 12 Sep 2024 18:38:29 +0200 Subject: [PATCH 35/41] Deprecate label flag and Align label filter flag with attribute filter flag name (#3232) * Deprecating label flag and introducing labels-filter flag Signed-off-by: root * Add changelog for labels-filter flag alignment * change_type modified to deprecation, mention deprecated and new flags in changelog and follow-up issue * Fix label filtering flag in e2e tests --------- Signed-off-by: root --- .chloggen/3218-align-label-filter-flag.yaml | 16 ++++++++++++++++ .github/workflows/e2e.yaml | 2 +- main.go | 7 ++++++- 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100755 .chloggen/3218-align-label-filter-flag.yaml diff --git a/.chloggen/3218-align-label-filter-flag.yaml b/.chloggen/3218-align-label-filter-flag.yaml new file mode 100755 index 0000000000..3daf4a7cf1 --- /dev/null +++ b/.chloggen/3218-align-label-filter-flag.yaml @@ -0,0 +1,16 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: deprecation + +# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) +component: operator + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Deprecated `label` flag and introduced `labels-filter` flag to align the label filtering with the attribute filtering flag name. The `label` flag will be removed when #3236 issue is resolved." + +# One or more tracking issues related to the change +issues: [3218] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 40ac159045..08e6da0b83 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -40,7 +40,7 @@ jobs: - group: e2e-multi-instrumentation setup: "add-multi-instrumentation-params prepare-e2e" - group: e2e-metadata-filters - setup: "add-operator-arg OPERATOR_ARG='--annotations-filter=.*filter.out --annotations-filter=config.*.gke.io.* --labels=.*filter.out' prepare-e2e" + setup: "add-operator-arg OPERATOR_ARG='--annotations-filter=.*filter.out --annotations-filter=config.*.gke.io.* --labels-filter=.*filter.out' prepare-e2e" - group: e2e-automatic-rbac setup: "add-rbac-permissions-to-operator prepare-e2e" steps: diff --git a/main.go b/main.go index 25913cd28f..951ba2ee1a 100644 --- a/main.go +++ b/main.go @@ -133,6 +133,7 @@ func main() { autoInstrumentationNginx string autoInstrumentationGo string labelsFilter []string + tmplabelsFilter []string annotationsFilter []string webhookPort int tlsOpt tlsConfig @@ -170,7 +171,8 @@ func main() { stringFlagOrEnv(&autoInstrumentationGo, "auto-instrumentation-go-image", "RELATED_IMAGE_AUTO_INSTRUMENTATION_GO", fmt.Sprintf("ghcr.io/open-telemetry/opentelemetry-go-instrumentation/autoinstrumentation-go:%s", v.AutoInstrumentationGo), "The default OpenTelemetry Go instrumentation image. This image is used when no image is specified in the CustomResource.") stringFlagOrEnv(&autoInstrumentationApacheHttpd, "auto-instrumentation-apache-httpd-image", "RELATED_IMAGE_AUTO_INSTRUMENTATION_APACHE_HTTPD", fmt.Sprintf("ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-apache-httpd:%s", v.AutoInstrumentationApacheHttpd), "The default OpenTelemetry Apache HTTPD instrumentation image. This image is used when no image is specified in the CustomResource.") stringFlagOrEnv(&autoInstrumentationNginx, "auto-instrumentation-nginx-image", "RELATED_IMAGE_AUTO_INSTRUMENTATION_NGINX", fmt.Sprintf("ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-apache-httpd:%s", v.AutoInstrumentationNginx), "The default OpenTelemetry Nginx instrumentation image. This image is used when no image is specified in the CustomResource.") - pflag.StringArrayVar(&labelsFilter, "label", []string{}, "Labels to filter away from propagating onto deploys. It should be a string array containing patterns, which are literal strings optionally containing a * wildcard character. Example: --label=.*filter.out will filter out labels that looks like: label.filter.out: true") + pflag.StringArrayVar(&labelsFilter, "labels-filter", []string{}, "Labels to filter away from propagating onto deploys. It should be a string array containing patterns, which are literal strings optionally containing a * wildcard character. Example: --labels-filter=.*filter.out will filter out labels that looks like: label.filter.out: true") + pflag.StringArrayVar(&tmplabelsFilter, "label", []string{}, "(Deprecated, please use the labels-filter flag) Labels to filter away from propagating onto deploys. It should be a string array containing patterns, which are literal strings optionally containing a * wildcard character. Example: --label=.*filter.out will filter out labels that looks like: label.filter.out: true") pflag.StringArrayVar(&annotationsFilter, "annotations-filter", []string{}, "Annotations to filter away from propagating onto deploys. It should be a string array containing patterns, which are literal strings optionally containing a * wildcard character. Example: --annotations-filter=.*filter.out will filter out annotations that looks like: annotation.filter.out: true") pflag.StringVar(&tlsOpt.minVersion, "tls-min-version", "VersionTLS12", "Minimum TLS version supported. Value must match version names from https://golang.org/pkg/crypto/tls/#pkg-constants.") pflag.StringSliceVar(&tlsOpt.cipherSuites, "tls-cipher-suites", nil, "Comma-separated list of cipher suites for the server. Values are from tls package constants (https://golang.org/pkg/crypto/tls/#pkg-constants). If omitted, the default Go cipher suites will be used") @@ -181,6 +183,9 @@ func main() { pflag.IntVar(&webhookPort, "webhook-port", 9443, "The port the webhook endpoint binds to.") pflag.Parse() + // Using labelfilters both from label and labels-filter flags, until label flag is removed + labelsFilter = append(labelsFilter, tmplabelsFilter...) + opts.EncoderConfigOptions = append(opts.EncoderConfigOptions, func(ec *zapcore.EncoderConfig) { ec.MessageKey = encodeMessageKey ec.LevelKey = encodeLevelKey From 73c623c746cdf0c2b5bfc51525d2f08b5098f068 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 11:32:14 +0200 Subject: [PATCH 36/41] Bump go.opentelemetry.io/collector/featuregate from 1.14.1 to 1.15.0 (#3291) Bumps [go.opentelemetry.io/collector/featuregate](https://github.com/open-telemetry/opentelemetry-collector) from 1.14.1 to 1.15.0. - [Release notes](https://github.com/open-telemetry/opentelemetry-collector/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-collector/blob/main/CHANGELOG-API.md) - [Commits](https://github.com/open-telemetry/opentelemetry-collector/compare/pdata/v1.14.1...pdata/v1.15.0) --- updated-dependencies: - dependency-name: go.opentelemetry.io/collector/featuregate dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 05e6f86a39..f45b3e2a0d 100644 --- a/go.mod +++ b/go.mod @@ -30,7 +30,7 @@ require ( github.com/shirou/gopsutil v3.21.11+incompatible github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/featuregate v1.14.1 + go.opentelemetry.io/collector/featuregate v1.15.0 go.opentelemetry.io/otel v1.29.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.29.0 go.opentelemetry.io/otel/exporters/prometheus v0.51.0 diff --git a/go.sum b/go.sum index 20c8ca9006..77534bd212 100644 --- a/go.sum +++ b/go.sum @@ -639,8 +639,8 @@ go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/collector/featuregate v1.14.1 h1:5jvlRe1b5FqhGsyYtuwrzNhFLthGCfm98b3PsCRgXDA= -go.opentelemetry.io/collector/featuregate v1.14.1/go.mod h1:47xrISO71vJ83LSMm8+yIDsUbKktUp48Ovt7RR6VbRs= +go.opentelemetry.io/collector/featuregate v1.15.0 h1:8KRWaZaE9hLlyMXnMTvnWtUJnzrBuTI0aLIvxqe8QP0= +go.opentelemetry.io/collector/featuregate v1.15.0/go.mod h1:47xrISO71vJ83LSMm8+yIDsUbKktUp48Ovt7RR6VbRs= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw= From 91a54a3390258fc507d3a1644c5325472fa3b951 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 11:33:33 +0200 Subject: [PATCH 37/41] Bump the kubernetes group with 6 updates (#3289) Bumps the kubernetes group with 6 updates: | Package | From | To | | --- | --- | --- | | [k8s.io/api](https://github.com/kubernetes/api) | `0.31.0` | `0.31.1` | | [k8s.io/apiextensions-apiserver](https://github.com/kubernetes/apiextensions-apiserver) | `0.31.0` | `0.31.1` | | [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) | `0.31.0` | `0.31.1` | | [k8s.io/client-go](https://github.com/kubernetes/client-go) | `0.31.0` | `0.31.1` | | [k8s.io/component-base](https://github.com/kubernetes/component-base) | `0.31.0` | `0.31.1` | | [k8s.io/kubectl](https://github.com/kubernetes/kubectl) | `0.31.0` | `0.31.1` | Updates `k8s.io/api` from 0.31.0 to 0.31.1 - [Commits](https://github.com/kubernetes/api/compare/v0.31.0...v0.31.1) Updates `k8s.io/apiextensions-apiserver` from 0.31.0 to 0.31.1 - [Release notes](https://github.com/kubernetes/apiextensions-apiserver/releases) - [Commits](https://github.com/kubernetes/apiextensions-apiserver/compare/v0.31.0...v0.31.1) Updates `k8s.io/apimachinery` from 0.31.0 to 0.31.1 - [Commits](https://github.com/kubernetes/apimachinery/compare/v0.31.0...v0.31.1) Updates `k8s.io/client-go` from 0.31.0 to 0.31.1 - [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md) - [Commits](https://github.com/kubernetes/client-go/compare/v0.31.0...v0.31.1) Updates `k8s.io/component-base` from 0.31.0 to 0.31.1 - [Commits](https://github.com/kubernetes/component-base/compare/v0.31.0...v0.31.1) Updates `k8s.io/kubectl` from 0.31.0 to 0.31.1 - [Commits](https://github.com/kubernetes/kubectl/compare/v0.31.0...v0.31.1) --- updated-dependencies: - dependency-name: k8s.io/api dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kubernetes - dependency-name: k8s.io/apiextensions-apiserver dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kubernetes - dependency-name: k8s.io/apimachinery dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kubernetes - dependency-name: k8s.io/client-go dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kubernetes - dependency-name: k8s.io/component-base dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kubernetes - dependency-name: k8s.io/kubectl dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kubernetes ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 12 ++++++------ go.sum | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/go.mod b/go.mod index f45b3e2a0d..7245c15f50 100644 --- a/go.mod +++ b/go.mod @@ -41,13 +41,13 @@ require ( go.uber.org/zap v1.27.0 gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v3 v3.0.1 - k8s.io/api v0.31.0 - k8s.io/apiextensions-apiserver v0.31.0 - k8s.io/apimachinery v0.31.0 - k8s.io/client-go v0.31.0 - k8s.io/component-base v0.31.0 + k8s.io/api v0.31.1 + k8s.io/apiextensions-apiserver v0.31.1 + k8s.io/apimachinery v0.31.1 + k8s.io/client-go v0.31.1 + k8s.io/component-base v0.31.1 k8s.io/klog/v2 v2.130.1 - k8s.io/kubectl v0.31.0 + k8s.io/kubectl v0.31.1 k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 sigs.k8s.io/controller-runtime v0.19.0 sigs.k8s.io/yaml v1.4.0 diff --git a/go.sum b/go.sum index 77534bd212..df82bba7fb 100644 --- a/go.sum +++ b/go.sum @@ -1047,22 +1047,22 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/api v0.31.0 h1:b9LiSjR2ym/SzTOlfMHm1tr7/21aD7fSkqgD/CVJBCo= -k8s.io/api v0.31.0/go.mod h1:0YiFF+JfFxMM6+1hQei8FY8M7s1Mth+z/q7eF1aJkTE= -k8s.io/apiextensions-apiserver v0.31.0 h1:fZgCVhGwsclj3qCw1buVXCV6khjRzKC5eCFt24kyLSk= -k8s.io/apiextensions-apiserver v0.31.0/go.mod h1:b9aMDEYaEe5sdK+1T0KU78ApR/5ZVp4i56VacZYEHxk= -k8s.io/apimachinery v0.31.0 h1:m9jOiSr3FoSSL5WO9bjm1n6B9KROYYgNZOb4tyZ1lBc= -k8s.io/apimachinery v0.31.0/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= -k8s.io/client-go v0.31.0 h1:QqEJzNjbN2Yv1H79SsS+SWnXkBgVu4Pj3CJQgbx0gI8= -k8s.io/client-go v0.31.0/go.mod h1:Y9wvC76g4fLjmU0BA+rV+h2cncoadjvjjkkIGoTLcGU= -k8s.io/component-base v0.31.0 h1:/KIzGM5EvPNQcYgwq5NwoQBaOlVFrghoVGr8lG6vNRs= -k8s.io/component-base v0.31.0/go.mod h1:TYVuzI1QmN4L5ItVdMSXKvH7/DtvIuas5/mm8YT3rTo= +k8s.io/api v0.31.1 h1:Xe1hX/fPW3PXYYv8BlozYqw63ytA92snr96zMW9gWTU= +k8s.io/api v0.31.1/go.mod h1:sbN1g6eY6XVLeqNsZGLnI5FwVseTrZX7Fv3O26rhAaI= +k8s.io/apiextensions-apiserver v0.31.1 h1:L+hwULvXx+nvTYX/MKM3kKMZyei+UiSXQWciX/N6E40= +k8s.io/apiextensions-apiserver v0.31.1/go.mod h1:tWMPR3sgW+jsl2xm9v7lAyRF1rYEK71i9G5dRtkknoQ= +k8s.io/apimachinery v0.31.1 h1:mhcUBbj7KUjaVhyXILglcVjuS4nYXiwC+KKFBgIVy7U= +k8s.io/apimachinery v0.31.1/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= +k8s.io/client-go v0.31.1 h1:f0ugtWSbWpxHR7sjVpQwuvw9a3ZKLXX0u0itkFXufb0= +k8s.io/client-go v0.31.1/go.mod h1:sKI8871MJN2OyeqRlmA4W4KM9KBdBUpDLu/43eGemCg= +k8s.io/component-base v0.31.1 h1:UpOepcrX3rQ3ab5NB6g5iP0tvsgJWzxTyAo20sgYSy8= +k8s.io/component-base v0.31.1/go.mod h1:WGeaw7t/kTsqpVTaCoVEtillbqAhF2/JgvO0LDOMa0w= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-openapi v0.0.0-20240808142205-8e686545bdb8 h1:1Wof1cGQgA5pqgo8MxKPtf+qN6Sh/0JzznmeGPm1HnE= k8s.io/kube-openapi v0.0.0-20240808142205-8e686545bdb8/go.mod h1:Os6V6dZwLNii3vxFpxcNaTmH8LJJBkOTg1N0tOA0fvA= -k8s.io/kubectl v0.31.0 h1:kANwAAPVY02r4U4jARP/C+Q1sssCcN/1p9Nk+7BQKVg= -k8s.io/kubectl v0.31.0/go.mod h1:pB47hhFypGsaHAPjlwrNbvhXgmuAr01ZBvAIIUaI8d4= +k8s.io/kubectl v0.31.1 h1:ih4JQJHxsEggFqDJEHSOdJ69ZxZftgeZvYo7M/cpp24= +k8s.io/kubectl v0.31.1/go.mod h1:aNuQoR43W6MLAtXQ/Bu4GDmoHlbhHKuyD49lmTC8eJM= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= From b1064505d840bb9a7ed805cde4e479731cb79d7e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 11:49:54 +0200 Subject: [PATCH 38/41] Bump the otel group with 6 updates (#3290) Bumps the otel group with 6 updates: | Package | From | To | | --- | --- | --- | | [go.opentelemetry.io/otel](https://github.com/open-telemetry/opentelemetry-go) | `1.29.0` | `1.30.0` | | [go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp](https://github.com/open-telemetry/opentelemetry-go) | `1.29.0` | `1.30.0` | | [go.opentelemetry.io/otel/exporters/prometheus](https://github.com/open-telemetry/opentelemetry-go) | `0.51.0` | `0.52.0` | | [go.opentelemetry.io/otel/metric](https://github.com/open-telemetry/opentelemetry-go) | `1.29.0` | `1.30.0` | | [go.opentelemetry.io/otel/sdk](https://github.com/open-telemetry/opentelemetry-go) | `1.29.0` | `1.30.0` | | [go.opentelemetry.io/otel/sdk/metric](https://github.com/open-telemetry/opentelemetry-go) | `1.29.0` | `1.30.0` | Updates `go.opentelemetry.io/otel` from 1.29.0 to 1.30.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.29.0...v1.30.0) Updates `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` from 1.29.0 to 1.30.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.29.0...v1.30.0) Updates `go.opentelemetry.io/otel/exporters/prometheus` from 0.51.0 to 0.52.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/example/prometheus/v0.51.0...example/prometheus/v0.52.0) Updates `go.opentelemetry.io/otel/metric` from 1.29.0 to 1.30.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.29.0...v1.30.0) Updates `go.opentelemetry.io/otel/sdk` from 1.29.0 to 1.30.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.29.0...v1.30.0) Updates `go.opentelemetry.io/otel/sdk/metric` from 1.29.0 to 1.30.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.29.0...v1.30.0) --- updated-dependencies: - dependency-name: go.opentelemetry.io/otel dependency-type: direct:production update-type: version-update:semver-minor dependency-group: otel - dependency-name: go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp dependency-type: direct:production update-type: version-update:semver-minor dependency-group: otel - dependency-name: go.opentelemetry.io/otel/exporters/prometheus dependency-type: direct:production update-type: version-update:semver-minor dependency-group: otel - dependency-name: go.opentelemetry.io/otel/metric dependency-type: direct:production update-type: version-update:semver-minor dependency-group: otel - dependency-name: go.opentelemetry.io/otel/sdk dependency-type: direct:production update-type: version-update:semver-minor dependency-group: otel - dependency-name: go.opentelemetry.io/otel/sdk/metric dependency-type: direct:production update-type: version-update:semver-minor dependency-group: otel ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 33 +++++++++++++++-------------- go.sum | 66 ++++++++++++++++++++++++++++++---------------------------- 2 files changed, 51 insertions(+), 48 deletions(-) diff --git a/go.mod b/go.mod index 7245c15f50..2e695ce7f8 100644 --- a/go.mod +++ b/go.mod @@ -31,12 +31,12 @@ require ( github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/collector/featuregate v1.15.0 - go.opentelemetry.io/otel v1.29.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.29.0 - go.opentelemetry.io/otel/exporters/prometheus v0.51.0 - go.opentelemetry.io/otel/metric v1.29.0 - go.opentelemetry.io/otel/sdk v1.29.0 - go.opentelemetry.io/otel/sdk/metric v1.29.0 + go.opentelemetry.io/otel v1.30.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.30.0 + go.opentelemetry.io/otel/exporters/prometheus v0.52.0 + go.opentelemetry.io/otel/metric v1.30.0 + go.opentelemetry.io/otel/sdk v1.30.0 + go.opentelemetry.io/otel/sdk/metric v1.30.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 gopkg.in/yaml.v2 v2.4.0 @@ -86,7 +86,7 @@ require ( github.com/edsrzf/mmap-go v1.1.0 // indirect github.com/efficientgo/core v1.0.0-rc.2 // indirect github.com/emicklei/go-restful/v3 v3.12.1 // indirect - github.com/envoyproxy/go-control-plane v0.12.0 // indirect + github.com/envoyproxy/go-control-plane v0.12.1-0.20240621013728-1eb8caab5155 // indirect github.com/envoyproxy/protoc-gen-validate v1.0.4 // indirect github.com/evanphx/json-patch/v5 v5.9.0 // indirect github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb // indirect @@ -176,6 +176,7 @@ require ( github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect github.com/pkg/errors v0.9.1 // indirect + github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus-community/prom-label-proxy v0.11.0 // indirect github.com/prometheus/alertmanager v0.27.0 // indirect @@ -194,26 +195,26 @@ require ( go.mongodb.org/mongo-driver v1.14.0 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect - go.opentelemetry.io/otel/trace v1.29.0 // indirect + go.opentelemetry.io/otel/trace v1.30.0 // indirect go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/atomic v1.11.0 // indirect golang.org/x/arch v0.8.0 // indirect - golang.org/x/crypto v0.26.0 // indirect + golang.org/x/crypto v0.27.0 // indirect golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect golang.org/x/mod v0.20.0 // indirect - golang.org/x/net v0.28.0 // indirect + golang.org/x/net v0.29.0 // indirect golang.org/x/oauth2 v0.22.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.24.0 // indirect - golang.org/x/term v0.23.0 // indirect - golang.org/x/text v0.17.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/term v0.24.0 // indirect + golang.org/x/text v0.18.0 // indirect golang.org/x/time v0.6.0 // indirect golang.org/x/tools v0.24.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect google.golang.org/api v0.188.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect - google.golang.org/grpc v1.65.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/grpc v1.66.1 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect diff --git a/go.sum b/go.sum index df82bba7fb..37d39c1af9 100644 --- a/go.sum +++ b/go.sum @@ -149,8 +149,8 @@ github.com/emicklei/go-restful/v3 v3.12.1/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRr github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.12.0 h1:4X+VP1GHd1Mhj6IB5mMeGbLCleqxjletLK6K0rbxyZI= -github.com/envoyproxy/go-control-plane v0.12.0/go.mod h1:ZBTaoJ23lqITozF0M6G4/IragXCQKCnYbmlmtHvwRG0= +github.com/envoyproxy/go-control-plane v0.12.1-0.20240621013728-1eb8caab5155 h1:IgJPqnrlY2Mr4pYB6oaMKvFvwJ9H+X6CCY5x1vCTcpc= +github.com/envoyproxy/go-control-plane v0.12.1-0.20240621013728-1eb8caab5155/go.mod h1:5Wkq+JduFtdAXihLmeTJf+tRYIT4KBc2vPXDhwVo1pA= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= @@ -523,6 +523,8 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -643,24 +645,24 @@ go.opentelemetry.io/collector/featuregate v1.15.0 h1:8KRWaZaE9hLlyMXnMTvnWtUJnzr go.opentelemetry.io/collector/featuregate v1.15.0/go.mod h1:47xrISO71vJ83LSMm8+yIDsUbKktUp48Ovt7RR6VbRs= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= -go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw= -go.opentelemetry.io/otel v1.29.0/go.mod h1:N/WtXPs1CNCUEx+Agz5uouwCba+i+bJGFicT8SR4NP8= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.29.0 h1:xvhQxJ/C9+RTnAj5DpTg7LSM1vbbMTiXt7e9hsfqHNw= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.29.0/go.mod h1:Fcvs2Bz1jkDM+Wf5/ozBGmi3tQ/c9zPKLnsipnfhGAo= +go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= +go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.30.0 h1:VrMAbeJz4gnVDg2zEzjHG4dEH86j4jO6VYB+NgtGD8s= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.30.0/go.mod h1:qqN/uFdpeitTvm+JDqqnjm517pmQRYxTORbETHq5tOc= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 h1:3Q/xZUyC1BBkualc9ROb4G8qkH90LXEIICcs5zv1OYY= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0/go.mod h1:s75jGIWA9OfCMzF0xr+ZgfrB5FEbbV7UuYo32ahUiFI= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.28.0 h1:j9+03ymgYhPKmeXGk5Zu+cIZOlVzd9Zv7QIiyItjFBU= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.28.0/go.mod h1:Y5+XiUG4Emn1hTfciPzGPJaSI+RpDts6BnCIir0SLqk= -go.opentelemetry.io/otel/exporters/prometheus v0.51.0 h1:G7uexXb/K3T+T9fNLCCKncweEtNEBMTO+46hKX5EdKw= -go.opentelemetry.io/otel/exporters/prometheus v0.51.0/go.mod h1:v0mFe5Kk7woIh938mrZBJBmENYquyA0IICrlYm4Y0t4= -go.opentelemetry.io/otel/metric v1.29.0 h1:vPf/HFWTNkPu1aYeIsc98l4ktOQaL6LeSoeV2g+8YLc= -go.opentelemetry.io/otel/metric v1.29.0/go.mod h1:auu/QWieFVWx+DmQOUMgj0F8LHWdgalxXqvp7BII/W8= -go.opentelemetry.io/otel/sdk v1.29.0 h1:vkqKjk7gwhS8VaWb0POZKmIEDimRCMsopNYnriHyryo= -go.opentelemetry.io/otel/sdk v1.29.0/go.mod h1:pM8Dx5WKnvxLCb+8lG1PRNIDxu9g9b9g59Qr7hfAAok= -go.opentelemetry.io/otel/sdk/metric v1.29.0 h1:K2CfmJohnRgvZ9UAj2/FhIf/okdWcNdBwe1m8xFXiSY= -go.opentelemetry.io/otel/sdk/metric v1.29.0/go.mod h1:6zZLdCl2fkauYoZIOn/soQIDSWFmNSRcICarHfuhNJQ= -go.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt39JTi4= -go.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ= +go.opentelemetry.io/otel/exporters/prometheus v0.52.0 h1:kmU3H0b9ufFSi8IQCcxack+sWUblKkFbqWYs6YiACGQ= +go.opentelemetry.io/otel/exporters/prometheus v0.52.0/go.mod h1:+wsAp2+JhuGXX7YRkjlkx6hyWY3ogFPfNA4x3nyiAh0= +go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= +go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ= +go.opentelemetry.io/otel/sdk v1.30.0 h1:cHdik6irO49R5IysVhdn8oaiR9m8XluDaJAs4DfOrYE= +go.opentelemetry.io/otel/sdk v1.30.0/go.mod h1:p14X4Ok8S+sygzblytT1nqG98QG2KYKv++HE0LY/mhg= +go.opentelemetry.io/otel/sdk/metric v1.30.0 h1:QJLT8Pe11jyHBHfSAgYH7kEmT24eX792jZO1bo4BXkM= +go.opentelemetry.io/otel/sdk/metric v1.30.0/go.mod h1:waS6P3YqFNzeP01kuo/MBBYqaoBJl7efRQHOaydhy1Y= +go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc= +go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o= go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= @@ -685,8 +687,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= -golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= -golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -763,8 +765,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= -golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= -golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -847,16 +849,16 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= -golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= -golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= -golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= +golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= +golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -868,8 +870,8 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= -golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -982,10 +984,10 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd h1:BBOTEWLuuEGQy9n1y9MhVJ9Qt0BDu21X8qZs71/uPZo= -google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:fO8wJzT2zbQbAjbIoos1285VfEIYKDDY+Dt+WpTkh6g= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1:hjSy6tcFQZ171igDaN5QHOw2n6vx40juYbC/x67CEhc= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -999,8 +1001,8 @@ google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3Iji google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.1 h1:hO5qAXR19+/Z44hmvIM4dQFMSYX9XcWsByfoxutBpAM= +google.golang.org/grpc v1.66.1/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= From 4ebb467a4626caedc9190e647dc07e4a9e108d7b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 12:06:11 +0200 Subject: [PATCH 39/41] Bump github.com/prometheus-operator/prometheus-operator/pkg/client (#3288) Bumps the prometheus group with 1 update: [github.com/prometheus-operator/prometheus-operator/pkg/client](https://github.com/prometheus-operator/prometheus-operator). Updates `github.com/prometheus-operator/prometheus-operator/pkg/client` from 0.76.1 to 0.76.2 - [Release notes](https://github.com/prometheus-operator/prometheus-operator/releases) - [Changelog](https://github.com/prometheus-operator/prometheus-operator/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus-operator/prometheus-operator/compare/v0.76.1...v0.76.2) --- updated-dependencies: - dependency-name: github.com/prometheus-operator/prometheus-operator/pkg/client dependency-type: direct:production update-type: version-update:semver-patch dependency-group: prometheus ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 2e695ce7f8..edc1b0e8a0 100644 --- a/go.mod +++ b/go.mod @@ -22,8 +22,8 @@ require ( github.com/openshift/api v0.0.0-20240124164020-e2ce40831f2e github.com/operator-framework/operator-lib v0.15.0 github.com/prometheus-operator/prometheus-operator v0.76.0 - github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.76.1 - github.com/prometheus-operator/prometheus-operator/pkg/client v0.76.1 + github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.76.2 + github.com/prometheus-operator/prometheus-operator/pkg/client v0.76.2 github.com/prometheus/client_golang v1.20.3 github.com/prometheus/common v0.59.1 github.com/prometheus/prometheus v0.54.1 diff --git a/go.sum b/go.sum index 37d39c1af9..b234dda6f1 100644 --- a/go.sum +++ b/go.sum @@ -534,10 +534,10 @@ github.com/prometheus-community/prom-label-proxy v0.11.0 h1:IO02WiiFMfcIqvjhwMbC github.com/prometheus-community/prom-label-proxy v0.11.0/go.mod h1:lfvrG70XqsxWDrSh1843QXBG0fSg8EbIXmAo8xGsvw8= github.com/prometheus-operator/prometheus-operator v0.76.0 h1:EjGJiQVF3BUy/iygeRlN6iMBIAySMGZobEm7+7A95pI= github.com/prometheus-operator/prometheus-operator v0.76.0/go.mod h1:y4PxsSBsOBwK1vXIw9U8DGLi8EptquItyP2IpqUtTGs= -github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.76.1 h1:QU2cs0xxKYvF1JfibP/8vs+pFy6OvIpqNR2lYC4jYNU= -github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.76.1/go.mod h1:Rd8YnCqz+2FYsiGmE2DMlaLjQRB4v2jFNnzCt9YY4IM= -github.com/prometheus-operator/prometheus-operator/pkg/client v0.76.1 h1:wMPmeRdflJFu14F0YaIiOIYGkBDDKipkeWW0q53d2+s= -github.com/prometheus-operator/prometheus-operator/pkg/client v0.76.1/go.mod h1:7vND+IkdMpZyfSyRs6P5/uXz6BlFDaOj8olErODi8I0= +github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.76.2 h1:BpGDC87A2SaxbKgONsFLEX3kRcRJee2aLQbjXsuz0hA= +github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.76.2/go.mod h1:Rd8YnCqz+2FYsiGmE2DMlaLjQRB4v2jFNnzCt9YY4IM= +github.com/prometheus-operator/prometheus-operator/pkg/client v0.76.2 h1:yncs8NglhE3hB+viNsabCAF9TBBDOBljHUyxHC5fSGY= +github.com/prometheus-operator/prometheus-operator/pkg/client v0.76.2/go.mod h1:AfbzyEUFxJmSoTiMcgNHHjDKcorBVd9TIwx0viURgEw= github.com/prometheus/alertmanager v0.27.0 h1:V6nTa2J5V4s8TG4C4HtrBP/WNSebCCTYGGv4qecA/+I= github.com/prometheus/alertmanager v0.27.0/go.mod h1:8Ia/R3urPmbzJ8OsdvmZvIprDwvwmYCmUbwBL+jlPOE= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= From 2ed5f03f1534d4050e75d3c7f757d1fc57fbcfb7 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Mon, 16 Sep 2024 09:32:46 -0500 Subject: [PATCH 40/41] Update the OpenTelemetry Java agent version to 2.8.0 (#3287) --- autoinstrumentation/java/version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoinstrumentation/java/version.txt b/autoinstrumentation/java/version.txt index 24ba9a38de..834f262953 100644 --- a/autoinstrumentation/java/version.txt +++ b/autoinstrumentation/java/version.txt @@ -1 +1 @@ -2.7.0 +2.8.0 From f2a8cf2533f8180de672cfa485210c1b78ee6559 Mon Sep 17 00:00:00 2001 From: Jacob Aronoff Date: Mon, 16 Sep 2024 10:34:35 -0400 Subject: [PATCH 41/41] Uses the new parsing structure for RBAC parsing (#3206) * begin interface change * move over processor config * use it * fix tests * Generics * rename * builder * Change to use the builder pattern instead of the option pattern * remove unused methods * fix unit tests * rename somethings * missed a spot * fix builder --- apis/v1beta1/config.go | 42 +++- internal/components/builder.go | 122 ++++++++++ internal/components/builder_test.go | 217 ++++++++++++++++++ internal/components/component.go | 65 +----- internal/components/exporters/helpers.go | 4 +- internal/components/exporters/helpers_test.go | 2 +- internal/components/generic_parser.go | 23 +- internal/components/generic_parser_test.go | 117 +++++++++- internal/components/multi_endpoint.go | 46 +++- internal/components/multi_endpoint_test.go | 189 +++++++++------ internal/components/processors/helpers.go | 50 ++++ .../components/processors/helpers_test.go | 85 +++++++ .../components/processors/k8sattribute.go | 81 +++++++ .../processors/k8sattribute_test.go | 151 ++++++++++++ .../processors/resourcedetection.go | 52 +++++ .../processors/resourcedetection_test.go | 121 ++++++++++ internal/components/receivers/helpers.go | 157 +++++++------ internal/components/single_endpoint.go | 33 +-- internal/components/single_endpoint_test.go | 106 ++++----- internal/manifests/collector/rbac.go | 26 +-- 20 files changed, 1367 insertions(+), 322 deletions(-) create mode 100644 internal/components/builder.go create mode 100644 internal/components/builder_test.go create mode 100644 internal/components/processors/helpers.go create mode 100644 internal/components/processors/helpers_test.go create mode 100644 internal/components/processors/k8sattribute.go create mode 100644 internal/components/processors/k8sattribute_test.go create mode 100644 internal/components/processors/resourcedetection.go create mode 100644 internal/components/processors/resourcedetection_test.go diff --git a/apis/v1beta1/config.go b/apis/v1beta1/config.go index 61fecb3ad1..fce6a610f4 100644 --- a/apis/v1beta1/config.go +++ b/apis/v1beta1/config.go @@ -27,9 +27,11 @@ import ( "github.com/go-logr/logr" "gopkg.in/yaml.v3" corev1 "k8s.io/api/core/v1" + rbacv1 "k8s.io/api/rbac/v1" "github.com/open-telemetry/opentelemetry-operator/internal/components" "github.com/open-telemetry/opentelemetry-operator/internal/components/exporters" + "github.com/open-telemetry/opentelemetry-operator/internal/components/processors" "github.com/open-telemetry/opentelemetry-operator/internal/components/receivers" ) @@ -139,9 +141,43 @@ type Config struct { Service Service `json:"service" yaml:"service"` } +// getRbacRulesForComponentKinds gets the RBAC Rules for the given ComponentKind(s). +func (c *Config) getRbacRulesForComponentKinds(logger logr.Logger, componentKinds ...ComponentKind) ([]rbacv1.PolicyRule, error) { + var rules []rbacv1.PolicyRule + enabledComponents := c.GetEnabledComponents() + for _, componentKind := range componentKinds { + var retriever components.ParserRetriever + var cfg AnyConfig + switch componentKind { + case KindReceiver: + retriever = receivers.ReceiverFor + cfg = c.Receivers + case KindExporter: + retriever = exporters.ParserFor + cfg = c.Exporters + case KindProcessor: + retriever = processors.ProcessorFor + if c.Processors == nil { + cfg = AnyConfig{} + } else { + cfg = *c.Processors + } + } + for componentName := range enabledComponents[componentKind] { + // TODO: Clean up the naming here and make it simpler to use a retriever. + parser := retriever(componentName) + if parsedRules, err := parser.GetRBACRules(logger, cfg.Object[componentName]); err != nil { + return nil, err + } else { + rules = append(rules, parsedRules...) + } + } + } + return rules, nil +} + // getPortsForComponentKinds gets the ports for the given ComponentKind(s). func (c *Config) getPortsForComponentKinds(logger logr.Logger, componentKinds ...ComponentKind) ([]corev1.ServicePort, error) { - var ports []corev1.ServicePort enabledComponents := c.GetEnabledComponents() for _, componentKind := range componentKinds { @@ -187,6 +223,10 @@ func (c *Config) GetAllPorts(logger logr.Logger) ([]corev1.ServicePort, error) { return c.getPortsForComponentKinds(logger, KindReceiver, KindExporter) } +func (c *Config) GetAllRbacRules(logger logr.Logger) ([]rbacv1.PolicyRule, error) { + return c.getRbacRulesForComponentKinds(logger, KindReceiver, KindExporter, KindProcessor) +} + // Yaml encodes the current object and returns it as a string. func (c *Config) Yaml() (string, error) { var buf bytes.Buffer diff --git a/internal/components/builder.go b/internal/components/builder.go new file mode 100644 index 0000000000..7dc3ba186e --- /dev/null +++ b/internal/components/builder.go @@ -0,0 +1,122 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package components + +import ( + "fmt" + + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/util/intstr" + + "github.com/open-telemetry/opentelemetry-operator/internal/naming" +) + +type ParserOption[ComponentConfigType any] func(*Settings[ComponentConfigType]) + +type Settings[ComponentConfigType any] struct { + protocol corev1.Protocol + appProtocol *string + targetPort intstr.IntOrString + nodePort int32 + name string + port int32 + portParser PortParser[ComponentConfigType] + rbacGen RBACRuleGenerator[ComponentConfigType] +} + +func NewEmptySettings[ComponentConfigType any]() *Settings[ComponentConfigType] { + return &Settings[ComponentConfigType]{} +} + +func (o *Settings[ComponentConfigType]) Apply(opts ...ParserOption[ComponentConfigType]) { + for _, opt := range opts { + opt(o) + } +} + +func (o *Settings[ComponentConfigType]) GetServicePort() *corev1.ServicePort { + return &corev1.ServicePort{ + Name: naming.PortName(o.name, o.port), + Port: o.port, + Protocol: o.protocol, + AppProtocol: o.appProtocol, + TargetPort: o.targetPort, + NodePort: o.nodePort, + } +} + +type Builder[ComponentConfigType any] []ParserOption[ComponentConfigType] + +func NewBuilder[ComponentConfigType any]() Builder[ComponentConfigType] { + return []ParserOption[ComponentConfigType]{} +} + +func (b Builder[ComponentConfigType]) WithProtocol(protocol corev1.Protocol) Builder[ComponentConfigType] { + return append(b, func(o *Settings[ComponentConfigType]) { + o.protocol = protocol + }) +} +func (b Builder[ComponentConfigType]) WithAppProtocol(appProtocol *string) Builder[ComponentConfigType] { + return append(b, func(o *Settings[ComponentConfigType]) { + o.appProtocol = appProtocol + }) +} +func (b Builder[ComponentConfigType]) WithTargetPort(targetPort int32) Builder[ComponentConfigType] { + return append(b, func(o *Settings[ComponentConfigType]) { + o.targetPort = intstr.FromInt32(targetPort) + }) +} +func (b Builder[ComponentConfigType]) WithNodePort(nodePort int32) Builder[ComponentConfigType] { + return append(b, func(o *Settings[ComponentConfigType]) { + o.nodePort = nodePort + }) +} +func (b Builder[ComponentConfigType]) WithName(name string) Builder[ComponentConfigType] { + return append(b, func(o *Settings[ComponentConfigType]) { + o.name = name + }) +} +func (b Builder[ComponentConfigType]) WithPort(port int32) Builder[ComponentConfigType] { + return append(b, func(o *Settings[ComponentConfigType]) { + o.port = port + }) +} +func (b Builder[ComponentConfigType]) WithPortParser(portParser PortParser[ComponentConfigType]) Builder[ComponentConfigType] { + return append(b, func(o *Settings[ComponentConfigType]) { + o.portParser = portParser + }) +} +func (b Builder[ComponentConfigType]) WithRbacGen(rbacGen RBACRuleGenerator[ComponentConfigType]) Builder[ComponentConfigType] { + return append(b, func(o *Settings[ComponentConfigType]) { + o.rbacGen = rbacGen + }) +} + +func (b Builder[ComponentConfigType]) Build() (*GenericParser[ComponentConfigType], error) { + o := NewEmptySettings[ComponentConfigType]() + o.Apply(b...) + if len(o.name) == 0 { + return nil, fmt.Errorf("invalid settings struct, no name specified") + } + return &GenericParser[ComponentConfigType]{name: o.name, portParser: o.portParser, rbacGen: o.rbacGen, settings: o}, nil +} + +func (b Builder[ComponentConfigType]) MustBuild() *GenericParser[ComponentConfigType] { + if p, err := b.Build(); err != nil { + panic(err) + } else { + return p + } +} diff --git a/internal/components/builder_test.go b/internal/components/builder_test.go new file mode 100644 index 0000000000..d600db4a70 --- /dev/null +++ b/internal/components/builder_test.go @@ -0,0 +1,217 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package components_test + +import ( + "fmt" + "testing" + + "github.com/go-logr/logr" + "github.com/stretchr/testify/assert" + corev1 "k8s.io/api/core/v1" + rbacv1 "k8s.io/api/rbac/v1" + + "github.com/open-telemetry/opentelemetry-operator/internal/components" +) + +func TestBuilder_Build(t *testing.T) { + type sampleConfig struct { + example string + number int + m map[string]interface{} + } + type want struct { + name string + ports []corev1.ServicePort + rules []rbacv1.PolicyRule + } + type fields[T any] struct { + b components.Builder[T] + } + type params struct { + conf interface{} + } + type testCase[T any] struct { + name string + fields fields[T] + params params + want want + wantErr assert.ErrorAssertionFunc + wantRbacErr assert.ErrorAssertionFunc + } + examplePortParser := func(logger logr.Logger, name string, defaultPort *corev1.ServicePort, config sampleConfig) ([]corev1.ServicePort, error) { + if defaultPort != nil { + return []corev1.ServicePort{*defaultPort}, nil + } + return nil, nil + } + tests := []testCase[sampleConfig]{ + { + name: "basic valid configuration", + fields: fields[sampleConfig]{ + b: components.NewBuilder[sampleConfig](). + WithPortParser(examplePortParser). + WithName("test-service"). + WithPort(80). + WithNodePort(80). + WithProtocol(corev1.ProtocolTCP), + }, + params: params{ + conf: sampleConfig{}, + }, + want: want{ + name: "__test-service", + ports: []corev1.ServicePort{ + { + Name: "test-service", + Port: 80, + NodePort: 80, + Protocol: corev1.ProtocolTCP, + }, + }, + rules: nil, + }, + wantErr: assert.NoError, + wantRbacErr: assert.NoError, + }, + { + name: "missing name", + fields: fields[sampleConfig]{ + b: components.NewBuilder[sampleConfig](). + WithPort(8080). + WithProtocol(corev1.ProtocolUDP), + }, + params: params{ + conf: sampleConfig{}, + }, + want: want{}, + wantErr: assert.Error, + wantRbacErr: assert.NoError, + }, + { + name: "complete configuration with RBAC rules", + fields: fields[sampleConfig]{ + b: components.NewBuilder[sampleConfig](). + WithName("secure-service"). + WithPort(443). + WithProtocol(corev1.ProtocolTCP). + WithRbacGen(func(logger logr.Logger, config sampleConfig) ([]rbacv1.PolicyRule, error) { + rules := []rbacv1.PolicyRule{ + { + NonResourceURLs: []string{config.example}, + APIGroups: []string{""}, + Resources: []string{"pods"}, + Verbs: []string{"get", "list"}, + }, + } + if config.number > 100 { + rules = append(rules, rbacv1.PolicyRule{ + APIGroups: []string{""}, + Resources: []string{"nodes"}, + Verbs: []string{"get", "list"}, + }) + } + return rules, nil + }), + }, + params: params{ + conf: sampleConfig{ + example: "test", + number: 100, + m: map[string]interface{}{ + "key": "value", + }, + }, + }, + want: want{ + name: "__secure-service", + ports: nil, + rules: []rbacv1.PolicyRule{ + { + NonResourceURLs: []string{"test"}, + APIGroups: []string{""}, + Resources: []string{"pods"}, + Verbs: []string{"get", "list"}, + }, + }, + }, + wantErr: assert.NoError, + wantRbacErr: assert.NoError, + }, + { + name: "complete configuration with RBAC rules errors", + fields: fields[sampleConfig]{ + b: components.NewBuilder[sampleConfig](). + WithName("secure-service"). + WithPort(443). + WithProtocol(corev1.ProtocolTCP). + WithRbacGen(func(logger logr.Logger, config sampleConfig) ([]rbacv1.PolicyRule, error) { + rules := []rbacv1.PolicyRule{ + { + NonResourceURLs: []string{config.example}, + APIGroups: []string{""}, + Resources: []string{"pods"}, + Verbs: []string{"get", "list"}, + }, + } + if v, ok := config.m["key"]; ok && v == "value" { + return nil, fmt.Errorf("errors from function") + } + return rules, nil + }), + }, + params: params{ + conf: sampleConfig{ + example: "test", + number: 100, + m: map[string]interface{}{ + "key": "value", + }, + }, + }, + want: want{ + name: "__secure-service", + ports: nil, + rules: nil, + }, + wantErr: assert.NoError, + wantRbacErr: assert.Error, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := tt.fields.b.Build() + if tt.wantErr(t, err, "WantErr()") && err != nil { + return + } + assert.Equalf(t, tt.want.name, got.ParserName(), "ParserName()") + ports, err := got.Ports(logr.Discard(), got.ParserType(), tt.params.conf) + assert.NoError(t, err) + assert.Equalf(t, tt.want.ports, ports, "Ports()") + rules, rbacErr := got.GetRBACRules(logr.Discard(), tt.params.conf) + if tt.wantRbacErr(t, rbacErr, "WantRbacErr()") && rbacErr != nil { + return + } + assert.Equalf(t, tt.want.rules, rules, "GetRBACRules()") + }) + } +} + +func TestMustBuildPanics(t *testing.T) { + b := components.Builder[*components.SingleEndpointConfig]{} + assert.Panics(t, func() { + b.MustBuild() + }) +} diff --git a/internal/components/component.go b/internal/components/component.go index 7e9ea78c74..36d3744839 100644 --- a/internal/components/component.go +++ b/internal/components/component.go @@ -22,9 +22,8 @@ import ( "github.com/go-logr/logr" corev1 "k8s.io/api/core/v1" + rbacv1 "k8s.io/api/rbac/v1" "k8s.io/apimachinery/pkg/util/intstr" - - "github.com/open-telemetry/opentelemetry-operator/internal/naming" ) var ( @@ -34,66 +33,17 @@ var ( PortNotFoundErr = errors.New("port should not be empty") ) -// PortParser is a function that returns a list of servicePorts given a config of type T. -type PortParser[T any] func(logger logr.Logger, name string, o *Option, config T) ([]corev1.ServicePort, error) - type PortRetriever interface { GetPortNum() (int32, error) GetPortNumOrDefault(logr.Logger, int32) int32 } -type Option struct { - protocol corev1.Protocol - appProtocol *string - targetPort intstr.IntOrString - nodePort int32 - name string - port int32 -} - -func NewOption(name string, port int32) *Option { - return &Option{ - name: name, - port: port, - } -} - -func (o *Option) Apply(opts ...PortBuilderOption) { - for _, opt := range opts { - opt(o) - } -} - -func (o *Option) GetServicePort() *corev1.ServicePort { - return &corev1.ServicePort{ - Name: naming.PortName(o.name, o.port), - Port: o.port, - Protocol: o.protocol, - AppProtocol: o.appProtocol, - TargetPort: o.targetPort, - NodePort: o.nodePort, - } -} - -type PortBuilderOption func(*Option) +// PortParser is a function that returns a list of servicePorts given a config of type Config. +type PortParser[ComponentConfigType any] func(logger logr.Logger, name string, defaultPort *corev1.ServicePort, config ComponentConfigType) ([]corev1.ServicePort, error) -func WithTargetPort(targetPort int32) PortBuilderOption { - return func(opt *Option) { - opt.targetPort = intstr.FromInt32(targetPort) - } -} - -func WithAppProtocol(proto *string) PortBuilderOption { - return func(opt *Option) { - opt.appProtocol = proto - } -} - -func WithProtocol(proto corev1.Protocol) PortBuilderOption { - return func(opt *Option) { - opt.protocol = proto - } -} +// RBACRuleGenerator is a function that generates a list of RBAC Rules given a configuration of type Config +// It's expected that type Config is the configuration used by a parser. +type RBACRuleGenerator[ComponentConfigType any] func(logger logr.Logger, config ComponentConfigType) ([]rbacv1.PolicyRule, error) // ComponentType returns the type for a given component name. // components have a name like: @@ -137,6 +87,9 @@ type Parser interface { // of the form "name" or "type/name" Ports(logger logr.Logger, name string, config interface{}) ([]corev1.ServicePort, error) + // GetRBACRules returns the rbac rules for this component + GetRBACRules(logger logr.Logger, config interface{}) ([]rbacv1.PolicyRule, error) + // ParserType returns the type of this parser ParserType() string diff --git a/internal/components/exporters/helpers.go b/internal/components/exporters/helpers.go index 3dd9ad2054..82108c5fc0 100644 --- a/internal/components/exporters/helpers.go +++ b/internal/components/exporters/helpers.go @@ -38,12 +38,12 @@ func ParserFor(name string) components.Parser { return parser } // We want the default for exporters to fail silently. - return components.NewGenericParser[any](components.ComponentType(name), components.UnsetPort, nil) + return components.NewBuilder[any]().WithName(name).MustBuild() } var ( componentParsers = []components.Parser{ - components.NewSinglePortParser("prometheus", 8888), + components.NewSinglePortParserBuilder("prometheus", 8888).MustBuild(), } ) diff --git a/internal/components/exporters/helpers_test.go b/internal/components/exporters/helpers_test.go index 80dfed3a20..77fb67aced 100644 --- a/internal/components/exporters/helpers_test.go +++ b/internal/components/exporters/helpers_test.go @@ -39,7 +39,7 @@ func TestParserForReturns(t *testing.T) { func TestCanRegister(t *testing.T) { const testComponentName = "test" - exporters.Register(testComponentName, components.NewSinglePortParser(testComponentName, 9000)) + exporters.Register(testComponentName, components.NewSinglePortParserBuilder(testComponentName, 9000).MustBuild()) assert.True(t, exporters.IsRegistered(testComponentName)) parser := exporters.ParserFor(testComponentName) assert.Equal(t, "test", parser.ParserType()) diff --git a/internal/components/generic_parser.go b/internal/components/generic_parser.go index 27c4f44b1a..4e3c3325ed 100644 --- a/internal/components/generic_parser.go +++ b/internal/components/generic_parser.go @@ -20,6 +20,7 @@ import ( "github.com/go-logr/logr" "github.com/mitchellh/mapstructure" corev1 "k8s.io/api/core/v1" + rbacv1 "k8s.io/api/rbac/v1" ) var ( @@ -30,8 +31,20 @@ var ( // functionality to idempotent functions. type GenericParser[T any] struct { name string + settings *Settings[T] portParser PortParser[T] - option *Option + rbacGen RBACRuleGenerator[T] +} + +func (g *GenericParser[T]) GetRBACRules(logger logr.Logger, config interface{}) ([]rbacv1.PolicyRule, error) { + if g.rbacGen == nil { + return nil, nil + } + var parsed T + if err := mapstructure.Decode(config, &parsed); err != nil { + return nil, err + } + return g.rbacGen(logger, parsed) } func (g *GenericParser[T]) Ports(logger logr.Logger, name string, config interface{}) ([]corev1.ServicePort, error) { @@ -42,7 +55,7 @@ func (g *GenericParser[T]) Ports(logger logr.Logger, name string, config interfa if err := mapstructure.Decode(config, &parsed); err != nil { return nil, err } - return g.portParser(logger, name, g.option, parsed) + return g.portParser(logger, name, g.settings.GetServicePort(), parsed) } func (g *GenericParser[T]) ParserType() string { @@ -52,9 +65,3 @@ func (g *GenericParser[T]) ParserType() string { func (g *GenericParser[T]) ParserName() string { return fmt.Sprintf("__%s", g.name) } - -func NewGenericParser[T any](name string, port int32, parser PortParser[T], opts ...PortBuilderOption) *GenericParser[T] { - o := NewOption(name, port) - o.Apply(opts...) - return &GenericParser[T]{name: name, portParser: parser, option: o} -} diff --git a/internal/components/generic_parser_test.go b/internal/components/generic_parser_test.go index 9d6be1ade6..a271bcd2dd 100644 --- a/internal/components/generic_parser_test.go +++ b/internal/components/generic_parser_test.go @@ -21,6 +21,7 @@ import ( "github.com/go-logr/logr" "github.com/stretchr/testify/assert" corev1 "k8s.io/api/core/v1" + rbacv1 "k8s.io/api/rbac/v1" "github.com/open-telemetry/opentelemetry-operator/internal/components" ) @@ -41,7 +42,7 @@ func TestGenericParser_GetPorts(t *testing.T) { tests := []testCase[*components.SingleEndpointConfig]{ { name: "valid config with endpoint", - g: components.NewGenericParser[*components.SingleEndpointConfig]("test", 0, components.ParseSingleEndpoint), + g: components.NewSinglePortParserBuilder("test", 0).MustBuild(), args: args{ logger: logr.Discard(), config: map[string]interface{}{ @@ -58,7 +59,7 @@ func TestGenericParser_GetPorts(t *testing.T) { }, { name: "valid config with listen_address", - g: components.NewGenericParser[*components.SingleEndpointConfig]("test", 0, components.ParseSingleEndpoint), + g: components.NewSinglePortParserBuilder("test", 0).MustBuild(), args: args{ logger: logr.Discard(), config: map[string]interface{}{ @@ -74,8 +75,8 @@ func TestGenericParser_GetPorts(t *testing.T) { wantErr: assert.NoError, }, { - name: "valid config with listen_address with option", - g: components.NewGenericParser[*components.SingleEndpointConfig]("test", 0, components.ParseSingleEndpoint, components.WithProtocol(corev1.ProtocolUDP)), + name: "valid config with listen_address with settings", + g: components.NewSinglePortParserBuilder("test", 0).WithProtocol(corev1.ProtocolUDP).MustBuild(), args: args{ logger: logr.Discard(), config: map[string]interface{}{ @@ -93,7 +94,7 @@ func TestGenericParser_GetPorts(t *testing.T) { }, { name: "invalid config with no endpoint or listen_address", - g: components.NewGenericParser[*components.SingleEndpointConfig]("test", 0, components.ParseSingleEndpoint), + g: components.NewSinglePortParserBuilder("test", 0).MustBuild(), args: args{ logger: logr.Discard(), config: map[string]interface{}{}, @@ -113,3 +114,109 @@ func TestGenericParser_GetPorts(t *testing.T) { }) } } + +func TestGenericParser_GetRBACRules(t *testing.T) { + type args struct { + logger logr.Logger + config interface{} + } + type testCase[T any] struct { + name string + g *components.GenericParser[T] + args args + want []rbacv1.PolicyRule + wantErr assert.ErrorAssertionFunc + } + + rbacGenFunc := func(logger logr.Logger, config *components.SingleEndpointConfig) ([]rbacv1.PolicyRule, error) { + if config.Endpoint == "" && config.ListenAddress == "" { + return nil, fmt.Errorf("either endpoint or listen_address must be specified") + } + return []rbacv1.PolicyRule{ + { + APIGroups: []string{""}, + Resources: []string{"pods"}, + Verbs: []string{"get", "list"}, + }, + }, nil + } + + tests := []testCase[*components.SingleEndpointConfig]{ + { + name: "valid config with endpoint", + g: components.NewSinglePortParserBuilder("test", 0).WithRbacGen(rbacGenFunc).MustBuild(), + args: args{ + logger: logr.Discard(), + config: map[string]interface{}{ + "endpoint": "http://localhost:8080", + }, + }, + want: []rbacv1.PolicyRule{ + { + APIGroups: []string{""}, + Resources: []string{"pods"}, + Verbs: []string{"get", "list"}, + }, + }, + wantErr: assert.NoError, + }, + { + name: "valid config with listen_address", + g: components.NewSinglePortParserBuilder("test", 0).WithRbacGen(rbacGenFunc).MustBuild(), + args: args{ + logger: logr.Discard(), + config: map[string]interface{}{ + "listen_address": "0.0.0.0:9090", + }, + }, + want: []rbacv1.PolicyRule{ + { + APIGroups: []string{""}, + Resources: []string{"pods"}, + Verbs: []string{"get", "list"}, + }, + }, + wantErr: assert.NoError, + }, + { + name: "invalid config with no endpoint or listen_address", + g: components.NewSinglePortParserBuilder("test", 0).WithRbacGen(rbacGenFunc).MustBuild(), + args: args{ + logger: logr.Discard(), + config: map[string]interface{}{}, + }, + want: nil, + wantErr: assert.Error, + }, + { + name: "Generic works", + g: components.NewBuilder[*components.SingleEndpointConfig]().WithName("test").MustBuild(), + args: args{ + logger: logr.Discard(), + config: map[string]interface{}{}, + }, + want: nil, + wantErr: assert.NoError, + }, + { + name: "failed to parse config", + g: components.NewSinglePortParserBuilder("test", 0).WithRbacGen(rbacGenFunc).MustBuild(), + args: args{ + logger: logr.Discard(), + config: func() {}, + }, + want: nil, + wantErr: assert.Error, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := tt.g.GetRBACRules(tt.args.logger, tt.args.config) + if !tt.wantErr(t, err, fmt.Sprintf("GetRBACRules(%v, %v)", tt.args.logger, tt.args.config)) { + return + } + assert.Equalf(t, tt.want, got, "GetRBACRules(%v, %v)", tt.args.logger, tt.args.config) + }) + } +} diff --git a/internal/components/multi_endpoint.go b/internal/components/multi_endpoint.go index d4e5948f81..7a10b90fd6 100644 --- a/internal/components/multi_endpoint.go +++ b/internal/components/multi_endpoint.go @@ -20,6 +20,7 @@ import ( "github.com/go-logr/logr" "github.com/mitchellh/mapstructure" corev1 "k8s.io/api/core/v1" + rbacv1 "k8s.io/api/rbac/v1" "github.com/open-telemetry/opentelemetry-operator/internal/naming" ) @@ -71,21 +72,46 @@ func (m *MultiPortReceiver) ParserName() string { return fmt.Sprintf("__%s", m.name) } -func NewMultiPortReceiver(name string, opts ...MultiPortOption) *MultiPortReceiver { +func (m *MultiPortReceiver) GetRBACRules(logr.Logger, interface{}) ([]rbacv1.PolicyRule, error) { + return nil, nil +} + +type MultiPortBuilder[ComponentConfigType any] []Builder[ComponentConfigType] + +func NewMultiPortReceiverBuilder(name string) MultiPortBuilder[*MultiProtocolEndpointConfig] { + return append(MultiPortBuilder[*MultiProtocolEndpointConfig]{}, NewBuilder[*MultiProtocolEndpointConfig]().WithName(name)) +} + +func NewProtocolBuilder(name string, port int32) Builder[*MultiProtocolEndpointConfig] { + return NewBuilder[*MultiProtocolEndpointConfig]().WithName(name).WithPort(port) +} + +func (mp MultiPortBuilder[ComponentConfigType]) AddPortMapping(builder Builder[ComponentConfigType]) MultiPortBuilder[ComponentConfigType] { + return append(mp, builder) +} + +func (mp MultiPortBuilder[ComponentConfigType]) Build() (*MultiPortReceiver, error) { + if len(mp) < 1 { + return nil, fmt.Errorf("must provide at least one port mapping") + } multiReceiver := &MultiPortReceiver{ - name: name, + name: mp[0].MustBuild().name, portMappings: map[string]*corev1.ServicePort{}, } - for _, opt := range opts { - opt(multiReceiver) + for _, bu := range mp[1:] { + built, err := bu.Build() + if err != nil { + return nil, err + } + multiReceiver.portMappings[built.name] = built.settings.GetServicePort() } - return multiReceiver + return multiReceiver, nil } -func WithPortMapping(name string, port int32, opts ...PortBuilderOption) MultiPortOption { - return func(parser *MultiPortReceiver) { - o := NewOption(name, port) - o.Apply(opts...) - parser.portMappings[name] = o.GetServicePort() +func (mp MultiPortBuilder[ComponentConfigType]) MustBuild() *MultiPortReceiver { + if p, err := mp.Build(); err != nil { + panic(err) + } else { + return p } } diff --git a/internal/components/multi_endpoint_test.go b/internal/components/multi_endpoint_test.go index 2aac06a5d1..deabf377a4 100644 --- a/internal/components/multi_endpoint_test.go +++ b/internal/components/multi_endpoint_test.go @@ -42,8 +42,7 @@ var ( func TestMultiPortReceiver_ParserName(t *testing.T) { type fields struct { - name string - opts []components.MultiPortOption + b components.MultiPortBuilder[*components.MultiProtocolEndpointConfig] } tests := []struct { name string @@ -53,34 +52,32 @@ func TestMultiPortReceiver_ParserName(t *testing.T) { { name: "no options", fields: fields{ - name: "receiver1", - opts: nil, + b: components.NewMultiPortReceiverBuilder("receiver1"), }, want: "__receiver1", }, { name: "with port mapping without builder options", fields: fields{ - name: "receiver2", - opts: []components.MultiPortOption{ - components.WithPortMapping("http", 80), - }, + b: components.NewMultiPortReceiverBuilder("receiver2").AddPortMapping( + components.NewProtocolBuilder("http", 80), + ), }, want: "__receiver2", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - m := components.NewMultiPortReceiver(tt.fields.name, tt.fields.opts...) - assert.Equalf(t, tt.want, m.ParserName(), "ParserName()") + s, err := tt.fields.b.Build() + assert.NoError(t, err) + assert.Equalf(t, tt.want, s.ParserName(), "ParserName()") }) } } func TestMultiPortReceiver_ParserType(t *testing.T) { type fields struct { - name string - opts []components.MultiPortOption + b components.MultiPortBuilder[*components.MultiProtocolEndpointConfig] } tests := []struct { name string @@ -90,26 +87,25 @@ func TestMultiPortReceiver_ParserType(t *testing.T) { { name: "no options", fields: fields{ - name: "receiver1", - opts: nil, + b: components.NewMultiPortReceiverBuilder("receiver1"), }, want: "receiver1", }, { name: "with port mapping without builder options", fields: fields{ - name: "receiver2/test", - opts: []components.MultiPortOption{ - components.WithPortMapping("http", 80), - }, + b: components.NewMultiPortReceiverBuilder("receiver2").AddPortMapping( + components.NewProtocolBuilder("http", 80), + ), }, want: "receiver2", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - m := components.NewMultiPortReceiver(tt.fields.name, tt.fields.opts...) - assert.Equalf(t, tt.want, m.ParserType(), "ParserType()") + s, err := tt.fields.b.Build() + assert.NoError(t, err) + assert.Equalf(t, tt.want, s.ParserType(), "ParserType()") }) } } @@ -117,37 +113,37 @@ func TestMultiPortReceiver_ParserType(t *testing.T) { func TestMultiPortReceiver_Ports(t *testing.T) { type fields struct { name string - opts []components.MultiPortOption + b components.MultiPortBuilder[*components.MultiProtocolEndpointConfig] } type args struct { config interface{} } tests := []struct { - name string - fields fields - args args - want []corev1.ServicePort - wantErr assert.ErrorAssertionFunc + name string + fields fields + args args + want []corev1.ServicePort + wantErr assert.ErrorAssertionFunc + wantBuildErr assert.ErrorAssertionFunc }{ { name: "no options", fields: fields{ name: "receiver1", - opts: nil, + b: components.NewMultiPortReceiverBuilder("receiver1"), }, args: args{ config: nil, }, - want: nil, - wantErr: assert.NoError, + want: nil, + wantBuildErr: assert.NoError, + wantErr: assert.NoError, }, { name: "single port mapping without builder options", fields: fields{ name: "receiver2", - opts: []components.MultiPortOption{ - components.WithPortMapping("http", 80), - }, + b: components.NewMultiPortReceiverBuilder("receiver2").AddPortMapping(components.NewProtocolBuilder("http", 80)), }, args: args{ config: httpConfig, @@ -158,15 +154,16 @@ func TestMultiPortReceiver_Ports(t *testing.T) { Port: 80, }, }, - wantErr: assert.NoError, + wantBuildErr: assert.NoError, + wantErr: assert.NoError, }, { name: "port mapping with target port", fields: fields{ name: "receiver3", - opts: []components.MultiPortOption{ - components.WithPortMapping("http", 80, components.WithTargetPort(8080)), - }, + b: components.NewMultiPortReceiverBuilder("receiver3"). + AddPortMapping(components.NewProtocolBuilder("http", 80). + WithTargetPort(8080)), }, args: args{ config: httpConfig, @@ -178,15 +175,16 @@ func TestMultiPortReceiver_Ports(t *testing.T) { TargetPort: intstr.FromInt(80), }, }, - wantErr: assert.NoError, + wantBuildErr: assert.NoError, + wantErr: assert.NoError, }, { name: "port mapping with app protocol", fields: fields{ name: "receiver4", - opts: []components.MultiPortOption{ - components.WithPortMapping("http", 80, components.WithAppProtocol(&components.HttpProtocol)), - }, + b: components.NewMultiPortReceiverBuilder("receiver4"). + AddPortMapping(components.NewProtocolBuilder("http", 80). + WithAppProtocol(&components.HttpProtocol)), }, args: args{ config: httpConfig, @@ -198,15 +196,16 @@ func TestMultiPortReceiver_Ports(t *testing.T) { AppProtocol: &components.HttpProtocol, }, }, - wantErr: assert.NoError, + wantBuildErr: assert.NoError, + wantErr: assert.NoError, }, { name: "port mapping with protocol", fields: fields{ name: "receiver5", - opts: []components.MultiPortOption{ - components.WithPortMapping("http", 80, components.WithProtocol(corev1.ProtocolTCP)), - }, + b: components.NewMultiPortReceiverBuilder("receiver2"). + AddPortMapping(components.NewProtocolBuilder("http", 80). + WithProtocol(corev1.ProtocolTCP)), }, args: args{ config: httpConfig, @@ -218,19 +217,20 @@ func TestMultiPortReceiver_Ports(t *testing.T) { Protocol: corev1.ProtocolTCP, }, }, - wantErr: assert.NoError, + wantBuildErr: assert.NoError, + wantErr: assert.NoError, }, { name: "multiple port mappings", fields: fields{ name: "receiver6", - opts: []components.MultiPortOption{ - components.WithPortMapping("http", 80), - components.WithPortMapping("grpc", 4317, - components.WithTargetPort(4317), - components.WithProtocol(corev1.ProtocolTCP), - components.WithAppProtocol(&components.GrpcProtocol)), - }, + b: components.NewMultiPortReceiverBuilder("receiver6"). + AddPortMapping(components.NewProtocolBuilder("http", 80)). + AddPortMapping(components.NewProtocolBuilder("grpc", 4317). + WithTargetPort(4317). + WithProtocol(corev1.ProtocolTCP). + WithAppProtocol(&components.GrpcProtocol), + ), }, args: args{ config: httpAndGrpcConfig, @@ -248,19 +248,20 @@ func TestMultiPortReceiver_Ports(t *testing.T) { Port: 80, }, }, - wantErr: assert.NoError, + wantBuildErr: assert.NoError, + wantErr: assert.NoError, }, { name: "multiple port mappings only one enabled", fields: fields{ name: "receiver6", - opts: []components.MultiPortOption{ - components.WithPortMapping("http", 80), - components.WithPortMapping("grpc", 4317, - components.WithTargetPort(4317), - components.WithProtocol(corev1.ProtocolTCP), - components.WithAppProtocol(&components.GrpcProtocol)), - }, + b: components.NewMultiPortReceiverBuilder("receiver6"). + AddPortMapping(components.NewProtocolBuilder("http", 80)). + AddPortMapping(components.NewProtocolBuilder("grpc", 4317). + WithTargetPort(4317). + WithProtocol(corev1.ProtocolTCP). + WithAppProtocol(&components.GrpcProtocol), + ), }, args: args{ config: httpConfig, @@ -271,39 +272,40 @@ func TestMultiPortReceiver_Ports(t *testing.T) { Port: 80, }, }, - wantErr: assert.NoError, + wantBuildErr: assert.NoError, + wantErr: assert.NoError, }, { name: "error unmarshalling configuration", fields: fields{ name: "receiver1", - opts: nil, + b: components.NewMultiPortReceiverBuilder("receiver1"), }, args: args{ config: "invalid config", // Simulate an invalid config that causes LoadMap to fail }, - want: nil, - wantErr: assert.Error, + want: nil, + wantBuildErr: assert.NoError, + wantErr: assert.Error, }, { name: "error marshaling configuration", fields: fields{ name: "receiver1", - opts: nil, + b: components.NewMultiPortReceiverBuilder("receiver1"), }, args: args{ config: func() {}, // Simulate an invalid config that causes LoadMap to fail }, - want: nil, - wantErr: assert.Error, + want: nil, + wantBuildErr: assert.NoError, + wantErr: assert.Error, }, { name: "unknown protocol", fields: fields{ name: "receiver2", - opts: []components.MultiPortOption{ - components.WithPortMapping("http", 80), - }, + b: components.NewMultiPortReceiverBuilder("receiver2").AddPortMapping(components.NewProtocolBuilder("http", 80)), }, args: args{ config: map[string]interface{}{ @@ -312,18 +314,57 @@ func TestMultiPortReceiver_Ports(t *testing.T) { }, }, }, - want: nil, - wantErr: assert.Error, + want: nil, + wantBuildErr: assert.NoError, + wantErr: assert.Error, + }, + { + name: "no name set", + fields: fields{ + name: "receiver2", + b: components.MultiPortBuilder[*components.MultiProtocolEndpointConfig]{}, + }, + args: args{ + config: map[string]interface{}{}, + }, + want: nil, + wantBuildErr: assert.Error, + }, + { + name: "bad builder", + fields: fields{ + name: "receiver2", + b: components.NewMultiPortReceiverBuilder("receiver2").AddPortMapping(components.NewBuilder[*components.MultiProtocolEndpointConfig]()), + }, + args: args{ + config: map[string]interface{}{}, + }, + want: nil, + wantErr: assert.NoError, + wantBuildErr: assert.Error, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - m := components.NewMultiPortReceiver(tt.fields.name, tt.fields.opts...) - got, err := m.Ports(logr.Discard(), tt.fields.name, tt.args.config) + s, err := tt.fields.b.Build() + if tt.wantBuildErr(t, err, fmt.Sprintf("Ports(%v)", tt.args.config)) && err != nil { + return + } + got, err := s.Ports(logr.Discard(), tt.fields.name, tt.args.config) if !tt.wantErr(t, err, fmt.Sprintf("Ports(%v)", tt.args.config)) { return } assert.ElementsMatchf(t, tt.want, got, "Ports(%v)", tt.args.config) + rbacGen, err := s.GetRBACRules(logr.Discard(), tt.args.config) + assert.NoError(t, err) + assert.Nil(t, rbacGen) }) } } + +func TestMultiMustBuildPanics(t *testing.T) { + b := components.MultiPortBuilder[*components.MultiProtocolEndpointConfig]{} + assert.Panics(t, func() { + b.MustBuild() + }) +} diff --git a/internal/components/processors/helpers.go b/internal/components/processors/helpers.go new file mode 100644 index 0000000000..ab1277b186 --- /dev/null +++ b/internal/components/processors/helpers.go @@ -0,0 +1,50 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package processors + +import "github.com/open-telemetry/opentelemetry-operator/internal/components" + +// registry holds a record of all known receiver parsers. +var registry = make(map[string]components.Parser) + +// Register adds a new parser builder to the list of known builders. +func Register(name string, p components.Parser) { + registry[name] = p +} + +// IsRegistered checks whether a parser is registered with the given name. +func IsRegistered(name string) bool { + _, ok := registry[components.ComponentType(name)] + return ok +} + +// ProcessorFor returns a parser builder for the given exporter name. +func ProcessorFor(name string) components.Parser { + if parser, ok := registry[components.ComponentType(name)]; ok { + return parser + } + return components.NewBuilder[any]().WithName(name).MustBuild() +} + +var componentParsers = []components.Parser{ + components.NewBuilder[K8sAttributeConfig]().WithName("k8sattributes").WithRbacGen(GenerateK8SAttrRbacRules).MustBuild(), + components.NewBuilder[ResourceDetectionConfig]().WithName("resourcedetection").WithRbacGen(GenerateResourceDetectionRbacRules).MustBuild(), +} + +func init() { + for _, parser := range componentParsers { + Register(parser.ParserType(), parser) + } +} diff --git a/internal/components/processors/helpers_test.go b/internal/components/processors/helpers_test.go new file mode 100644 index 0000000000..5ef0b40a8f --- /dev/null +++ b/internal/components/processors/helpers_test.go @@ -0,0 +1,85 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package processors_test + +import ( + "testing" + + "github.com/go-logr/logr" + "github.com/stretchr/testify/assert" + logf "sigs.k8s.io/controller-runtime/pkg/log" + + "github.com/open-telemetry/opentelemetry-operator/internal/components" + "github.com/open-telemetry/opentelemetry-operator/internal/components/processors" +) + +var logger = logf.Log.WithName("unit-tests") + +func TestParserForReturns(t *testing.T) { + const testComponentName = "test" + parser := processors.ProcessorFor(testComponentName) + assert.Equal(t, "test", parser.ParserType()) + assert.Equal(t, "__test", parser.ParserName()) + ports, err := parser.Ports(logr.Discard(), testComponentName, map[string]interface{}{ + "endpoint": "localhost:9000", + }) + assert.NoError(t, err) + assert.Len(t, ports, 0) // Should use the nop parser +} + +func TestCanRegister(t *testing.T) { + const testComponentName = "test" + processors.Register(testComponentName, components.NewSinglePortParserBuilder(testComponentName, 9000).MustBuild()) + assert.True(t, processors.IsRegistered(testComponentName)) + parser := processors.ProcessorFor(testComponentName) + assert.Equal(t, "test", parser.ParserType()) + assert.Equal(t, "__test", parser.ParserName()) + ports, err := parser.Ports(logr.Discard(), testComponentName, map[string]interface{}{}) + assert.NoError(t, err) + assert.Len(t, ports, 1) + assert.Equal(t, ports[0].Port, int32(9000)) +} + +func TestDownstreamParsers(t *testing.T) { + for _, tt := range []struct { + desc string + processorName string + parserName string + }{ + {"k8sattributes", "k8sattributes", "__k8sattributes"}, + {"resourcedetection", "resourcedetection", "__resourcedetection"}, + } { + t.Run(tt.processorName, func(t *testing.T) { + t.Run("builds successfully", func(t *testing.T) { + // test + parser := processors.ProcessorFor(tt.processorName) + + // verify + assert.Equal(t, tt.parserName, parser.ParserName()) + }) + t.Run("bad config errors", func(t *testing.T) { + // prepare + parser := processors.ProcessorFor(tt.processorName) + + // test throwing in pure junk + _, err := parser.Ports(logger, tt.processorName, func() {}) + + // verify + assert.Nil(t, err) + }) + + }) + } +} diff --git a/internal/components/processors/k8sattribute.go b/internal/components/processors/k8sattribute.go new file mode 100644 index 0000000000..f9d5266c60 --- /dev/null +++ b/internal/components/processors/k8sattribute.go @@ -0,0 +1,81 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package processors + +import ( + "fmt" + "strings" + + "github.com/go-logr/logr" + rbacv1 "k8s.io/api/rbac/v1" +) + +type FieldExtractConfig struct { + TagName string `mapstructure:"tag_name"` + Key string `mapstructure:"key"` + KeyRegex string `mapstructure:"key_regex"` + Regex string `mapstructure:"regex"` + From string `mapstructure:"from"` +} + +type Extract struct { + Metadata []string `mapstructure:"metadata"` + Labels []FieldExtractConfig `mapstructure:"labels"` + Annotations []FieldExtractConfig `mapstructure:"annotations"` +} + +// K8sAttributeConfig is a minimal struct needed for parsing a valid k8sattribute processor configuration +// This only contains the fields necessary for parsing, other fields can be added in the future. +type K8sAttributeConfig struct { + Extract Extract `mapstructure:"extract"` +} + +func GenerateK8SAttrRbacRules(_ logr.Logger, config K8sAttributeConfig) ([]rbacv1.PolicyRule, error) { + // These policies need to be added always + var prs = []rbacv1.PolicyRule{ + { + APIGroups: []string{""}, + Resources: []string{"pods", "namespaces"}, + Verbs: []string{"get", "watch", "list"}, + }, + } + + replicasetPolicy := rbacv1.PolicyRule{ + APIGroups: []string{"apps"}, + Resources: []string{"replicasets"}, + Verbs: []string{"get", "watch", "list"}, + } + + if len(config.Extract.Metadata) == 0 { + prs = append(prs, replicasetPolicy) + } + addedReplicasetPolicy := false + for _, m := range config.Extract.Metadata { + metadataField := fmt.Sprint(m) + if (metadataField == "k8s.deployment.uid" || metadataField == "k8s.deployment.name") && !addedReplicasetPolicy { + prs = append(prs, replicasetPolicy) + addedReplicasetPolicy = true + } else if strings.Contains(metadataField, "k8s.node") { + prs = append(prs, + rbacv1.PolicyRule{ + APIGroups: []string{""}, + Resources: []string{"nodes"}, + Verbs: []string{"get", "watch", "list"}, + }, + ) + } + } + return prs, nil +} diff --git a/internal/components/processors/k8sattribute_test.go b/internal/components/processors/k8sattribute_test.go new file mode 100644 index 0000000000..604656f93a --- /dev/null +++ b/internal/components/processors/k8sattribute_test.go @@ -0,0 +1,151 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package processors_test + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/assert" + rbacv1 "k8s.io/api/rbac/v1" + + "github.com/open-telemetry/opentelemetry-operator/internal/components/processors" +) + +func TestGenerateK8SAttrRbacRules(t *testing.T) { + type args struct { + config interface{} + } + tests := []struct { + name string + args args + want []rbacv1.PolicyRule + wantErr assert.ErrorAssertionFunc + }{ + { + name: "default config with empty metadata", + args: args{ + config: map[string]interface{}{ + "extract": map[string]interface{}{ + "metadata": []string{}, + "labels": []interface{}{}, + "annotations": []interface{}{}, + }, + }, + }, + want: []rbacv1.PolicyRule{ + { + APIGroups: []string{""}, + Resources: []string{"pods", "namespaces"}, + Verbs: []string{"get", "watch", "list"}, + }, + { + APIGroups: []string{"apps"}, + Resources: []string{"replicasets"}, + Verbs: []string{"get", "watch", "list"}, + }, + }, + wantErr: assert.NoError, + }, + { + name: "config with deployment metadata", + args: args{ + config: map[string]interface{}{ + "extract": map[string]interface{}{ + "metadata": []string{"k8s.deployment.uid", "k8s.deployment.name"}, + "labels": []interface{}{}, + "annotations": []interface{}{}, + }, + }, + }, + want: []rbacv1.PolicyRule{ + { + APIGroups: []string{""}, + Resources: []string{"pods", "namespaces"}, + Verbs: []string{"get", "watch", "list"}, + }, + { + APIGroups: []string{"apps"}, + Resources: []string{"replicasets"}, + Verbs: []string{"get", "watch", "list"}, + }, + }, + wantErr: assert.NoError, + }, + { + name: "config with node metadata", + args: args{ + config: map[string]interface{}{ + "extract": map[string]interface{}{ + "metadata": []string{"k8s.node.name"}, + "labels": []interface{}{}, + "annotations": []interface{}{}, + }, + }, + }, + want: []rbacv1.PolicyRule{ + { + APIGroups: []string{""}, + Resources: []string{"pods", "namespaces"}, + Verbs: []string{"get", "watch", "list"}, + }, + { + APIGroups: []string{""}, + Resources: []string{"nodes"}, + Verbs: []string{"get", "watch", "list"}, + }, + }, + wantErr: assert.NoError, + }, + { + name: "invalid config", + args: args{ + config: "hi", + }, + want: nil, + wantErr: assert.Error, + }, + { + name: "config with invalid metadata", + args: args{ + config: map[string]interface{}{ + "extract": map[string]interface{}{ + "metadata": []string{"invalid.metadata"}, + "labels": []interface{}{}, + "annotations": []interface{}{}, + }, + }, + }, + want: []rbacv1.PolicyRule{ + { + APIGroups: []string{""}, + Resources: []string{"pods", "namespaces"}, + Verbs: []string{"get", "watch", "list"}, + }, + }, + wantErr: assert.NoError, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + parser := processors.ProcessorFor("k8sattributes") + got, err := parser.GetRBACRules(logger, tt.args.config) + if !tt.wantErr(t, err, fmt.Sprintf("GetRBACRules(%v)", tt.args.config)) { + return + } + assert.Equalf(t, tt.want, got, "GetRBACRules(%v)", tt.args.config) + }) + } +} diff --git a/internal/components/processors/resourcedetection.go b/internal/components/processors/resourcedetection.go new file mode 100644 index 0000000000..5d5af17c11 --- /dev/null +++ b/internal/components/processors/resourcedetection.go @@ -0,0 +1,52 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package processors + +import ( + "fmt" + + "github.com/go-logr/logr" + rbacv1 "k8s.io/api/rbac/v1" +) + +// ResourceDetectionConfig is a minimal struct needed for parsing a valid resourcedetection processor configuration +// This only contains the fields necessary for parsing, other fields can be added in the future. +type ResourceDetectionConfig struct { + Detectors []string `mapstructure:"detectors"` +} + +func GenerateResourceDetectionRbacRules(_ logr.Logger, config ResourceDetectionConfig) ([]rbacv1.PolicyRule, error) { + var prs []rbacv1.PolicyRule + for _, d := range config.Detectors { + detectorName := fmt.Sprint(d) + switch detectorName { + case "k8snode": + policy := rbacv1.PolicyRule{ + APIGroups: []string{""}, + Resources: []string{"nodes"}, + Verbs: []string{"get", "list"}, + } + prs = append(prs, policy) + case "openshift": + policy := rbacv1.PolicyRule{ + APIGroups: []string{"config.openshift.io"}, + Resources: []string{"infrastructures", "infrastructures/status"}, + Verbs: []string{"get", "watch", "list"}, + } + prs = append(prs, policy) + } + } + return prs, nil +} diff --git a/internal/components/processors/resourcedetection_test.go b/internal/components/processors/resourcedetection_test.go new file mode 100644 index 0000000000..4d6b448d40 --- /dev/null +++ b/internal/components/processors/resourcedetection_test.go @@ -0,0 +1,121 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package processors_test + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/assert" + rbacv1 "k8s.io/api/rbac/v1" + + "github.com/open-telemetry/opentelemetry-operator/internal/components/processors" +) + +func TestGenerateResourceDetectionRbacRules(t *testing.T) { + type args struct { + config map[string]interface{} + } + tests := []struct { + name string + args args + want []rbacv1.PolicyRule + wantErr assert.ErrorAssertionFunc + }{ + { + name: "default config with no detectors", + args: args{ + config: map[string]interface{}{ + "detectors": []string{}, + }, + }, + want: nil, + wantErr: assert.NoError, + }, + { + name: "config with k8snode detector", + args: args{ + config: map[string]interface{}{ + "detectors": []string{"k8snode"}, + }, + }, + want: []rbacv1.PolicyRule{ + { + APIGroups: []string{""}, + Resources: []string{"nodes"}, + Verbs: []string{"get", "list"}, + }, + }, + wantErr: assert.NoError, + }, + { + name: "config with openshift detector", + args: args{ + config: map[string]interface{}{ + "detectors": []string{"openshift"}, + }, + }, + want: []rbacv1.PolicyRule{ + { + APIGroups: []string{"config.openshift.io"}, + Resources: []string{"infrastructures", "infrastructures/status"}, + Verbs: []string{"get", "watch", "list"}, + }, + }, + wantErr: assert.NoError, + }, + { + name: "config with multiple detectors", + args: args{ + config: map[string]interface{}{ + "detectors": []string{"k8snode", "openshift"}, + }, + }, + want: []rbacv1.PolicyRule{ + { + APIGroups: []string{""}, + Resources: []string{"nodes"}, + Verbs: []string{"get", "list"}, + }, + { + APIGroups: []string{"config.openshift.io"}, + Resources: []string{"infrastructures", "infrastructures/status"}, + Verbs: []string{"get", "watch", "list"}, + }, + }, + wantErr: assert.NoError, + }, + { + name: "config with invalid detector", + args: args{ + config: map[string]interface{}{ + "detectors": []string{"invalid"}, + }, + }, + want: nil, + wantErr: assert.NoError, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + parser := processors.ProcessorFor("resourcedetection") + got, err := parser.GetRBACRules(logger, tt.args.config) + if !tt.wantErr(t, err, fmt.Sprintf("GetRBACRules(%v)", tt.args.config)) { + return + } + assert.Equalf(t, tt.want, got, "GetRBACRules(%v)", tt.args.config) + }) + } +} diff --git a/internal/components/receivers/helpers.go b/internal/components/receivers/helpers.go index 6802f3a038..89a3cb6fe7 100644 --- a/internal/components/receivers/helpers.go +++ b/internal/components/receivers/helpers.go @@ -39,82 +39,103 @@ func ReceiverFor(name string) components.Parser { if parser, ok := registry[components.ComponentType(name)]; ok { return parser } - return components.NewSilentSinglePortParser(components.ComponentType(name), components.UnsetPort) + return components.NewSilentSinglePortParserBuilder(components.ComponentType(name), components.UnsetPort).MustBuild() } // NewScraperParser is an instance of a generic parser that returns nothing when called and never fails. func NewScraperParser(name string) *components.GenericParser[any] { - return components.NewGenericParser[any](name, components.UnsetPort, nil) + return components.NewBuilder[any]().WithName(name).WithPort(components.UnsetPort).MustBuild() } var ( componentParsers = []components.Parser{ - components.NewMultiPortReceiver("otlp", - components.WithPortMapping( - "grpc", - 4317, - components.WithAppProtocol(&components.GrpcProtocol), - components.WithTargetPort(4317), - ), components.WithPortMapping( - "http", - 4318, - components.WithAppProtocol(&components.HttpProtocol), - components.WithTargetPort(4318), - ), - ), - components.NewMultiPortReceiver("skywalking", - components.WithPortMapping(components.GrpcProtocol, 11800, - components.WithTargetPort(11800), - components.WithAppProtocol(&components.GrpcProtocol), - ), - components.WithPortMapping(components.HttpProtocol, 12800, - components.WithTargetPort(12800), - components.WithAppProtocol(&components.HttpProtocol), - )), - components.NewMultiPortReceiver("jaeger", - components.WithPortMapping(components.GrpcProtocol, 14250, - components.WithTargetPort(14250), - components.WithProtocol(corev1.ProtocolTCP), - components.WithAppProtocol(&components.GrpcProtocol), - ), - components.WithPortMapping("thrift_http", 14268, - components.WithTargetPort(14268), - components.WithProtocol(corev1.ProtocolTCP), - components.WithAppProtocol(&components.HttpProtocol), - ), - components.WithPortMapping("thrift_compact", 6831, - components.WithTargetPort(6831), - components.WithProtocol(corev1.ProtocolUDP), - ), - components.WithPortMapping("thrift_binary", 6832, - components.WithTargetPort(6832), - components.WithProtocol(corev1.ProtocolUDP), - ), - ), - components.NewMultiPortReceiver("loki", - components.WithPortMapping(components.GrpcProtocol, 9095, - components.WithTargetPort(9095), - components.WithAppProtocol(&components.GrpcProtocol), - ), - components.WithPortMapping(components.HttpProtocol, 3100, - components.WithTargetPort(3100), - components.WithAppProtocol(&components.HttpProtocol), - ), - ), - components.NewSinglePortParser("awsxray", 2000, components.WithProtocol(corev1.ProtocolUDP), components.WithTargetPort(2000)), - components.NewSinglePortParser("carbon", 2003, components.WithTargetPort(2003)), - components.NewSinglePortParser("collectd", 8081, components.WithTargetPort(8081)), - components.NewSinglePortParser("fluentforward", 8006, components.WithTargetPort(8006)), - components.NewSinglePortParser("influxdb", 8086, components.WithTargetPort(8086)), - components.NewSinglePortParser("opencensus", 55678, components.WithAppProtocol(nil), components.WithTargetPort(55678)), - components.NewSinglePortParser("sapm", 7276, components.WithTargetPort(7276)), - components.NewSinglePortParser("signalfx", 9943, components.WithTargetPort(9943)), - components.NewSinglePortParser("splunk_hec", 8088, components.WithTargetPort(8088)), - components.NewSinglePortParser("statsd", 8125, components.WithProtocol(corev1.ProtocolUDP), components.WithTargetPort(8125)), - components.NewSinglePortParser("tcplog", components.UnsetPort, components.WithProtocol(corev1.ProtocolTCP)), - components.NewSinglePortParser("udplog", components.UnsetPort, components.WithProtocol(corev1.ProtocolUDP)), - components.NewSinglePortParser("wavefront", 2003, components.WithTargetPort(2003)), - components.NewSinglePortParser("zipkin", 9411, components.WithAppProtocol(&components.HttpProtocol), components.WithProtocol(corev1.ProtocolTCP), components.WithTargetPort(3100)), + components.NewMultiPortReceiverBuilder("otlp"). + AddPortMapping(components.NewProtocolBuilder("grpc", 4317). + WithAppProtocol(&components.GrpcProtocol). + WithTargetPort(4317)). + AddPortMapping(components.NewProtocolBuilder("http", 4318). + WithAppProtocol(&components.HttpProtocol). + WithTargetPort(4318)). + MustBuild(), + components.NewMultiPortReceiverBuilder("skywalking"). + AddPortMapping(components.NewProtocolBuilder(components.GrpcProtocol, 11800). + WithTargetPort(11800). + WithAppProtocol(&components.GrpcProtocol)). + AddPortMapping(components.NewProtocolBuilder(components.HttpProtocol, 12800). + WithTargetPort(12800). + WithAppProtocol(&components.HttpProtocol)). + MustBuild(), + components.NewMultiPortReceiverBuilder("jaeger"). + AddPortMapping(components.NewProtocolBuilder(components.GrpcProtocol, 14250). + WithTargetPort(14250). + WithProtocol(corev1.ProtocolTCP). + WithAppProtocol(&components.GrpcProtocol)). + AddPortMapping(components.NewProtocolBuilder("thrift_http", 14268). + WithTargetPort(14268). + WithProtocol(corev1.ProtocolTCP). + WithAppProtocol(&components.HttpProtocol)). + AddPortMapping(components.NewProtocolBuilder("thrift_compact", 6831). + WithTargetPort(6831). + WithProtocol(corev1.ProtocolUDP)). + AddPortMapping(components.NewProtocolBuilder("thrift_binary", 6832). + WithTargetPort(6832). + WithProtocol(corev1.ProtocolUDP)). + MustBuild(), + components.NewMultiPortReceiverBuilder("loki"). + AddPortMapping(components.NewProtocolBuilder(components.GrpcProtocol, 9095). + WithTargetPort(9095). + WithAppProtocol(&components.GrpcProtocol)). + AddPortMapping(components.NewProtocolBuilder(components.HttpProtocol, 3100). + WithTargetPort(3100). + WithAppProtocol(&components.HttpProtocol)). + MustBuild(), + components.NewSinglePortParserBuilder("awsxray", 2000). + WithTargetPort(2000). + WithProtocol(corev1.ProtocolUDP). + MustBuild(), + components.NewSinglePortParserBuilder("carbon", 2003). + WithTargetPort(2003). + MustBuild(), + components.NewSinglePortParserBuilder("collectd", 8081). + WithTargetPort(8081). + MustBuild(), + components.NewSinglePortParserBuilder("fluentforward", 8006). + WithTargetPort(8006). + MustBuild(), + components.NewSinglePortParserBuilder("influxdb", 8086). + WithTargetPort(8086). + MustBuild(), + components.NewSinglePortParserBuilder("opencensus", 55678). + WithAppProtocol(nil). + WithTargetPort(55678). + MustBuild(), + components.NewSinglePortParserBuilder("sapm", 7276). + WithTargetPort(7276). + MustBuild(), + components.NewSinglePortParserBuilder("signalfx", 9943). + WithTargetPort(9943). + MustBuild(), + components.NewSinglePortParserBuilder("splunk_hec", 8088). + WithTargetPort(8088). + MustBuild(), + components.NewSinglePortParserBuilder("statsd", 8125). + WithProtocol(corev1.ProtocolUDP). + WithTargetPort(8125). + MustBuild(), + components.NewSinglePortParserBuilder("tcplog", components.UnsetPort). + WithProtocol(corev1.ProtocolTCP). + MustBuild(), + components.NewSinglePortParserBuilder("udplog", components.UnsetPort). + WithProtocol(corev1.ProtocolUDP). + MustBuild(), + components.NewSinglePortParserBuilder("wavefront", 2003). + WithTargetPort(2003). + MustBuild(), + components.NewSinglePortParserBuilder("zipkin", 9411). + WithAppProtocol(&components.HttpProtocol). + WithProtocol(corev1.ProtocolTCP). + WithTargetPort(3100). + MustBuild(), NewScraperParser("prometheus"), NewScraperParser("kubeletstats"), NewScraperParser("sshcheck"), diff --git a/internal/components/single_endpoint.go b/internal/components/single_endpoint.go index e97df3b41f..914136b568 100644 --- a/internal/components/single_endpoint.go +++ b/internal/components/single_endpoint.go @@ -21,6 +21,10 @@ import ( "github.com/open-telemetry/opentelemetry-operator/internal/naming" ) +var ( + _ Parser = &GenericParser[*SingleEndpointConfig]{} +) + // SingleEndpointConfig represents the minimal struct for a given YAML configuration input containing either // endpoint or listen_address. type SingleEndpointConfig struct { @@ -48,38 +52,37 @@ func (g *SingleEndpointConfig) GetPortNum() (int32, error) { return UnsetPort, PortNotFoundErr } -func ParseSingleEndpointSilent(logger logr.Logger, name string, o *Option, singleEndpointConfig *SingleEndpointConfig) ([]corev1.ServicePort, error) { - return internalParseSingleEndpoint(logger, name, true, o, singleEndpointConfig) +func ParseSingleEndpointSilent(logger logr.Logger, name string, defaultPort *corev1.ServicePort, singleEndpointConfig *SingleEndpointConfig) ([]corev1.ServicePort, error) { + return internalParseSingleEndpoint(logger, name, true, defaultPort, singleEndpointConfig) } -func ParseSingleEndpoint(logger logr.Logger, name string, o *Option, singleEndpointConfig *SingleEndpointConfig) ([]corev1.ServicePort, error) { - return internalParseSingleEndpoint(logger, name, false, o, singleEndpointConfig) +func ParseSingleEndpoint(logger logr.Logger, name string, defaultPort *corev1.ServicePort, singleEndpointConfig *SingleEndpointConfig) ([]corev1.ServicePort, error) { + return internalParseSingleEndpoint(logger, name, false, defaultPort, singleEndpointConfig) } -func internalParseSingleEndpoint(logger logr.Logger, name string, failSilently bool, o *Option, singleEndpointConfig *SingleEndpointConfig) ([]corev1.ServicePort, error) { +func internalParseSingleEndpoint(logger logr.Logger, name string, failSilently bool, defaultPort *corev1.ServicePort, singleEndpointConfig *SingleEndpointConfig) ([]corev1.ServicePort, error) { if singleEndpointConfig == nil { return nil, nil } - if _, err := singleEndpointConfig.GetPortNum(); err != nil && o.port == UnsetPort { + if _, err := singleEndpointConfig.GetPortNum(); err != nil && defaultPort.Port == UnsetPort { if failSilently { - logger.WithValues("receiver", o.name).V(4).Info("couldn't parse the endpoint's port and no default port set", "error", err) + logger.WithValues("receiver", defaultPort.Name).V(4).Info("couldn't parse the endpoint's port and no default port set", "error", err) err = nil } else { - logger.WithValues("receiver", o.name).Error(err, "couldn't parse the endpoint's port and no default port set") + logger.WithValues("receiver", defaultPort.Name).Error(err, "couldn't parse the endpoint's port and no default port set") } return []corev1.ServicePort{}, err } - port := singleEndpointConfig.GetPortNumOrDefault(logger, o.port) - svcPort := o.GetServicePort() + port := singleEndpointConfig.GetPortNumOrDefault(logger, defaultPort.Port) + svcPort := defaultPort svcPort.Name = naming.PortName(name, port) return []corev1.ServicePort{ConstructServicePort(svcPort, port)}, nil } -func NewSinglePortParser(name string, port int32, opts ...PortBuilderOption) *GenericParser[*SingleEndpointConfig] { - return NewGenericParser(name, port, ParseSingleEndpoint, opts...) +func NewSinglePortParserBuilder(name string, port int32) Builder[*SingleEndpointConfig] { + return NewBuilder[*SingleEndpointConfig]().WithPort(port).WithName(name).WithPortParser(ParseSingleEndpoint) } -// NewSilentSinglePortParser returns a ParseSingleEndpoint that errors silently on failure to find a port. -func NewSilentSinglePortParser(name string, port int32, opts ...PortBuilderOption) *GenericParser[*SingleEndpointConfig] { - return NewGenericParser(name, port, ParseSingleEndpointSilent, opts...) +func NewSilentSinglePortParserBuilder(name string, port int32) Builder[*SingleEndpointConfig] { + return NewBuilder[*SingleEndpointConfig]().WithPort(port).WithName(name).WithPortParser(ParseSingleEndpointSilent) } diff --git a/internal/components/single_endpoint_test.go b/internal/components/single_endpoint_test.go index 9e544d40b9..bf0757d835 100644 --- a/internal/components/single_endpoint_test.go +++ b/internal/components/single_endpoint_test.go @@ -109,9 +109,7 @@ func TestSingleEndpointConfig_GetPortNumOrDefault(t *testing.T) { func TestSingleEndpointParser_ParserName(t *testing.T) { type fields struct { - name string - port int32 - opts []components.PortBuilderOption + b components.Builder[*components.SingleEndpointConfig] } tests := []struct { name string @@ -121,25 +119,22 @@ func TestSingleEndpointParser_ParserName(t *testing.T) { { name: "no options", fields: fields{ - name: "receiver1", - opts: nil, + b: components.NewSinglePortParserBuilder("receiver1", components.UnsetPort), }, want: "__receiver1", }, { name: "with port mapping without builder options", fields: fields{ - name: "receiver2", - opts: []components.PortBuilderOption{ - components.WithTargetPort(8080), - }, + b: components.NewSinglePortParserBuilder("receiver2", components.UnsetPort).WithTargetPort(8080), }, want: "__receiver2", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - s := components.NewSinglePortParser(tt.fields.name, tt.fields.port, tt.fields.opts...) + s, err := tt.fields.b.Build() + assert.NoError(t, err) assert.Equalf(t, tt.want, s.ParserName(), "ParserName()") }) } @@ -147,9 +142,7 @@ func TestSingleEndpointParser_ParserName(t *testing.T) { func TestSingleEndpointParser_ParserType(t *testing.T) { type fields struct { - name string - port int32 - opts []components.PortBuilderOption + b components.Builder[*components.SingleEndpointConfig] } tests := []struct { name string @@ -159,25 +152,22 @@ func TestSingleEndpointParser_ParserType(t *testing.T) { { name: "no options", fields: fields{ - name: "receiver1", - opts: nil, + b: components.NewSinglePortParserBuilder("receiver1", components.UnsetPort), }, want: "receiver1", }, { name: "with port mapping without builder options", fields: fields{ - name: "receiver2/test", - opts: []components.PortBuilderOption{ - components.WithTargetPort(80), - }, + b: components.NewSinglePortParserBuilder("receiver2", components.UnsetPort).WithTargetPort(8080), }, want: "receiver2", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - s := components.NewSinglePortParser(tt.fields.name, tt.fields.port, tt.fields.opts...) + s, err := tt.fields.b.Build() + assert.NoError(t, err) assert.Equalf(t, tt.want, s.ParserType(), "ParserType()") }) } @@ -185,9 +175,7 @@ func TestSingleEndpointParser_ParserType(t *testing.T) { func TestSingleEndpointParser_Ports(t *testing.T) { type fields struct { - name string - port int32 - opts []components.PortBuilderOption + b components.Builder[*components.SingleEndpointConfig] } type args struct { config interface{} @@ -202,8 +190,7 @@ func TestSingleEndpointParser_Ports(t *testing.T) { { name: "ValidConfigWithPort", fields: fields{ - name: "testparser", - port: 8080, + b: components.NewSinglePortParserBuilder("testparser", 8080), }, args: args{ config: map[string]interface{}{ @@ -215,11 +202,21 @@ func TestSingleEndpointParser_Ports(t *testing.T) { }, wantErr: assert.NoError, }, + { + name: "ValidConfigWithPort nil config", + fields: fields{ + b: components.NewSinglePortParserBuilder("testparser", 8080), + }, + args: args{ + config: nil, + }, + want: nil, + wantErr: assert.NoError, + }, { name: "ValidConfigWithDefaultPort", fields: fields{ - name: "testparser", - port: 8080, + b: components.NewSinglePortParserBuilder("testparser", 8080), }, args: args{ config: map[string]interface{}{}, @@ -232,13 +229,10 @@ func TestSingleEndpointParser_Ports(t *testing.T) { { name: "ConfigWithFixins", fields: fields{ - name: "testparser", - port: 8080, - opts: []components.PortBuilderOption{ - components.WithTargetPort(4317), - components.WithProtocol(corev1.ProtocolTCP), - components.WithAppProtocol(&components.GrpcProtocol), - }, + b: components.NewSinglePortParserBuilder("testparser", 8080). + WithTargetPort(4317). + WithProtocol(corev1.ProtocolTCP). + WithAppProtocol(&components.GrpcProtocol), }, args: args{ config: map[string]interface{}{}, @@ -257,8 +251,7 @@ func TestSingleEndpointParser_Ports(t *testing.T) { { name: "InvalidConfigMissingPort", fields: fields{ - name: "testparser", - port: 0, + b: components.NewSinglePortParserBuilder("testparser", components.UnsetPort), }, args: args{ config: map[string]interface{}{ @@ -271,8 +264,7 @@ func TestSingleEndpointParser_Ports(t *testing.T) { { name: "ErrorParsingConfig", fields: fields{ - name: "testparser", - port: 8080, + b: components.NewSinglePortParserBuilder("testparser", components.UnsetPort), }, args: args{ config: "invalid config", @@ -283,8 +275,9 @@ func TestSingleEndpointParser_Ports(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - s := components.NewSinglePortParser(tt.fields.name, tt.fields.port, tt.fields.opts...) - got, err := s.Ports(logr.Discard(), tt.fields.name, tt.args.config) + s, err := tt.fields.b.Build() + assert.NoError(t, err) + got, err := s.Ports(logr.Discard(), s.ParserType(), tt.args.config) if !tt.wantErr(t, err, fmt.Sprintf("Ports(%v)", tt.args.config)) { return } @@ -294,10 +287,9 @@ func TestSingleEndpointParser_Ports(t *testing.T) { } func TestNewSilentSinglePortParser_Ports(t *testing.T) { + type fields struct { - name string - port int32 - opts []components.PortBuilderOption + b components.Builder[*components.SingleEndpointConfig] } type args struct { config interface{} @@ -312,8 +304,7 @@ func TestNewSilentSinglePortParser_Ports(t *testing.T) { { name: "ValidConfigWithPort", fields: fields{ - name: "testparser", - port: 8080, + b: components.NewSilentSinglePortParserBuilder("testparser", 8080), }, args: args{ config: map[string]interface{}{ @@ -328,8 +319,7 @@ func TestNewSilentSinglePortParser_Ports(t *testing.T) { { name: "ValidConfigWithDefaultPort", fields: fields{ - name: "testparser", - port: 8080, + b: components.NewSilentSinglePortParserBuilder("testparser", 8080), }, args: args{ config: map[string]interface{}{}, @@ -342,13 +332,10 @@ func TestNewSilentSinglePortParser_Ports(t *testing.T) { { name: "ConfigWithFixins", fields: fields{ - name: "testparser", - port: 8080, - opts: []components.PortBuilderOption{ - components.WithTargetPort(4317), - components.WithProtocol(corev1.ProtocolTCP), - components.WithAppProtocol(&components.GrpcProtocol), - }, + b: components.NewSilentSinglePortParserBuilder("testparser", 8080). + WithTargetPort(4317). + WithProtocol(corev1.ProtocolTCP). + WithAppProtocol(&components.GrpcProtocol), }, args: args{ config: map[string]interface{}{}, @@ -367,8 +354,7 @@ func TestNewSilentSinglePortParser_Ports(t *testing.T) { { name: "InvalidConfigMissingPort", fields: fields{ - name: "testparser", - port: 0, + b: components.NewSilentSinglePortParserBuilder("testparser", components.UnsetPort), }, args: args{ config: map[string]interface{}{ @@ -381,8 +367,7 @@ func TestNewSilentSinglePortParser_Ports(t *testing.T) { { name: "ErrorParsingConfig", fields: fields{ - name: "testparser", - port: 8080, + b: components.NewSilentSinglePortParserBuilder("testparser", 8080), }, args: args{ config: "invalid config", @@ -393,8 +378,9 @@ func TestNewSilentSinglePortParser_Ports(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - s := components.NewSilentSinglePortParser(tt.fields.name, tt.fields.port, tt.fields.opts...) - got, err := s.Ports(logr.Discard(), tt.fields.name, tt.args.config) + s, err := tt.fields.b.Build() + assert.NoError(t, err) + got, err := s.Ports(logr.Discard(), s.ParserType(), tt.args.config) if !tt.wantErr(t, err, fmt.Sprintf("Ports(%v)", tt.args.config)) { return } diff --git a/internal/manifests/collector/rbac.go b/internal/manifests/collector/rbac.go index 70bac31c75..610d948b67 100644 --- a/internal/manifests/collector/rbac.go +++ b/internal/manifests/collector/rbac.go @@ -19,25 +19,15 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" - "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector/adapters" "github.com/open-telemetry/opentelemetry-operator/internal/manifests/manifestutils" "github.com/open-telemetry/opentelemetry-operator/internal/naming" ) func ClusterRole(params manifests.Params) (*rbacv1.ClusterRole, error) { - confStr, err := params.OtelCol.Spec.Config.Yaml() + rules, err := params.OtelCol.Spec.Config.GetAllRbacRules(params.Log) if err != nil { return nil, err - } - - configFromString, err := adapters.ConfigFromString(confStr) - if err != nil { - params.Log.Error(err, "couldn't extract the configuration from the context") - return nil, nil - } - rules := adapters.ConfigToRBAC(params.Log, configFromString) - - if len(rules) == 0 { + } else if len(rules) == 0 { return nil, nil } @@ -60,18 +50,10 @@ func ClusterRole(params manifests.Params) (*rbacv1.ClusterRole, error) { } func ClusterRoleBinding(params manifests.Params) (*rbacv1.ClusterRoleBinding, error) { - confStr, err := params.OtelCol.Spec.Config.Yaml() + rules, err := params.OtelCol.Spec.Config.GetAllRbacRules(params.Log) if err != nil { return nil, err - } - configFromString, err := adapters.ConfigFromString(confStr) - if err != nil { - params.Log.Error(err, "couldn't extract the configuration from the context") - return nil, nil - } - rules := adapters.ConfigToRBAC(params.Log, configFromString) - - if len(rules) == 0 { + } else if len(rules) == 0 { return nil, nil }
false
false
false
false
false
storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. Default is ThinProvisioned.
+
+ Default: ThinProvisioned
false