-
Notifications
You must be signed in to change notification settings - Fork 56
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
Update RabbitMQ and add configuration for Users and VHosts #327
Conversation
Caution Review failedThe pull request is closed. WalkthroughThe changes encompass updates to the RabbitMQ application, including version increments in the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant RabbitMQ
participant Kubernetes
User->>RabbitMQ: Request user creation
RabbitMQ->>Kubernetes: Create User resource
Kubernetes-->>RabbitMQ: Confirm User created
RabbitMQ-->>User: User created successfully
User->>RabbitMQ: Request virtual host creation
RabbitMQ->>Kubernetes: Create Vhost resource
Kubernetes-->>RabbitMQ: Confirm Vhost created
RabbitMQ-->>User: Vhost created successfully
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (8)
- packages/apps/rabbitmq/Chart.yaml (1 hunks)
- packages/apps/rabbitmq/README.md (1 hunks)
- packages/apps/rabbitmq/templates/dashboard-resourcemap.yaml (1 hunks)
- packages/apps/rabbitmq/templates/rabbitmq.yaml (1 hunks)
- packages/apps/rabbitmq/values.schema.json (1 hunks)
- packages/apps/rabbitmq/values.yaml (1 hunks)
- packages/apps/rabbitmq/values1.yaml (1 hunks)
- packages/system/rabbitmq-operator/Makefile (1 hunks)
Additional context used
yamllint
packages/apps/rabbitmq/templates/dashboard-resourcemap.yaml
[error] 4-4: syntax error: expected , but found ''
(syntax)
Additional comments not posted (14)
packages/apps/rabbitmq/templates/dashboard-resourcemap.yaml (1)
1-22
: LGTM!The
dashboard-resourcemap.yaml
file looks good to me. It defines a Kubernetes Role resource with appropriate permissions for the RabbitMQ dashboard to access user credentials and service details.The syntax error reported by yamllint at line 4 seems to be a false positive, as the line is using correct Go template syntax and follows the expected YAML structure.
Tools
yamllint
[error] 4-4: syntax error: expected , but found ''
(syntax)
packages/apps/rabbitmq/values1.yaml (2)
1-11
: LGTM!The common parameters are correctly defined.
26-37
: LGTM!The virtual hosts configuration is correctly defined.
packages/system/rabbitmq-operator/Makefile (1)
11-13
: LGTM!The code segment enhances the operator's capabilities by allowing it to manage messaging topology configurations alongside the existing cluster operator configurations. It follows the same pattern as the existing code for downloading and processing the cluster operator configuration file, maintaining consistency and readability.
The
yq
command ensures that the downloaded YAML file doesn't contain anyNamespace
kind entries, which is a good practice to avoid conflicts with the existing namespace. Thesed
command replaces the hardcoded namespacerabbitmq-system
with the variable$(NAMESPACE)
, making the configuration more flexible and reusable.Overall, the code changes look good and are approved.
packages/apps/rabbitmq/values.schema.json (1)
25-28
: LGTM!The new "vhosts" property is correctly defined in the JSON schema:
- The property is defined as an object.
- The description clearly indicates that it is for configuring virtual hosts.
- The default value of an empty object is appropriate.
The code changes are approved.
packages/apps/rabbitmq/values.yaml (2)
15-25
: LGTM!The
users
configuration section is well-structured and allows for flexible user credential definitions. The empty dictionary initialization is appropriate, and the provided example clearly illustrates the structure for defining user credentials.
27-41
: LGTM!The
vhosts
configuration section is well-structured and allows for flexible virtual host definitions and user role assignments. The empty dictionary initialization is appropriate, and the provided example clearly illustrates the structure for defining virtual hosts and assigning user roles.packages/apps/rabbitmq/Chart.yaml (2)
19-19
: LGTM!Incrementing the chart version is a standard practice when making changes to the chart. The change is approved.
25-25
: Verify compatibility with the new application version.Updating the
appVersion
to"3.13.2"
is important for tracking the evolution of the application. Please ensure that the rest of the chart, including the templates and configuration, is compatible with RabbitMQ version 3.13.2.Run the following script to verify the compatibility:
packages/apps/rabbitmq/README.md (1)
22-28
: LGTM!The changes to the README file are well-structured and provide clear guidance on the new configuration options for the RabbitMQ service. The table structure is consistent with the existing "Parameters" section, and the default values for
users
andvhosts
are reasonable placeholders.The addition of this section enhances the documentation's comprehensiveness and usability.
packages/apps/rabbitmq/templates/rabbitmq.yaml (4)
20-31
: LGTM!The code changes for handling user passwords are approved. The logic ensures that every user has a valid password by checking the user values, retrieving from a Kubernetes Secret, or generating a random password as a fallback. This enhances security and usability.
33-54
: LGTM!The code changes for creating RabbitMQ user resources are approved. The logic automates the user creation based on the provided values, generates unique names and associated secrets, and securely stores the hashed passwords in annotations. This improves the configuration management and security.
56-96
: LGTM!The code changes for creating RabbitMQ virtual host and permission resources are approved. The logic automates the resource creation based on the provided values, differentiates permissions based on user roles (admin and readonly), and ensures appropriate access control. This improves the configuration management and security.
34-35
: LGTM!The code changes for adding new
User
,Vhost
,Permission
, andSecret
resources are approved. The resources are correctly defined with the appropriateapiVersion
andkind
, enhancing the functionality of the RabbitMQ configuration by introducing user, virtual host, and permission management.Also applies to: 58-59, 68-69, 46-47
packages/apps/rabbitmq/values1.yaml
Outdated
## @section Common parameters | ||
|
||
## @param external Enable external access from outside the cluster | ||
## @param size Persistent Volume size | ||
## @param replicas Number of RabbitMQ replicas | ||
## @param storageClass StorageClass used to store the data | ||
## | ||
external: false | ||
size: 10Gi | ||
replicas: 3 | ||
storageClass: "" | ||
|
||
## @section Configuration parameters | ||
|
||
users: | ||
user1: | ||
password: strongpassword | ||
user2: | ||
password: hackme | ||
user4: | ||
password: testtest | ||
user5: {} | ||
user6: {} | ||
|
||
|
||
vhosts: | ||
myapp: | ||
roles: | ||
admin: | ||
- user1 | ||
- user2 | ||
readonly: | ||
- user4 | ||
test: | ||
roles: | ||
admin: | ||
- user4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The configuration file is well-structured, but the user configuration needs improvement.
The values1.yaml
file is a new YAML configuration file for RabbitMQ. It defines common parameters, user configuration, and virtual hosts configuration.
The file structure and syntax are correct, and the configuration parameters seem reasonable, except for the issues flagged in the user configuration:
- The passwords for
user1
anduser2
are weak and should be changed to strong values. - The empty configuration for
user5
anduser6
is unnecessary and should be removed.
Please address these issues to improve the security and maintainability of the configuration.
packages/apps/rabbitmq/values1.yaml
Outdated
users: | ||
user1: | ||
password: strongpassword | ||
user2: | ||
password: hackme | ||
user4: | ||
password: testtest | ||
user5: {} | ||
user6: {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use strong passwords and remove unnecessary empty configurations.
The user configuration has the following issues:
- The passwords for
user1
anduser2
are weak and should be changed to strong values. - The empty configuration for
user5
anduser6
is unnecessary and should be removed.
Apply this diff to fix the issues:
users:
user1:
- password: strongpassword
+ password: <strong_password_1>
user2:
- password: hackme
+ password: <strong_password_2>
user4:
password: testtest
- user5: {}
- user6: {}
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
users: | |
user1: | |
password: strongpassword | |
user2: | |
password: hackme | |
user4: | |
password: testtest | |
user5: {} | |
user6: {} | |
users: | |
user1: | |
password: <strong_password_1> | |
user2: | |
password: <strong_password_2> | |
user4: | |
password: testtest |
9045065
to
6b82ce2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (8)
- packages/apps/rabbitmq/Chart.yaml (1 hunks)
- packages/apps/rabbitmq/README.md (1 hunks)
- packages/apps/rabbitmq/templates/dashboard-resourcemap.yaml (1 hunks)
- packages/apps/rabbitmq/templates/rabbitmq.yaml (1 hunks)
- packages/apps/rabbitmq/values.schema.json (1 hunks)
- packages/apps/rabbitmq/values.yaml (1 hunks)
- packages/apps/rabbitmq/values1.yaml (1 hunks)
- packages/system/rabbitmq-operator/Makefile (1 hunks)
Files skipped from review due to trivial changes (1)
- packages/apps/rabbitmq/README.md
Files skipped from review as they are similar to previous changes (5)
- packages/apps/rabbitmq/Chart.yaml
- packages/apps/rabbitmq/values.schema.json
- packages/apps/rabbitmq/values.yaml
- packages/apps/rabbitmq/values1.yaml
- packages/system/rabbitmq-operator/Makefile
Additional context used
yamllint
packages/apps/rabbitmq/templates/dashboard-resourcemap.yaml
[error] 4-4: syntax error: expected , but found ''
(syntax)
Additional comments not posted (4)
packages/apps/rabbitmq/templates/dashboard-resourcemap.yaml (2)
1-22
: LGTM!The Kubernetes Role configuration for the RabbitMQ dashboard looks good:
- The Role is correctly defined with the appropriate
apiVersion
andkind
.- The Role grants read permissions (
get
,list
,watch
) on the specified secrets and service, which aligns with the purpose of the RabbitMQ dashboard.- The use of Helm templating syntax allows dynamic generation of resource names based on the release name and user configurations.
The code changes are approved.
Tools
yamllint
[error] 4-4: syntax error: expected , but found ''
(syntax)
4-4
: Skip the syntax error reported by yamllint.The syntax error reported by yamllint at line 4 is a false positive. The Helm template expression
{{ .Release.Name }}-dashboard-resources
is valid and will be rendered correctly during Helm chart installation. yamllint is not aware of the Helm templating syntax, leading to the false positive error.Tools
yamllint
[error] 4-4: syntax error: expected , but found ''
(syntax)
packages/apps/rabbitmq/templates/rabbitmq.yaml (2)
21-54
: LGTM!The code changes for handling user passwords and creating RabbitMQ User resources are well-structured and enhance security.
56-96
: LGTM!The code changes for creating RabbitMQ Vhost and Permission resources are well-structured and ensure appropriate access control based on user roles.
Signed-off-by: Andrei Kvapil <[email protected]>
6b82ce2
to
e962e21
Compare
Signed-off-by: Andrei Kvapil [email protected]
Summary by CodeRabbit
New Features
Documentation
Chores