sigs.k8s.io/external-dns@v0.14.1/pkg/apis/externaldns/types.go (about)

     1  /*
     2  Copyright 2017 The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package externaldns
    18  
    19  import (
    20  	"fmt"
    21  	"reflect"
    22  	"regexp"
    23  	"strconv"
    24  	"strings"
    25  	"time"
    26  
    27  	"k8s.io/apimachinery/pkg/labels"
    28  
    29  	"sigs.k8s.io/external-dns/endpoint"
    30  
    31  	"github.com/alecthomas/kingpin/v2"
    32  	"github.com/sirupsen/logrus"
    33  
    34  	"sigs.k8s.io/external-dns/source"
    35  )
    36  
    37  const (
    38  	passwordMask = "******"
    39  )
    40  
    41  // Version is the current version of the app, generated at build time
    42  var Version = "unknown"
    43  
    44  // Config is a project-wide configuration
    45  type Config struct {
    46  	APIServerURL                       string
    47  	KubeConfig                         string
    48  	RequestTimeout                     time.Duration
    49  	DefaultTargets                     []string
    50  	GlooNamespaces                     []string
    51  	SkipperRouteGroupVersion           string
    52  	Sources                            []string
    53  	Namespace                          string
    54  	AnnotationFilter                   string
    55  	LabelFilter                        string
    56  	IngressClassNames                  []string
    57  	FQDNTemplate                       string
    58  	CombineFQDNAndAnnotation           bool
    59  	IgnoreHostnameAnnotation           bool
    60  	IgnoreIngressTLSSpec               bool
    61  	IgnoreIngressRulesSpec             bool
    62  	GatewayNamespace                   string
    63  	GatewayLabelFilter                 string
    64  	Compatibility                      string
    65  	PublishInternal                    bool
    66  	PublishHostIP                      bool
    67  	AlwaysPublishNotReadyAddresses     bool
    68  	ConnectorSourceServer              string
    69  	Provider                           string
    70  	GoogleProject                      string
    71  	GoogleBatchChangeSize              int
    72  	GoogleBatchChangeInterval          time.Duration
    73  	GoogleZoneVisibility               string
    74  	DomainFilter                       []string
    75  	ExcludeDomains                     []string
    76  	RegexDomainFilter                  *regexp.Regexp
    77  	RegexDomainExclusion               *regexp.Regexp
    78  	ZoneNameFilter                     []string
    79  	ZoneIDFilter                       []string
    80  	TargetNetFilter                    []string
    81  	ExcludeTargetNets                  []string
    82  	AlibabaCloudConfigFile             string
    83  	AlibabaCloudZoneType               string
    84  	AWSZoneType                        string
    85  	AWSZoneTagFilter                   []string
    86  	AWSAssumeRole                      string
    87  	AWSAssumeRoleExternalID            string
    88  	AWSBatchChangeSize                 int
    89  	AWSBatchChangeSizeBytes            int
    90  	AWSBatchChangeSizeValues           int
    91  	AWSBatchChangeInterval             time.Duration
    92  	AWSEvaluateTargetHealth            bool
    93  	AWSAPIRetries                      int
    94  	AWSPreferCNAME                     bool
    95  	AWSZoneCacheDuration               time.Duration
    96  	AWSSDServiceCleanup                bool
    97  	AWSZoneMatchParent                 bool
    98  	AWSDynamoDBRegion                  string
    99  	AWSDynamoDBTable                   string
   100  	AzureConfigFile                    string
   101  	AzureResourceGroup                 string
   102  	AzureSubscriptionID                string
   103  	AzureUserAssignedIdentityClientID  string
   104  	BluecatDNSConfiguration            string
   105  	BluecatConfigFile                  string
   106  	BluecatDNSView                     string
   107  	BluecatGatewayHost                 string
   108  	BluecatRootZone                    string
   109  	BluecatDNSServerName               string
   110  	BluecatDNSDeployType               string
   111  	BluecatSkipTLSVerify               bool
   112  	CloudflareProxied                  bool
   113  	CloudflareDNSRecordsPerPage        int
   114  	CoreDNSPrefix                      string
   115  	RcodezeroTXTEncrypt                bool
   116  	AkamaiServiceConsumerDomain        string
   117  	AkamaiClientToken                  string
   118  	AkamaiClientSecret                 string
   119  	AkamaiAccessToken                  string
   120  	AkamaiEdgercPath                   string
   121  	AkamaiEdgercSection                string
   122  	InfobloxGridHost                   string
   123  	InfobloxWapiPort                   int
   124  	InfobloxWapiUsername               string
   125  	InfobloxWapiPassword               string `secure:"yes"`
   126  	InfobloxWapiVersion                string
   127  	InfobloxSSLVerify                  bool
   128  	InfobloxView                       string
   129  	InfobloxMaxResults                 int
   130  	InfobloxFQDNRegEx                  string
   131  	InfobloxNameRegEx                  string
   132  	InfobloxCreatePTR                  bool
   133  	InfobloxCacheDuration              int
   134  	DynCustomerName                    string
   135  	DynUsername                        string
   136  	DynPassword                        string `secure:"yes"`
   137  	DynMinTTLSeconds                   int
   138  	OCIConfigFile                      string
   139  	OCICompartmentOCID                 string
   140  	OCIAuthInstancePrincipal           bool
   141  	OCIZoneScope                       string
   142  	OCIZoneCacheDuration               time.Duration
   143  	InMemoryZones                      []string
   144  	OVHEndpoint                        string
   145  	OVHApiRateLimit                    int
   146  	PDNSServer                         string
   147  	PDNSAPIKey                         string `secure:"yes"`
   148  	PDNSSkipTLSVerify                  bool
   149  	TLSCA                              string
   150  	TLSClientCert                      string
   151  	TLSClientCertKey                   string
   152  	Policy                             string
   153  	Registry                           string
   154  	TXTOwnerID                         string
   155  	TXTPrefix                          string
   156  	TXTSuffix                          string
   157  	TXTEncryptEnabled                  bool
   158  	TXTEncryptAESKey                   string `secure:"yes"`
   159  	Interval                           time.Duration
   160  	MinEventSyncInterval               time.Duration
   161  	Once                               bool
   162  	DryRun                             bool
   163  	UpdateEvents                       bool
   164  	LogFormat                          string
   165  	MetricsAddress                     string
   166  	LogLevel                           string
   167  	TXTCacheInterval                   time.Duration
   168  	TXTWildcardReplacement             string
   169  	ExoscaleEndpoint                   string
   170  	ExoscaleAPIKey                     string `secure:"yes"`
   171  	ExoscaleAPISecret                  string `secure:"yes"`
   172  	ExoscaleAPIEnvironment             string
   173  	ExoscaleAPIZone                    string
   174  	CRDSourceAPIVersion                string
   175  	CRDSourceKind                      string
   176  	ServiceTypeFilter                  []string
   177  	CFAPIEndpoint                      string
   178  	CFUsername                         string
   179  	CFPassword                         string
   180  	ResolveServiceLoadBalancerHostname bool
   181  	RFC2136Host                        string
   182  	RFC2136Port                        int
   183  	RFC2136Zone                        []string
   184  	RFC2136Insecure                    bool
   185  	RFC2136GSSTSIG                     bool
   186  	RFC2136KerberosRealm               string
   187  	RFC2136KerberosUsername            string
   188  	RFC2136KerberosPassword            string `secure:"yes"`
   189  	RFC2136TSIGKeyName                 string
   190  	RFC2136TSIGSecret                  string `secure:"yes"`
   191  	RFC2136TSIGSecretAlg               string
   192  	RFC2136TAXFR                       bool
   193  	RFC2136MinTTL                      time.Duration
   194  	RFC2136BatchChangeSize             int
   195  	RFC2136UseTLS                      bool
   196  	RFC2136SkipTLSVerify               bool
   197  	NS1Endpoint                        string
   198  	NS1IgnoreSSL                       bool
   199  	NS1MinTTLSeconds                   int
   200  	TransIPAccountName                 string
   201  	TransIPPrivateKeyFile              string
   202  	DigitalOceanAPIPageSize            int
   203  	ManagedDNSRecordTypes              []string
   204  	ExcludeDNSRecordTypes              []string
   205  	GoDaddyAPIKey                      string `secure:"yes"`
   206  	GoDaddySecretKey                   string `secure:"yes"`
   207  	GoDaddyTTL                         int64
   208  	GoDaddyOTE                         bool
   209  	OCPRouterName                      string
   210  	IBMCloudProxied                    bool
   211  	IBMCloudConfigFile                 string
   212  	TencentCloudConfigFile             string
   213  	TencentCloudZoneType               string
   214  	PiholeServer                       string
   215  	PiholePassword                     string `secure:"yes"`
   216  	PiholeTLSInsecureSkipVerify        bool
   217  	PluralCluster                      string
   218  	PluralProvider                     string
   219  	WebhookProviderURL                 string
   220  	WebhookProviderReadTimeout         time.Duration
   221  	WebhookProviderWriteTimeout        time.Duration
   222  	WebhookServer                      bool
   223  	TraefikDisableLegacy               bool
   224  	TraefikDisableNew                  bool
   225  }
   226  
   227  var defaultConfig = &Config{
   228  	APIServerURL:                "",
   229  	KubeConfig:                  "",
   230  	RequestTimeout:              time.Second * 30,
   231  	DefaultTargets:              []string{},
   232  	GlooNamespaces:              []string{"gloo-system"},
   233  	SkipperRouteGroupVersion:    "zalando.org/v1",
   234  	Sources:                     nil,
   235  	Namespace:                   "",
   236  	AnnotationFilter:            "",
   237  	LabelFilter:                 labels.Everything().String(),
   238  	IngressClassNames:           nil,
   239  	FQDNTemplate:                "",
   240  	CombineFQDNAndAnnotation:    false,
   241  	IgnoreHostnameAnnotation:    false,
   242  	IgnoreIngressTLSSpec:        false,
   243  	IgnoreIngressRulesSpec:      false,
   244  	GatewayNamespace:            "",
   245  	GatewayLabelFilter:          "",
   246  	Compatibility:               "",
   247  	PublishInternal:             false,
   248  	PublishHostIP:               false,
   249  	ConnectorSourceServer:       "localhost:8080",
   250  	Provider:                    "",
   251  	GoogleProject:               "",
   252  	GoogleBatchChangeSize:       1000,
   253  	GoogleBatchChangeInterval:   time.Second,
   254  	GoogleZoneVisibility:        "",
   255  	DomainFilter:                []string{},
   256  	ZoneIDFilter:                []string{},
   257  	ExcludeDomains:              []string{},
   258  	RegexDomainFilter:           regexp.MustCompile(""),
   259  	RegexDomainExclusion:        regexp.MustCompile(""),
   260  	TargetNetFilter:             []string{},
   261  	ExcludeTargetNets:           []string{},
   262  	AlibabaCloudConfigFile:      "/etc/kubernetes/alibaba-cloud.json",
   263  	AWSZoneType:                 "",
   264  	AWSZoneTagFilter:            []string{},
   265  	AWSZoneMatchParent:          false,
   266  	AWSAssumeRole:               "",
   267  	AWSAssumeRoleExternalID:     "",
   268  	AWSBatchChangeSize:          1000,
   269  	AWSBatchChangeSizeBytes:     32000,
   270  	AWSBatchChangeSizeValues:    1000,
   271  	AWSBatchChangeInterval:      time.Second,
   272  	AWSEvaluateTargetHealth:     true,
   273  	AWSAPIRetries:               3,
   274  	AWSPreferCNAME:              false,
   275  	AWSZoneCacheDuration:        0 * time.Second,
   276  	AWSSDServiceCleanup:         false,
   277  	AWSDynamoDBRegion:           "",
   278  	AWSDynamoDBTable:            "external-dns",
   279  	AzureConfigFile:             "/etc/kubernetes/azure.json",
   280  	AzureResourceGroup:          "",
   281  	AzureSubscriptionID:         "",
   282  	BluecatConfigFile:           "/etc/kubernetes/bluecat.json",
   283  	BluecatDNSDeployType:        "no-deploy",
   284  	CloudflareProxied:           false,
   285  	CloudflareDNSRecordsPerPage: 100,
   286  	CoreDNSPrefix:               "/skydns/",
   287  	RcodezeroTXTEncrypt:         false,
   288  	AkamaiServiceConsumerDomain: "",
   289  	AkamaiClientToken:           "",
   290  	AkamaiClientSecret:          "",
   291  	AkamaiAccessToken:           "",
   292  	AkamaiEdgercSection:         "",
   293  	AkamaiEdgercPath:            "",
   294  	InfobloxGridHost:            "",
   295  	InfobloxWapiPort:            443,
   296  	InfobloxWapiUsername:        "admin",
   297  	InfobloxWapiPassword:        "",
   298  	InfobloxWapiVersion:         "2.3.1",
   299  	InfobloxSSLVerify:           true,
   300  	InfobloxView:                "",
   301  	InfobloxMaxResults:          0,
   302  	InfobloxFQDNRegEx:           "",
   303  	InfobloxCreatePTR:           false,
   304  	InfobloxCacheDuration:       0,
   305  	OCIConfigFile:               "/etc/kubernetes/oci.yaml",
   306  	OCIZoneScope:                "GLOBAL",
   307  	OCIZoneCacheDuration:        0 * time.Second,
   308  	InMemoryZones:               []string{},
   309  	OVHEndpoint:                 "ovh-eu",
   310  	OVHApiRateLimit:             20,
   311  	PDNSServer:                  "http://localhost:8081",
   312  	PDNSAPIKey:                  "",
   313  	PDNSSkipTLSVerify:           false,
   314  	TLSCA:                       "",
   315  	TLSClientCert:               "",
   316  	TLSClientCertKey:            "",
   317  	Policy:                      "sync",
   318  	Registry:                    "txt",
   319  	TXTOwnerID:                  "default",
   320  	TXTPrefix:                   "",
   321  	TXTSuffix:                   "",
   322  	TXTCacheInterval:            0,
   323  	TXTWildcardReplacement:      "",
   324  	MinEventSyncInterval:        5 * time.Second,
   325  	TXTEncryptEnabled:           false,
   326  	TXTEncryptAESKey:            "",
   327  	Interval:                    time.Minute,
   328  	Once:                        false,
   329  	DryRun:                      false,
   330  	UpdateEvents:                false,
   331  	LogFormat:                   "text",
   332  	MetricsAddress:              ":7979",
   333  	LogLevel:                    logrus.InfoLevel.String(),
   334  	ExoscaleAPIEnvironment:      "api",
   335  	ExoscaleAPIZone:             "ch-gva-2",
   336  	ExoscaleAPIKey:              "",
   337  	ExoscaleAPISecret:           "",
   338  	CRDSourceAPIVersion:         "externaldns.k8s.io/v1alpha1",
   339  	CRDSourceKind:               "DNSEndpoint",
   340  	ServiceTypeFilter:           []string{},
   341  	CFAPIEndpoint:               "",
   342  	CFUsername:                  "",
   343  	CFPassword:                  "",
   344  	RFC2136Host:                 "",
   345  	RFC2136Port:                 0,
   346  	RFC2136Zone:                 []string{},
   347  	RFC2136Insecure:             false,
   348  	RFC2136GSSTSIG:              false,
   349  	RFC2136KerberosRealm:        "",
   350  	RFC2136KerberosUsername:     "",
   351  	RFC2136KerberosPassword:     "",
   352  	RFC2136TSIGKeyName:          "",
   353  	RFC2136TSIGSecret:           "",
   354  	RFC2136TSIGSecretAlg:        "",
   355  	RFC2136TAXFR:                true,
   356  	RFC2136MinTTL:               0,
   357  	RFC2136BatchChangeSize:      50,
   358  	RFC2136UseTLS:               false,
   359  	RFC2136SkipTLSVerify:        false,
   360  	NS1Endpoint:                 "",
   361  	NS1IgnoreSSL:                false,
   362  	TransIPAccountName:          "",
   363  	TransIPPrivateKeyFile:       "",
   364  	DigitalOceanAPIPageSize:     50,
   365  	ManagedDNSRecordTypes:       []string{endpoint.RecordTypeA, endpoint.RecordTypeAAAA, endpoint.RecordTypeCNAME},
   366  	ExcludeDNSRecordTypes:       []string{},
   367  	GoDaddyAPIKey:               "",
   368  	GoDaddySecretKey:            "",
   369  	GoDaddyTTL:                  600,
   370  	GoDaddyOTE:                  false,
   371  	IBMCloudProxied:             false,
   372  	IBMCloudConfigFile:          "/etc/kubernetes/ibmcloud.json",
   373  	TencentCloudConfigFile:      "/etc/kubernetes/tencent-cloud.json",
   374  	TencentCloudZoneType:        "",
   375  	PiholeServer:                "",
   376  	PiholePassword:              "",
   377  	PiholeTLSInsecureSkipVerify: false,
   378  	PluralCluster:               "",
   379  	PluralProvider:              "",
   380  	WebhookProviderURL:          "http://localhost:8888",
   381  	WebhookProviderReadTimeout:  5 * time.Second,
   382  	WebhookProviderWriteTimeout: 10 * time.Second,
   383  	WebhookServer:               false,
   384  	TraefikDisableLegacy:        false,
   385  	TraefikDisableNew:           false,
   386  }
   387  
   388  // NewConfig returns new Config object
   389  func NewConfig() *Config {
   390  	return &Config{}
   391  }
   392  
   393  func (cfg *Config) String() string {
   394  	// prevent logging of sensitive information
   395  	temp := *cfg
   396  
   397  	t := reflect.TypeOf(temp)
   398  	for i := 0; i < t.NumField(); i++ {
   399  		f := t.Field(i)
   400  		if val, ok := f.Tag.Lookup("secure"); ok && val == "yes" {
   401  			if f.Type.Kind() != reflect.String {
   402  				continue
   403  			}
   404  			v := reflect.ValueOf(&temp).Elem().Field(i)
   405  			if v.String() != "" {
   406  				v.SetString(passwordMask)
   407  			}
   408  		}
   409  	}
   410  
   411  	return fmt.Sprintf("%+v", temp)
   412  }
   413  
   414  // allLogLevelsAsStrings returns all logrus levels as a list of strings
   415  func allLogLevelsAsStrings() []string {
   416  	var levels []string
   417  	for _, level := range logrus.AllLevels {
   418  		levels = append(levels, level.String())
   419  	}
   420  	return levels
   421  }
   422  
   423  // ParseFlags adds and parses flags from command line
   424  func (cfg *Config) ParseFlags(args []string) error {
   425  	app := kingpin.New("external-dns", "ExternalDNS synchronizes exposed Kubernetes Services and Ingresses with DNS providers.\n\nNote that all flags may be replaced with env vars - `--flag` -> `EXTERNAL_DNS_FLAG=1` or `--flag value` -> `EXTERNAL_DNS_FLAG=value`")
   426  	app.Version(Version)
   427  	app.DefaultEnvars()
   428  
   429  	// Flags related to Kubernetes
   430  	app.Flag("server", "The Kubernetes API server to connect to (default: auto-detect)").Default(defaultConfig.APIServerURL).StringVar(&cfg.APIServerURL)
   431  	app.Flag("kubeconfig", "Retrieve target cluster configuration from a Kubernetes configuration file (default: auto-detect)").Default(defaultConfig.KubeConfig).StringVar(&cfg.KubeConfig)
   432  	app.Flag("request-timeout", "Request timeout when calling Kubernetes APIs. 0s means no timeout").Default(defaultConfig.RequestTimeout.String()).DurationVar(&cfg.RequestTimeout)
   433  	app.Flag("resolve-service-load-balancer-hostname", "Resolve the hostname of LoadBalancer-type Service object to IP addresses in order to create DNS A/AAAA records instead of CNAMEs").BoolVar(&cfg.ResolveServiceLoadBalancerHostname)
   434  
   435  	// Flags related to cloud foundry
   436  	app.Flag("cf-api-endpoint", "The fully-qualified domain name of the cloud foundry instance you are targeting").Default(defaultConfig.CFAPIEndpoint).StringVar(&cfg.CFAPIEndpoint)
   437  	app.Flag("cf-username", "The username to log into the cloud foundry API").Default(defaultConfig.CFUsername).StringVar(&cfg.CFUsername)
   438  	app.Flag("cf-password", "The password to log into the cloud foundry API").Default(defaultConfig.CFPassword).StringVar(&cfg.CFPassword)
   439  
   440  	// Flags related to Gloo
   441  	app.Flag("gloo-namespace", "The Gloo Proxy namespace; specify multiple times for multiple namespaces. (default: gloo-system)").Default("gloo-system").StringsVar(&cfg.GlooNamespaces)
   442  
   443  	// Flags related to Skipper RouteGroup
   444  	app.Flag("skipper-routegroup-groupversion", "The resource version for skipper routegroup").Default(source.DefaultRoutegroupVersion).StringVar(&cfg.SkipperRouteGroupVersion)
   445  
   446  	// Flags related to processing source
   447  	app.Flag("source", "The resource types that are queried for endpoints; specify multiple times for multiple sources (required, options: service, ingress, node, pod, fake, connector, gateway-httproute, gateway-grpcroute, gateway-tlsroute, gateway-tcproute, gateway-udproute, istio-gateway, istio-virtualservice, cloudfoundry, contour-httpproxy, gloo-proxy, crd, empty, skipper-routegroup, openshift-route, ambassador-host, kong-tcpingress, f5-virtualserver, traefik-proxy)").Required().PlaceHolder("source").EnumsVar(&cfg.Sources, "service", "ingress", "node", "pod", "gateway-httproute", "gateway-grpcroute", "gateway-tlsroute", "gateway-tcproute", "gateway-udproute", "istio-gateway", "istio-virtualservice", "cloudfoundry", "contour-httpproxy", "gloo-proxy", "fake", "connector", "crd", "empty", "skipper-routegroup", "openshift-route", "ambassador-host", "kong-tcpingress", "f5-virtualserver", "traefik-proxy")
   448  	app.Flag("openshift-router-name", "if source is openshift-route then you can pass the ingress controller name. Based on this name external-dns will select the respective router from the route status and map that routerCanonicalHostname to the route host while creating a CNAME record.").StringVar(&cfg.OCPRouterName)
   449  	app.Flag("namespace", "Limit resources queried for endpoints to a specific namespace (default: all namespaces)").Default(defaultConfig.Namespace).StringVar(&cfg.Namespace)
   450  	app.Flag("annotation-filter", "Filter resources queried for endpoints by annotation, using label selector semantics").Default(defaultConfig.AnnotationFilter).StringVar(&cfg.AnnotationFilter)
   451  	app.Flag("label-filter", "Filter resources queried for endpoints by label selector; currently supported by source types crd, gateway-httproute, gateway-grpcroute, gateway-tlsroute, gateway-tcproute, gateway-udproute, ingress, node, openshift-route, and service").Default(defaultConfig.LabelFilter).StringVar(&cfg.LabelFilter)
   452  	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)
   453  	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)
   454  	app.Flag("combine-fqdn-annotation", "Combine FQDN template and Annotations instead of overwriting").BoolVar(&cfg.CombineFQDNAndAnnotation)
   455  	app.Flag("ignore-hostname-annotation", "Ignore hostname annotation when generating DNS names, valid only when --fqdn-template is set (default: false)").BoolVar(&cfg.IgnoreHostnameAnnotation)
   456  	app.Flag("ignore-ingress-tls-spec", "Ignore the spec.tls section in Ingress resources (default: false)").BoolVar(&cfg.IgnoreIngressTLSSpec)
   457  	app.Flag("gateway-namespace", "Limit Gateways of Route endpoints to a specific namespace (default: all namespaces)").StringVar(&cfg.GatewayNamespace)
   458  	app.Flag("gateway-label-filter", "Filter Gateways of Route endpoints via label selector (default: all gateways)").StringVar(&cfg.GatewayLabelFilter)
   459  	app.Flag("compatibility", "Process annotation semantics from legacy implementations (optional, options: mate, molecule, kops-dns-controller)").Default(defaultConfig.Compatibility).EnumVar(&cfg.Compatibility, "", "mate", "molecule", "kops-dns-controller")
   460  	app.Flag("ignore-ingress-rules-spec", "Ignore the spec.rules section in Ingress resources (default: false)").BoolVar(&cfg.IgnoreIngressRulesSpec)
   461  	app.Flag("publish-internal-services", "Allow external-dns to publish DNS records for ClusterIP services (optional)").BoolVar(&cfg.PublishInternal)
   462  	app.Flag("publish-host-ip", "Allow external-dns to publish host-ip for headless services (optional)").BoolVar(&cfg.PublishHostIP)
   463  	app.Flag("always-publish-not-ready-addresses", "Always publish also not ready addresses for headless services (optional)").BoolVar(&cfg.AlwaysPublishNotReadyAddresses)
   464  	app.Flag("connector-source-server", "The server to connect for connector source, valid only when using connector source").Default(defaultConfig.ConnectorSourceServer).StringVar(&cfg.ConnectorSourceServer)
   465  	app.Flag("crd-source-apiversion", "API version of the CRD for crd source, e.g. `externaldns.k8s.io/v1alpha1`, valid only when using crd source").Default(defaultConfig.CRDSourceAPIVersion).StringVar(&cfg.CRDSourceAPIVersion)
   466  	app.Flag("crd-source-kind", "Kind of the CRD for the crd source in API group and version specified by crd-source-apiversion").Default(defaultConfig.CRDSourceKind).StringVar(&cfg.CRDSourceKind)
   467  	app.Flag("service-type-filter", "The service types to take care about (default: all, expected: ClusterIP, NodePort, LoadBalancer or ExternalName)").StringsVar(&cfg.ServiceTypeFilter)
   468  	app.Flag("managed-record-types", "Record types to manage; specify multiple times to include many; (default: A, AAAA, CNAME) (supported records: A, AAAA, CNAME, NS, SRV, TXT)").Default("A", "AAAA", "CNAME").StringsVar(&cfg.ManagedDNSRecordTypes)
   469  	app.Flag("exclude-record-types", "Record types to exclude from management; specify multiple times to exclude many; (optional)").Default().StringsVar(&cfg.ExcludeDNSRecordTypes)
   470  	app.Flag("default-targets", "Set globally default host/IP that will apply as a target instead of source addresses. Specify multiple times for multiple targets (optional)").StringsVar(&cfg.DefaultTargets)
   471  	app.Flag("target-net-filter", "Limit possible targets by a net filter; specify multiple times for multiple possible nets (optional)").StringsVar(&cfg.TargetNetFilter)
   472  	app.Flag("exclude-target-net", "Exclude target nets (optional)").StringsVar(&cfg.ExcludeTargetNets)
   473  	app.Flag("traefik-disable-legacy", "Disable listeners on Resources under the traefik.containo.us API Group").Default(strconv.FormatBool(defaultConfig.TraefikDisableLegacy)).BoolVar(&cfg.TraefikDisableLegacy)
   474  	app.Flag("traefik-disable-new", "Disable listeners on Resources under the traefik.io API Group").Default(strconv.FormatBool(defaultConfig.TraefikDisableNew)).BoolVar(&cfg.TraefikDisableNew)
   475  
   476  	// Flags related to providers
   477  	providers := []string{"akamai", "alibabacloud", "aws", "aws-sd", "azure", "azure-dns", "azure-private-dns", "bluecat", "civo", "cloudflare", "coredns", "designate", "digitalocean", "dnsimple", "dyn", "exoscale", "gandi", "godaddy", "google", "ibmcloud", "infoblox", "inmemory", "linode", "ns1", "oci", "ovh", "pdns", "pihole", "plural", "rcodezero", "rdns", "rfc2136", "safedns", "scaleway", "skydns", "tencentcloud", "transip", "ultradns", "vinyldns", "vultr", "webhook"}
   478  	app.Flag("provider", "The DNS provider where the DNS records will be created (required, options: "+strings.Join(providers, ", ")+")").Required().PlaceHolder("provider").EnumVar(&cfg.Provider, providers...)
   479  	app.Flag("domain-filter", "Limit possible target zones by a domain suffix; specify multiple times for multiple domains (optional)").Default("").StringsVar(&cfg.DomainFilter)
   480  	app.Flag("exclude-domains", "Exclude subdomains (optional)").Default("").StringsVar(&cfg.ExcludeDomains)
   481  	app.Flag("regex-domain-filter", "Limit possible domains and target zones by a Regex filter; Overrides domain-filter (optional)").Default(defaultConfig.RegexDomainFilter.String()).RegexpVar(&cfg.RegexDomainFilter)
   482  	app.Flag("regex-domain-exclusion", "Regex filter that excludes domains and target zones matched by regex-domain-filter (optional)").Default(defaultConfig.RegexDomainExclusion.String()).RegexpVar(&cfg.RegexDomainExclusion)
   483  	app.Flag("zone-name-filter", "Filter target zones by zone domain (For now, only AzureDNS provider is using this flag); specify multiple times for multiple zones (optional)").Default("").StringsVar(&cfg.ZoneNameFilter)
   484  	app.Flag("zone-id-filter", "Filter target zones by hosted zone id; specify multiple times for multiple zones (optional)").Default("").StringsVar(&cfg.ZoneIDFilter)
   485  	app.Flag("google-project", "When using the Google provider, current project is auto-detected, when running on GCP. Specify other project with this. Must be specified when running outside GCP.").Default(defaultConfig.GoogleProject).StringVar(&cfg.GoogleProject)
   486  	app.Flag("google-batch-change-size", "When using the Google provider, set the maximum number of changes that will be applied in each batch.").Default(strconv.Itoa(defaultConfig.GoogleBatchChangeSize)).IntVar(&cfg.GoogleBatchChangeSize)
   487  	app.Flag("google-batch-change-interval", "When using the Google provider, set the interval between batch changes.").Default(defaultConfig.GoogleBatchChangeInterval.String()).DurationVar(&cfg.GoogleBatchChangeInterval)
   488  	app.Flag("google-zone-visibility", "When using the Google provider, filter for zones with this visibility (optional, options: public, private)").Default(defaultConfig.GoogleZoneVisibility).EnumVar(&cfg.GoogleZoneVisibility, "", "public", "private")
   489  	app.Flag("alibaba-cloud-config-file", "When using the Alibaba Cloud provider, specify the Alibaba Cloud configuration file (required when --provider=alibabacloud)").Default(defaultConfig.AlibabaCloudConfigFile).StringVar(&cfg.AlibabaCloudConfigFile)
   490  	app.Flag("alibaba-cloud-zone-type", "When using the Alibaba Cloud provider, filter for zones of this type (optional, options: public, private)").Default(defaultConfig.AlibabaCloudZoneType).EnumVar(&cfg.AlibabaCloudZoneType, "", "public", "private")
   491  	app.Flag("aws-zone-type", "When using the AWS provider, filter for zones of this type (optional, options: public, private)").Default(defaultConfig.AWSZoneType).EnumVar(&cfg.AWSZoneType, "", "public", "private")
   492  	app.Flag("aws-zone-tags", "When using the AWS provider, filter for zones with these tags").Default("").StringsVar(&cfg.AWSZoneTagFilter)
   493  	app.Flag("aws-assume-role", "When using the AWS API, assume this IAM role. Useful for hosted zones in another AWS account. Specify the full ARN, e.g. `arn:aws:iam::123455567:role/external-dns` (optional)").Default(defaultConfig.AWSAssumeRole).StringVar(&cfg.AWSAssumeRole)
   494  	app.Flag("aws-assume-role-external-id", "When using the AWS API and assuming a role then specify this external ID` (optional)").Default(defaultConfig.AWSAssumeRoleExternalID).StringVar(&cfg.AWSAssumeRoleExternalID)
   495  	app.Flag("aws-batch-change-size", "When using the AWS provider, set the maximum number of changes that will be applied in each batch.").Default(strconv.Itoa(defaultConfig.AWSBatchChangeSize)).IntVar(&cfg.AWSBatchChangeSize)
   496  	app.Flag("aws-batch-change-size-bytes", "When using the AWS provider, set the maximum byte size that will be applied in each batch.").Default(strconv.Itoa(defaultConfig.AWSBatchChangeSizeBytes)).IntVar(&cfg.AWSBatchChangeSizeBytes)
   497  	app.Flag("aws-batch-change-size-values", "When using the AWS provider, set the maximum total record values that will be applied in each batch.").Default(strconv.Itoa(defaultConfig.AWSBatchChangeSizeValues)).IntVar(&cfg.AWSBatchChangeSizeValues)
   498  	app.Flag("aws-batch-change-interval", "When using the AWS provider, set the interval between batch changes.").Default(defaultConfig.AWSBatchChangeInterval.String()).DurationVar(&cfg.AWSBatchChangeInterval)
   499  	app.Flag("aws-evaluate-target-health", "When using the AWS provider, set whether to evaluate the health of a DNS target (default: enabled, disable with --no-aws-evaluate-target-health)").Default(strconv.FormatBool(defaultConfig.AWSEvaluateTargetHealth)).BoolVar(&cfg.AWSEvaluateTargetHealth)
   500  	app.Flag("aws-api-retries", "When using the AWS API, set the maximum number of retries before giving up.").Default(strconv.Itoa(defaultConfig.AWSAPIRetries)).IntVar(&cfg.AWSAPIRetries)
   501  	app.Flag("aws-prefer-cname", "When using the AWS provider, prefer using CNAME instead of ALIAS (default: disabled)").BoolVar(&cfg.AWSPreferCNAME)
   502  	app.Flag("aws-zones-cache-duration", "When using the AWS provider, set the zones list cache TTL (0s to disable).").Default(defaultConfig.AWSZoneCacheDuration.String()).DurationVar(&cfg.AWSZoneCacheDuration)
   503  	app.Flag("aws-zone-match-parent", "Expand limit possible target by sub-domains (default: disabled)").BoolVar(&cfg.AWSZoneMatchParent)
   504  	app.Flag("aws-sd-service-cleanup", "When using the AWS CloudMap provider, delete empty Services without endpoints (default: disabled)").BoolVar(&cfg.AWSSDServiceCleanup)
   505  	app.Flag("azure-config-file", "When using the Azure provider, specify the Azure configuration file (required when --provider=azure)").Default(defaultConfig.AzureConfigFile).StringVar(&cfg.AzureConfigFile)
   506  	app.Flag("azure-resource-group", "When using the Azure provider, override the Azure resource group to use (optional)").Default(defaultConfig.AzureResourceGroup).StringVar(&cfg.AzureResourceGroup)
   507  	app.Flag("azure-subscription-id", "When using the Azure provider, override the Azure subscription to use (optional)").Default(defaultConfig.AzureSubscriptionID).StringVar(&cfg.AzureSubscriptionID)
   508  	app.Flag("azure-user-assigned-identity-client-id", "When using the Azure provider, override the client id of user assigned identity in config file (optional)").Default("").StringVar(&cfg.AzureUserAssignedIdentityClientID)
   509  	app.Flag("tencent-cloud-config-file", "When using the Tencent Cloud provider, specify the Tencent Cloud configuration file (required when --provider=tencentcloud)").Default(defaultConfig.TencentCloudConfigFile).StringVar(&cfg.TencentCloudConfigFile)
   510  	app.Flag("tencent-cloud-zone-type", "When using the Tencent Cloud provider, filter for zones with visibility (optional, options: public, private)").Default(defaultConfig.TencentCloudZoneType).EnumVar(&cfg.TencentCloudZoneType, "", "public", "private")
   511  
   512  	// Flags related to BlueCat provider
   513  	app.Flag("bluecat-dns-configuration", "When using the Bluecat provider, specify the Bluecat DNS configuration string (optional when --provider=bluecat)").Default("").StringVar(&cfg.BluecatDNSConfiguration)
   514  	app.Flag("bluecat-config-file", "When using the Bluecat provider, specify the Bluecat configuration file (optional when --provider=bluecat)").Default(defaultConfig.BluecatConfigFile).StringVar(&cfg.BluecatConfigFile)
   515  	app.Flag("bluecat-dns-view", "When using the Bluecat provider, specify the Bluecat DNS view string (optional when --provider=bluecat)").Default("").StringVar(&cfg.BluecatDNSView)
   516  	app.Flag("bluecat-gateway-host", "When using the Bluecat provider, specify the Bluecat Gateway Host (optional when --provider=bluecat)").Default("").StringVar(&cfg.BluecatGatewayHost)
   517  	app.Flag("bluecat-root-zone", "When using the Bluecat provider, specify the Bluecat root zone (optional when --provider=bluecat)").Default("").StringVar(&cfg.BluecatRootZone)
   518  	app.Flag("bluecat-skip-tls-verify", "When using the Bluecat provider, specify to skip TLS verification (optional when --provider=bluecat) (default: false)").BoolVar(&cfg.BluecatSkipTLSVerify)
   519  	app.Flag("bluecat-dns-server-name", "When using the Bluecat provider, specify the Bluecat DNS Server to initiate deploys against. This is only used if --bluecat-dns-deploy-type is not 'no-deploy' (optional when --provider=bluecat)").Default("").StringVar(&cfg.BluecatDNSServerName)
   520  	app.Flag("bluecat-dns-deploy-type", "When using the Bluecat provider, specify the type of DNS deployment to initiate after records are updated. Valid options are 'full-deploy' and 'no-deploy'. Deploy will only execute if --bluecat-dns-server-name is set (optional when --provider=bluecat)").Default(defaultConfig.BluecatDNSDeployType).StringVar(&cfg.BluecatDNSDeployType)
   521  
   522  	app.Flag("cloudflare-proxied", "When using the Cloudflare provider, specify if the proxy mode must be enabled (default: disabled)").BoolVar(&cfg.CloudflareProxied)
   523  	app.Flag("cloudflare-dns-records-per-page", "When using the Cloudflare provider, specify how many DNS records listed per page, max possible 5,000 (default: 100)").Default(strconv.Itoa(defaultConfig.CloudflareDNSRecordsPerPage)).IntVar(&cfg.CloudflareDNSRecordsPerPage)
   524  	app.Flag("coredns-prefix", "When using the CoreDNS provider, specify the prefix name").Default(defaultConfig.CoreDNSPrefix).StringVar(&cfg.CoreDNSPrefix)
   525  	app.Flag("akamai-serviceconsumerdomain", "When using the Akamai provider, specify the base URL (required when --provider=akamai and edgerc-path not specified)").Default(defaultConfig.AkamaiServiceConsumerDomain).StringVar(&cfg.AkamaiServiceConsumerDomain)
   526  	app.Flag("akamai-client-token", "When using the Akamai provider, specify the client token (required when --provider=akamai and edgerc-path not specified)").Default(defaultConfig.AkamaiClientToken).StringVar(&cfg.AkamaiClientToken)
   527  	app.Flag("akamai-client-secret", "When using the Akamai provider, specify the client secret (required when --provider=akamai and edgerc-path not specified)").Default(defaultConfig.AkamaiClientSecret).StringVar(&cfg.AkamaiClientSecret)
   528  	app.Flag("akamai-access-token", "When using the Akamai provider, specify the access token (required when --provider=akamai and edgerc-path not specified)").Default(defaultConfig.AkamaiAccessToken).StringVar(&cfg.AkamaiAccessToken)
   529  	app.Flag("akamai-edgerc-path", "When using the Akamai provider, specify the .edgerc file path. Path must be reachable form invocation environment. (required when --provider=akamai and *-token, secret serviceconsumerdomain not specified)").Default(defaultConfig.AkamaiEdgercPath).StringVar(&cfg.AkamaiEdgercPath)
   530  	app.Flag("akamai-edgerc-section", "When using the Akamai provider, specify the .edgerc file path (Optional when edgerc-path is specified)").Default(defaultConfig.AkamaiEdgercSection).StringVar(&cfg.AkamaiEdgercSection)
   531  	app.Flag("infoblox-grid-host", "When using the Infoblox provider, specify the Grid Manager host (required when --provider=infoblox)").Default(defaultConfig.InfobloxGridHost).StringVar(&cfg.InfobloxGridHost)
   532  	app.Flag("infoblox-wapi-port", "When using the Infoblox provider, specify the WAPI port (default: 443)").Default(strconv.Itoa(defaultConfig.InfobloxWapiPort)).IntVar(&cfg.InfobloxWapiPort)
   533  	app.Flag("infoblox-wapi-username", "When using the Infoblox provider, specify the WAPI username (default: admin)").Default(defaultConfig.InfobloxWapiUsername).StringVar(&cfg.InfobloxWapiUsername)
   534  	app.Flag("infoblox-wapi-password", "When using the Infoblox provider, specify the WAPI password (required when --provider=infoblox)").Default(defaultConfig.InfobloxWapiPassword).StringVar(&cfg.InfobloxWapiPassword)
   535  	app.Flag("infoblox-wapi-version", "When using the Infoblox provider, specify the WAPI version (default: 2.3.1)").Default(defaultConfig.InfobloxWapiVersion).StringVar(&cfg.InfobloxWapiVersion)
   536  	app.Flag("infoblox-ssl-verify", "When using the Infoblox provider, specify whether to verify the SSL certificate (default: true, disable with --no-infoblox-ssl-verify)").Default(strconv.FormatBool(defaultConfig.InfobloxSSLVerify)).BoolVar(&cfg.InfobloxSSLVerify)
   537  	app.Flag("infoblox-view", "DNS view (default: \"\")").Default(defaultConfig.InfobloxView).StringVar(&cfg.InfobloxView)
   538  	app.Flag("infoblox-max-results", "Add _max_results as query parameter to the URL on all API requests. The default is 0 which means _max_results is not set and the default of the server is used.").Default(strconv.Itoa(defaultConfig.InfobloxMaxResults)).IntVar(&cfg.InfobloxMaxResults)
   539  	app.Flag("infoblox-fqdn-regex", "Apply this regular expression as a filter for obtaining zone_auth objects. This is disabled by default.").Default(defaultConfig.InfobloxFQDNRegEx).StringVar(&cfg.InfobloxFQDNRegEx)
   540  	app.Flag("infoblox-name-regex", "Apply this regular expression as a filter on the name field for obtaining infoblox records. This is disabled by default.").Default(defaultConfig.InfobloxNameRegEx).StringVar(&cfg.InfobloxNameRegEx)
   541  	app.Flag("infoblox-create-ptr", "When using the Infoblox provider, create a ptr entry in addition to an entry").Default(strconv.FormatBool(defaultConfig.InfobloxCreatePTR)).BoolVar(&cfg.InfobloxCreatePTR)
   542  	app.Flag("infoblox-cache-duration", "When using the Infoblox provider, set the record TTL (0s to disable).").Default(strconv.Itoa(defaultConfig.InfobloxCacheDuration)).IntVar(&cfg.InfobloxCacheDuration)
   543  	app.Flag("dyn-customer-name", "When using the Dyn provider, specify the Customer Name").Default("").StringVar(&cfg.DynCustomerName)
   544  	app.Flag("dyn-username", "When using the Dyn provider, specify the Username").Default("").StringVar(&cfg.DynUsername)
   545  	app.Flag("dyn-password", "When using the Dyn provider, specify the password").Default("").StringVar(&cfg.DynPassword)
   546  	app.Flag("dyn-min-ttl", "Minimal TTL (in seconds) for records. This value will be used if the provided TTL for a service/ingress is lower than this.").IntVar(&cfg.DynMinTTLSeconds)
   547  	app.Flag("oci-config-file", "When using the OCI provider, specify the OCI configuration file (required when --provider=oci").Default(defaultConfig.OCIConfigFile).StringVar(&cfg.OCIConfigFile)
   548  	app.Flag("oci-compartment-ocid", "When using the OCI provider, specify the OCID of the OCI compartment containing all managed zones and records.  Required when using OCI IAM instance principal authentication.").StringVar(&cfg.OCICompartmentOCID)
   549  	app.Flag("oci-zone-scope", "When using OCI provider, filter for zones with this scope (optional, options: GLOBAL, PRIVATE). Defaults to GLOBAL, setting to empty value will target both.").Default(defaultConfig.OCIZoneScope).EnumVar(&cfg.OCIZoneScope, "", "GLOBAL", "PRIVATE")
   550  	app.Flag("oci-auth-instance-principal", "When using the OCI provider, specify whether OCI IAM instance principal authentication should be used (instead of key-based auth via the OCI config file).").Default(strconv.FormatBool(defaultConfig.OCIAuthInstancePrincipal)).BoolVar(&cfg.OCIAuthInstancePrincipal)
   551  	app.Flag("oci-zones-cache-duration", "When using the OCI provider, set the zones list cache TTL (0s to disable).").Default(defaultConfig.OCIZoneCacheDuration.String()).DurationVar(&cfg.OCIZoneCacheDuration)
   552  	app.Flag("rcodezero-txt-encrypt", "When using the Rcodezero provider with txt registry option, set if TXT rrs are encrypted (default: false)").Default(strconv.FormatBool(defaultConfig.RcodezeroTXTEncrypt)).BoolVar(&cfg.RcodezeroTXTEncrypt)
   553  	app.Flag("inmemory-zone", "Provide a list of pre-configured zones for the inmemory provider; specify multiple times for multiple zones (optional)").Default("").StringsVar(&cfg.InMemoryZones)
   554  	app.Flag("ovh-endpoint", "When using the OVH provider, specify the endpoint (default: ovh-eu)").Default(defaultConfig.OVHEndpoint).StringVar(&cfg.OVHEndpoint)
   555  	app.Flag("ovh-api-rate-limit", "When using the OVH provider, specify the API request rate limit, X operations by seconds (default: 20)").Default(strconv.Itoa(defaultConfig.OVHApiRateLimit)).IntVar(&cfg.OVHApiRateLimit)
   556  	app.Flag("pdns-server", "When using the PowerDNS/PDNS provider, specify the URL to the pdns server (required when --provider=pdns)").Default(defaultConfig.PDNSServer).StringVar(&cfg.PDNSServer)
   557  	app.Flag("pdns-api-key", "When using the PowerDNS/PDNS provider, specify the API key to use to authorize requests (required when --provider=pdns)").Default(defaultConfig.PDNSAPIKey).StringVar(&cfg.PDNSAPIKey)
   558  	app.Flag("pdns-skip-tls-verify", "When using the PowerDNS/PDNS provider, disable verification of any TLS certificates (optional when --provider=pdns) (default: false)").Default(strconv.FormatBool(defaultConfig.PDNSSkipTLSVerify)).BoolVar(&cfg.PDNSSkipTLSVerify)
   559  	app.Flag("ns1-endpoint", "When using the NS1 provider, specify the URL of the API endpoint to target (default: https://api.nsone.net/v1/)").Default(defaultConfig.NS1Endpoint).StringVar(&cfg.NS1Endpoint)
   560  	app.Flag("ns1-ignoressl", "When using the NS1 provider, specify whether to verify the SSL certificate (default: false)").Default(strconv.FormatBool(defaultConfig.NS1IgnoreSSL)).BoolVar(&cfg.NS1IgnoreSSL)
   561  	app.Flag("ns1-min-ttl", "Minimal TTL (in seconds) for records. This value will be used if the provided TTL for a service/ingress is lower than this.").IntVar(&cfg.NS1MinTTLSeconds)
   562  	app.Flag("digitalocean-api-page-size", "Configure the page size used when querying the DigitalOcean API.").Default(strconv.Itoa(defaultConfig.DigitalOceanAPIPageSize)).IntVar(&cfg.DigitalOceanAPIPageSize)
   563  	app.Flag("ibmcloud-config-file", "When using the IBM Cloud provider, specify the IBM Cloud configuration file (required when --provider=ibmcloud").Default(defaultConfig.IBMCloudConfigFile).StringVar(&cfg.IBMCloudConfigFile)
   564  	app.Flag("ibmcloud-proxied", "When using the IBM provider, specify if the proxy mode must be enabled (default: disabled)").BoolVar(&cfg.IBMCloudProxied)
   565  	// GoDaddy flags
   566  	app.Flag("godaddy-api-key", "When using the GoDaddy provider, specify the API Key (required when --provider=godaddy)").Default(defaultConfig.GoDaddyAPIKey).StringVar(&cfg.GoDaddyAPIKey)
   567  	app.Flag("godaddy-api-secret", "When using the GoDaddy provider, specify the API secret (required when --provider=godaddy)").Default(defaultConfig.GoDaddySecretKey).StringVar(&cfg.GoDaddySecretKey)
   568  	app.Flag("godaddy-api-ttl", "TTL (in seconds) for records. This value will be used if the provided TTL for a service/ingress is not provided.").Int64Var(&cfg.GoDaddyTTL)
   569  	app.Flag("godaddy-api-ote", "When using the GoDaddy provider, use OTE api (optional, default: false, when --provider=godaddy)").BoolVar(&cfg.GoDaddyOTE)
   570  
   571  	// Flags related to TLS communication
   572  	app.Flag("tls-ca", "When using TLS communication, the path to the certificate authority to verify server communications (optionally specify --tls-client-cert for two-way TLS)").Default(defaultConfig.TLSCA).StringVar(&cfg.TLSCA)
   573  	app.Flag("tls-client-cert", "When using TLS communication, the path to the certificate to present as a client (not required for TLS)").Default(defaultConfig.TLSClientCert).StringVar(&cfg.TLSClientCert)
   574  	app.Flag("tls-client-cert-key", "When using TLS communication, the path to the certificate key to use with the client certificate (not required for TLS)").Default(defaultConfig.TLSClientCertKey).StringVar(&cfg.TLSClientCertKey)
   575  
   576  	// Flags related to Exoscale provider
   577  	app.Flag("exoscale-apienv", "When using Exoscale provider, specify the API environment (optional)").Default(defaultConfig.ExoscaleAPIEnvironment).StringVar(&cfg.ExoscaleAPIEnvironment)
   578  	app.Flag("exoscale-apizone", "When using Exoscale provider, specify the API Zone (optional)").Default(defaultConfig.ExoscaleAPIZone).StringVar(&cfg.ExoscaleAPIZone)
   579  	app.Flag("exoscale-apikey", "Provide your API Key for the Exoscale provider").Default(defaultConfig.ExoscaleAPIKey).StringVar(&cfg.ExoscaleAPIKey)
   580  	app.Flag("exoscale-apisecret", "Provide your API Secret for the Exoscale provider").Default(defaultConfig.ExoscaleAPISecret).StringVar(&cfg.ExoscaleAPISecret)
   581  
   582  	// Flags related to RFC2136 provider
   583  	app.Flag("rfc2136-host", "When using the RFC2136 provider, specify the host of the DNS server").Default(defaultConfig.RFC2136Host).StringVar(&cfg.RFC2136Host)
   584  	app.Flag("rfc2136-port", "When using the RFC2136 provider, specify the port of the DNS server").Default(strconv.Itoa(defaultConfig.RFC2136Port)).IntVar(&cfg.RFC2136Port)
   585  	app.Flag("rfc2136-zone", "When using the RFC2136 provider, specify zone entries of the DNS server to use").StringsVar(&cfg.RFC2136Zone)
   586  	app.Flag("rfc2136-insecure", "When using the RFC2136 provider, specify whether to attach TSIG or not (default: false, requires --rfc2136-tsig-keyname and rfc2136-tsig-secret)").Default(strconv.FormatBool(defaultConfig.RFC2136Insecure)).BoolVar(&cfg.RFC2136Insecure)
   587  	app.Flag("rfc2136-tsig-keyname", "When using the RFC2136 provider, specify the TSIG key to attached to DNS messages (required when --rfc2136-insecure=false)").Default(defaultConfig.RFC2136TSIGKeyName).StringVar(&cfg.RFC2136TSIGKeyName)
   588  	app.Flag("rfc2136-tsig-secret", "When using the RFC2136 provider, specify the TSIG (base64) value to attached to DNS messages (required when --rfc2136-insecure=false)").Default(defaultConfig.RFC2136TSIGSecret).StringVar(&cfg.RFC2136TSIGSecret)
   589  	app.Flag("rfc2136-tsig-secret-alg", "When using the RFC2136 provider, specify the TSIG (base64) value to attached to DNS messages (required when --rfc2136-insecure=false)").Default(defaultConfig.RFC2136TSIGSecretAlg).StringVar(&cfg.RFC2136TSIGSecretAlg)
   590  	app.Flag("rfc2136-tsig-axfr", "When using the RFC2136 provider, specify the TSIG (base64) value to attached to DNS messages (required when --rfc2136-insecure=false)").BoolVar(&cfg.RFC2136TAXFR)
   591  	app.Flag("rfc2136-min-ttl", "When using the RFC2136 provider, specify minimal TTL (in duration format) for records. This value will be used if the provided TTL for a service/ingress is lower than this").Default(defaultConfig.RFC2136MinTTL.String()).DurationVar(&cfg.RFC2136MinTTL)
   592  	app.Flag("rfc2136-gss-tsig", "When using the RFC2136 provider, specify whether to use secure updates with GSS-TSIG using Kerberos (default: false, requires --rfc2136-kerberos-realm, --rfc2136-kerberos-username, and rfc2136-kerberos-password)").Default(strconv.FormatBool(defaultConfig.RFC2136GSSTSIG)).BoolVar(&cfg.RFC2136GSSTSIG)
   593  	app.Flag("rfc2136-kerberos-username", "When using the RFC2136 provider with GSS-TSIG, specify the username of the user with permissions to update DNS records (required when --rfc2136-gss-tsig=true)").Default(defaultConfig.RFC2136KerberosUsername).StringVar(&cfg.RFC2136KerberosUsername)
   594  	app.Flag("rfc2136-kerberos-password", "When using the RFC2136 provider with GSS-TSIG, specify the password of the user with permissions to update DNS records (required when --rfc2136-gss-tsig=true)").Default(defaultConfig.RFC2136KerberosPassword).StringVar(&cfg.RFC2136KerberosPassword)
   595  	app.Flag("rfc2136-kerberos-realm", "When using the RFC2136 provider with GSS-TSIG, specify the realm of the user with permissions to update DNS records (required when --rfc2136-gss-tsig=true)").Default(defaultConfig.RFC2136KerberosRealm).StringVar(&cfg.RFC2136KerberosRealm)
   596  	app.Flag("rfc2136-batch-change-size", "When using the RFC2136 provider, set the maximum number of changes that will be applied in each batch.").Default(strconv.Itoa(defaultConfig.RFC2136BatchChangeSize)).IntVar(&cfg.RFC2136BatchChangeSize)
   597  	app.Flag("rfc2136-use-tls", "When using the RFC2136 provider, communicate with name server over tls").BoolVar(&cfg.RFC2136UseTLS)
   598  	app.Flag("rfc2136-skip-tls-verify", "When using TLS with the RFC2136 provider, disable verification of any TLS certificates").BoolVar(&cfg.RFC2136SkipTLSVerify)
   599  
   600  	// Flags related to TransIP provider
   601  	app.Flag("transip-account", "When using the TransIP provider, specify the account name (required when --provider=transip)").Default(defaultConfig.TransIPAccountName).StringVar(&cfg.TransIPAccountName)
   602  	app.Flag("transip-keyfile", "When using the TransIP provider, specify the path to the private key file (required when --provider=transip)").Default(defaultConfig.TransIPPrivateKeyFile).StringVar(&cfg.TransIPPrivateKeyFile)
   603  
   604  	// Flags related to Pihole provider
   605  	app.Flag("pihole-server", "When using the Pihole provider, the base URL of the Pihole web server (required when --provider=pihole)").Default(defaultConfig.PiholeServer).StringVar(&cfg.PiholeServer)
   606  	app.Flag("pihole-password", "When using the Pihole provider, the password to the server if it is protected").Default(defaultConfig.PiholePassword).StringVar(&cfg.PiholePassword)
   607  	app.Flag("pihole-tls-skip-verify", "When using the Pihole provider, disable verification of any TLS certificates").BoolVar(&cfg.PiholeTLSInsecureSkipVerify)
   608  
   609  	// Flags related to the Plural provider
   610  	app.Flag("plural-cluster", "When using the plural provider, specify the cluster name you're running with").Default(defaultConfig.PluralCluster).StringVar(&cfg.PluralCluster)
   611  	app.Flag("plural-provider", "When using the plural provider, specify the provider name you're running with").Default(defaultConfig.PluralProvider).StringVar(&cfg.PluralProvider)
   612  
   613  	// Flags related to policies
   614  	app.Flag("policy", "Modify how DNS records are synchronized between sources and providers (default: sync, options: sync, upsert-only, create-only)").Default(defaultConfig.Policy).EnumVar(&cfg.Policy, "sync", "upsert-only", "create-only")
   615  
   616  	// Flags related to the registry
   617  	app.Flag("registry", "The registry implementation to use to keep track of DNS record ownership (default: txt, options: txt, noop, dynamodb, aws-sd)").Default(defaultConfig.Registry).EnumVar(&cfg.Registry, "txt", "noop", "dynamodb", "aws-sd")
   618  	app.Flag("txt-owner-id", "When using the TXT or DynamoDB registry, a name that identifies this instance of ExternalDNS (default: default)").Default(defaultConfig.TXTOwnerID).StringVar(&cfg.TXTOwnerID)
   619  	app.Flag("txt-prefix", "When using the TXT registry, a custom string that's prefixed to each ownership DNS record (optional). Could contain record type template like '%{record_type}-prefix-'. Mutual exclusive with txt-suffix!").Default(defaultConfig.TXTPrefix).StringVar(&cfg.TXTPrefix)
   620  	app.Flag("txt-suffix", "When using the TXT registry, a custom string that's suffixed to the host portion of each ownership DNS record (optional). Could contain record type template like '-%{record_type}-suffix'. Mutual exclusive with txt-prefix!").Default(defaultConfig.TXTSuffix).StringVar(&cfg.TXTSuffix)
   621  	app.Flag("txt-wildcard-replacement", "When using the TXT registry, a custom string that's used instead of an asterisk for TXT records corresponding to wildcard DNS records (optional)").Default(defaultConfig.TXTWildcardReplacement).StringVar(&cfg.TXTWildcardReplacement)
   622  	app.Flag("txt-encrypt-enabled", "When using the TXT registry, set if TXT records should be encrypted before stored (default: disabled)").BoolVar(&cfg.TXTEncryptEnabled)
   623  	app.Flag("txt-encrypt-aes-key", "When using the TXT registry, set TXT record decryption and encryption 32 byte aes key (required when --txt-encrypt=true)").Default(defaultConfig.TXTEncryptAESKey).StringVar(&cfg.TXTEncryptAESKey)
   624  	app.Flag("dynamodb-region", "When using the DynamoDB registry, the AWS region of the DynamoDB table (optional)").Default(cfg.AWSDynamoDBRegion).StringVar(&cfg.AWSDynamoDBRegion)
   625  	app.Flag("dynamodb-table", "When using the DynamoDB registry, the name of the DynamoDB table (default: \"external-dns\")").Default(defaultConfig.AWSDynamoDBTable).StringVar(&cfg.AWSDynamoDBTable)
   626  
   627  	// Flags related to the main control loop
   628  	app.Flag("txt-cache-interval", "The interval between cache synchronizations in duration format (default: disabled)").Default(defaultConfig.TXTCacheInterval.String()).DurationVar(&cfg.TXTCacheInterval)
   629  	app.Flag("interval", "The interval between two consecutive synchronizations in duration format (default: 1m)").Default(defaultConfig.Interval.String()).DurationVar(&cfg.Interval)
   630  	app.Flag("min-event-sync-interval", "The minimum interval between two consecutive synchronizations triggered from kubernetes events in duration format (default: 5s)").Default(defaultConfig.MinEventSyncInterval.String()).DurationVar(&cfg.MinEventSyncInterval)
   631  	app.Flag("once", "When enabled, exits the synchronization loop after the first iteration (default: disabled)").BoolVar(&cfg.Once)
   632  	app.Flag("dry-run", "When enabled, prints DNS record changes rather than actually performing them (default: disabled)").BoolVar(&cfg.DryRun)
   633  	app.Flag("events", "When enabled, in addition to running every interval, the reconciliation loop will get triggered when supported sources change (default: disabled)").BoolVar(&cfg.UpdateEvents)
   634  
   635  	// Miscellaneous flags
   636  	app.Flag("log-format", "The format in which log messages are printed (default: text, options: text, json)").Default(defaultConfig.LogFormat).EnumVar(&cfg.LogFormat, "text", "json")
   637  	app.Flag("metrics-address", "Specify where to serve the metrics and health check endpoint (default: :7979)").Default(defaultConfig.MetricsAddress).StringVar(&cfg.MetricsAddress)
   638  	app.Flag("log-level", "Set the level of logging. (default: info, options: panic, debug, info, warning, error, fatal)").Default(defaultConfig.LogLevel).EnumVar(&cfg.LogLevel, allLogLevelsAsStrings()...)
   639  
   640  	// Webhook provider
   641  	app.Flag("webhook-provider-url", "[EXPERIMENTAL] The URL of the remote endpoint to call for the webhook provider (default: http://localhost:8888)").Default(defaultConfig.WebhookProviderURL).StringVar(&cfg.WebhookProviderURL)
   642  	app.Flag("webhook-provider-read-timeout", "[EXPERIMENTAL] The read timeout for the webhook provider in duration format (default: 5s)").Default(defaultConfig.WebhookProviderReadTimeout.String()).DurationVar(&cfg.WebhookProviderReadTimeout)
   643  	app.Flag("webhook-provider-write-timeout", "[EXPERIMENTAL] The write timeout for the webhook provider in duration format (default: 10s)").Default(defaultConfig.WebhookProviderWriteTimeout.String()).DurationVar(&cfg.WebhookProviderWriteTimeout)
   644  
   645  	app.Flag("webhook-server", "[EXPERIMENTAL] When enabled, runs as a webhook server instead of a controller. (default: false).").BoolVar(&cfg.WebhookServer)
   646  
   647  	_, err := app.Parse(args)
   648  	if err != nil {
   649  		return err
   650  	}
   651  
   652  	return nil
   653  }