Skip to content

Commit

Permalink
Merge pull request enterprise-contract#185 from lcarva/HACBS-2428
Browse files Browse the repository at this point in the history
Add config per policy source
  • Loading branch information
lcarva committed Sep 21, 2023
2 parents bba3a57 + d10dbf9 commit 2782a69
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 107 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/dependency-review.yml

This file was deleted.

77 changes: 0 additions & 77 deletions .github/workflows/scorecards.yml

This file was deleted.

16 changes: 16 additions & 0 deletions api/config/appstudio.redhat.com_enterprisecontractpolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,22 @@ spec:
items:
description: Source defines policies and data that are evaluated together
properties:
config:
description: Config specifies which policy rules are included, or excluded, from the provided policy source urls.
properties:
exclude:
description: Exclude is a set of policy exclusions that, in case of failure, do not block the success of the outcome.
items:
type: string
type: array
x-kubernetes-list-type: set
include:
description: Include is a set of policy inclusions that are added to the policy evaluation. These take precedence over policy exclusions.
items:
type: string
type: array
x-kubernetes-list-type: set
type: object
data:
description: List of go-getter style policy data source urls
items:
Expand Down
22 changes: 21 additions & 1 deletion api/v1alpha1/enterprisecontractpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,29 @@ type Source struct {
// +optional
// +kubebuilder:validation:Type:=object
RuleData *extv1.JSON `json:"ruleData,omitempty"`
// Config specifies which policy rules are included, or excluded, from the
// provided policy source urls.
// +optional
// +kubebuilder:validation:Type:=object
Config *SourceConfig `json:"config,omitempty"`
}

// SourceConfig specifies config options for a policy source.
type SourceConfig struct {
// Exclude is a set of policy exclusions that, in case of failure, do not block
// the success of the outcome.
// +optional
// +listType:=set
Exclude []string `json:"exclude,omitempty"`
// Include is a set of policy inclusions that are added to the policy evaluation.
// These take precedence over policy exclusions.
// +optional
// +listType:=set
Include []string `json:"include,omitempty"`
}

// EnterpriseContractPolicyConfiguration configuration of modifications to policy evaluation
// EnterpriseContractPolicyConfiguration configuration of modifications to policy evaluation.
// DEPRECATED: Use the config for a policy source instead.
type EnterpriseContractPolicyConfiguration struct {
// Exclude set of policy exclusions that, in case of failure, do not block
// the success of the outcome.
Expand Down
30 changes: 30 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,22 @@ spec:
items:
description: Source defines policies and data that are evaluated together
properties:
config:
description: Config specifies which policy rules are included, or excluded, from the provided policy source urls.
properties:
exclude:
description: Exclude is a set of policy exclusions that, in case of failure, do not block the success of the outcome.
items:
type: string
type: array
x-kubernetes-list-type: set
include:
description: Include is a set of policy inclusions that are added to the policy evaluation. These take precedence over policy exclusions.
items:
type: string
type: array
x-kubernetes-list-type: set
type: object
data:
description: List of go-getter style policy data source urls
items:
Expand Down
19 changes: 18 additions & 1 deletion docs/modules/ROOT/pages/reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Appears In: xref:{anchor_prefix}-github-com-enterprise-contract-enterprise-contr
[id="{anchor_prefix}-github-com-enterprise-contract-enterprise-contract-controller-api-v1alpha1-enterprisecontractpolicyconfiguration"]
=== EnterpriseContractPolicyConfiguration

EnterpriseContractPolicyConfiguration configuration of modifications to policy evaluation
EnterpriseContractPolicyConfiguration configuration of modifications to policy evaluation. DEPRECATED: Use the config for a policy source instead.

[quote]
Appears In: xref:{anchor_prefix}-github-com-enterprise-contract-enterprise-contract-controller-api-v1alpha1-enterprisecontractpolicyspec[$$EnterpriseContractPolicySpec$$]
Expand Down Expand Up @@ -133,6 +133,23 @@ Appears In: xref:{anchor_prefix}-github-com-enterprise-contract-enterprise-contr
| *`policy`* __string array__ | List of go-getter style policy source urls
| *`data`* __string array__ | List of go-getter style policy data source urls
| *`ruleData`* __JSON__ | Arbitrary rule data that will be visible to policy rules
| *`config`* __xref:{anchor_prefix}-github-com-enterprise-contract-enterprise-contract-controller-api-v1alpha1-sourceconfig[$$SourceConfig$$]__ | Config specifies which policy rules are included, or excluded, from the provided policy source urls.
|===


[id="{anchor_prefix}-github-com-enterprise-contract-enterprise-contract-controller-api-v1alpha1-sourceconfig"]
=== SourceConfig

SourceConfig specifies config options for a policy source.

[quote]
Appears In: xref:{anchor_prefix}-github-com-enterprise-contract-enterprise-contract-controller-api-v1alpha1-source[$$Source$$]

[cols="25a,75a", options="header"]
|===
| Field | Description
| *`exclude`* __string array__ | Exclude is a set of policy exclusions that, in case of failure, do not block the success of the outcome.
| *`include`* __string array__ | Include is a set of policy inclusions that are added to the policy evaluation. These take precedence over policy exclusions.
|===


0 comments on commit 2782a69

Please sign in to comment.