Skip to content
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

Make spread encryption the default for v1 API create_db #590

Merged
merged 4 commits into from
Nov 21, 2023

Conversation

cchen-vertica
Copy link
Collaborator

For v1 api, set 'vertica' as the default value of encryptSpreadComm: when encryptSpreadComm is set to an empty string or not set, the operator will also enable spread encryption when creating a database. Add another value "disabled" to encryptSpreadComm for the user to explicitly disable spread encryption.

@cchen-vertica cchen-vertica changed the title made spread encryption default in v1 api Made spread encryption a default behavior for create_db in v1 api Nov 16, 2023
@cchen-vertica cchen-vertica force-pushed the cchen/make-spread-encryption-default branch from b36e4e0 to 2e71868 Compare November 17, 2023 17:19
@@ -175,7 +175,7 @@ func (c *CreateDBReconciler) generatePostDBCreateSQL(ctx context.Context, initia
// config parm in the create db call.
if c.Vdb.Spec.EncryptSpreadComm != vapi.EncryptSpreadCommDisabled && ok && vinf.IsOlder(vapi.SetEncryptSpreadCommAsConfigVersion) {
sb.WriteString(fmt.Sprintf(`alter database default set parameter EncryptSpreadComm = '%s';
`, c.Vdb.Spec.EncryptSpreadComm))
`, vapi.EncryptSpreadCommWithVertica))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you do this? What if a user wants to disable spread encryption(if that even makes sense)?

Copy link
Collaborator Author

@cchen-vertica cchen-vertica Nov 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code here is for enabling spread encryption. The if statement above makes sure the user does not want to disable spread encryption. When encryptSpreadComm is an empty string, 'c.Vdb.Spec.EncryptSpreadComm' won't give the correct value to the ddl, but 'vapi.EncryptSpreadCommWithVertica' will.

v, ok := g.ConfigurationParams.Get("InitialDefaultSubclusterName")
Expect(ok).Should(BeTrue())
Expect(v).Should(Equal(vdb.Spec.Subclusters[0].Name))
v, ok = g.ConfigurationParams.Get("EncryptSpreadComm")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can create a new test function for spread encryption where you can directly call setEncryptSpreadCommConfigIfNecessary() and have a few scenarios by changing EncryptSpreadComm and vertica version.

@@ -36,3 +36,4 @@ spec:
imagePullSecrets: []
volumes: []
volumeMounts: []
encryptSpreadComm: disabled
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why didn't you do the same for other e2e tests?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think encrypting spread channel will not affect other e2e tests. And since "enable" is the default behavior now, we can test the default behavior in other e2e tests.

It turns out the admintool e2e tests are using old Vertica version(12.0.3) that does not support spread channel encryption without a db restart. Do you think should we update the Vertica version for the admintool e2e tests or should I disable spread channel encryption for the admintool e2e tests?

Copy link
Collaborator

@spilchen spilchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest we update the broken e2e testcases to explicitly disable spread encryption.


// getEncryptSpreadComm will return "vertica" if encryptSpreadComm is set to
// an empty string, otherwise return the value of encryptSpreadComm
func (g *ConfigParamsGenerator) getEncryptSpreadComm() string {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this to VeritcaDB? And rename it so that it's exported (i.e. GetEncryptSpreadComm). There is a file (helpers.go) that has these kind of functions.

@spilchen spilchen changed the title Made spread encryption a default behavior for create_db in v1 api Make spread encryption the default for v1 API create_db Nov 21, 2023
@spilchen spilchen merged commit 0993cf5 into main Nov 21, 2023
24 checks passed
@spilchen spilchen deleted the cchen/make-spread-encryption-default branch November 21, 2023 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants