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

Bug: Creating two policy templates with the same name succeeds #69

Merged
merged 1 commit into from
Jun 9, 2023
Merged

Conversation

yiraeChristineKim
Copy link
Contributor

Creating a policy with identical names succeeds. The ConfigurationPolicy is repeatedly overwritten by the template-sync, swapping out the two policies, and repeatedly updating the status with alternating statuses from the two policies.

For example, this policy has two ConfigurationPolicy templates both named policy-pod

Expect to fail and return a status that there is a duplicate name instead.

Ref: https://issues.redhat.com/browse/ACM-5724
Signed-off-by: Yi Rae Kim yikim@redhat.com

@openshift-ci openshift-ci bot requested review from gparvin and JustinKuli June 9, 2023 01:28
@openshift-ci openshift-ci bot added the approved label Jun 9, 2023
@yiraeChristineKim yiraeChristineKim requested review from dhaiducek, JustinKuli and mprahl and removed request for gparvin and JustinKuli June 9, 2023 10:59
Copy link
Member

@JustinKuli JustinKuli left a comment

Choose a reason for hiding this comment

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

Looks good overall, the test looks good. I'm just worried about the weird error case.

controllers/templatesync/template_sync.go Outdated Show resolved Hide resolved
Comment on lines 170 to 174
if err != nil {
reqLogger.Error(err, "Failed to check duplicate configurationpolicy name")

return reconcile.Result{}, nil
}
Copy link
Member

Choose a reason for hiding this comment

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

I think the error flow here could cause some problems. It looks like an error can occur if a template object definition isn't valid and can't be unmarshalled. This return makes it give up forever, without putting a status on the policy...

I think the unmarshal error could be ignored in hasDupName, and just skip those templates. So hasDupName wouldn't return an error, and the logic would be a bit simpler. The same error should appear later when the templates are being considered individually, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good great catch!

Signed-off-by: Yi Rae Kim <yikim@redhat.com>
@openshift-ci openshift-ci bot added the lgtm label Jun 9, 2023
@openshift-ci
Copy link

openshift-ci bot commented Jun 9, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JustinKuli, yiraeChristineKim

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 [JustinKuli,yiraeChristineKim]

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