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

The ConfigurationPolicy error message for a missing namespace #80

Conversation

ChunxiAlexLuo
Copy link
Contributor

@ChunxiAlexLuo ChunxiAlexLuo force-pushed the The-ConfigurationPolicy-error-message-for-a-missing-namespace-is-incomplete branch 4 times, most recently from 9e249de to 999e3e3 Compare November 18, 2022 20:07
@ChunxiAlexLuo ChunxiAlexLuo force-pushed the The-ConfigurationPolicy-error-message-for-a-missing-namespace-is-incomplete branch from 6b3cf80 to bd9e489 Compare November 18, 2022 20:09
@mprahl
Copy link
Member

mprahl commented Nov 21, 2022

@ChunxiAlexLuo, I was thinking that you would add the additional information to the error message here instead:

if objDetails.isNamespaced && namespace == "" {
log.Info("The object template is namespaced but no namespace is specified. Cannot process.")
// namespaced but none specified, generate violation
statusUpdateNeeded = addConditionToStatus(policy, index, false, "K8s missing namespace",
"namespaced object has no namespace specified "+
"from the policy namespaceSelector nor the object metadata",
)
if statusUpdateNeeded {
eventType := eventNormal
if index < len(policy.Status.CompliancyDetails) &&
policy.Status.CompliancyDetails[index].ComplianceState == policyv1.NonCompliant {
eventType = eventWarning
}
r.Recorder.Event(policy, eventType, fmt.Sprintf(eventFmtStr, policy.GetName(), objDetails.name),
convertPolicyStatusToString(policy))
}
return nil, false, "", "", nil, statusUpdateNeeded
}

@ChunxiAlexLuo ChunxiAlexLuo force-pushed the The-ConfigurationPolicy-error-message-for-a-missing-namespace-is-incomplete branch from c9c6c13 to 69faef9 Compare November 23, 2022 20:40
@ChunxiAlexLuo ChunxiAlexLuo force-pushed the The-ConfigurationPolicy-error-message-for-a-missing-namespace-is-incomplete branch from 69faef9 to e959517 Compare November 23, 2022 21:00
@openshift-ci
Copy link

openshift-ci bot commented Nov 23, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ChunxiAlexLuo, 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:
  • OWNERS [ChunxiAlexLuo,mprahl]

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

@openshift-merge-robot openshift-merge-robot merged commit 36aed58 into open-cluster-management-io:main Nov 23, 2022
@ChunxiAlexLuo ChunxiAlexLuo deleted the The-ConfigurationPolicy-error-message-for-a-missing-namespace-is-incomplete branch November 23, 2022 22:43
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