Skip to content

Commit

Permalink
worker: log Ingress resource type
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Yastrebov <alexander.yastrebov@zalando.de>
  • Loading branch information
AlexanderYastrebov committed Apr 7, 2022
1 parent 66bba09 commit 68a0629
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
4 changes: 2 additions & 2 deletions kubernetes/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ type Ingress struct {
resourceType ingressType
}

// String returns a string representation of the Ingress instance containing the namespace and the resource name.
// String returns a string representation of the Ingress instance containing the type, namespace and the resource name.
func (i *Ingress) String() string {
return fmt.Sprintf("%s/%s", i.Namespace, i.Name)
return fmt.Sprintf("%s %s/%s", i.resourceType, i.Namespace, i.Name)
}

// ConfigMap is the ingress-controller's representation of a Kubernetes
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ func TestNewIngressFromKube(tt *testing.T) {
} else {
assert.NoError(t, err)
assert.Equal(t, tc.ingress, got, "mapping from kubernetes ingress to adapter failed")
assert.Equal(t, got.String(), fmt.Sprintf("%s/%s", tc.ingress.Namespace, tc.ingress.Name), "wrong value from String()")
assert.Equal(t, got.String(), fmt.Sprintf("%s %s/%s", tc.ingress.resourceType, tc.ingress.Namespace, tc.ingress.Name), "wrong value from String()")
}
})
}
Expand Down
13 changes: 4 additions & 9 deletions worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,12 +401,7 @@ func matchIngressesToLoadBalancers(

if ingress.CertificateARN != "" {
if !certs.CertificateExists(ingress.CertificateARN) {
log.Errorf(
"Failed to find certificate '%s' for ingress '%s/%s'",
ingress.CertificateARN,
ingress.Namespace,
ingress.Name,
)
log.Errorf("Failed to find certificate %s for %s", ingress.CertificateARN, ingress)
continue
}
certificateARNs = []string{ingress.CertificateARN}
Expand Down Expand Up @@ -576,12 +571,12 @@ func updateIngress(kubeAdapter *kubernetes.Adapter, lb *loadBalancer, problems *
for _, ing := range ingresses {
if err := kubeAdapter.UpdateIngressLoadBalancer(ing, dnsName); err != nil {
if err == kubernetes.ErrUpdateNotNeeded {
log.Debugf("Ingress update not needed %v with DNS name %q", ing, dnsName)
log.Debugf("Update not needed for %s with DNS name %s", ing, dnsName)
} else {
problems.Add("failed to update ingress %q: %w", ing, err)
problems.Add("failed to update %s: %w", ing, err)
}
} else {
log.Infof("Updated ingress %v with DNS name %q", ing, dnsName)
log.Infof("Updated %s with DNS name %s", ing, dnsName)
}
}
}
Expand Down

0 comments on commit 68a0629

Please sign in to comment.