Skip to content

test/omid #514

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

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
e87034f
feat(test): make it easy to test custom images
razvan Jun 4, 2024
d7aa82c
revert some tests to hbase-latest
razvan Jun 4, 2024
86ca320
fix indentation
razvan Jun 4, 2024
bc3299a
fix access-hbase container image
razvan Jun 4, 2024
f7da603
wip: temp test setup
adwk67 Jun 4, 2024
8a7a984
fix yaml lint
razvan Jun 4, 2024
4da9949
merge branch feat/opa-authorizer
razvan Jun 4, 2024
1ce9881
fix opa pull policy
razvan Jun 4, 2024
44e8456
use AllowAccessController
razvan Jun 4, 2024
8b21b56
Added custom logging to the kerberos test
razvan Jun 5, 2024
71b77b7
Set log4j2 properties in the kerberos test
razvan Jun 5, 2024
50b6dec
Use log4j2 properties starting with HBase 2.6
razvan Jun 6, 2024
bd70621
Fix clippy errors
razvan Jun 6, 2024
0065ae3
fix kerberos test
razvan Jun 6, 2024
aa082eb
separated opa from kerberos tests
razvan Jun 6, 2024
94485cb
restore kerberos tests from main
razvan Jun 6, 2024
24c1d0e
readd custom image support to the kerberos tests
razvan Jun 6, 2024
8cff952
reduce opa test dimensions
razvan Jun 7, 2024
3eb7c6e
example rego rules and test
adwk67 Jun 10, 2024
bbe7d26
use 2.6.0 sandbox image for tests
razvan Jun 10, 2024
0cdbb63
working integration test
adwk67 Jun 11, 2024
3afc3c1
Merge branch 'feat/opa' of github.com:stackabletech/hbase-operator in…
adwk67 Jun 11, 2024
f6d810e
update profiler integration test
razvan Jun 11, 2024
ddd3329
fix logging test
razvan Jun 11, 2024
8270710
Merge branch 'main' into feat/opa
razvan Jun 11, 2024
608aa00
update krb5 image for opa tests
razvan Jun 11, 2024
19b2881
fix snapshot tests
razvan Jun 11, 2024
4812832
fix yaml lint
razvan Jun 11, 2024
86b3fdc
Merge branch 'main' into feat/opa
razvan Jun 12, 2024
e6d927b
working rego rules test
adwk67 Jun 12, 2024
9b6b3b8
Merge branch 'feat/opa' of github.com:stackabletech/hbase-operator in…
adwk67 Jun 12, 2024
a6b3aa7
Operator adds OPA authorizer props
razvan Jun 13, 2024
fbc15b6
regenerate charts
razvan Jun 13, 2024
a179c45
adapted tests to addition of scanner checks
adwk67 Jun 13, 2024
49231cc
Update OPA test with authorization props
razvan Jun 13, 2024
144219d
replace realm dimension with CLUSTER.LOCAL
razvan Jun 13, 2024
1e0db7c
add docs
adwk67 Jun 13, 2024
8cb9ccf
Merge branch 'feat/opa' of github.com:stackabletech/hbase-operator in…
adwk67 Jun 13, 2024
96dc40f
Update changelog and test-definition.yaml
razvan Jun 14, 2024
fd77f5d
Minor doc tweaks
razvan Jun 14, 2024
3f28b3a
docs: separate Rego examples from authorizer configuration
razvan Jun 14, 2024
8c27797
fix yaml lint
razvan Jun 14, 2024
f9beb0d
test(omid): added omid kuttl test
razvan Jun 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## [Unreleased]

### Added

- Added `clusterConfig.authorization` property to support the OPA authorizer starting with HBase 2.6 ([#506]).
- Configure log4j2 starting with HBase 2.6 upwards ([#506]).

[#506]: https://github.com/stackabletech/hbase-operator/pull/506

## [24.3.0] - 2024-03-20

### Added
Expand Down
19 changes: 19 additions & 0 deletions deploy/helm/hbase-operator/crds/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,25 @@ spec:
required:
- kerberos
type: object
authorization:
nullable: true
properties:
opa:
description: Configure the OPA stacklet [discovery ConfigMap](https://docs.stackable.tech/home/nightly/concepts/service_discovery) and the name of the Rego package containing your authorization rules. Consult the [OPA authorization documentation](https://docs.stackable.tech/home/nightly/concepts/opa) to learn how to deploy Rego authorization rules with OPA.
properties:
configMapName:
description: The [discovery ConfigMap](https://docs.stackable.tech/home/nightly/concepts/service_discovery) for the OPA stacklet that should be used for authorization requests.
type: string
package:
description: The name of the Rego package containing the Rego rules for the product.
nullable: true
type: string
required:
- configMapName
type: object
required:
- opa
type: object
hdfsConfigMapName:
description: Name of the [discovery ConfigMap](https://docs.stackable.tech/home/nightly/concepts/service_discovery) for an HDFS cluster.
type: string
Expand Down
123 changes: 123 additions & 0 deletions docs/modules/hbase/examples/rego/hbase.rego
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
package hbase

import rego.v1

default allow := false
default matches_identity(identity) := false

# table is null if the request is for namespace permissions, but as parameters cannot be
# undefined, we have to set it to something specific:
checked_table_name := input.table.qualifierAsString if {input.table.qualifierAsString}
checked_table_name := "__undefined__" if {not input.table.qualifierAsString}

allow if {
some acl in acls
matches_identity(acl.identity)
matches_resource(input.namespace, checked_table_name, acl.resource)
action_sufficient_for_operation(acl.action, input.action)
}

# Identity mentions the (long) userName explicitly
matches_identity(identity) if {
identity in {
concat("", ["user:", input.callerUgi.userName])
}
}

# Identity regex matches the (long) userName
matches_identity(identity) if {
match_entire(identity, concat("", ["userRegex:", input.callerUgi.userName]))
}

# Identity mentions group the user is part of (by looking up using the (long) userName)
matches_identity(identity) if {
some group in groups_for_user[input.callerUgi.userName]
identity == concat("", ["group:", group])
}

# Allow all resources
matches_resource(namespace, table, resource) if {
resource == ":"
}

# Resource mentions the namespace explicitly
matches_resource(namespace, table, resource) if {
resource == concat("", [namespace, ":"])
}

# Resource mentions the namespaced table explicitly
matches_resource(namespace, table, resource) if {
resource == concat("", [namespace, ":", table])
}

match_entire(pattern, value) if {
# Add the anchors ^ and $
pattern_with_anchors := concat("", ["^", pattern, "$"])

regex.match(pattern_with_anchors, value)
}

action_sufficient_for_operation(action, operation) if {
action_hierarchy[action][_] == action_for_operation[operation]
}

action_hierarchy := {
"full": ["full", "rw", "ro"],
"rw": ["rw", "ro"],
"ro": ["ro"],
}

action_for_operation := {
"ADMIN": "full",
"CREATE": "full",
"WRITE": "rw",
"READ": "ro",
}

groups_for_user := {
"hbase/test-hbase-permissions.default.svc.cluster.local@CLUSTER.LOCAL": ["admins"],
"testuser/test-hbase-permissions.default.svc.cluster.local@CLUSTER.LOCAL": ["admins"],
"admin/test-hbase-permissions.default.svc.cluster.local@CLUSTER.LOCAL": ["admins"],
"alice/test-hbase-permissions.default.svc.cluster.local@CLUSTER.LOCAL": ["developers"],
"readonlyuser1/test-hbase-permissions.default.svc.cluster.local@CLUSTER.LOCAL": [],
"readonlyuser2/test-hbase-permissions.default.svc.cluster.local@CLUSTER.LOCAL": [],
"bob/test-hbase-permissions.default.svc.cluster.local@CLUSTER.LOCAL": []
}

acls := [
{
"identity": "group:admins",
"action": "full",
"resource": ":",
},
{
"identity": "group:developers",
"action": "full",
"resource": "developers:",
},
{
"identity": "user:alice/test-hbase-permissions.default.svc.cluster.local@CLUSTER.LOCAL",
"action": "rw",
"resource": "developers:table2",
},
{
"identity": "user:bob/test-hbase-permissions.default.svc.cluster.local@CLUSTER.LOCAL",
"action": "rw",
"resource": "developers:table1",
},
{
"identity": "user:bob/test-hbase-permissions.default.svc.cluster.local@CLUSTER.LOCAL",
"action": "rw",
"resource": "public:table3",
},
{
"identity": "user:readonlyuser1/test-hbase-permissions.default.svc.cluster.local@CLUSTER.LOCAL",
"action": "ro",
"resource": "public:test",
},
{
"identity": "user:readonlyuser2/test-hbase-permissions.default.svc.cluster.local@CLUSTER.LOCAL",
"action": "ro",
"resource": ":",
},
]
210 changes: 210 additions & 0 deletions docs/modules/hbase/examples/rego/hbase_test.rego
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
package hbase

import rego.v1

test_permission_admin if {
allow with input as {
"callerUgi" : {
"userName" : "admin/test-hbase-permissions.default.svc.cluster.local@CLUSTER.LOCAL",
"primaryGroup" : "admin",
},
"table" : {
"namespaceAsString" : "hbase",
"qualifierAsString" : "meta",
},
"namespace" : "hbase",
"action" : "WRITE"
}
}

test_namespace_admin if {
allow with input as {
"callerUgi" : {
"realUser" : null,
"userName" : "admin/test-hbase-permissions.default.svc.cluster.local@CLUSTER.LOCAL",
"shortUserName" : "admin",
"primaryGroup" : null,
"groups" : [ ],
"authenticationMethod" : "KERBEROS",
"realAuthenticationMethod" : "KERBEROS"
},
"table" : null,
"namespace" : "developers",
"action" : "ADMIN"
}
}

test_permission_developers if {
allow with input as {
"callerUgi" : {
"userName" : "alice/test-hbase-permissions.default.svc.cluster.local@CLUSTER.LOCAL",
"primaryGroup" : "admin",
},
"table" : {
"namespaceAsString" : "developers",
"qualifierAsString" : "table1",
},
"namespace" : "developers",
"action" : "WRITE"
}
}

test_permission_alice if {
allow with input as {
"callerUgi" : {
"userName" : "alice/test-hbase-permissions.default.svc.cluster.local@CLUSTER.LOCAL",
"primaryGroup" : "admin",
},
"table" : {
"namespaceAsString" : "developers",
"qualifierAsString" : "table2",
},
"namespace" : "developers",
"action" : "WRITE"
}
}

test_no_permission_bob if {
not allow with input as {
"callerUgi" : {
"userName" : "bob/test-hbase-permissions.default.svc.cluster.local@CLUSTER.LOCAL",
"primaryGroup" : "admin",
},
"table" : {
"namespaceAsString" : "developers",
"qualifierAsString" : "table2",
},
"namespace" : "developers",
"action" : "WRITE"
}
}

test_permission_bob1 if {
allow with input as {
"callerUgi" : {
"userName" : "bob/test-hbase-permissions.default.svc.cluster.local@CLUSTER.LOCAL",
"primaryGroup" : "admin",
},
"table" : {
"namespaceAsString" : "public",
"qualifierAsString" : "table3",
},
"namespace" : "public",
"action" : "WRITE"
}
}

test_permission_bob2 if {
allow with input as {
"callerUgi" : {
"userName" : "bob/test-hbase-permissions.default.svc.cluster.local@CLUSTER.LOCAL",
"primaryGroup" : "admin",
},
"table" : {
"namespaceAsString" : "developers",
"qualifierAsString" : "table1",
},
"namespace" : "developers",
"action" : "WRITE"
}
}

test_permission_hbase if {
allow with input as {
"callerUgi" : {
"realUser" : null,
"userName" : "hbase/test-hbase-permissions.default.svc.cluster.local@CLUSTER.LOCAL",
"shortUserName" : "hbase",
"primaryGroup" : null,
"groups" : [ ],
"authenticationMethod" : "KERBEROS",
"realAuthenticationMethod" : "KERBEROS"
},
"table" : {
"name" : "aGJhc2U6bWV0YQ==",
"nameAsString" : "hbase:meta",
"namespace" : "aGJhc2U=",
"namespaceAsString" : "hbase",
"qualifier" : "bWV0YQ==",
"qualifierAsString" : "meta",
"nameWithNamespaceInclAsString" : "hbase:meta"
},
"namespace" : "hbase",
"action" : "WRITE"
}
}

test_permission_testuser if {
allow with input as {
"callerUgi" : {
"realUser" : null,
"userName" : "testuser/test-hbase-permissions.default.svc.cluster.local@CLUSTER.LOCAL",
"shortUserName" : "testuser",
"primaryGroup" : null,
"groups" : [ ],
"authenticationMethod" : "KERBEROS",
"realAuthenticationMethod" : "KERBEROS"
},
"table" : {
"name" : "dGVzdA==",
"nameAsString" : "test",
"namespace" : "ZGVmYXVsdA==",
"namespaceAsString" : "default",
"qualifier" : "dGVzdA==",
"qualifierAsString" : "test",
"nameWithNamespaceInclAsString" : "default:test"
},
"namespace" : "default",
"action" : "WRITE"
}
}

test_permission_readonlyuser1 if {
allow with input as {
"callerUgi" : {
"realUser" : null,
"userName" : "readonlyuser1/test-hbase-permissions.default.svc.cluster.local@CLUSTER.LOCAL",
"shortUserName" : "readonlyuser",
"primaryGroup" : null,
"groups" : [ ],
"authenticationMethod" : "KERBEROS",
"realAuthenticationMethod" : "KERBEROS"
},
"table" : {
"name" : "cHVibGljOnRlc3Q=",
"nameAsString" : "public:test",
"namespace" : "cHVibGlj",
"namespaceAsString" : "public",
"qualifier" : "dGVzdA==",
"qualifierAsString" : "test",
"nameWithNamespaceInclAsString" : "public:test"
},
"namespace" : "public",
"action" : "READ"
}
}

test_permission_readonlyuser2 if {
allow with input as {
"callerUgi" : {
"realUser" : null,
"userName" : "readonlyuser2/test-hbase-permissions.default.svc.cluster.local@CLUSTER.LOCAL",
"shortUserName" : "readonlyuser",
"primaryGroup" : null,
"groups" : [ ],
"authenticationMethod" : "KERBEROS",
"realAuthenticationMethod" : "KERBEROS"
},
"table" : {
"name" : "cHVibGljOnRlc3Q=",
"nameAsString" : "public:test",
"namespace" : "cHVibGlj",
"namespaceAsString" : "public",
"qualifier" : "dGVzdA==",
"qualifierAsString" : "test",
"nameWithNamespaceInclAsString" : "public:test"
},
"namespace" : "public",
"action" : "READ"
}
}
14 changes: 14 additions & 0 deletions docs/modules/hbase/examples/usage-guide/hbase-regorules.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: hbase-regorules
labels:
opa.stackable.tech/bundle: "true"
data:
hdfs.rego: |
package hbase

import rego.v1

default allow = true
Loading
Loading