Skip to content

Commit

Permalink
ALT-828 Allow DRC2 calls with SPIRE
Browse files Browse the repository at this point in the history
The DRC2 feature uses a new "ogopogod" API with SPIRE. Add this to the
OPA policy to enable this feature.
  • Loading branch information
dgloe-hpe committed Dec 19, 2023
1 parent 5adee70 commit 8117bd1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion kubernetes/cray-opa/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#
apiVersion: v2
name: cray-opa
version: 1.33.0
version: 1.33.1
description: Cray Open Policy Agent
keywords:
- opa
Expand Down
5 changes: 5 additions & 0 deletions kubernetes/cray-opa/templates/policies/spire.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ data:
{"method": "HEAD", "path": `^/apis/jackaloped/.*$`},
{"method": "POST", "path": `^/apis/jackaloped/.*$`},
{"method": "DELETE", "path": `^/apis/jackaloped/.*$`},
# ogopogod - DRC2
{"method": "GET", "path": `^/apis/ogopogod/.*$`},
{"method": "HEAD", "path": `^/apis/ogopogod/.*$`},
{"method": "POST", "path": `^/apis/ogopogod/.*$`},
{"method": "DELETE", "path": `^/apis/ogopogod/.*$`},
],
"heartbeat": [
{{- if and (eq $.Values.opa.xnamePolicy.heartbeat true) (eq $.Values.opa.xnamePolicy.enabled true) }}
Expand Down
7 changes: 7 additions & 0 deletions kubernetes/cray-opa/tests/opa/spire_test.rego.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,13 @@ test_wlm {
not allow.http_status with input as {"attributes": {"request": {"http": {"method": "DELETE", "path": "/apis/jackaloped/fabric/nics", "headers": {"authorization": spire_sub}}}}}
# jackaloped - not allowed
allow.http_status == 403 with input as {"attributes": {"request": {"http": {"method": "PUT", "path": "/apis/jackaloped/fabric/nics", "headers": {"authorization": spire_sub}}}}}
# ogopogod - allowed
not allow.http_status with input as {"attributes": {"request": {"http": {"method": "GET", "path": "/apis/ogopogod/partitions", "headers": {"authorization": spire_sub}}}}}
not allow.http_status with input as {"attributes": {"request": {"http": {"method": "HEAD", "path": "/apis/ogopogod/partitions", "headers": {"authorization": spire_sub}}}}}
not allow.http_status with input as {"attributes": {"request": {"http": {"method": "POST", "path": "/apis/ogopogod/partitions", "headers": {"authorization": spire_sub}}}}}
not allow.http_status with input as {"attributes": {"request": {"http": {"method": "DELETE", "path": "/apis/ogopogod/partitions", "headers": {"authorization": spire_sub}}}}}
# ogopogod - not allowed
allow.http_status == 403 with input as {"attributes": {"request": {"http": {"method": "PUT", "path": "/apis/ogopogod/partitions", "headers": {"authorization": spire_sub}}}}}
}

test_tpm_provisioner_cray_spire {
Expand Down

0 comments on commit 8117bd1

Please sign in to comment.