Skip to content

Commit d7108d6

Browse files
Merge branch 'master' into asset-image-info-json
2 parents 7c61db0 + c97c7a0 commit d7108d6

File tree

52 files changed

+1422
-101
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1422
-101
lines changed

.evergreen-tasks.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,46 @@ tasks:
690690
commands:
691691
- func: "e2e_test"
692692

693+
- name: e2e_sharded_cluster_scram_sha_256_switch_project
694+
tags: [ "patch-run" ]
695+
commands:
696+
- func: "e2e_test"
697+
698+
- name: e2e_sharded_cluster_scram_sha_1_switch_project
699+
tags: [ "patch-run" ]
700+
commands:
701+
- func: "e2e_test"
702+
703+
- name: e2e_sharded_cluster_x509_switch_project
704+
tags: [ "patch-run" ]
705+
commands:
706+
- func: "e2e_test"
707+
708+
- name: e2e_replica_set_scram_sha_256_switch_project
709+
tags: [ "patch-run" ]
710+
commands:
711+
- func: "e2e_test"
712+
713+
- name: e2e_replica_set_scram_sha_1_switch_project
714+
tags: [ "patch-run" ]
715+
commands:
716+
- func: "e2e_test"
717+
718+
- name: e2e_replica_set_x509_switch_project
719+
tags: [ "patch-run" ]
720+
commands:
721+
- func: "e2e_test"
722+
723+
- name: e2e_replica_set_ldap_switch_project
724+
tags: [ "patch-run" ]
725+
commands:
726+
- func: "e2e_test"
727+
728+
- name: e2e_sharded_cluster_ldap_switch_project
729+
tags: [ "patch-run" ]
730+
commands:
731+
- func: "e2e_test"
732+
693733
# TODO: not used in any variant
694734
- name: e2e_replica_set_scram_x509_internal_cluster
695735
tags: [ "patch-run" ]

.evergreen.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,15 @@ task_groups:
745745
- e2e_sharded_cluster_scram_sha_1_user_connectivity
746746
- e2e_sharded_cluster_scram_x509_ic_manual_certs
747747
- e2e_sharded_cluster_external_access
748+
- e2e_replica_set_scram_sha_256_switch_project
749+
- e2e_sharded_cluster_scram_sha_256_switch_project
750+
- e2e_replica_set_scram_sha_1_switch_project
751+
- e2e_sharded_cluster_scram_sha_1_switch_project
752+
# TODO CLOUDP-349093 - Disabled these tests as they don't use the password secret, and project migrations aren't fully supported yet.
753+
# e2e_sharded_cluster_x509_switch_project
754+
# e2e_replica_set_x509_switch_project
755+
# e2e_replica_set_ldap_switch_project
756+
# e2e_sharded_cluster_ldap_switch_project
748757
# e2e_auth_transitions_task_group
749758
- e2e_replica_set_scram_sha_and_x509
750759
- e2e_replica_set_x509_to_scram_transition

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Summary
22

3-
<!-- Enter your issue summary here.-->
3+
<!-- Enter your PR summary here. Try to emphasize on WHY this change is needed, followed by what's being done in the PR. -->
44

55
## Proof of Work
66

api/v1/mdb/mongodb_types.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,13 @@ func (m *MongoDB) GetOwnerLabels() map[string]string {
171171
}
172172
}
173173

174+
// GetKind returns the Kind of the MongoDB resource. This is needed because
175+
// when objects are retrieved from the Kubernetes API, the TypeMeta
176+
// (which contains Kind and APIVersion) is not populated.
177+
func (m *MongoDB) GetKind() string {
178+
return "MongoDB"
179+
}
180+
174181
// GetSecretsMountedIntoDBPod returns a list of all the optional secret names that are used by this resource.
175182
func (m *MongoDB) GetSecretsMountedIntoDBPod() []string {
176183
secrets := []string{}
@@ -688,10 +695,10 @@ func (m *MongoDbSpec) GetClusterDomain() string {
688695

689696
func (m *MongoDbSpec) MinimumMajorVersion() uint64 {
690697
if m.FeatureCompatibilityVersion != nil && *m.FeatureCompatibilityVersion != "" {
691-
fcv := *m.FeatureCompatibilityVersion
698+
fcvString := *m.FeatureCompatibilityVersion
692699

693700
// ignore errors here as the format of FCV/version is handled by CRD validation
694-
semverFcv, _ := semver.Make(fmt.Sprintf("%s.0", fcv))
701+
semverFcv, _ := fcv.FeatureCompatibilityVersionToSemverFormat(fcvString)
695702
return semverFcv.Major
696703
}
697704
semverVersion, _ := semver.Make(m.GetMongoDBVersion())

api/v1/mdb/mongodb_validation.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212

1313
v1 "github.com/mongodb/mongodb-kubernetes/api/v1"
1414
"github.com/mongodb/mongodb-kubernetes/api/v1/status"
15+
"github.com/mongodb/mongodb-kubernetes/pkg/fcv"
1516
"github.com/mongodb/mongodb-kubernetes/pkg/multicluster"
1617
"github.com/mongodb/mongodb-kubernetes/pkg/util"
1718
"github.com/mongodb/mongodb-kubernetes/pkg/util/stringutil"
@@ -430,15 +431,21 @@ func featureCompatibilityVersionValidation(d DbCommonSpec) v1.ValidationResult {
430431
return ValidateFCV(fcv)
431432
}
432433

433-
func ValidateFCV(fcv *string) v1.ValidationResult {
434-
if fcv != nil {
435-
f := *fcv
436-
if f == util.AlwaysMatchVersionFCV {
434+
func ValidateFCV(fcvStringPointer *string) v1.ValidationResult {
435+
if fcvStringPointer != nil {
436+
fcvString := *fcvStringPointer
437+
if fcvString == util.AlwaysMatchVersionFCV {
437438
return v1.ValidationSuccess()
438439
}
439-
splitted := strings.Split(f, ".")
440+
441+
splitted := strings.Split(fcvString, ".")
440442
if len(splitted) != 2 {
441-
return v1.ValidationError("invalid feature compatibility version: %s, possible values are: '%s' or 'major.minor'", f, util.AlwaysMatchVersionFCV)
443+
return v1.ValidationError("invalid feature compatibility version %q, possible values are: '%s' or 'major.minor'", fcvString, util.AlwaysMatchVersionFCV)
444+
}
445+
446+
_, err := fcv.FeatureCompatibilityVersionToSemverFormat(fcvString)
447+
if err != nil {
448+
return v1.ValidationError("invalid feature compatibility version %q: %s", fcvString, err)
442449
}
443450
}
444451
return v1.ValidationResult{}

api/v1/mdb/mongodb_validation_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ func TestReplicasetFCV(t *testing.T) {
244244
name: "Invalid FCV value",
245245
fcv: ptr.To("test"),
246246
expectError: true,
247-
expectedErrorMessage: "invalid feature compatibility version: test, possible values are: 'AlwaysMatchVersion' or 'major.minor'",
247+
expectedErrorMessage: "invalid feature compatibility version \"test\", possible values are: 'AlwaysMatchVersion' or 'major.minor'",
248248
},
249249
{
250250
name: "Valid FCV with specific version",
@@ -255,7 +255,13 @@ func TestReplicasetFCV(t *testing.T) {
255255
name: "Invalid FCV - not major.minor only",
256256
fcv: ptr.To("4.0.0"),
257257
expectError: true,
258-
expectedErrorMessage: "invalid feature compatibility version: 4.0.0, possible values are: 'AlwaysMatchVersion' or 'major.minor'",
258+
expectedErrorMessage: "invalid feature compatibility version \"4.0.0\", possible values are: 'AlwaysMatchVersion' or 'major.minor'",
259+
},
260+
{
261+
name: "Invalid FCV - not major leading 0",
262+
fcv: ptr.To("4.01"),
263+
expectError: true,
264+
expectedErrorMessage: "invalid feature compatibility version \"4.01\": Minor number must not contain leading zeroes \"01\"",
259265
},
260266
{
261267
name: "Valid FCV with AlwaysMatchVersion",

api/v1/mdbmulti/mongodb_multi_types.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,13 @@ func (m *MongoDBMultiCluster) GetOwnerLabels() map[string]string {
180180
}
181181
}
182182

183+
// GetKind returns the Kind of the MongoDBMultiCluster resource. This is needed because
184+
// when objects are retrieved from the Kubernetes API, the TypeMeta
185+
// (which contains Kind and APIVersion) is not populated.
186+
func (m *MongoDBMultiCluster) GetKind() string {
187+
return "MongoDBMultiCluster"
188+
}
189+
183190
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
184191
type MongoDBMultiClusterList struct {
185192
metav1.TypeMeta `json:",inline"`
@@ -535,10 +542,10 @@ func (m *MongoDBMultiSpec) GetMemberOptions() []automationconfig.MemberOptions {
535542

536543
func (m *MongoDBMultiSpec) MinimumMajorVersion() uint64 {
537544
if m.FeatureCompatibilityVersion != nil && *m.FeatureCompatibilityVersion != "" {
538-
fcv := *m.FeatureCompatibilityVersion
545+
fcvString := *m.FeatureCompatibilityVersion
539546

540547
// ignore errors here as the format of FCV/version is handled by CRD validation
541-
semverFcv, _ := semver.Make(fmt.Sprintf("%s.0", fcv))
548+
semverFcv, _ := fcv.FeatureCompatibilityVersionToSemverFormat(fcvString)
542549
return semverFcv.Major
543550
}
544551
semverVersion, _ := semver.Make(m.GetMongoDBVersion())

api/v1/om/opsmanager_types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,13 @@ func (om *MongoDBOpsManager) GetOwnerLabels() map[string]string {
349349
}
350350
}
351351

352+
// GetKind returns the Kind of the MongoDBOpsManager resource. This is needed because
353+
// when objects are retrieved from the Kubernetes API, the TypeMeta
354+
// (which contains Kind and APIVersion) is not populated.
355+
func (om *MongoDBOpsManager) GetKind() string {
356+
return "MongoDBOpsManager"
357+
}
358+
352359
// MongoDBOpsManagerServiceDefinition struct that defines the mechanism by which this Ops Manager resource
353360
// is exposed, via a Service, to the outside of the Kubernetes Cluster.
354361
type MongoDBOpsManagerServiceDefinition struct {

api/v1/owner.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@ type ResourceOwner interface {
1414
type ObjectOwner interface {
1515
ResourceOwner
1616
client.Object
17+
// GetKind returns the Kind of the resource. This is needed because
18+
// when objects are retrieved from the Kubernetes API, the TypeMeta
19+
// (which contains Kind and APIVersion) is not populated.
20+
GetKind() string
1721
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
kind: fix
3+
date: 2025-11-27
4+
---
5+
6+
* Backed up the agent password in a secret for SCRAM authentication to prevent unnecessary password rotations.

0 commit comments

Comments
 (0)