Skip to content

Commit

Permalink
gofmt simplify new ingress-class changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dsalisbury committed Oct 2, 2021
1 parent 0aa3d55 commit 6c4a450
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/apis/externaldns/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ func (cfg *Config) ParseFlags(args []string) error {
app.Flag("namespace", "Limit sources of endpoints to a specific namespace (default: all namespaces)").Default(defaultConfig.Namespace).StringVar(&cfg.Namespace)
app.Flag("annotation-filter", "Filter sources managed by external-dns via annotation using label selector semantics (default: all sources)").Default(defaultConfig.AnnotationFilter).StringVar(&cfg.AnnotationFilter)
app.Flag("label-filter", "Filter sources managed by external-dns via label selector when listing all resources; currently only supported by source CRD").Default(defaultConfig.LabelFilter).StringVar(&cfg.LabelFilter)
app.Flag("ingress-class", "Require an ingress to have this class name (defaults to any class; specify multiple times to allow more than one class)").StringsVar(&cfg.IngressClassNames)
app.Flag("ingress-class", "Require an ingress to have this class name (defaults to any class; specify multiple times to allow more than one class)").StringsVar(&cfg.IngressClassNames)
app.Flag("fqdn-template", "A templated string that's used to generate DNS names from sources that don't define a hostname themselves, or to add a hostname suffix when paired with the fake source (optional). Accepts comma separated list for multiple global FQDN.").Default(defaultConfig.FQDNTemplate).StringVar(&cfg.FQDNTemplate)
app.Flag("combine-fqdn-annotation", "Combine FQDN template and Annotations instead of overwriting").BoolVar(&cfg.CombineFQDNAndAnnotation)
app.Flag("ignore-hostname-annotation", "Ignore hostname annotation when generating DNS names, valid only when using fqdn-template is set (optional, default: false)").BoolVar(&cfg.IgnoreHostnameAnnotation)
Expand Down
10 changes: 5 additions & 5 deletions source/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type ingressSource struct {
client kubernetes.Interface
namespace string
annotationFilter string
ingressClassNames []string
ingressClassNames []string
fqdnTemplate *template.Template
combineFQDNAnnotation bool
ignoreHostnameAnnotation bool
Expand Down Expand Up @@ -135,7 +135,7 @@ func (sc *ingressSource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, e
return nil, err
}

ingresses, err = sc.filterByIngressClass(ingresses)
ingresses, err = sc.filterByIngressClass(ingresses)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -253,13 +253,13 @@ func (sc *ingressSource) filterByIngressClass(ingresses []*networkv1.Ingress) ([
filteredList := []*networkv1.Ingress{}

for _, ingress := range ingresses {
var matched = false;
var matched = false

for _, nameFilter := range sc.ingressClassNames {
if ingress.Spec.IngressClassName != nil && nameFilter == *ingress.Spec.IngressClassName {
matched = true;
matched = true
} else if matchLabelSelector(selector, ingress.Annotations) {
matched = true;
matched = true
}

if matched {
Expand Down

0 comments on commit 6c4a450

Please sign in to comment.