Skip to content
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

Small improvements to recordDiff #248

Merged

Conversation

mprahl
Copy link
Member

@mprahl mprahl commented May 21, 2024

See each commit for details.

@mprahl mprahl force-pushed the recorddiff branch 2 times, most recently from 44a8192 to b791c44 Compare May 21, 2024 19:13
@mprahl mprahl mentioned this pull request May 21, 2024
Comment on lines 202 to 208
// RecordDiff specifies whether and where to log the difference between the object on the cluster
// and the `objectDefinition` in the policy. The supported options are `InStatus` to record the
// difference in the policy status field, `Log` to log the difference in the
// config-policy-controller pod, and `None` to not log the diff. The default value is `None` for
// object kinds that include sensitive data including `ConfigMap`, `OAuthAccessToken`,
// `OAuthAuthorizeTokens`, `Route`, and `Secret` or when a policy template references sensitive
// data. For all other kinds, the default value is `InStatus`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// RecordDiff specifies whether and where to log the difference between the object on the cluster
// and the `objectDefinition` in the policy. The supported options are `InStatus` to record the
// difference in the policy status field, `Log` to log the difference in the
// config-policy-controller pod, and `None` to not log the diff. The default value is `None` for
// object kinds that include sensitive data including `ConfigMap`, `OAuthAccessToken`,
// `OAuthAuthorizeTokens`, `Route`, and `Secret` or when a policy template references sensitive
// data. For all other kinds, the default value is `InStatus`.
// RecordDiff specifies whether and where to log the difference between the object on the cluster
// and the `objectDefinition` parameter in the policy. The supported options are `InStatus` to record the
// difference in the policy status field, `Log` to log the difference in the
// `config-policy-controlle`r pod, and `None` to not log the difference. The default value is `None` for
// object kinds that include sensitive data including resources such as, `ConfigMap`, `OAuthAccessToken`,
// `OAuthAuthorizeTokens`, `Route`, and `Secret`, or when a policy template references sensitive
// data. For all other kinds, the default value is `InStatus`.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to not use the resources such as suggestion since I think it's already clear enough with just object kinds.

Comment on lines 2797 to 2800
`# This diff may contain sensitive data. The spec["object-templates"][%d]["recordDiff"] field must be set `+
`to "InStatus" for the diff to be recorded in the policy status. Consider existing access to the `+
`ConfigurationPolicy objects and the etcd encryption configuration before proceeding.`,
objectTemplateIndex,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the other syntax bold the parameters? Also for this statement, saying "changes" instead of "differences" is more clear. However, I like "differences" for the sake of consistency. The extra tick marks from is a bit confusing for me. To be specific and if it is supported, please monospace "spec", "object-templates.recordDiff", "InStatus", "ConfigurationPolicy"

Suggested change
`# This diff may contain sensitive data. The spec["object-templates"][%d]["recordDiff"] field must be set `+
`to "InStatus" for the diff to be recorded in the policy status. Consider existing access to the `+
`ConfigurationPolicy objects and the etcd encryption configuration before proceeding.`,
objectTemplateIndex,
`# This diff might contain sensitive data. The spec field, ["object-templates"][%d]["recordDiff"] fmust be set `+
`to "InStatus" for the differences to be recorded in the policy status. Consider existing access to the `+
`ConfigurationPolicy objects and the etcd encryption configuration before you proceed.`,
objectTemplateIndex,

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The syntax of spec["object-templates"][%d]["recordDiff"] is the JSON notation to access the field which is why it's specified this way. This would make sense to the user since they write their configuration policy in JSON or YAML (which is a superset of JSON).

@mprahl mprahl force-pushed the recorddiff branch 2 times, most recently from d049c5c to e22b067 Compare May 21, 2024 19:48
@mprahl
Copy link
Member Author

mprahl commented May 21, 2024

Thanks for the reviews @dhaiducek and @dockerymick . This is ready for another round.

Signed-off-by: mprahl <mprahl@users.noreply.github.com>
This provides more context as to why it may be unsafe to enable it.

Signed-off-by: mprahl <mprahl@users.noreply.github.com>
Signed-off-by: mprahl <mprahl@users.noreply.github.com>
Copy link
Member

@dhaiducek dhaiducek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link

openshift-ci bot commented May 21, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dhaiducek, mprahl

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants