Skip to content

Commit

Permalink
fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinWeindel committed Jan 21, 2025
1 parent 49aeac6 commit 13ce5f5
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 36 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ See the [Istio tutorial](docs/usage/tutorials/istio-gateways.md) for a more deta
#### Gateway API gateways
The Gateway API version `gateway.networking.k8s.io/v1` and `gateway.networking.k8s.io/v1alpha2` are supported.
The Gateway API versions `gateway.networking.k8s.io/v1` and `gateway.networking.k8s.io/v1beta1` are supported.
To enable automatic management of `DNSEntries`, annotate the Gateway API `Gateway` resource with `dns.gardener.cloud/dnsnames="*"`.
The domain names are extracted from the `spec.listeners.hostnames` field and from the field `spec.hostnames` of related `HTTPRoute` resources.
Expand Down
21 changes: 0 additions & 21 deletions pkg/controller/source/gateways/gatewayapi/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/ptr"
gatewayapisv1 "sigs.k8s.io/gateway-api/apis/v1"
gatewayapisv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
gatewayapisv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"

"github.com/gardener/external-dns-management/pkg/dns"
Expand Down Expand Up @@ -106,12 +105,6 @@ func (s *gatewaySource) extractServerHosts(obj resources.ObjectData) ([]string,
hosts = append(hosts, string(*listener.Hostname))
}
}
case *gatewayapisv1alpha2.Gateway:
for _, listener := range data.Spec.Listeners {
if listener.Hostname != nil {
hosts = append(hosts, string(*listener.Hostname))
}
}
default:
return nil, fmt.Errorf("unexpected istio gateway type: %#v", obj)
}
Expand Down Expand Up @@ -143,10 +136,6 @@ func (s *gatewaySource) extractServerHosts(obj resources.ObjectData) ([]string,
for _, h := range r.Spec.Hostnames {
hosts = addHost(hosts, string(h))
}
case *gatewayapisv1alpha2.HTTPRoute:
for _, h := range r.Spec.Hostnames {
hosts = addHost(hosts, string(h))
}
}
}
return hosts, nil
Expand Down Expand Up @@ -178,16 +167,6 @@ func (s *gatewaySource) getTargets(obj resources.ObjectData) utils.StringSet {
ipAddresses = append(ipAddresses, address.Value)
}
}
case *gatewayapisv1alpha2.Gateway:
for _, address := range data.Status.Addresses {
t := address.Type
switch {
case t != nil && *t == gatewayapisv1alpha2.HostnameAddressType:
hostnames = append(hostnames, address.Value)
case t == nil || *t == gatewayapisv1alpha2.IPAddressType:
ipAddresses = append(ipAddresses, address.Value)
}
}
}
switch {
case len(hostnames) == 1:
Expand Down
12 changes: 0 additions & 12 deletions pkg/controller/source/gateways/gatewayapi/httproutesReconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/gardener/controller-manager-library/pkg/logger"
"github.com/gardener/controller-manager-library/pkg/resources"
gatewayapisv1 "sigs.k8s.io/gateway-api/apis/v1"
gatewayapisv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
gatewayapisv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
)

Expand Down Expand Up @@ -82,17 +81,6 @@ func extractGatewayNames(route resources.ObjectData) resources.ObjectNameSet {
gatewayNames.Add(resources.NewObjectName(namespace, string(ref.Name)))
}
}
case *gatewayapisv1alpha2.HTTPRoute:
for _, ref := range data.Spec.ParentRefs {
if (ref.Group == nil || string(*ref.Group) == GroupKindGateway.Group) &&
(ref.Kind == nil || string(*ref.Kind) == GroupKindGateway.Kind) {
namespace := data.Namespace
if ref.Namespace != nil {
namespace = string(*ref.Namespace)
}
gatewayNames.Add(resources.NewObjectName(namespace, string(ref.Name)))
}
}
}
return gatewayNames
}
4 changes: 2 additions & 2 deletions test/integration/providerRateLimits_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ var _ = Describe("ProviderRateLimits", func() {
}
}
// rate is limited to one request per 15s
Ω(maxDuration > 14*time.Second).Should(BeTrue(), fmt.Sprintf("max: %.1f > 14s", maxDuration.Seconds()))
Ω(maxDuration).Should(BeNumerically(">", 14*time.Second), fmt.Sprintf("max: %.1f > 14s", maxDuration.Seconds()))

start = time.Now()
err = testEnv.DeleteEntriesAndWait(entries...)
Ω(err).ShouldNot(HaveOccurred())
deleteDuration := time.Since(start)
// delete operations are not rate limited
Ω(deleteDuration < 15*time.Second).Should(BeTrue(), fmt.Sprintf("deletion: %.1f < 15s", maxDuration.Seconds()))
Ω(deleteDuration).Should(BeNumerically("<", 15*time.Second), fmt.Sprintf("deletion: %.1f < 15s", maxDuration.Seconds()))

err = testEnv.DeleteProviderAndSecret(pr)
Ω(err).ShouldNot(HaveOccurred())
Expand Down

0 comments on commit 13ce5f5

Please sign in to comment.