feat: Feature/rego generator - #167
Conversation
- New Flag created for supporting rego generation - Added testcases and docs updated
|
|
||
| | File | Content | | ||
| |------|---------| | ||
| | `policy.rego` | Plain OPA v1 Rego source | |
There was a problem hiding this comment.
is there any use of human readable file @Rohit-Singh43-1 ?
means as per requirement you need base64 file right
There was a problem hiding this comment.
also if this file is needed can we create other flag example format flag
default to base64?
| --in pod.yaml \ | ||
| --out policy.rego | ||
| # Output: | ||
| # Successfully generated Rego policy: policy.rego |
There was a problem hiding this comment.
I feel better if we create one more flag ex: format here to generate type of file as per requirement
There was a problem hiding this comment.
Thanks @vikas-sharma24 for review ,we need 2 files base64 can directly copied to contract and nomal file your user to verify the details , For now we can go with once we mature wiith this feature we can remove human text files all together and only base64 will be handled
| assert.Contains(t, policy, `quay\\.io/prometheus/busybox:latest`) | ||
| assert.Contains(t, policy, "allow_image(image_name)") | ||
| assert.Contains(t, policy, "allow_command(image_name, args)") | ||
| // HpcrText returns standard base64 (not the encrypted hyper-protect-basic prefix) |
|
|
||
| // TestProcess_WithInitContainer tests Process with pod containing init containers | ||
| func TestProcess_WithInitContainer(t *testing.T) { | ||
| podYAML := `apiVersion: v1 |
There was a problem hiding this comment.
add one testcase with invalid kind
| apiVersion: v1 | ||
| kind: Pod | ||
| metadata: | ||
| name: hpcc-workload-pod |
There was a problem hiding this comment.
change this to ccco instead of hpcc, check other references as well example (lables -> app)
|
@Rohit-Singh43-1 could you add some examples of the new command? Also resolve git conflicts |
|
`./contract-cli-s390x --help Supports:
Documentation: https://ibm-hyper-protect.github.io/contract-cli/ Usage: Available Commands: Flags: Use "contract-cli [command] --help" for more information about a command. Mandatory Flags: Optional Flags: l` |
Description
Introduced a new cli parameter rego-generator.
Provides support of rego file generation and providing base64 rego policy
Implements the contract GenerateRegoPolicy() Public API
Related Issue
Fixes #
Type of Change
Target Platform
Testing
make testpassesmake fmtapplied (no formatting changes needed)Checklist
make test)