-
Notifications
You must be signed in to change notification settings - Fork 326
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
Use metadata field from configEntry #343
Conversation
bf0c6c8
to
a0c74d7
Compare
a3f2400
to
bb6fae3
Compare
bb6fae3
to
27c54d0
Compare
93279e0
to
9848109
Compare
controller/configentry_controller.go
Outdated
entry, _, err := r.ConsulClient.ConfigEntries().Get(configEntry.ConsulKind(), configEntry.Name(), &capi.QueryOptions{ | ||
Namespace: r.consulNamespace(req.Namespace, configEntry.ConsulNamespaced()), | ||
}) | ||
|
||
if err != nil { | ||
return ctrl.Result{}, fmt.Errorf("deleting config entry from consul: %w", err) | ||
return ctrl.Result{}, fmt.Errorf("getting config entry from consul: %w", err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this shouldn't actually error out since if it is deleted then it's actually good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch. Updated this check to ignore notFound errors (I'm time traveling. Ignore timestamps.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for helping with finding the bug BTW. I really appreciate it.
- This ensures we dont have to necessarily write failing tests every time we add a field
…ed in external cluster
- Add error message in logs if Consul entry isnt deleted. - Extract private method to share meta across resources.
Co-authored-by: Luke Kysow <1034429+lkysow@users.noreply.github.com>
9848109
to
ab7f4c3
Compare
82d8c9a
to
cefc24e
Compare
controller/configentry_controller.go
Outdated
// Our finalizer is present, so we need to delete the config entry | ||
// from consul. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can probably drop this comment. Doesn't make much sense here since we're so deep into the deletion process here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🦞 Looks great!
cefc24e
to
ede9b38
Compare
This will determine if the resource is managed from outside the current cluster
Changes proposed in this PR:
datacenter
that is a required flag for the controller for startup. This string will be used in the meta() field of the config entries managed by ConsulThis field will be ignore when checking for equality between resources with
cmp.Equal()
.How I've tested this PR:
How I expect reviewers to test this PR:
Checklist: