-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix constantly updating objects with a null struct
It was tricky to find an example of this. Most optional structs I found would get populated with some default values, meaning they wouldn't be omitted by the kube api. Signed-off-by: Justin Kulikauskas <jkulikau@redhat.com>
- Loading branch information
1 parent
30d0179
commit 2b96a71
Showing
4 changed files
with
118 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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 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
38 changes: 38 additions & 0 deletions
38
test/resources/case31_policy_history/event-config-policy-emptystruct.yaml
This file contains 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,38 @@ | ||
apiVersion: policy.open-cluster-management.io/v1 | ||
kind: ConfigurationPolicy | ||
metadata: | ||
name: config-policy-event-emptystruct | ||
labels: | ||
policy.open-cluster-management.io/policy: test-policy-security | ||
ownerReferences: | ||
- apiVersion: policy.open-cluster-management.io/v1 | ||
blockOwnerDeletion: false | ||
controller: true | ||
kind: Policy | ||
name: test-policy-security-emptystruct | ||
uid: 08bae967-4262-498a-84e9-d1f0e321b41e | ||
spec: | ||
pruneObjectBehavior: DeleteAll | ||
remediationAction: enforce | ||
namespaceSelector: | ||
exclude: | ||
- kube-* | ||
include: | ||
- default | ||
object-templates: | ||
- complianceType: musthave | ||
objectDefinition: | ||
action: DidTheThing | ||
apiVersion: events.k8s.io/v1 | ||
eventTime: 2023-04-27T14:37:36.721589Z | ||
kind: Event | ||
metadata: | ||
name: configpol-test-event | ||
namespace: default | ||
note: Successfully did something | ||
reason: Success | ||
regarding: null | ||
related: null | ||
reportingController: ConfigPolicyTester | ||
reportingInstance: configpol-history-test | ||
type: Normal |
41 changes: 41 additions & 0 deletions
41
test/resources/case31_policy_history/event-policy-emptystruct.yaml
This file contains 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,41 @@ | ||
apiVersion: policy.open-cluster-management.io/v1 | ||
kind: Policy | ||
metadata: | ||
name: test-policy-security-emptystruct | ||
annotations: | ||
policy.open-cluster.management.io/standards: NIST-CSF | ||
policy.open-cluster.management.io/categories: PR.PT Protective Technology | ||
policy.open-cluster.management.io/controls: PR.PT-3 Least Functionality | ||
spec: | ||
remediationAction: enforce | ||
disabled: false | ||
policy-templates: | ||
- objectDefinition: | ||
apiVersion: policy.open-cluster-management.io/v1 | ||
kind: ConfigurationPolicy | ||
metadata: | ||
name: config-policy-event-emptystruct | ||
spec: | ||
remediationAction: enforce | ||
namespaceSelector: | ||
exclude: | ||
- kube-* | ||
include: | ||
- default | ||
object-templates: | ||
- complianceType: musthave | ||
objectDefinition: | ||
action: DidTheThing | ||
apiVersion: events.k8s.io/v1 | ||
eventTime: 2023-04-27T14:37:36.721589Z | ||
kind: Event | ||
metadata: | ||
name: configpol-test-event | ||
namespace: default | ||
note: Successfully did something | ||
reason: Success | ||
regarding: null | ||
related: null | ||
reportingController: ConfigPolicyTester | ||
reportingInstance: configpol-history-test | ||
type: Normal |