mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-09-22 16:41:01 +02:00
Merge pull request #5246 from mloiseleur/chore/golangci-lint-action
chore(ci): update linter to v2.0.2
This commit is contained in:
commit
f9725a19c9
10
.github/workflows/lint.yaml
vendored
10
.github/workflows/lint.yaml
vendored
@ -9,8 +9,12 @@ jobs:
|
|||||||
name: Markdown, Go and OAS
|
name: Markdown, Go and OAS
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read # to fetch code (actions/checkout)
|
# Required: allow read access to the content for analysis.
|
||||||
|
contents: read
|
||||||
|
# For OAS check
|
||||||
checks: write
|
checks: write
|
||||||
|
# For go lang linter
|
||||||
|
pull-requests: read
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Check out code into the Go module directory
|
- name: Check out code into the Go module directory
|
||||||
@ -40,11 +44,11 @@ jobs:
|
|||||||
|
|
||||||
# https://github.com/golangci/golangci-lint-action?tab=readme-ov-file#verify
|
# https://github.com/golangci/golangci-lint-action?tab=readme-ov-file#verify
|
||||||
- name: Verify linter configuration and Lint go code
|
- name: Verify linter configuration and Lint go code
|
||||||
uses: golangci/golangci-lint-action@v6
|
uses: golangci/golangci-lint-action@v7
|
||||||
with:
|
with:
|
||||||
verify: true
|
verify: true
|
||||||
args: --timeout=30m
|
args: --timeout=30m
|
||||||
version: v1.64
|
version: v2.0
|
||||||
|
|
||||||
# Run Spectral
|
# Run Spectral
|
||||||
- name: Lint OpenAPI spec
|
- name: Lint OpenAPI spec
|
||||||
|
@ -1,51 +1,40 @@
|
|||||||
linters-settings:
|
version: "2"
|
||||||
exhaustive:
|
|
||||||
default-signifies-exhaustive: false
|
|
||||||
goimports:
|
|
||||||
local-prefixes: sigs.k8s.io/external-dns
|
|
||||||
misspell:
|
|
||||||
locale: US
|
|
||||||
revive:
|
|
||||||
ignore-generated-header: true
|
|
||||||
rules:
|
|
||||||
- name: confusing-naming
|
|
||||||
disabled: true
|
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
# please, do not use `enable-all`: it's deprecated and will be removed soon.
|
default: none
|
||||||
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
|
|
||||||
disable-all: true
|
|
||||||
enable:
|
enable:
|
||||||
- dogsled
|
- dogsled
|
||||||
- gofmt
|
|
||||||
- goimports
|
|
||||||
- goprintffuncname
|
- goprintffuncname
|
||||||
- govet
|
- govet
|
||||||
- ineffassign
|
- ineffassign
|
||||||
- misspell
|
- misspell
|
||||||
- rowserrcheck
|
|
||||||
- typecheck
|
|
||||||
- unconvert
|
|
||||||
- whitespace
|
|
||||||
- revive
|
- revive
|
||||||
- unused
|
- rowserrcheck
|
||||||
- gosimple
|
|
||||||
- staticcheck
|
- staticcheck
|
||||||
|
- unconvert
|
||||||
issues:
|
- unused
|
||||||
# Excluding configuration per-path, per-linter, per-text and per-source
|
- whitespace
|
||||||
exclude-files:
|
settings:
|
||||||
- endpoint/zz_generated.deepcopy.go
|
exhaustive:
|
||||||
exclude-rules:
|
default-signifies-exhaustive: false
|
||||||
- path: _test\.go
|
misspell:
|
||||||
linters:
|
locale: US
|
||||||
|
revive:
|
||||||
|
rules:
|
||||||
|
- name: confusing-naming
|
||||||
|
disabled: true
|
||||||
|
exclusions:
|
||||||
|
generated: lax
|
||||||
|
presets:
|
||||||
|
- comments
|
||||||
|
- common-false-positives
|
||||||
|
- legacy
|
||||||
|
- std-error-handling
|
||||||
|
rules:
|
||||||
|
- linters:
|
||||||
- deadcode
|
- deadcode
|
||||||
- depguard
|
- depguard
|
||||||
- dogsled
|
- dogsled
|
||||||
- gofmt
|
|
||||||
- goimports
|
|
||||||
- goprintffuncname
|
- goprintffuncname
|
||||||
- gosimple
|
|
||||||
- govet
|
- govet
|
||||||
- ineffassign
|
- ineffassign
|
||||||
- misspell
|
- misspell
|
||||||
@ -53,17 +42,29 @@ issues:
|
|||||||
- rowserrcheck
|
- rowserrcheck
|
||||||
- staticcheck
|
- staticcheck
|
||||||
- structcheck
|
- structcheck
|
||||||
- stylecheck
|
|
||||||
- typecheck
|
|
||||||
- unconvert
|
- unconvert
|
||||||
- unused
|
- unused
|
||||||
- varcheck
|
- varcheck
|
||||||
- whitespace
|
- whitespace
|
||||||
- path: source/ambassador_host.go
|
path: _test\.go
|
||||||
linters: [ typecheck ]
|
paths:
|
||||||
- path: source/contour_httpproxy.go
|
- endpoint/zz_generated.deepcopy.go
|
||||||
linters: [ typecheck ]
|
- third_party$
|
||||||
- path: source/f5_virtualserver.go
|
- builtin$
|
||||||
linters: [ typecheck ]
|
- examples$
|
||||||
- path: source/kong_tcpingress.go
|
formatters:
|
||||||
linters: [ typecheck ]
|
enable:
|
||||||
|
- gofmt
|
||||||
|
- goimports
|
||||||
|
settings:
|
||||||
|
goimports:
|
||||||
|
local-prefixes:
|
||||||
|
- sigs.k8s.io/external-dns
|
||||||
|
exclusions:
|
||||||
|
generated: lax
|
||||||
|
paths:
|
||||||
|
- endpoint/zz_generated.deepcopy.go
|
||||||
|
- third_party$
|
||||||
|
- builtin$
|
||||||
|
- examples$
|
||||||
|
- _test\.go
|
||||||
|
2
Makefile
2
Makefile
@ -37,7 +37,7 @@ endif
|
|||||||
|
|
||||||
#? golangci-lint: Install golangci-lint tool
|
#? golangci-lint: Install golangci-lint tool
|
||||||
golangci-lint:
|
golangci-lint:
|
||||||
@command -v golangci-lint > /dev/null || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.64.5
|
@command -v golangci-lint > /dev/null || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.0.2
|
||||||
|
|
||||||
#? golangci-lint-verify: Verify golangci-lint configuration
|
#? golangci-lint-verify: Verify golangci-lint configuration
|
||||||
golangci-lint-verify: golangci-lint
|
golangci-lint-verify: golangci-lint
|
||||||
|
@ -55,7 +55,7 @@ func main() {
|
|||||||
flags := computeFlags()
|
flags := computeFlags()
|
||||||
content, err := flags.generateMarkdownTable()
|
content, err := flags.generateMarkdownTable()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
_ = fmt.Errorf("failed to generate markdown file '%s': %v\n", path, err.Error())
|
_ = fmt.Errorf("failed to generate markdown file '%s': %v", path, err.Error())
|
||||||
}
|
}
|
||||||
content = content + "\n"
|
content = content + "\n"
|
||||||
_ = utils.WriteToFile(path, content)
|
_ = utils.WriteToFile(path, content)
|
||||||
|
@ -72,17 +72,18 @@ func CidrToInAddr(cidr string) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle IPv4 Class-full and IPv6:
|
// Handle IPv4 Class-full and IPv6:
|
||||||
if total == 32 {
|
switch total {
|
||||||
|
case 32:
|
||||||
if bits%8 != 0 {
|
if bits%8 != 0 {
|
||||||
return "", fmt.Errorf("IPv4 mask must be multiple of 8 bits")
|
return "", fmt.Errorf("IPv4 mask must be multiple of 8 bits")
|
||||||
}
|
}
|
||||||
toTrim = (total - bits) / 8
|
toTrim = (total - bits) / 8
|
||||||
} else if total == 128 {
|
case 128:
|
||||||
if bits%4 != 0 {
|
if bits%4 != 0 {
|
||||||
return "", fmt.Errorf("IPv6 mask must be multiple of 4 bits")
|
return "", fmt.Errorf("IPv6 mask must be multiple of 4 bits")
|
||||||
}
|
}
|
||||||
toTrim = (total - bits) / 4
|
toTrim = (total - bits) / 4
|
||||||
} else {
|
default:
|
||||||
return "", fmt.Errorf("invalid address (not IPv4 or IPv6): %v", cidr)
|
return "", fmt.Errorf("invalid address (not IPv4 or IPv6): %v", cidr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,11 +321,12 @@ func newAkamaiRecordset(dnsName, recordType string, ttl int, targets []string) d
|
|||||||
// cleanTargets preps recordset rdata if necessary for EdgeDNS
|
// cleanTargets preps recordset rdata if necessary for EdgeDNS
|
||||||
func cleanTargets(rtype string, targets ...string) []string {
|
func cleanTargets(rtype string, targets ...string) []string {
|
||||||
log.Debugf("Targets to clean: [%v]", targets)
|
log.Debugf("Targets to clean: [%v]", targets)
|
||||||
if rtype == "CNAME" || rtype == "SRV" {
|
switch rtype {
|
||||||
|
case "CNAME", "SRV":
|
||||||
for idx, target := range targets {
|
for idx, target := range targets {
|
||||||
targets[idx] = strings.TrimSuffix(target, ".")
|
targets[idx] = strings.TrimSuffix(target, ".")
|
||||||
}
|
}
|
||||||
} else if rtype == "TXT" {
|
case "TXT":
|
||||||
for idx, target := range targets {
|
for idx, target := range targets {
|
||||||
log.Debugf("TXT data to clean: [%s]", target)
|
log.Debugf("TXT data to clean: [%s]", target)
|
||||||
// need to embed text data in quotes. Make sure not piling on
|
// need to embed text data in quotes. Make sure not piling on
|
||||||
@ -359,7 +360,7 @@ func trimTxtRdata(rdata []string, rtype string) []string {
|
|||||||
func ttlAsInt(src endpoint.TTL) int {
|
func ttlAsInt(src endpoint.TTL) int {
|
||||||
var temp interface{} = int64(src)
|
var temp interface{} = int64(src)
|
||||||
temp64 := temp.(int64)
|
temp64 := temp.(int64)
|
||||||
var ttl int = edgeDNSRecordTTL
|
var ttl = edgeDNSRecordTTL
|
||||||
if temp64 > 0 && temp64 <= int64(maxInt) {
|
if temp64 > 0 && temp64 <= int64(maxInt) {
|
||||||
ttl = int(temp64)
|
ttl = int(temp64)
|
||||||
}
|
}
|
||||||
|
@ -492,7 +492,7 @@ func (p *AlibabaCloudProvider) escapeTXTRecordValue(value string) string {
|
|||||||
|
|
||||||
func (p *AlibabaCloudProvider) unescapeTXTRecordValue(value string) string {
|
func (p *AlibabaCloudProvider) unescapeTXTRecordValue(value string) string {
|
||||||
if strings.HasPrefix(value, "heritage=") {
|
if strings.HasPrefix(value, "heritage=") {
|
||||||
return fmt.Sprintf("\"%s\"", strings.Replace(value, ";", ",", -1))
|
return fmt.Sprintf("\"%s\"", strings.ReplaceAll(value, ";", ","))
|
||||||
}
|
}
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
@ -673,7 +673,7 @@ func (p *CloudFlareProvider) listDNSRecordsWithAutoPagination(ctx context.Contex
|
|||||||
records[newDNSRecordIndex(r)] = r
|
records[newDNSRecordIndex(r)] = r
|
||||||
}
|
}
|
||||||
params.ResultInfo = resultInfo.Next()
|
params.ResultInfo = resultInfo.Next()
|
||||||
if params.ResultInfo.Done() {
|
if params.Done() {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ type GandiProvider struct {
|
|||||||
func NewGandiProvider(ctx context.Context, domainFilter endpoint.DomainFilter, dryRun bool) (*GandiProvider, error) {
|
func NewGandiProvider(ctx context.Context, domainFilter endpoint.DomainFilter, dryRun bool) (*GandiProvider, error) {
|
||||||
key, ok_key := os.LookupEnv("GANDI_KEY")
|
key, ok_key := os.LookupEnv("GANDI_KEY")
|
||||||
pat, ok_pat := os.LookupEnv("GANDI_PAT")
|
pat, ok_pat := os.LookupEnv("GANDI_PAT")
|
||||||
if !(ok_key || ok_pat) {
|
if !ok_key && !ok_pat {
|
||||||
return nil, errors.New("no environment variable GANDI_KEY or GANDI_PAT provided")
|
return nil, errors.New("no environment variable GANDI_KEY or GANDI_PAT provided")
|
||||||
}
|
}
|
||||||
if ok_key {
|
if ok_key {
|
||||||
|
@ -588,7 +588,7 @@ func (p OVHProvider) newOvhChangeUpdate(endpointsOld []*endpoint.Endpoint, endpo
|
|||||||
toInsertTarget := []string{}
|
toInsertTarget := []string{}
|
||||||
|
|
||||||
for _, target := range endpointsNew.Targets {
|
for _, target := range endpointsNew.Targets {
|
||||||
var toDelete int = -1
|
var toDelete = -1
|
||||||
|
|
||||||
for i, record := range oldRecords {
|
for i, record := range oldRecords {
|
||||||
if target == record.Target {
|
if target == record.Target {
|
||||||
|
@ -48,7 +48,7 @@ func NewPluralProvider(cluster, provider string) (*PluralProvider, error) {
|
|||||||
endpoint := os.Getenv("PLURAL_ENDPOINT")
|
endpoint := os.Getenv("PLURAL_ENDPOINT")
|
||||||
|
|
||||||
if token == "" {
|
if token == "" {
|
||||||
return nil, fmt.Errorf("No plural access token provided, you must set the PLURAL_ACCESS_TOKEN env var")
|
return nil, fmt.Errorf("no plural access token provided, you must set the PLURAL_ACCESS_TOKEN env var")
|
||||||
}
|
}
|
||||||
|
|
||||||
config := &Config{
|
config := &Config{
|
||||||
|
@ -30,7 +30,7 @@ import (
|
|||||||
// SoftError is an error, that provider will only log as error instead
|
// SoftError is an error, that provider will only log as error instead
|
||||||
// of fatal. It is meant for error propagation from providers to tell
|
// of fatal. It is meant for error propagation from providers to tell
|
||||||
// that this is a transient error.
|
// that this is a transient error.
|
||||||
var SoftError error = errors.New("soft error")
|
var SoftError error = errors.New("soft error") //nolint:staticcheck
|
||||||
|
|
||||||
// NewSoftErrorf creates a SoftError with formats according to a format specifier and returns the string as a
|
// NewSoftErrorf creates a SoftError with formats according to a format specifier and returns the string as a
|
||||||
func NewSoftErrorf(format string, a ...any) error {
|
func NewSoftErrorf(format string, a ...any) error {
|
||||||
|
@ -238,13 +238,14 @@ func (api *defaultTencentAPIService) ModifyRecord(request *dnspod.ModifyRecordRe
|
|||||||
func dealWithError(action Action, request string, err error) bool {
|
func dealWithError(action Action, request string, err error) bool {
|
||||||
log.Errorf("dealWithError %s/%s request: %s, error: %s.", action.Service, action.Name, request, err.Error())
|
log.Errorf("dealWithError %s/%s request: %s, error: %s.", action.Service, action.Name, request, err.Error())
|
||||||
if sdkError, ok := err.(*errors.TencentCloudSDKError); ok {
|
if sdkError, ok := err.(*errors.TencentCloudSDKError); ok {
|
||||||
if sdkError.Code == "RequestLimitExceeded" {
|
switch sdkError.Code {
|
||||||
|
case "RequestLimitExceeded":
|
||||||
return true
|
return true
|
||||||
} else if sdkError.Code == "InternalError" || sdkError.Code == "ClientError.HttpStatusCodeError" {
|
case "InternalError", "ClientError.HttpStatusCodeError":
|
||||||
return false
|
return false
|
||||||
} else if sdkError.Code == "ClientError.NetworkError" {
|
case "ClientError.NetworkError":
|
||||||
return false
|
return false
|
||||||
} else if sdkError.Code == "AuthFailure.UnauthorizedOperation" || sdkError.Code == "UnauthorizedOperation.CamNoAuth" {
|
case "AuthFailure.UnauthorizedOperation", "UnauthorizedOperation.CamNoAuth":
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
@ -292,9 +292,10 @@ func (p *UltraDNSProvider) submitChanges(ctx context.Context, changes []*UltraDN
|
|||||||
|
|
||||||
for zoneName, changes := range zoneChanges {
|
for zoneName, changes := range zoneChanges {
|
||||||
for _, change := range changes {
|
for _, change := range changes {
|
||||||
if change.ResourceRecordSetUltraDNS.RRType == "CNAME" {
|
switch change.ResourceRecordSetUltraDNS.RRType {
|
||||||
|
case "CNAME":
|
||||||
cnameownerName = change.ResourceRecordSetUltraDNS.OwnerName
|
cnameownerName = change.ResourceRecordSetUltraDNS.OwnerName
|
||||||
} else if change.ResourceRecordSetUltraDNS.RRType == "TXT" {
|
case "TXT":
|
||||||
txtownerName = change.ResourceRecordSetUltraDNS.OwnerName
|
txtownerName = change.ResourceRecordSetUltraDNS.OwnerName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ func legacyEndpointsFromMoleculeService(svc *v1.Service) []*endpoint.Endpoint {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
hostnameList := strings.Split(strings.Replace(hostnameAnnotation, " ", "", -1), ",")
|
hostnameList := strings.Split(strings.ReplaceAll(hostnameAnnotation, " ", ""), ",")
|
||||||
|
|
||||||
for _, hostname := range hostnameList {
|
for _, hostname := range hostnameList {
|
||||||
// Create a corresponding endpoint for each configured external entrypoint.
|
// Create a corresponding endpoint for each configured external entrypoint.
|
||||||
@ -145,9 +145,9 @@ func legacyEndpointsFromDNSControllerNodePortService(svc *v1.Service, sc *servic
|
|||||||
|
|
||||||
var hostnameList []string
|
var hostnameList []string
|
||||||
if isExternal {
|
if isExternal {
|
||||||
hostnameList = strings.Split(strings.Replace(hostnameAnnotation, " ", "", -1), ",")
|
hostnameList = strings.Split(strings.ReplaceAll(hostnameAnnotation, " ", ""), ",")
|
||||||
} else {
|
} else {
|
||||||
hostnameList = strings.Split(strings.Replace(internalHostnameAnnotation, " ", "", -1), ",")
|
hostnameList = strings.Split(strings.ReplaceAll(internalHostnameAnnotation, " ", ""), ",")
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, hostname := range hostnameList {
|
for _, hostname := range hostnameList {
|
||||||
@ -186,10 +186,10 @@ func legacyEndpointsFromDNSControllerLoadBalancerService(svc *v1.Service) []*end
|
|||||||
|
|
||||||
var hostnameList []string
|
var hostnameList []string
|
||||||
if hasExternal {
|
if hasExternal {
|
||||||
hostnameList = append(hostnameList, strings.Split(strings.Replace(hostnameAnnotation, " ", "", -1), ",")...)
|
hostnameList = append(hostnameList, strings.Split(strings.ReplaceAll(hostnameAnnotation, " ", ""), ",")...)
|
||||||
}
|
}
|
||||||
if hasInternal {
|
if hasInternal {
|
||||||
hostnameList = append(hostnameList, strings.Split(strings.Replace(internalHostnameAnnotation, " ", "", -1), ",")...)
|
hostnameList = append(hostnameList, strings.Split(strings.ReplaceAll(internalHostnameAnnotation, " ", ""), ",")...)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, hostname := range hostnameList {
|
for _, hostname := range hostnameList {
|
||||||
|
@ -96,7 +96,7 @@ func NewCRDClientForAPIVersionKind(client kubernetes.Interface, kubeConfig, apiS
|
|||||||
scheme := runtime.NewScheme()
|
scheme := runtime.NewScheme()
|
||||||
addKnownTypes(scheme, groupVersion)
|
addKnownTypes(scheme, groupVersion)
|
||||||
|
|
||||||
config.ContentConfig.GroupVersion = &groupVersion
|
config.GroupVersion = &groupVersion
|
||||||
config.APIPath = "/apis"
|
config.APIPath = "/apis"
|
||||||
config.NegotiatedSerializer = serializer.WithoutConversionCodecFactory{CodecFactory: serializer.NewCodecFactory(scheme)}
|
config.NegotiatedSerializer = serializer.WithoutConversionCodecFactory{CodecFactory: serializer.NewCodecFactory(scheme)}
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ func (cs *crdSource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, error
|
|||||||
crdEndpoints := []*endpoint.Endpoint{}
|
crdEndpoints := []*endpoint.Endpoint{}
|
||||||
for _, ep := range dnsEndpoint.Spec.Endpoints {
|
for _, ep := range dnsEndpoint.Spec.Endpoints {
|
||||||
if (ep.RecordType == "CNAME" || ep.RecordType == "A" || ep.RecordType == "AAAA") && len(ep.Targets) < 1 {
|
if (ep.RecordType == "CNAME" || ep.RecordType == "A" || ep.RecordType == "AAAA") && len(ep.Targets) < 1 {
|
||||||
log.Warnf("Endpoint %s with DNSName %s has an empty list of targets", dnsEndpoint.ObjectMeta.Name, ep.DNSName)
|
log.Warnf("Endpoint %s with DNSName %s has an empty list of targets", dnsEndpoint.Name, ep.DNSName)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ func (cs *crdSource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, error
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if illegalTarget {
|
if illegalTarget {
|
||||||
log.Warnf("Endpoint %s with DNSName %s has an illegal target. The subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com')", dnsEndpoint.ObjectMeta.Name, ep.DNSName)
|
log.Warnf("Endpoint %s with DNSName %s has an illegal target. The subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com')", dnsEndpoint.Name, ep.DNSName)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,7 +231,7 @@ func (cs *crdSource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, error
|
|||||||
|
|
||||||
func (cs *crdSource) setResourceLabel(crd *endpoint.DNSEndpoint, endpoints []*endpoint.Endpoint) {
|
func (cs *crdSource) setResourceLabel(crd *endpoint.DNSEndpoint, endpoints []*endpoint.Endpoint) {
|
||||||
for _, ep := range endpoints {
|
for _, ep := range endpoints {
|
||||||
ep.Labels[endpoint.ResourceLabelKey] = fmt.Sprintf("crd/%s/%s", crd.ObjectMeta.Namespace, crd.ObjectMeta.Name)
|
ep.Labels[endpoint.ResourceLabelKey] = fmt.Sprintf("crd/%s/%s", crd.Namespace, crd.Name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ func (ps *podSource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, error
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ps.podSourceDomain != "" {
|
if ps.podSourceDomain != "" {
|
||||||
domain := pod.ObjectMeta.Name + "." + ps.podSourceDomain
|
domain := pod.Name + "." + ps.podSourceDomain
|
||||||
if len(targets) == 0 {
|
if len(targets) == 0 {
|
||||||
addToEndpointMap(endpointMap, domain, suitableType(pod.Status.PodIP), pod.Status.PodIP)
|
addToEndpointMap(endpointMap, domain, suitableType(pod.Status.PodIP), pod.Status.PodIP)
|
||||||
}
|
}
|
||||||
|
@ -694,7 +694,7 @@ func (sc *serviceSource) extractNodePortEndpoints(svc *v1.Service, hostname stri
|
|||||||
// take the service name from the K8s Service object
|
// take the service name from the K8s Service object
|
||||||
// it is safe to use since it is DNS compatible
|
// it is safe to use since it is DNS compatible
|
||||||
// see https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-label-names
|
// see https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-label-names
|
||||||
serviceName := svc.ObjectMeta.Name
|
serviceName := svc.Name
|
||||||
|
|
||||||
// figure out the protocol
|
// figure out the protocol
|
||||||
protocol := strings.ToLower(string(port.Protocol))
|
protocol := strings.ToLower(string(port.Protocol))
|
||||||
|
@ -315,7 +315,7 @@ func (sc *routeGroupSource) endpointsFromTemplate(rg *routeGroup) ([]*endpoint.E
|
|||||||
|
|
||||||
var endpoints []*endpoint.Endpoint
|
var endpoints []*endpoint.Endpoint
|
||||||
// splits the FQDN template and removes the trailing periods
|
// splits the FQDN template and removes the trailing periods
|
||||||
hostnameList := strings.Split(strings.Replace(hostnames, " ", "", -1), ",")
|
hostnameList := strings.Split(strings.ReplaceAll(hostnames, " ", ""), ",")
|
||||||
for _, hostname := range hostnameList {
|
for _, hostname := range hostnameList {
|
||||||
hostname = strings.TrimSuffix(hostname, ".")
|
hostname = strings.TrimSuffix(hostname, ".")
|
||||||
endpoints = append(endpoints, endpointsForHostname(hostname, targets, ttl, providerSpecific, setIdentifier, resource)...)
|
endpoints = append(endpoints, endpointsForHostname(hostname, targets, ttl, providerSpecific, setIdentifier, resource)...)
|
||||||
|
@ -179,7 +179,7 @@ func getInternalHostnamesFromAnnotations(annotations map[string]string) []string
|
|||||||
}
|
}
|
||||||
|
|
||||||
func splitHostnameAnnotation(annotation string) []string {
|
func splitHostnameAnnotation(annotation string) []string {
|
||||||
return strings.Split(strings.Replace(annotation, " ", "", -1), ",")
|
return strings.Split(strings.ReplaceAll(annotation, " ", ""), ",")
|
||||||
}
|
}
|
||||||
|
|
||||||
func getAliasFromAnnotations(annotations map[string]string) bool {
|
func getAliasFromAnnotations(annotations map[string]string) bool {
|
||||||
@ -251,7 +251,7 @@ func getTargetsFromTargetAnnotation(annotations map[string]string) endpoint.Targ
|
|||||||
targetAnnotation, exists := annotations[targetAnnotationKey]
|
targetAnnotation, exists := annotations[targetAnnotationKey]
|
||||||
if exists && targetAnnotation != "" {
|
if exists && targetAnnotation != "" {
|
||||||
// splits the hostname annotation and removes the trailing periods
|
// splits the hostname annotation and removes the trailing periods
|
||||||
targetsList := strings.Split(strings.Replace(targetAnnotation, " ", "", -1), ",")
|
targetsList := strings.Split(strings.ReplaceAll(targetAnnotation, " ", ""), ",")
|
||||||
for _, targetHostname := range targetsList {
|
for _, targetHostname := range targetsList {
|
||||||
targetHostname = strings.TrimSuffix(targetHostname, ".")
|
targetHostname = strings.TrimSuffix(targetHostname, ".")
|
||||||
targets = append(targets, targetHostname)
|
targets = append(targets, targetHostname)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user