Skip to content

Commit

Permalink
Fixed formating
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaoBraveCoding committed Sep 16, 2020
1 parent 328465e commit 1304ef3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pkg/apis/externaldns/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,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").Default(defaultConfig.LabelFilter).StringVar(&cfg.LabelFilter)
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("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
21 changes: 13 additions & 8 deletions source/crd.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type crdSource struct {
crdResource string
codec runtime.ParameterCodec
annotationFilter string
labelFilter string
labelFilter string
}

func addKnownTypes(scheme *runtime.Scheme, groupVersion schema.GroupVersion) error {
Expand Down Expand Up @@ -108,7 +108,7 @@ func NewCRDSource(crdClient rest.Interface, namespace, kind string, annotationFi
crdResource: strings.ToLower(kind) + "s",
namespace: namespace,
annotationFilter: annotationFilter,
labelFilter: labelFilter,
labelFilter: labelFilter,
crdClient: crdClient,
codec: runtime.NewParameterCodec(scheme),
}, nil
Expand All @@ -121,15 +121,20 @@ func (cs *crdSource) AddEventHandler(ctx context.Context, handler func()) {
func (cs *crdSource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, error) {
endpoints := []*endpoint.Endpoint{}

var result *endpoint.DNSEndpointList
var err error

var (
result *endpoint.DNSEndpointList
err error
)

if cs.labelFilter != "" {
result, err = cs.List(&metav1.ListOptions{LabelSelector: cs.labelFilter})
result, err = cs.List(ctx, &metav1.ListOptions{LabelSelector: cs.labelFilter})
} else {
result, err = cs.List(&metav1.ListOptions{})
result, err = cs.List(ctx, &metav1.ListOptions{})
}
if err != nil {
return nil, err
}

result, err = cs.filterByAnnotations(result)

if err != nil {
Expand Down

0 comments on commit 1304ef3

Please sign in to comment.