Skip to content

Commit a66d50e

Browse files
authored
Merge branch 'main' into 3078
2 parents c8bb8b5 + b256c9a commit a66d50e

File tree

7 files changed

+39
-7
lines changed

7 files changed

+39
-7
lines changed

.chloggen/3474.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: breaking
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action)
5+
component: operator
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: Make ServiceMonitor for operator metrics optional and disable it by default
9+
10+
# One or more tracking issues related to the change
11+
issues: [3474]
12+
13+
# (Optional) One or more lines of additional information to render under the primary note.
14+
# These lines will be padded with 2 spaces and then inserted directly into the document.
15+
# Use pipe (|) for multiline entries.
16+
subtext: |
17+
Add `--create-sm-operator-metrics` flag to create a ServiceMonitor for the operator metrics.
18+
This is disabled by default, which is a breaking change, because it was enabled by default in 0.113.0 and 0.114.0.

.github/workflows/shellcheck.yaml

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ jobs:
1111
name: shellcheck
1212
runs-on: ubuntu-24.04
1313
env:
14-
VERSION: v0.10.0
14+
# renovate: datasource=github-releases depName=https://github.com/koalaman/shellcheck
15+
SHELLCHECK_VERSION: v0.10.0
1516
steps:
1617
- uses: actions/checkout@v4
1718
- name: shellcheck ci scripts
@@ -21,12 +22,12 @@ jobs:
2122
with:
2223
scandir: ".ci"
2324
severity: warning
24-
version: ${{ env.VERSION }}
25+
version: ${{ env.SHELLCHECK_VERSION }}
2526
- name: shellcheck hack scripts
2627
uses: ludeeus/[email protected]
2728
env:
2829
SHELLCHECK_OPTS: -x -e SC2059 -e SC2086
2930
with:
3031
scandir: "hack"
3132
severity: warning
32-
version: ${{ env.VERSION }}
33+
version: ${{ env.SHELLCHECK_VERSION }}

bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,7 @@ spec:
528528
- --openshift-create-dashboard=true
529529
- --feature-gates=+operator.observability.prometheus
530530
- --enable-cr-metrics=true
531+
- --create-sm-operator-metrics=true
531532
env:
532533
- name: SERVICE_ACCOUNT_NAME
533534
valueFrom:

config/overlays/openshift/manager-patch.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
- '--enable-go-instrumentation=true'
1010
- '--openshift-create-dashboard=true'
1111
- '--feature-gates=+operator.observability.prometheus'
12-
- '--enable-cr-metrics=true'
12+
- '--enable-cr-metrics=true'
13+
- '--create-sm-operator-metrics=true'

controllers/reconcile_test.go

+7
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,13 @@ func TestOpenTelemetryCollectorReconciler_Reconcile(t *testing.T) {
648648
if deletionTimestamp != nil {
649649
err := k8sClient.Delete(testContext, &tt.args.params, client.PropagationPolicy(metav1.DeletePropagationForeground))
650650
assert.NoError(t, err)
651+
// wait until the reconciler sees the deletion
652+
assert.EventuallyWithT(t, func(collect *assert.CollectT) {
653+
actual := &v1beta1.OpenTelemetryCollector{}
654+
err := reconciler.Get(testContext, nsn, actual)
655+
assert.NoError(collect, err)
656+
assert.NotNil(t, actual.GetDeletionTimestamp())
657+
}, time.Second*5, time.Millisecond)
651658
}
652659
req := k8sreconcile.Request{
653660
NamespacedName: nsn,

main.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ func main() {
115115
enableNodeJSInstrumentation bool
116116
enableJavaInstrumentation bool
117117
enableCRMetrics bool
118+
createSMOperatorMetrics bool
118119
collectorImage string
119120
targetAllocatorImage string
120121
operatorOpAMPBridgeImage string
@@ -154,6 +155,7 @@ func main() {
154155
pflag.BoolVar(&enableNodeJSInstrumentation, constants.FlagNodeJS, true, "Controls whether the operator supports nodejs auto-instrumentation")
155156
pflag.BoolVar(&enableJavaInstrumentation, constants.FlagJava, true, "Controls whether the operator supports java auto-instrumentation")
156157
pflag.BoolVar(&enableCRMetrics, constants.FlagCRMetrics, false, "Controls whether exposing the CR metrics is enabled")
158+
pflag.BoolVar(&createSMOperatorMetrics, "create-sm-operator-metrics", false, "Create a ServiceMonitor for the operator metrics")
157159

158160
stringFlagOrEnv(&collectorImage, "collector-image", "RELATED_IMAGE_COLLECTOR", fmt.Sprintf("ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:%s", v.OpenTelemetryCollector), "The default OpenTelemetry collector image. This image is used when no image is specified in the CustomResource.")
159161
stringFlagOrEnv(&targetAllocatorImage, "target-allocator-image", "RELATED_IMAGE_TARGET_ALLOCATOR", fmt.Sprintf("ghcr.io/open-telemetry/opentelemetry-operator/target-allocator:%s", v.TargetAllocator), "The default OpenTelemetry target allocator image. This image is used when no image is specified in the CustomResource.")
@@ -219,6 +221,7 @@ func main() {
219221
"enable-nodejs-instrumentation", enableNodeJSInstrumentation,
220222
"enable-java-instrumentation", enableJavaInstrumentation,
221223
"create-openshift-dashboard", createOpenShiftDashboard,
224+
"create-sm-operator-metrics", createSMOperatorMetrics,
222225
"zap-message-key", encodeMessageKey,
223226
"zap-level-key", encodeLevelKey,
224227
"zap-time-key", encodeTimeKey,
@@ -413,7 +416,7 @@ func main() {
413416
os.Exit(1)
414417
}
415418

416-
if cfg.PrometheusCRAvailability() == prometheus.Available {
419+
if cfg.PrometheusCRAvailability() == prometheus.Available && createSMOperatorMetrics {
417420
operatorMetrics, opError := operatormetrics.NewOperatorMetrics(mgr.GetConfig(), scheme, ctrl.Log.WithName("operator-metrics-sm"))
418421
if opError != nil {
419422
setupLog.Error(opError, "Failed to create the operator metrics SM")

renovate.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
},
1818
{
1919
"customType": "regex",
20-
"description" : "Update tool versions in the Makefile",
20+
"description" : "Update tool versions in the Makefile and Github Actions",
2121
"fileMatch": [
22-
"(^|/)Makefile$"
22+
"(^|/)Makefile$",
23+
"(^|/)\\.github/workflows/.+\\.ya?ml$"
2324
],
2425
"matchStrings": [
2526
"# renovate: datasource=(?<datasource>[a-z-.]+?) depName=(?<depName>[^\\s]+?)(?: (?:packageName)=(?<packageName>[^\\s]+?))?(?: versioning=(?<versioning>[^\\s]+?))?(?: extractVersion=(?<extractVersion>[^\\s]+?))?(?: registryUrl=(?<registryUrl>[^\\s]+?))\\s+[A-Za-z0-9_]+?_VERSION\\s*:*\\??=\\s*[\"']?(?<currentValue>.+?)[\"']?\\s"

0 commit comments

Comments
 (0)