-
Notifications
You must be signed in to change notification settings - Fork 16
DNS Groups. #669
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
base: main
Are you sure you want to change the base?
DNS Groups. #669
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ Dockerfile.cross | |
| *.swp | ||
| *.swo | ||
| *~ | ||
| examples/* | ||
|
|
||
| # Helm chart packages | ||
| *operator*.tgz* | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,15 @@ | ||
| k.example.com { | ||
| debug | ||
| errors | ||
| log | ||
|
|
||
| rewrite name regex kuadrant-active-groups\.(.*)k.example\.com kuadrant-active-groups-coredns.pb.hcpapps.net | ||
| forward kuadrant-active-groups-coredns.pb.hcpapps.net /etc/resolv.conf | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this will need to be updated to allow this custom host to be passed in at set up time, somehow, that's for another ticket: #670 |
||
|
|
||
| health { | ||
| lameduck 5s | ||
| } | ||
| ready | ||
| log | ||
| geoip GeoLite2-City-demo.mmdb { | ||
| edns-subnet | ||
| } | ||
|
|
@@ -15,4 +19,4 @@ k.example.com { | |
| } | ||
| kuadrant | ||
| prometheus 0.0.0.0:9153 | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,22 @@ | ||
| k.example.com { | ||
| debug | ||
| errors | ||
| log | ||
| geoip GeoLite2-City-demo.mmdb | ||
| metadata | ||
| transfer { | ||
| to * | ||
| } | ||
| kuadrant | ||
| } | ||
| debug | ||
| errors | ||
| log | ||
|
|
||
| rewrite name regex kuadrant-active-groups\.(.*)k.example\.com kuadrant-active-groups-coredns.pb.hcpapps.net | ||
| forward kuadrant-active-groups-coredns.pb.hcpapps.net /etc/resolv.conf | ||
|
|
||
| health { | ||
| lameduck 5s | ||
| } | ||
| ready | ||
| geoip GeoLite2-City-demo.mmdb { | ||
| edns-subnet | ||
| } | ||
| metadata | ||
| transfer { | ||
| to * | ||
| } | ||
| kuadrant | ||
| prometheus 0.0.0.0:9153 | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,11 +26,16 @@ import ( | |
| "github.com/kuadrant/dns-operator/types" | ||
| ) | ||
|
|
||
| const ( | ||
| activeGroupsTXTRecordName = "kuadrant-active-groups" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you replace this with this constant as well, please? |
||
| ) | ||
|
|
||
| type BaseDNSRecordReconciler struct { | ||
| Scheme *runtime.Scheme | ||
| ProviderFactory provider.Factory | ||
| DelegationRole string | ||
| Group types.Group | ||
| TXTResolver TXTResolver | ||
| } | ||
|
|
||
| func (r *BaseDNSRecordReconciler) IsPrimary() bool { | ||
|
|
@@ -106,7 +111,7 @@ func (r *BaseDNSRecordReconciler) publishRecord(ctx context.Context, dnsRecord D | |
| if err != nil { | ||
| return hadChanges, err | ||
| } | ||
| logger.Info("Published DNSRecord to zone") | ||
| logger.Info("Published DNSRecord to zone", "hadChanges?", hadChanges) | ||
|
|
||
| return hadChanges, nil | ||
| } | ||
|
|
@@ -129,9 +134,11 @@ func (r *BaseDNSRecordReconciler) applyChanges(ctx context.Context, dnsRecord DN | |
| return false, err | ||
| } | ||
|
|
||
| recordRegistry = registry.GroupRegistry{ | ||
| Registry: recordRegistry, | ||
| Group: r.Group, | ||
| if !dnsRecord.GetDNSRecord().IsAuthoritativeRecord() { | ||
philbrookes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| recordRegistry = registry.GroupRegistry{ | ||
| Registry: recordRegistry, | ||
| Group: dnsRecord.GetGroup(), | ||
| } | ||
| } | ||
|
|
||
| policyID := "sync" | ||
|
|
@@ -192,7 +199,12 @@ func (r *BaseDNSRecordReconciler) applyChanges(ctx context.Context, dnsRecord DN | |
| } | ||
|
|
||
| func (r *BaseDNSRecordReconciler) updateStatus(ctx context.Context, client client.Client, previous, current DNSRecordAccessor, err error) (reconcile.Result, error) { | ||
| result, uErr := r.updateStatusAndRequeue(ctx, client, previous, current, 0) | ||
| _, requeueTime := recordReceivedPrematurely(current) | ||
| if !current.IsActive() { | ||
| requeueTime = InactiveGroupRequeueTime | ||
| } | ||
| result, uErr := r.updateStatusAndRequeue(ctx, client, previous, current, requeueTime) | ||
|
|
||
| if uErr != nil { | ||
| err = uErr | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,17 +41,21 @@ type DNSRecordAccessor interface { | |
| GetStatus() *v1alpha1.DNSRecordStatus | ||
| SetStatusConditions(hadChanges bool) | ||
| SetStatusCondition(conditionType string, status metav1.ConditionStatus, reason, message string) | ||
| ClearStatusCondition(conditionType string) | ||
| GetStatusCondition(conditionType string) *metav1.Condition | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We seem to never use the |
||
| SetStatusOwnerID(id string) | ||
| SetStatusZoneID(id string) | ||
| SetStatusZoneDomainName(domainName string) | ||
| SetStatusDomainOwners(owners []string) | ||
| SetStatusEndpoints(endpoints []*externaldns.Endpoint) | ||
| SetStatusObservedGeneration(observedGeneration int64) | ||
| SetStatusGroup(types.Group) | ||
| SetStatusActiveGroups(types.Groups) | ||
| HasOwnerIDAssigned() bool | ||
| HasDNSZoneAssigned() bool | ||
| HasProviderSecretAssigned() bool | ||
| IsDeleting() bool | ||
| IsActive() bool | ||
| } | ||
|
|
||
| type DNSRecord struct { | ||
|
|
@@ -92,7 +96,14 @@ func (s *DNSRecord) GetStatus() *v1alpha1.DNSRecordStatus { | |
|
|
||
| func (s *DNSRecord) SetStatusConditions(_ bool) { | ||
| //We do nothing here at the moment!! | ||
| return | ||
| } | ||
|
|
||
| func (s *DNSRecord) GetStatusCondition(conditionType string) *metav1.Condition { | ||
| return meta.FindStatusCondition(s.GetStatus().Conditions, conditionType) | ||
| } | ||
|
|
||
| func (s *DNSRecord) ClearStatusCondition(conditionType string) { | ||
| meta.RemoveStatusCondition(&s.GetStatus().Conditions, conditionType) | ||
| } | ||
|
|
||
| func (s *DNSRecord) SetStatusCondition(conditionType string, status metav1.ConditionStatus, reason, message string) { | ||
|
|
@@ -136,6 +147,10 @@ func (s *DNSRecord) SetStatusGroup(group types.Group) { | |
| s.GetStatus().Group = group | ||
| } | ||
|
|
||
| func (s *DNSRecord) SetStatusActiveGroups(groups types.Groups) { | ||
| s.GetStatus().ActiveGroups = groups.String() | ||
| } | ||
|
|
||
| type RemoteDNSRecord struct { | ||
| *v1alpha1.DNSRecord | ||
| ClusterID string | ||
|
|
@@ -182,7 +197,16 @@ func (s *RemoteDNSRecord) GetStatus() *v1alpha1.DNSRecordStatus { | |
|
|
||
| func (s *RemoteDNSRecord) SetStatusConditions(_ bool) { | ||
| //We do nothing here at the moment!! | ||
| return | ||
| } | ||
|
|
||
| func (s *RemoteDNSRecord) GetStatusCondition(conditionType string) *metav1.Condition { | ||
| return meta.FindStatusCondition(s.Status.Conditions, conditionType) | ||
| } | ||
|
|
||
| func (s *RemoteDNSRecord) ClearStatusCondition(conditionType string) { | ||
| conditions := s.GetStatus().Conditions | ||
| meta.RemoveStatusCondition(&conditions, conditionType) | ||
| s.GetStatus().Conditions = conditions | ||
| } | ||
|
|
||
| func (s *RemoteDNSRecord) SetStatusCondition(conditionType string, status metav1.ConditionStatus, reason, message string) { | ||
|
|
@@ -231,6 +255,11 @@ func (s *RemoteDNSRecord) SetStatusGroup(_ types.Group) { | |
| panic("cannot set Group on remote record") | ||
| } | ||
|
|
||
| func (s *RemoteDNSRecord) SetStatusActiveGroups(groups types.Groups) { | ||
| s.GetStatus().ActiveGroups = groups.String() | ||
| s.setStatus() | ||
| } | ||
|
|
||
| func (s *RemoteDNSRecord) setStatus() { | ||
| s.DNSRecord.Status.SetRemoteRecordStatus(s.ClusterID, *s.status) | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.