Skip to content

Commit

Permalink
fix(conditions): Fit generated condition type into the restrictions
Browse files Browse the repository at this point in the history
The Condition Type has format restrictions that weren't respected,
changed the format to reflect those restrictions and also made sure that
both providers and controller looks at the same condition
  • Loading branch information
pier-oliviert committed Nov 20, 2024
1 parent bc61e46 commit 73a06d8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions internal/reconcilers/controller/dnsrecord_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (r *DNSRecordReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
}

if lock.Condition().Status == konditions.ConditionInitialized {
lock.Execute(ctx, func(c konditions.Condition) (konditions.Condition, error) {
return ctrl.Result{}, lock.Execute(ctx, func(c konditions.Condition) (konditions.Condition, error) {
found := 0
var integrations phonebook.DNSIntegrationList

Expand All @@ -98,8 +98,8 @@ func (r *DNSRecordReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
if slices.Contains(integration.Spec.Zones, record.Spec.Zone) {
found += 1
record.Status.Conditions.SetCondition(konditions.Condition{
Type: konditions.ConditionType(fmt.Sprintf("provider://%s", integration.Name)),
Status: konditions.ConditionCompleted,
Type: konditions.ConditionType(fmt.Sprintf("provider.%s", integration.Name)),
Status: konditions.ConditionInitialized,
Reason: fmt.Sprintf("Integration has authority over %s", record.Spec.Zone),
})
}
Expand Down
2 changes: 1 addition & 1 deletion internal/reconcilers/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (r *ProviderReconciler) Reconcile(ctx context.Context, req ctrl.Request) (r
record: record,
}

conditionType := konditions.ConditionType(r.Integration)
conditionType := konditions.ConditionType(fmt.Sprintf("provider.%s", r.Integration))
condition := record.Status.Conditions.FindType(conditionType)
if condition == nil || condition.Status == konditions.ConditionError || condition.Status == konditions.ConditionCompleted {
return result, nil
Expand Down

0 comments on commit 73a06d8

Please sign in to comment.