-
Notifications
You must be signed in to change notification settings - Fork 47
Add docs for the Role resource in Kubernetes #1378
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
Open
JakeSCahill
wants to merge
2
commits into
DOC-1459
Choose a base branch
from
DOC-1512
base: DOC-1459
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
@cluster:roles | ||
Feature: Role CRDs | ||
Background: Cluster available | ||
Given cluster "roles" is available | ||
|
||
@skip:gke @skip:aks @skip:eks | ||
Scenario: Manage roles | ||
Given there is no role "admin-role" in cluster "roles" | ||
And there are the following pre-existing users in cluster "roles" | ||
| name | password | mechanism | | ||
| alice | password | SCRAM-SHA-256 | | ||
| bob | password | SCRAM-SHA-256 | | ||
When I apply Kubernetes manifest: | ||
""" | ||
# tag::manage-roles-with-principals[] | ||
# In this example manifest, a role called "admin-role" is created in a cluster called "roles". | ||
# The role includes two principals (alice and bob) who will inherit the role's permissions. | ||
--- | ||
apiVersion: cluster.redpanda.com/v1alpha2 | ||
kind: Role | ||
metadata: | ||
name: admin-role | ||
spec: | ||
cluster: | ||
clusterRef: | ||
name: roles | ||
principals: | ||
- User:alice | ||
- User:bob | ||
# end::manage-roles-with-principals[] | ||
""" | ||
And role "admin-role" is successfully synced | ||
Then role "admin-role" should exist in cluster "roles" | ||
And role "admin-role" should have members "alice" and "bob" in cluster "roles" | ||
|
||
@skip:gke @skip:aks @skip:eks | ||
Scenario: Manage roles with authorization | ||
Given there is no role "read-only-role" in cluster "roles" | ||
And there are the following pre-existing users in cluster "roles" | ||
| name | password | mechanism | | ||
| charlie | password | SCRAM-SHA-256 | | ||
When I apply Kubernetes manifest: | ||
""" | ||
# tag::manage-roles-with-authorization[] | ||
# In this example manifest, a role called "read-only-role" is created in a cluster called "roles". | ||
# The role includes authorization rules that allow reading from topics with names starting with "public-". | ||
--- | ||
apiVersion: cluster.redpanda.com/v1alpha2 | ||
kind: Role | ||
metadata: | ||
name: read-only-role | ||
spec: | ||
cluster: | ||
clusterRef: | ||
name: roles | ||
principals: | ||
- User:charlie | ||
authorization: | ||
acls: | ||
- type: allow | ||
resource: | ||
type: topic | ||
name: public- | ||
patternType: prefixed | ||
operations: [Read, Describe] | ||
# end::manage-roles-with-authorization[] | ||
""" | ||
And role "read-only-role" is successfully synced | ||
Then role "read-only-role" should exist in cluster "roles" | ||
And role "read-only-role" should have ACLs for topic pattern "public-" in cluster "roles" | ||
And user "charlie" should be able to read from topic "public-test" in cluster "roles" | ||
|
||
@skip:gke @skip:aks @skip:eks | ||
Scenario: Manage authorization-only roles | ||
Given there are the following pre-existing users in cluster "roles" | ||
| name | password | mechanism | | ||
| travis | password | SCRAM-SHA-256 | | ||
And there is a pre-existing role "travis-role" in cluster "roles" | ||
When I apply Kubernetes manifest: | ||
""" | ||
# tag::manage-authz-only-roles[] | ||
# In this example manifest, a role CRD called "travis-role" manages ACLs for an existing role. | ||
# The role includes authorization rules that allow reading from topics with names starting with "some-topic". | ||
# This example assumes that you already have a role called "travis-role" in your cluster. | ||
--- | ||
apiVersion: cluster.redpanda.com/v1alpha2 | ||
kind: Role | ||
metadata: | ||
name: travis-role | ||
spec: | ||
cluster: | ||
clusterRef: | ||
name: roles | ||
principals: | ||
- User:travis | ||
authorization: | ||
acls: | ||
- type: allow | ||
resource: | ||
type: topic | ||
name: some-topic | ||
patternType: prefixed | ||
operations: [Read] | ||
# end::manage-authz-only-roles[] | ||
""" | ||
And role "travis-role" is successfully synced | ||
And I delete the CRD role "travis-role" | ||
Then there should still be role "travis-role" in cluster "roles" | ||
And there should be no ACLs for role "travis-role" in cluster "roles" |
6 changes: 3 additions & 3 deletions
6
modules/manage/pages/kubernetes/security/authentication/index.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
= Authentication for Redpanda in Kubernetes | ||
= Authentication and Authorization for Redpanda in Kubernetes | ||
:page-layout: index | ||
:description: Learn how to configure authentication for Redpanda in Kubernetes using Helm values or the User resource with the Redpanda Operator. | ||
:description: Learn how to configure authentication and authorization for Redpanda in Kubernetes using Helm values or the User resource with the Redpanda Operator. | ||
:page-aliases: security:sasl-kubernetes.adoc, manage:kubernetes/security/sasl-kubernetes.adoc, security:kubernetes-sasl.adoc, manage:kubernetes/security/authentication/sasl-kubernetes.adoc, reference:redpanda-operator/kubernetes-mtls.adoc, reference:redpanda-operator/kubernetes-sasl.adoc | ||
|
||
Redpanda offers two methods to manage authentication in a Kubernetes environment. These options allow administrators to control user access and permissions, ensuring secure communication with the Redpanda cluster. | ||
Redpanda offers two methods to manage authentication and authorization in a Kubernetes environment. These options allow administrators to control user access and permissions, ensuring secure communication with the Redpanda cluster. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.