Skip to content

K8SPSMDB-1154: disable encryption by default for inMemory #1912

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pkg/apis/psmdb/v1/psmdb_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,16 @@ func (rs *ReplsetSpec) SetDefaults(platform version.Platform, cr *PerconaServerM
}
}

if rs.Storage != nil && rs.Storage.Engine == StorageEngineInMemory {
encryptionEnabled, err := rs.Configuration.IsEncryptionEnabled()
if err != nil {
return errors.Wrap(err, "failed to parse replset configuration")
}
if encryptionEnabled != nil && *encryptionEnabled {
return errors.New("inMemory storage engine doesn't support encryption")
}
}

return nil
}

Expand Down
4 changes: 4 additions & 0 deletions pkg/psmdb/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,11 @@ func isEncryptionEnabled(cr *api.PerconaServerMongoDB, replset *api.ReplsetSpec)
if err != nil {
return false, errors.Wrap(err, "failed to parse replset configuration")
}

if enabled == nil {
if replset.Storage.Engine == api.StorageEngineInMemory {
return false, nil // disabled for inMemory engine by default
}
return true, nil // true by default
}
return *enabled, nil
Expand Down
Loading