Skip to content

Commit f987153

Browse files
Merge branch 'main' into bump-cont-runtime
2 parents a83ca36 + 667af32 commit f987153

File tree

25 files changed

+233
-188
lines changed

25 files changed

+233
-188
lines changed

.github/workflows/ci.yaml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88
pull_request:
99
branches:
1010
- "*"
11+
merge_group:
12+
types: [checks_requested]
1113

1214
permissions:
1315
contents: read
@@ -37,12 +39,12 @@ jobs:
3739
- name: Checkout
3840
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3941
with:
40-
fetch-depth: 2
41-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
42+
fetch-depth: ${{ github.event_name == 'merge_group' && 0 || 2 }}
43+
ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha || github.sha }}
4244
- name: Check if it is a protected branch
4345
id: is-protected-branch
4446
run: |
45-
if [[ "$GITHUB_REF" == "refs/heads/main" || "$GITHUB_REF" == refs/heads/release-* ]]; then
47+
if [[ "$GITHUB_REF" == "refs/heads/main" || "$GITHUB_REF" == refs/heads/release-* || "$GITHUB_EVENT_NAME" == "merge_group" ]]; then
4648
echo "is_protected_branch=true" >> "$GITHUB_OUTPUT"
4749
else
4850
echo "is_protected_branch=false" >> "$GITHUB_OUTPUT"
@@ -62,43 +64,43 @@ jobs:
6264
files: |
6365
.github/workflows/**
6466
.github/actions/**
65-
base_sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
67+
base_sha: ${{ github.event.pull_request.base.sha || github.event.merge_group.head_sha || github.event.before }}
6668
- name: Detect Go file changes
6769
uses: tj-actions/changed-files@e0021407031f5be11a464abee9a0776171c79891 # v47.0.1
6870
id: go-files
6971
with:
7072
files: |
7173
**/*.go
7274
go.mod
73-
base_sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
75+
base_sha: ${{ github.event.pull_request.base.sha || github.event.merge_group.head_sha || github.event.before }}
7476
- name: Detect Dockerfile changes
7577
uses: tj-actions/changed-files@e0021407031f5be11a464abee9a0776171c79891 # v47.0.1
7678
id: dockerfile
7779
with:
7880
files: |
7981
Dockerfile
80-
base_sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
82+
base_sha: ${{ github.event.pull_request.base.sha || github.event.merge_group.head_sha || github.event.before }}
8183
- name: Detect Helm config changes
8284
uses: tj-actions/changed-files@e0021407031f5be11a464abee9a0776171c79891 # v47.0.1
8385
id: helm
8486
with:
8587
files: |
8688
config/**
87-
base_sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
89+
base_sha: ${{ github.event.pull_request.base.sha || github.event.merge_group.head_sha || github.event.before }}
8890
- name: Detect prerequisites.mk changes
8991
uses: tj-actions/changed-files@e0021407031f5be11a464abee9a0776171c79891 # v47.0.1
9092
id: prerequisites
9193
with:
9294
files: |
9395
hack/make/prerequisites.mk
94-
base_sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
96+
base_sha: ${{ github.event.pull_request.base.sha || github.event.merge_group.head_sha || github.event.before }}
9597
- name: Detect markdown changes
9698
uses: tj-actions/changed-files@e0021407031f5be11a464abee9a0776171c79891 # v47.0.1
9799
id: markdown
98100
with:
99101
files: |
100102
**/*.md
101-
base_sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
103+
base_sha: ${{ github.event.pull_request.base.sha || github.event.merge_group.head_sha || github.event.before }}
102104
- name: List Changed Files
103105
run: |
104106
echo "CI changed: ${CHANGED_CI_FILES}"

.github/workflows/codeql-analysis.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88
# The branches below must be a subset of the branches above
99
branches:
1010
- main
11+
merge_group:
12+
types: [checks_requested]
1113
schedule:
1214
- cron: '34 23 * * 0'
1315

.github/workflows/fips-ci.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88
pull_request:
99
branches:
1010
- "*"
11+
merge_group:
12+
types: [checks_requested]
1113

1214
permissions:
1315
contents: read
@@ -29,12 +31,12 @@ jobs:
2931
- name: Checkout
3032
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3133
with:
32-
fetch-depth: 2
33-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
34+
fetch-depth: ${{ github.event_name == 'merge_group' && 0 || 2 }}
35+
ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha || github.sha }}
3436
- name: Check if it is a protected branch
3537
id: is-protected-branch
3638
run: |
37-
if [[ "$GITHUB_REF" == "refs/heads/main" || "$GITHUB_REF" == refs/heads/release-* ]]; then
39+
if [[ "$GITHUB_REF" == "refs/heads/main" || "$GITHUB_REF" == refs/heads/release-* || "$GITHUB_EVENT_NAME" == "merge_group" ]]; then
3840
echo "is_protected_branch=true" >> "$GITHUB_OUTPUT"
3941
else
4042
echo "is_protected_branch=false" >> "$GITHUB_OUTPUT"
@@ -46,22 +48,22 @@ jobs:
4648
files: |
4749
.github/workflows/**
4850
.github/actions/**
49-
base_sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
51+
base_sha: ${{ github.event.pull_request.base.sha || github.event.merge_group.head_sha || github.event.before }}
5052
- name: Detect Go file changes
5153
uses: tj-actions/changed-files@e0021407031f5be11a464abee9a0776171c79891 # v47.0.1
5254
id: go-files
5355
with:
5456
files: |
5557
**/*.go
5658
go.mod
57-
base_sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
59+
base_sha: ${{ github.event.pull_request.base.sha || github.event.merge_group.head_sha || github.event.before }}
5860
- name: Detect fips.Dockerfile changes
5961
uses: tj-actions/changed-files@e0021407031f5be11a464abee9a0776171c79891 # v47.0.1
6062
id: dockerfile
6163
with:
6264
files: |
6365
fips.Dockerfile
64-
base_sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
66+
base_sha: ${{ github.event.pull_request.base.sha || github.event.merge_group.head_sha || github.event.before }}
6567
- name: List Changed Files
6668
run: |
6769
echo "CI changed: ${CHANGED_CI_FILES}"

cmd/bootstrapper/cmd.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package bootstrapper
22

33
import (
4-
"github.com/Dynatrace/dynatrace-bootstrapper/cmd"
5-
"github.com/Dynatrace/dynatrace-bootstrapper/cmd/configure"
6-
"github.com/Dynatrace/dynatrace-bootstrapper/cmd/move"
4+
"github.com/Dynatrace/dynatrace-bootstrapper/cmd/k8sinit"
5+
"github.com/Dynatrace/dynatrace-bootstrapper/cmd/k8sinit/configure"
6+
"github.com/Dynatrace/dynatrace-bootstrapper/cmd/k8sinit/move"
77
"github.com/Dynatrace/dynatrace-operator/cmd/bootstrapper/download"
88
"github.com/Dynatrace/dynatrace-operator/pkg/arch"
99
dtclient "github.com/Dynatrace/dynatrace-operator/pkg/clients/dynatrace"
@@ -18,8 +18,8 @@ import (
1818
const (
1919
Use = "bootstrap"
2020

21-
TargetFolderFlag = cmd.TargetFolderFlag
22-
SuppressErrorsFlag = cmd.SuppressErrorsFlag
21+
TargetFolderFlag = k8sinit.TargetFolderFlag
22+
SuppressErrorsFlag = k8sinit.SuppressErrorsFlag
2323
TechnologiesFlag = move.TechnologyFlag
2424

2525
TargetVersionFlag = "version"

cmd/bootstrapper/cmd_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import (
55
"path/filepath"
66
"testing"
77

8-
"github.com/Dynatrace/dynatrace-bootstrapper/cmd/configure"
9-
"github.com/Dynatrace/dynatrace-bootstrapper/cmd/configure/attributes/container"
10-
"github.com/Dynatrace/dynatrace-bootstrapper/cmd/configure/attributes/pod"
8+
"github.com/Dynatrace/dynatrace-bootstrapper/cmd/k8sinit/configure"
9+
"github.com/Dynatrace/dynatrace-bootstrapper/cmd/k8sinit/configure/attributes/container"
10+
"github.com/Dynatrace/dynatrace-bootstrapper/cmd/k8sinit/configure/attributes/pod"
1111
"github.com/Dynatrace/dynatrace-bootstrapper/pkg/configure/oneagent/pmc"
1212
"github.com/Dynatrace/dynatrace-bootstrapper/pkg/configure/oneagent/preload"
1313
"github.com/stretchr/testify/assert"

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/Dynatrace/dynatrace-operator
33
go 1.25.0
44

55
require (
6-
github.com/Dynatrace/dynatrace-bootstrapper v1.1.3
6+
github.com/Dynatrace/dynatrace-bootstrapper v1.2.0
77
github.com/container-storage-interface/spec v1.12.0
88
github.com/docker/cli v29.1.5+incompatible
99
github.com/evanphx/json-patch v5.9.11+incompatible

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
github.com/Dynatrace/dynatrace-bootstrapper v1.1.3 h1:kEJPUFtYdK9zmbAh/VolS9olRXxMbPTNrkWYJcmEZts=
2-
github.com/Dynatrace/dynatrace-bootstrapper v1.1.3/go.mod h1:ay06V+TDGXVTY1FpmZj386RJ7XBbxwLcJdsbiCjlK4w=
1+
github.com/Dynatrace/dynatrace-bootstrapper v1.2.0 h1:BTPXQAVvDSei/vyYEltG/0NfHDykGq9BvhMGPiOyHLI=
2+
github.com/Dynatrace/dynatrace-bootstrapper v1.2.0/go.mod h1:kn5omRWE5sRTwTCTrSl3L3NLJv77FA8pzx2/UPPMGuA=
33
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
44
github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
55
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=

pkg/controllers/dynakube/logmonitoring/logmonsettings/conditions.go

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,19 @@ import (
66
)
77

88
const (
9-
alreadyExistReason = "AlreadyExist"
10-
skippedReason = "Skipped"
11-
errorReason = "Error"
12-
createdReason = "Created"
9+
existsReason = "Exists"
10+
skippedReason = "Skipped"
11+
errorReason = "Error"
1312

1413
ConditionType = "LogMonitoringSettings"
1514
)
1615

17-
func setCreatedCondition(conditions *[]metav1.Condition) {
16+
func setExistsCondition(conditions *[]metav1.Condition) {
1817
condition := metav1.Condition{
1918
Type: ConditionType,
2019
Status: metav1.ConditionTrue,
21-
Reason: createdReason,
22-
Message: "LogMonitoring settings have been created.",
23-
}
24-
_ = meta.SetStatusCondition(conditions, condition)
25-
}
26-
27-
func setAlreadyExistsCondition(conditions *[]metav1.Condition) {
28-
condition := metav1.Condition{
29-
Type: ConditionType,
30-
Status: metav1.ConditionTrue,
31-
Reason: alreadyExistReason,
32-
Message: "LogMonitoring settings already exist, will not create new ones.",
20+
Reason: existsReason,
21+
Message: "LogMonitoring settings exist.",
3322
}
3423
_ = meta.SetStatusCondition(conditions, condition)
3524
}
@@ -39,7 +28,7 @@ func setErrorCondition(conditions *[]metav1.Condition, message string) {
3928
Type: ConditionType,
4029
Status: metav1.ConditionFalse,
4130
Reason: errorReason,
42-
Message: "LogMonitoring settings creation was skipped: " + message,
31+
Message: "LogMonitoring settings creation has encountered an error: " + message,
4332
}
4433
_ = meta.SetStatusCondition(conditions, condition)
4534
}

pkg/controllers/dynakube/logmonitoring/logmonsettings/reconciler.go

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,40 @@ import (
88
"github.com/Dynatrace/dynatrace-operator/pkg/api/latest/dynakube/logmonitoring"
99
dtclient "github.com/Dynatrace/dynatrace-operator/pkg/clients/dynatrace"
1010
"github.com/Dynatrace/dynatrace-operator/pkg/clients/dynatrace/settings"
11-
"github.com/Dynatrace/dynatrace-operator/pkg/controllers"
1211
"github.com/Dynatrace/dynatrace-operator/pkg/util/kubernetes/fields/k8sconditions"
1312
"github.com/Dynatrace/dynatrace-operator/pkg/util/timeprovider"
1413
"github.com/pkg/errors"
1514
"k8s.io/apimachinery/pkg/api/meta"
1615
)
1716

18-
type reconciler struct {
17+
type Reconciler struct {
1918
dk *dynakube.DynaKube
2019
dtc settings.APIClient
2120

2221
timeProvider *timeprovider.Provider
2322
}
2423

25-
type ReconcilerBuilder func(dtc settings.APIClient, dk *dynakube.DynaKube) controllers.Reconciler
26-
27-
var _ ReconcilerBuilder = NewReconciler
28-
29-
func NewReconciler(dtc settings.APIClient, dk *dynakube.DynaKube) controllers.Reconciler {
30-
return &reconciler{
24+
func NewReconciler(dtc settings.APIClient, dk *dynakube.DynaKube) *Reconciler {
25+
return &Reconciler{
3126
dk: dk,
3227
dtc: dtc,
3328
timeProvider: timeprovider.New(),
3429
}
3530
}
3631

37-
func (r *reconciler) Reconcile(ctx context.Context) error {
38-
if !k8sconditions.IsOutdated(r.timeProvider, r.dk, ConditionType) {
39-
return nil
40-
}
41-
32+
func (r *Reconciler) Reconcile(ctx context.Context) error {
4233
if !r.dk.LogMonitoring().IsEnabled() {
4334
_ = meta.RemoveStatusCondition(r.dk.Conditions(), ConditionType)
4435

4536
return nil
4637
}
4738

39+
if !k8sconditions.IsOutdated(r.timeProvider, r.dk, ConditionType) {
40+
return nil
41+
}
42+
43+
_ = meta.RemoveStatusCondition(r.dk.Conditions(), ConditionType)
44+
4845
hasReadScope := k8sconditions.IsOptionalScopeAvailable(r.dk, dtclient.ConditionTypeAPITokenSettingsRead)
4946
hasWriteScope := k8sconditions.IsOptionalScopeAvailable(r.dk, dtclient.ConditionTypeAPITokenSettingsWrite)
5047

@@ -75,7 +72,7 @@ func (r *reconciler) Reconcile(ctx context.Context) error {
7572
return nil
7673
}
7774

78-
func (r *reconciler) checkLogMonitoringSettings(ctx context.Context) error {
75+
func (r *Reconciler) checkLogMonitoringSettings(ctx context.Context) error {
7976
log.Info("start reconciling log monitoring settings")
8077

8178
if r.dk.Status.KubernetesClusterMEID == "" {
@@ -97,7 +94,7 @@ func (r *reconciler) checkLogMonitoringSettings(ctx context.Context) error {
9794
if logMonitoringSettings.TotalCount > 0 {
9895
log.Info("there are already settings", "settings", logMonitoringSettings)
9996

100-
setAlreadyExistsCondition(r.dk.Conditions())
97+
setExistsCondition(r.dk.Conditions())
10198

10299
return nil
103100
}
@@ -114,7 +111,7 @@ func (r *reconciler) checkLogMonitoringSettings(ctx context.Context) error {
114111
return err
115112
}
116113

117-
setCreatedCondition(r.dk.Conditions())
114+
setExistsCondition(r.dk.Conditions())
118115
log.Info("log monitoring setting created", "settings", objectID)
119116

120117
return nil

0 commit comments

Comments
 (0)