-
Notifications
You must be signed in to change notification settings - Fork 33
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
sotw: dnspolicy #937
sotw: dnspolicy #937
Conversation
d558ea1
to
18f3056
Compare
controllers/dnspolicies_validator.go
Outdated
} | ||
|
||
func (r *DNSPoliciesValidator) validate(_ context.Context, _ []controller.ResourceEvent, topology *machinery.Topology, _ error, state *sync.Map) error { | ||
policies := topology.Policies().Items(func(o machinery.Object) bool { |
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.
night be a nice option in the future to have a topology.Policies().ForGVK(...)
?
return nil, false | ||
}) | ||
|
||
for i := range orphanRecords { |
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.
open question. If we are using lo
should we not end up using it for slices also? https://github.com/samber/lo?tab=readme-ov-file#foreach
@guicassolato ?
|
||
return opts | ||
} | ||
|
||
func (b *BootOptionsBuilder) Reconciler() controller.ReconcileFunc { | ||
mainWorkflow := &controller.Workflow{ | ||
Precondition: initWorkflow(b.client).Run, | ||
Tasks: []controller.ReconcileFunc{ |
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.
are each of these dispatched in their own routine?
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.
These changes all look pretty good to me. Couple of minor comments but nothing major.
4c58b9a
to
76839c3
Compare
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.
I have removed so of my previous comments. After looking at this a second time last night, I had a misunderstanding of what was going on here. There is something going on here that seems out of place I have quite point my finger on it yet.
45d301e
to
76839c3
Compare
"app.kubernetes.io/name": KuadrantAppName, | ||
"app.kubernetes.io/part-of": KuadrantAppName, | ||
} | ||
} |
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.
Copied the layout and labels from https://github.com/Kuadrant/kuadrant-operator/blob/main/pkg/openshift/consoleplugin/common.go
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.
I've been adding a few common vars and helper funcs for things like labeling internal resources we create, etc, including one to identify the resource as "managed-by" kuadrant, here:
kuadrantManagedLabelKey = "kuadrant.io/managed" |
(and also at the top of specific workflow files, when the var is not just as common as these ones.)
Happy to move those here once this is merged, if you believe it would help having them all in one place rather than separated by area.
b55dbdf
to
c6fbbcf
Compare
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.
few minor things. But generally changes look ok and approachable. Will try it out locally but happy to approve
@mikenairn I did a bunch of addiitonal manual tests with multiple gateways, multiple httproutes, deleting httproutes, deleting gateways, no credentials etc all worked as expected 👍 |
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 good to me 👍
4191c5c
to
e5393eb
Compare
Add basic setup for DNSPolicy state of the world tasks, dnsrecord types, watcher and linker function (Listener -> DNSRecord) * Update dns policy validator in preparation for status updates, adds correct errors for acceptance. * Add common labels that get applied to all dnsrecord resources created by the kuadrant operator * Add filter to topology for dnsrecords to only add records that contain Signed-off-by: Michael Nairn <mnairn@redhat.com>
Move all logic to delete orphan dnsrecord resources for a DNSPolicy to the sotw reconciler and based all decisions on the current topology. Orphan record is one that no longer has a valid path between it's owner DNSPolicy and itself in the topology. This covers the following scenarios: * Listener is deleted from the Gateway * Gateway is deleted * Policy is deleted(K8s will also deal with this due to the owner relationship) * Policy ref is changed Does not deal with the removal of records based on the state of the gateway. Signed-off-by: Michael Nairn <mnairn@redhat.com>
Signed-off-by: Michael Nairn <mnairn@redhat.com>
Signed-off-by: Michael Nairn <mnairn@redhat.com>
* Add dnsPolicyTypeFilterFunc for reuse across dns policy tasks * Add Validate method to DNSPolicy * Add context specific errors to state during reconciliation and append them to the enforced message on status update. Signed-off-by: Michael Nairn <mnairn@redhat.com>
Requires this fix Kuadrant/policy-machinery#45 Signed-off-by: Michael Nairn <mnairn@redhat.com>
e5393eb
to
2469b62
Compare
* sotw: dnspolicy init Add basic setup for DNSPolicy state of the world tasks, dnsrecord types, watcher and linker function (Listener -> DNSRecord) * Update dns policy validator in preparation for status updates, adds correct errors for acceptance. * Add common labels that get applied to all dnsrecord resources created by the kuadrant operator * Add filter to topology for dnsrecords to only add records that contain * sotw: dnspolicy delete orphan records Move all logic to delete orphan dnsrecord resources for a DNSPolicy to the sotw reconciler and based all decisions on the current topology. Orphan record is one that no longer has a valid path between it's owner DNSPolicy and itself in the topology. This covers the following scenarios: * Listener is deleted from the Gateway * Gateway is deleted * Policy is deleted(K8s will also deal with this due to the owner relationship) * Policy ref is changed Does not deal with the removal of records based on the state of the gateway. * sotw dnspolicy: status and dnspolicies reconciliation * Bump policy-machinery v0.6.1 --------- Signed-off-by: Michael Nairn <mnairn@redhat.com> Signed-off-by: R-Lawton <rlawton@redhat.com>
Follow on from Kuadrant#937 to cleanup controller files to bring them more inline with the current sotw approach. There are no logical changes in this commit, existing code is just being moved. Signed-off-by: Michael Nairn <mnairn@redhat.com>
Follow on from Kuadrant#937 to cleanup controller files to bring them more inline with the current sotw approach. There are no logical changes in this commit, existing code is just being moved. Signed-off-by: Michael Nairn <mnairn@redhat.com>
Follow on from #937 to cleanup controller files to bring them more inline with the current sotw approach. There are no logical changes in this commit, existing code is just being moved. Signed-off-by: Michael Nairn <mnairn@redhat.com>
Adds state of the world tasks for DNSPolicy.
Cleanup old controller files(Left as is for easier reviews, will do this in a separate PR after this one with no logic changes)closes #818 #823