Skip to content

Commit

Permalink
Merge branch 'main' into instrumentation-support-label
Browse files Browse the repository at this point in the history
  • Loading branch information
crossoverJie committed May 17, 2024
2 parents 73eb99e + 797f660 commit a4500da
Show file tree
Hide file tree
Showing 51 changed files with 1,556 additions and 279 deletions.
16 changes: 16 additions & 0 deletions .chloggen/add-collector-pool-healthy.yaml
Original file line number Diff line number Diff line change
@@ -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: opamp

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add healthy field at collector pool level in opamp bridge heartbeat

# One or more tracking issues related to the change
issues: [2936]

# (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:
16 changes: 16 additions & 0 deletions .chloggen/cleanup-roles.yaml
Original file line number Diff line number Diff line change
@@ -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: Cleanup ClusterRoles and ClusterRoleBindings created by the operator

# One or more tracking issues related to the change
issues: [2938]

# (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: The operator uses finalizer on the collector to run the cleanup
17 changes: 17 additions & 0 deletions .chloggen/collector-readiness-support.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 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: Add support for readinessProbe on OpenTelemetryCollector CRD.

# One or more tracking issues related to the change
issues: [2943]

# (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: |
Add support for readinessProbe on `OpenTelemetryCollector` and its default similar to the already supported livenessProbe.
16 changes: 16 additions & 0 deletions .chloggen/customized-log-encoder.yaml
Original file line number Diff line number Diff line change
@@ -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: operator

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Enabling new Logs Enconder Configuration parameters.

# One or more tracking issues related to the change
issues: [268]

# (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:
17 changes: 17 additions & 0 deletions .chloggen/fix-collector-node-selector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 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: Fix to reflect changes of OpenTelemetryCollector.spec.nodeSelector in the collector Pods

# One or more tracking issues related to the change
issues: [2940]

# (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: |
When updating `OpenTelemetryCollector.spec.nodeSelector` it was not removing previous selector from the final collector pod (Deployment/Daemonset/Statefulset).
16 changes: 16 additions & 0 deletions .chloggen/fix-ta-check-policy.yaml
Original file line number Diff line number Diff line change
@@ -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: Fixed non-expected warnings on TA webhook.

# One or more tracking issues related to the change
issues: [2685]

# (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:
18 changes: 18 additions & 0 deletions .chloggen/ta-add-https.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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: Added option for creating an mTLS-configured HTTPS server to fetch scrape config with real secret values.

# One or more tracking issues related to the change
issues: [1669]

# (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: |
The change introduces an option to create an additional HTTPS server with mTLS configuration.
This server is specifically utilized for obtaining the scrape configuration with actual secret values.
16 changes: 16 additions & 0 deletions .chloggen/verify-prom-crd-resources.yaml
Original file line number Diff line number Diff line change
@@ -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: Ensure all Prometheus CRDs are installed

# One or more tracking issues related to the change
issues: [2964]

# (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:
34 changes: 34 additions & 0 deletions DEBUG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Debug tips to the OpenTelemetry Operator

A tip during a troubleshooting process is always welcome. Therefore, we prepared this documentation to help you identify possible issues and improve the application's reliability.

## Customizing Logs Output
By the default the Operator's log format is console like you can see below:
```bash
2024-05-06T11:55:11+02:00 INFO setup Prometheus CRDs are installed, adding to scheme.
2024-05-06T11:55:11+02:00 INFO setup Openshift CRDs are not installed, skipping adding to scheme.
2024-05-06T11:55:11+02:00 INFO setup the env var WATCH_NAMESPACE isn't set, watching all namespaces
2024-05-06T11:55:11+02:00 INFO Webhooks are disabled, operator is running an unsupported mode {"ENABLE_WEBHOOKS": "false"}
2024-05-06T11:55:11+02:00 INFO setup starting manager
```
If it is necessary to customize the log format, so you can use one of the following parameters:
- `--zap-devel`: Development Mode defaults(encoder=consoleEncoder,logLevel=Debug,stackTraceLevel=Warn). Production Mode defaults(encoder=jsonEncoder,logLevel=Info,stackTraceLevel=Error) (default false)
- `--zap-encoder`: Zap log encoding (one of 'json' or 'console')
- `--zap-log-level` Zap Level to configure the verbosity of logging. Can be one of 'debug', 'info', 'error', or any integer value > 0 which corresponds to custom debug levels of increasing verbosity
- `--zap-stacktrace-level` Zap Level at and above which stacktraces are captured (one of 'info', 'error', 'panic').
- `--zap-time-encoding` Zap time encoding (one of 'epoch', 'millis', 'nano', 'iso8601', 'rfc3339' or 'rfc3339nano'). Defaults to 'epoch'.
- The following parameters are effective only if the `--zap-encoder=json`:
- `zap-message-key`: The message key to be used in the customized Log Encoder
- `zap-level-key`: The level key to be used in the customized Log Encoder
- `zap-time-key`: The time key to be used in the customized Log Encoder
- `zap-level-format`: The level format to be used in the customized Log Encoder
Running the Operator with the parameters `--zap-encoder=json`, `--zap-message-key="msg"`, `zap-level-key="severity"`,`zap-time-key="timestamp"`,`zap-level-format="uppercase"` you should see the following output:
```bash
{"severity":"INFO","timestamp":"2024-05-07T16:23:35+02:00","logger":"setup","msg":"Prometheus CRDs are installed, adding to scheme."}
{"severity":"INFO","timestamp":"2024-05-07T16:23:35+02:00","logger":"setup","msg":"Openshift CRDs are not installed, skipping adding to scheme."}
{"severity":"INFO","timestamp":"2024-05-07T16:23:35+02:00","logger":"setup","msg":"the env var WATCH_NAMESPACE isn't set, watching all namespaces"}
{"severity":"INFO","timestamp":"2024-05-07T16:23:35+02:00","msg":"Webhooks are disabled, operator is running an unsupported mode","ENABLE_WEBHOOKS":"false"}
{"severity":"INFO","timestamp":"2024-05-07T16:23:35+02:00","logger":"setup","msg":"starting manager"}
```
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -777,23 +777,26 @@ Emeritus Approvers:

Target Allocator Maintainers ([@open-telemetry/operator-ta-maintainers](https://github.com/orgs/open-telemetry/teams/operator-ta-maintainers)):

- [Anthony Mirabella](https://github.com/Aneurysm9), AWS
- [Kristina Pathak](https://github.com/kristinapathak), Lightstep
- [Sebastian Poxhofer](https://github.com/secustor)

Emeritus Target Allocator Maintainers

- [Anthony Mirabella](https://github.com/Aneurysm9), AWS

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), Sumo Logic
- [Pavol Loffay](https://github.com/pavolloffay), Red Hat
- [Vineeth Pothulapati](https://github.com/VineethReddy02), Timescale

Emeritus Maintainers

- [Alex Boten](https://github.com/codeboten), Lightstep
- [Bogdan Drutu](https://github.com/BogdanDrutu), Splunk
- [Juraci Paixão Kröhling](https://github.com/jpkrohling), Grafana Labs
- [Tigran Najaryan](https://github.com/tigrannajaryan), Splunk
- [Vineeth Pothulapati](https://github.com/VineethReddy02), Timescale

Learn more about roles in the [community repository](https://github.com/open-telemetry/community/blob/main/community-membership.md).

Expand Down
13 changes: 6 additions & 7 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,9 @@ The operator should be released within a week after the [OpenTelemetry collector

| Version | Release manager |
|----------|-----------------|
| v0.100.0 | @VineethReddy02 |
| v0.101.0 | @TylerHelmuth |
| v0.102.0 | @swiatekm-sumo |
| v0.103.0 | @frzifus |
| v0.104.0 | @jaronoff97 |
| v0.105.0 | @pavolloffay |
| v0.106.0 | @yuriolisa |
| v0.100.0 | @TylerHelmuth |
| v0.101.0 | @swiatekm-sumo |
| v0.102.0 | @frzifus |
| v0.103.0 | @jaronoff97 |
| v0.104.0 | @pavolloffay |
| v0.105.0 | @yuriolisa |
55 changes: 34 additions & 21 deletions apis/v1beta1/collector_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func (c CollectorWebhook) validate(ctx context.Context, r *OpenTelemetryCollecto

nullObjects := r.Spec.Config.nullObjects()
if len(nullObjects) > 0 {
warnings = append(warnings, fmt.Sprintf("Collector config spec.config has null objects: %s. For compatibility tooling (kustomize and kubectl edit) it is recommended to use empty obejects e.g. batch: {}.", strings.Join(nullObjects, ", ")))
warnings = append(warnings, fmt.Sprintf("Collector config spec.config has null objects: %s. For compatibility with other tooling, such as kustomize and kubectl edit, it is recommended to use empty objects e.g. batch: {}.", strings.Join(nullObjects, ", ")))
}

// validate volumeClaimTemplates
Expand Down Expand Up @@ -289,25 +289,14 @@ func (c CollectorWebhook) validate(ctx context.Context, r *OpenTelemetryCollecto
return warnings, fmt.Errorf("a valid Ingress hostname has to be defined for subdomain ruleType")
}

if r.Spec.LivenessProbe != nil {
if r.Spec.LivenessProbe.InitialDelaySeconds != nil && *r.Spec.LivenessProbe.InitialDelaySeconds < 0 {
return warnings, fmt.Errorf("the OpenTelemetry Spec LivenessProbe InitialDelaySeconds configuration is incorrect. InitialDelaySeconds should be greater than or equal to 0")
}
if r.Spec.LivenessProbe.PeriodSeconds != nil && *r.Spec.LivenessProbe.PeriodSeconds < 1 {
return warnings, fmt.Errorf("the OpenTelemetry Spec LivenessProbe PeriodSeconds configuration is incorrect. PeriodSeconds should be greater than or equal to 1")
}
if r.Spec.LivenessProbe.TimeoutSeconds != nil && *r.Spec.LivenessProbe.TimeoutSeconds < 1 {
return warnings, fmt.Errorf("the OpenTelemetry Spec LivenessProbe TimeoutSeconds configuration is incorrect. TimeoutSeconds should be greater than or equal to 1")
}
if r.Spec.LivenessProbe.SuccessThreshold != nil && *r.Spec.LivenessProbe.SuccessThreshold < 1 {
return warnings, fmt.Errorf("the OpenTelemetry Spec LivenessProbe SuccessThreshold configuration is incorrect. SuccessThreshold should be greater than or equal to 1")
}
if r.Spec.LivenessProbe.FailureThreshold != nil && *r.Spec.LivenessProbe.FailureThreshold < 1 {
return warnings, fmt.Errorf("the OpenTelemetry Spec LivenessProbe FailureThreshold configuration is incorrect. FailureThreshold should be greater than or equal to 1")
}
if r.Spec.LivenessProbe.TerminationGracePeriodSeconds != nil && *r.Spec.LivenessProbe.TerminationGracePeriodSeconds < 1 {
return warnings, fmt.Errorf("the OpenTelemetry Spec LivenessProbe TerminationGracePeriodSeconds configuration is incorrect. TerminationGracePeriodSeconds should be greater than or equal to 1")
}
// validate probes Liveness/Readiness
err := validateProbe("LivenessProbe", r.Spec.LivenessProbe)
if err != nil {
return warnings, err
}
err = validateProbe("ReadinessProbe", r.Spec.ReadinessProbe)
if err != nil {
return warnings, err
}

// validate updateStrategy for DaemonSet
Expand Down Expand Up @@ -355,7 +344,7 @@ func (c CollectorWebhook) validateTargetAllocatorConfig(ctx context.Context, r *
}
// if the prometheusCR is enabled, it needs a suite of permissions to function
if r.Spec.TargetAllocator.PrometheusCR.Enabled {
if subjectAccessReviews, err := c.reviewer.CheckPolicyRules(ctx, r.GetNamespace(), r.Spec.TargetAllocator.ServiceAccount, targetAllocatorCRPolicyRules...); err != nil {
if subjectAccessReviews, err := c.reviewer.CheckPolicyRules(ctx, r.Spec.TargetAllocator.ServiceAccount, r.GetNamespace(), targetAllocatorCRPolicyRules...); err != nil {
return nil, fmt.Errorf("unable to check rbac rules %w", err)
} else if allowed, deniedReviews := rbac.AllSubjectAccessReviewsAllowed(subjectAccessReviews); !allowed {
return rbac.WarningsGroupedByResource(deniedReviews), nil
Expand All @@ -365,6 +354,30 @@ func (c CollectorWebhook) validateTargetAllocatorConfig(ctx context.Context, r *
return nil, nil
}

func validateProbe(probeName string, probe *Probe) error {
if probe != nil {
if probe.InitialDelaySeconds != nil && *probe.InitialDelaySeconds < 0 {
return fmt.Errorf("the OpenTelemetry Spec %s InitialDelaySeconds configuration is incorrect. InitialDelaySeconds should be greater than or equal to 0", probeName)
}
if probe.PeriodSeconds != nil && *probe.PeriodSeconds < 1 {
return fmt.Errorf("the OpenTelemetry Spec %s PeriodSeconds configuration is incorrect. PeriodSeconds should be greater than or equal to 1", probeName)
}
if probe.TimeoutSeconds != nil && *probe.TimeoutSeconds < 1 {
return fmt.Errorf("the OpenTelemetry Spec %s TimeoutSeconds configuration is incorrect. TimeoutSeconds should be greater than or equal to 1", probeName)
}
if probe.SuccessThreshold != nil && *probe.SuccessThreshold < 1 {
return fmt.Errorf("the OpenTelemetry Spec %s SuccessThreshold configuration is incorrect. SuccessThreshold should be greater than or equal to 1", probeName)
}
if probe.FailureThreshold != nil && *probe.FailureThreshold < 1 {
return fmt.Errorf("the OpenTelemetry Spec %s FailureThreshold configuration is incorrect. FailureThreshold should be greater than or equal to 1", probeName)
}
if probe.TerminationGracePeriodSeconds != nil && *probe.TerminationGracePeriodSeconds < 1 {
return fmt.Errorf("the OpenTelemetry Spec %s TerminationGracePeriodSeconds configuration is incorrect. TerminationGracePeriodSeconds should be greater than or equal to 1", probeName)
}
}
return nil
}

func checkAutoscalerSpec(autoscaler *AutoscalerSpec) error {
if autoscaler.Behavior != nil {
if autoscaler.Behavior.ScaleDown != nil && autoscaler.Behavior.ScaleDown.StabilizationWindowSeconds != nil &&
Expand Down
Loading

0 comments on commit a4500da

Please sign in to comment.