Add default system users (#110)#129
Conversation
Signed-off-by: hieu2102 <hieund2102@gmail.com>
Signed-off-by: hieu2102 <hieund2102@gmail.com>
Signed-off-by: hieu2102 <hieund2102@gmail.com>
Signed-off-by: hieu2102 <hieund2102@gmail.com>
Signed-off-by: hieu2102 <hieund2102@gmail.com>
Signed-off-by: hieu2102 <hieund2102@gmail.com>
Signed-off-by: hieu2102 <hieund2102@gmail.com>
Signed-off-by: hieu2102 <hieund2102@gmail.com>
Signed-off-by: hieu2102 <hieund2102@gmail.com>
Signed-off-by: hieu2102 <hieund2102@gmail.com>
39d2000 to
a699a92
Compare
Signed-off-by: hieu2102 <hieund2102@gmail.com>
Signed-off-by: hieu2102 <hieund2102@gmail.com>
jdheyburn
left a comment
There was a problem hiding this comment.
Thanks for taking a look at this! I've not tested this myself yet, but left some comments.
| } | ||
|
|
||
| func generatePassword() string { | ||
| randstr := rand.Text() |
There was a problem hiding this comment.
What does this generate for us? i.e. password length, characters, etc.
There was a problem hiding this comment.
I've added a comment about this in the latest commit
There was a problem hiding this comment.
I checked the generated value. Could we have it to be upper and lower case letters too? Today its just uppercase.
Signed-off-by: hieu2102 <hieund2102@gmail.com>
Signed-off-by: hieu2102 <hieund2102@gmail.com>
| } | ||
|
|
||
| func generatePassword() string { | ||
| randstr := rand.Text() |
There was a problem hiding this comment.
I checked the generated value. Could we have it to be upper and lower case letters too? Today its just uppercase.
| Namespace: cluster.Namespace, | ||
| Labels: labels(cluster), | ||
| }, | ||
| Data: map[string][]byte{}, |
There was a problem hiding this comment.
Good point, let me add it
Signed-off-by: hieu2102 <hieund2102@gmail.com>
Signed-off-by: hieu2102 <hieund2102@gmail.com>
Signed-off-by: hieu2102 <hieund2102@gmail.com>
jdheyburn
left a comment
There was a problem hiding this comment.
Thanks for working on this!
getValkeyRole in the ValkeyNode controller connects to Valkey unauthenticated to check the replication role. This was missed in valkey-io#129 when the cluster controller was updated to use _operator credentials. Once the default user is restricted, the role check fails silently and ValkeyNode status.role is always empty. Signed-off-by: Daan Vinken <daanvinken@tythus.com>
|
I think we missed one here #137 |
implements valkey-io#110 - add defaults system users `_operator` and `_exporter` - update `GetClusterState`, `GetNodeState` functions to connect to Valkey using `_operator` user - fall back to `default` (unauthenticated on WRONGPASS error) - `metrics-exporter` container will connect using `_exporter` user (by setting `REDIS_USER`, `REDIS_PASSWORD` env variables) - add CEL validation to reject users with named started with `_` - add ACL hash annotation to pod template, when the internal ACL secret (`internal-<clusterName>-acl`) changed, the pods will be recreated automatically --------- Signed-off-by: hieu2102 <hieund2102@gmail.com>
getValkeyRole in the ValkeyNode controller connects to Valkey unauthenticated to check the replication role. This was missed in valkey-io#129 when the cluster controller was updated to use _operator credentials. Once the default user is restricted, the role check fails silently and ValkeyNode status.role is always empty. Signed-off-by: Daan Vinken <daanvinken@tythus.com>
getValkeyRole in the ValkeyNode controller connects to Valkey unauthenticated to check the replication role. This was missed in valkey-io#129 when the cluster controller was updated to use _operator credentials. Once the default user is restricted, the role check fails silently and ValkeyNode status.role is always empty. Signed-off-by: Daan Vinken <daanvinken@tythus.com>
getValkeyRole in the ValkeyNode controller connects to Valkey unauthenticated to check the replication role. This was missed in valkey-io#129 when the cluster controller was updated to use _operator credentials. Once the default user is restricted, the role check fails silently and ValkeyNode status.role is always empty. Signed-off-by: Daan Vinken <daanvinken@tythus.com>
getValkeyRole in the ValkeyNode controller connects to Valkey unauthenticated to check the replication role. This was missed in valkey-io#129 when the cluster controller was updated to use _operator credentials. Once the default user is restricted, the role check fails silently and ValkeyNode status.role is always empty. Signed-off-by: Daan Vinken <daanvinken@tythus.com>
getValkeyRole in the ValkeyNode controller connects to Valkey unauthenticated to check the replication role. This was missed in valkey-io#129 when the cluster controller was updated to use _operator credentials. Once the default user is restricted, the role check fails silently and ValkeyNode status.role is always empty. Signed-off-by: Daan Vinken <daanvinken@tythus.com>
This PR is a follow-up to #129 which added `_operator` system user authentication to the cluster controller but missed the `getValkeyRole` code path in the ValkeyNode controller. ### Summary `getValkeyRole` connects to Valkey unauthenticated to check the replication role. Once the default user is restricted or disabled via `spec.users`, the role check fails silently and `ValkeyNode.status.role` is always empty. ### Implementation Pass `_operator` credentials to `getValkeyRole`, matching how the cluster controller authenticates in `GetClusterState`. If the system password secret doesn't exist yet (fresh cluster before ACLs are set up), the password is empty and the connection falls back to unauthenticated. ### Limitations None. ### Testing Existing E2E tests cover this path (role is populated in ValkeyNode status). No behavioral change when the default user is open. ### Checklist Before submitting the PR make sure the following are checked: - [x] This Pull Request is related to one issue. - [x] Commit message explains what changed and why - [NA] Tests are added or updated. - [NA] Documentation files are updated. - [x] I have run pre-commit locally (`pre-commit run --all-files` or hooks on commit) Signed-off-by: Daan Vinken <daanvinken@tythus.com>
…#137) This PR is a follow-up to valkey-io#129 which added `_operator` system user authentication to the cluster controller but missed the `getValkeyRole` code path in the ValkeyNode controller. ### Summary `getValkeyRole` connects to Valkey unauthenticated to check the replication role. Once the default user is restricted or disabled via `spec.users`, the role check fails silently and `ValkeyNode.status.role` is always empty. ### Implementation Pass `_operator` credentials to `getValkeyRole`, matching how the cluster controller authenticates in `GetClusterState`. If the system password secret doesn't exist yet (fresh cluster before ACLs are set up), the password is empty and the connection falls back to unauthenticated. ### Limitations None. ### Testing Existing E2E tests cover this path (role is populated in ValkeyNode status). No behavioral change when the default user is open. ### Checklist Before submitting the PR make sure the following are checked: - [x] This Pull Request is related to one issue. - [x] Commit message explains what changed and why - [NA] Tests are added or updated. - [NA] Documentation files are updated. - [x] I have run pre-commit locally (`pre-commit run --all-files` or hooks on commit) Signed-off-by: Daan Vinken <daanvinken@tythus.com>
implements #110
_operatorand_exporterGetClusterState,GetNodeStatefunctions to connect to Valkey using_operatoruserdefault(unauthenticated on WRONGPASS error)metrics-exportercontainer will connect using_exporteruser (by settingREDIS_USER,REDIS_PASSWORDenv variables)_internal-<clusterName>-acl) changed, the pods will be recreated automatically