(feat) Support for creating users on cluster init#82
(feat) Support for creating users on cluster init#82utdrmac wants to merge 4 commits intovalkey-io:mainfrom
Conversation
Signed-off-by: utdrmac <matthew.boehm@percona.com>
|
e2e tests pass in my local kind cluster |
| var _ = BeforeSuite(func() { | ||
| By("building the manager image") | ||
| cmd := exec.Command("make", "docker-build", fmt.Sprintf("IMG=%s", managerImage)) | ||
| By("purging old events") |
There was a problem hiding this comment.
K8S holds on to events for an extended period of time, even after a cluster is deleted. This call to purge events was added because subsequent e2e tests would fail if a previous test failed due to the e2e test fetching all events.
There was a problem hiding this comment.
Good catch. We could move it to valkeycluster_test.go to have it close to where its needed.
This is also the only testcase/context where we use involvedObject.name=valkeycluster-sample.
I guess it needs to be in a BeforeEach instead then.
|
|
||
| .PHONY: build | ||
| build: manifests generate fmt vet ## Build manager binary. | ||
| build: manifests generate fmt vet lint ## Build manager binary. |
There was a problem hiding this comment.
The golangci-lint was only ran during github e2e tests, and it was frustrating for this to fail remotely. Simple change to check this locally first.
jdheyburn
left a comment
There was a problem hiding this comment.
This is great to see, thank you for putting the time in! Just left some comments for clarity
| // Do not apply a password to this user | ||
| // +kubebuilder:default=false | ||
| NoPassword bool `json:"nopass,omitempty"` | ||
|
|
There was a problem hiding this comment.
i think passwordEnabled or enabledPassword would be good naming here instead of NoPassword. Also i am not sure this is general use case of having nopass attached to user. if they really want to acheieve this they can always use rawacl.
There was a problem hiding this comment.
It might not be general or recommended, but if Valkey exposes it as an option it might be useful to abstract it away.
https://valkey.io/topics/acl/#configure-acls-with-the-acl-command
This boolean is used in the PR in a few places. If we were to remove NoPassword here, would we change those conditions to be 'nopass' in RawAcl (pseudocode) ?
There was a problem hiding this comment.
I think the idea was since the ACL keyword is nopass then this follows-ish 1:1. Since the default is false if not specified, is there a strong reason to remove it? As the code is now, if removed, then passwords are always searched for even in a nopass=true case. The code would then need to check rawAcl for presence of nopass to achieve same logic.
Signed-off-by: utdrmac <matthew.boehm@percona.com>
|
I think we're almost there with this PR, just pending @sandeepkunusoth approval from their remaining comments |
| var _ = BeforeSuite(func() { | ||
| By("building the manager image") | ||
| cmd := exec.Command("make", "docker-build", fmt.Sprintf("IMG=%s", managerImage)) | ||
| By("purging old events") |
There was a problem hiding this comment.
Good catch. We could move it to valkeycluster_test.go to have it close to where its needed.
This is also the only testcase/context where we use involvedObject.name=valkeycluster-sample.
I guess it needs to be in a BeforeEach instead then.
| for _, shard := range s.Shards { | ||
| for _, slot := range shard.Slots { | ||
| var next []SlotsRange | ||
| var next []SlotsRange //nolint:prealloc |
There was a problem hiding this comment.
Interesting that this isn't showing in CI, our current main (given by kubebuilder) uses
make lint
...
Downloading github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.7.2
0 issues.
which is using
go: downloading github.com/alexkohler/prealloc v1.0.0
Is this seen with newer versions of golangci-lint/prealloc?
There was a problem hiding this comment.
Must be. I'm using golangci-lint has version 2.8.0 built with go1.25.5
bjosv
left a comment
There was a problem hiding this comment.
LGTM, my previous comments are nits
Signed-off-by: utdrmac <matthew.boehm@percona.com>
|
Resolved conflict with c679809 |
|
@utdrmac I think there is a bad merge pulling in some functions that no longer exist. Would you mind double checking to see what can be removed? Once that's done I'll approve and merge. Thanks again! |
Resolves #36
This feature allows for the creation of Valkey users on cluster initialization. The feature abstracts Valkey ACL permissions into several objects, giving better readability, and creation flexibility to users that may not be intimately familiar with Valkey ACLs.